Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Open file pasted into working directory toolbar #14092

Merged
merged 12 commits into from
Jun 22, 2023

Conversation

impact27
Copy link
Contributor

@impact27 impact27 commented Oct 29, 2020

Description of Changes

When pasting a file location in the working directory bar, it will go to this file's directory instead of failing, and open the file in the editor. so:
/path/to/my/file.py transforms to /path/to/my/

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Issue(s) Resolved

Fixes #15254

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@pep8speaks
Copy link

pep8speaks commented Nov 10, 2020

Hello @impact27! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 51:80: E501 line too long (80 > 79 characters)

Line 420:39: E231 missing whitespace after ':'
Line 585:35: E128 continuation line under-indented for visual indent
Line 597:35: E128 continuation line under-indented for visual indent
Line 608:80: E501 line too long (81 > 79 characters)
Line 609:41: E128 continuation line under-indented for visual indent
Line 1133:69: E272 multiple spaces before keyword
Line 1139:80: E501 line too long (83 > 79 characters)

Line 216:5: E303 too many blank lines (2)
Line 218:5: E301 expected 1 blank line, found 0

Comment last updated at 2022-07-28 21:55:50 UTC

@impact27 impact27 changed the title PR: accept non valid dir in working dir PR: Open file paster into working dir combo box Nov 10, 2020
@impact27 impact27 changed the title PR: Open file paster into working dir combo box PR: Open file pasted into working dir combo box Nov 10, 2020
@impact27 impact27 changed the base branch from master to 4.x November 12, 2020 11:09
@impact27 impact27 closed this Nov 12, 2020
@impact27 impact27 reopened this Nov 12, 2020
@impact27 impact27 force-pushed the fix_working_dir branch 2 times, most recently from e53ed1c to 6514da0 Compare April 12, 2021 06:21
@impact27 impact27 changed the base branch from 4.x to 5.x April 12, 2021 06:21
@ccordoba12
Copy link
Member

Hey @impact27, sorry for missing this one and thanks for updating it. Why do you think this is a good idea?

@impact27
Copy link
Contributor Author

impact27 commented Oct 6, 2021

The usecase is: I have a python file path in my clipboard (from a failed test or something else). I want to open this file. There is a path dialog in spyder so pasting it there would make sense. It results in the cwd to be set to the folder containing the file, and the file to open.
It also solves the problem of: I want to go to the folder containing this file.

@ccordoba12
Copy link
Member

The usecase is: I have a python file path in my clipboard (from a failed test or something else). I want to open this file. There is a path dialog in spyder so pasting it there would make sense

Hey @impact27, I don't know if you're aware of the %edit magic. That's what I use when I want open a file I have in my clipboard in Spyder.

It results in the cwd to be set to the folder containing the file, and the file to open.
It also solves the problem of: I want to go to the folder containing this file.

Ok, that makes sense but I don't know how discoverable this new UX could be. I understand this would be quite useful to you, but the idea is that others can benefit from it as well (of course, using the %edit magic is not discoverable either).

@impact27
Copy link
Contributor Author

impact27 commented Dec 8, 2022

I guess the argument would be: what should we do if the user pastes a file in the wd box? I think that in that case, the most useful result would be to set the wd to the file dir and open the file.

@ccordoba12
Copy link
Member

I guess the argument would be: what should we do if the user pastes a file in the wd box? I think that in that case, the most useful result would be to set the wd to the file dir and open the file.

Very good point. I'm convinced that this is a nice addition, so I'll proceed to review the code.

spyder/plugins/workingdirectory/container.py Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Show resolved Hide resolved
spyder/widgets/comboboxes.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/widgets/comboboxes.py Outdated Show resolved Hide resolved
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha1, v6.0alpha2 Jun 8, 2023
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last small suggestions for you @impact27 then this should be ready code-wise.

One thing that's missing though is a test for this. Could you also add a simple one? That way we'll be sure this functionality doesn't break in the future.

MANIFEST.in Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/plugins/workingdirectory/container.py Outdated Show resolved Hide resolved
spyder/widgets/comboboxes.py Outdated Show resolved Hide resolved
@ccordoba12 ccordoba12 changed the title PR: Open file pasted into working dir combo box PR: Open file pasted into working directory toolbar Jun 21, 2023
impact27 and others added 2 commits June 21, 2023 19:12
@ccordoba12
Copy link
Member

I'll fix the problem with the Spyder 5/6 changelog files later today. So, don't worry about it.

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks @impact27!

@ccordoba12 ccordoba12 merged commit 14b3fd5 into spyder-ide:master Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Pasting a file in the working directory doesn't work.
3 participants