-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-49844: IDLE startup configuration #5541
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
base: main
Are you sure you want to change the base?
Conversation
I'm sorry, but I don't understand why Appveyor is failing. It's on my new tests, which are like the existing tests, only on a Text box (so it's not attached to a tracer). The failed test is showing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a partial review, but at least see if the text code change solves the test failure.
I do not know yet if this patch, or indeed, IDLE startup, works correctly. I may want to do some refactoring in pyshell before or as part of this change. Will comment on issue.
Lib/idlelib/pyshell.py
Outdated
@@ -495,6 +495,11 @@ def restart_subprocess(self, with_cwd=False, filename=''): | |||
# reload remote debugger breakpoints for all PyShellEditWindows | |||
debug.load_breakpoints() | |||
self.compile.compiler.flags = self.original_compiler_flags | |||
if idleConf.GetOption('main', 'ShellWindow', | |||
'restart-code-on', type='bool'): | |||
config_startup_code = idleConf.GetOption( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, 'startup' seems fine here, perhaps because of the '_'s and the name being long anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Lib/idlelib/configdialog.py
Outdated
@@ -109,11 +109,13 @@ def create_widgets(self): | |||
self.fontpage = FontPage(note, self.highpage) | |||
self.keyspage = KeysPage(note) | |||
self.genpage = GenPage(note) | |||
self.startuppage = StartupPage(note) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer 'startpage' and 'StartPage' for internal code, but leave 'Startup' on the tab itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if idleConf.GetOption('main', 'ShellWindow', | ||
'startup-code-on', type='bool'): | ||
config_startup_code = idleConf.GetOption( | ||
'main', 'ShellWindow', 'shell-startup-code') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seems to have missed the difference between 'restart-code-on' and 'startup-code-on'. I need to look at pyshell changes, especially, in broader context. I want to understand and document the pyshell code better, with comments and docstrings , before changing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'restart-code-on' and 'startup-code-on' are checkbuttons that indicate when to run the code defined within config. Although your comment on the ticket mentions just having one code set for it, since startup and restart are different now, I added the checkbutton so that the code could be run just at initial startup, just at restart (Ctrl-F6), or both.
I thought documenting and tests for pyshell might be added as a dependency, just as the editor tests project would be a dependency.
Lib/idlelib/pyshell.py
Outdated
'startup-code-on', type='bool'): | ||
config_startup_code = idleConf.GetOption( | ||
'main', 'ShellWindow', 'shell-startup-code') | ||
sys.argv = ['-c'] + [config_startup_code] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I use '-c' in Windows command prompt, the string that follows must be quoted with "", not '' (not an issue when provided in a variable) and cannot contain literal newlines. I know that Linux shells are different. I suspect that the newlines in the test strings might be the test failure cause.
Even if the test passes, I would not be sure that this line will work as expected. User code must be executed by run.py in its pseudomain context after Python starts run.py in the real main context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked on Linux and I wasn't sure what issues it would run into on other systems. Although I was considering the config code to be similar to the '-c' or -'s' options in terms of functionality. But I didn't realize that those might not currently be correct.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
This PR is stale because it has been open for 30 days with no activity. |
This PR is stale because it has been open for 30 days with no activity. |
https://bugs.python.org/issue5594