Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Show customize box after check, attach to shell.
Don't ask for config if still may toss.
Want focus to go to shell unless cancel.
  • Loading branch information
terryjreedy committed Jun 18, 2019
commit 4a64274f0c5f06df12ee237c6312241e8b15091e
14 changes: 8 additions & 6 deletions Lib/idlelib/runscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,16 @@ def run_module_event(self, event):
return self._run_module_event(event)

def run_custom_event(self, event):
run_args = CustomRun(event.widget, "Customize Run").result
if not run_args: # User cancelled.
return 'break'
return self._run_module_event(event, run_args=run_args)
return self._run_module_event(event, customize=True)

def _run_module_event(self, event, *, run_args=None):
def _run_module_event(self, event, *, customize=False):
"""Run the module after setting up the environment.

First check the syntax. If OK, make sure the shell is active and
then transfer the arguments, set the run environment's working
directory to the directory of the module being executed and also
add that directory to its sys.path if not already included.
"""
cli_args, restart = run_args if run_args is not None else ([], True)
filename = self.getfilename()
if not filename:
return 'break'
Expand All @@ -139,6 +135,12 @@ def _run_module_event(self, event, *, run_args=None):
if not self.tabnanny(filename):
return 'break'
interp = self.shell.interp
if customize:
title = f"Customize {self.editwin.short_title()} Run"
run_args = CustomRun(self.shell.text, title).result
if not run_args: # User cancelled.
return 'break'
cli_args, restart = run_args if customize else ([], True)
if pyshell.use_subprocess and restart:
interp.restart_subprocess(with_cwd=False, filename=
self.editwin._filename_to_unicode(filename))
Expand Down