Skip to content

Commit cf1aee9

Browse files
committed
bpo-37627: IDLE: Improve menu option run customized
1 parent 5623ac8 commit cf1aee9

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

Lib/idlelib/editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
307307
text.bind("<<paren-closed>>", parenmatch.paren_closed_event)
308308
scriptbinding = ScriptBinding(self)
309309
text.bind("<<check-module>>", scriptbinding.check_module_event)
310-
text.bind("<<run-module>>", scriptbinding.run_module_event)
311310
text.bind("<<run-custom>>", scriptbinding.run_custom_event)
311+
text.bind("<<run-module>>", scriptbinding.run_module_event)
312312
text.bind("<<do-rstrip>>", self.Rstrip(self).do_rstrip)
313313
ctip = self.Calltip(self)
314314
text.bind("<<try-open-calltip>>", ctip.try_open_calltip_event)

Lib/idlelib/mainmenu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
('run', [
7676
('Python Shell', '<<open-python-shell>>'),
7777
('C_heck Module', '<<check-module>>'),
78-
('R_un Module', '<<run-module>>'),
7978
('Run... _Customized', '<<run-custom>>'),
79+
('R_un Module', '<<run-module>>'),
8080
]),
8181

8282
('shell', [

Lib/idlelib/runscript.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(self, editwin):
3939
# XXX This should be done differently
4040
self.flist = self.editwin.flist
4141
self.root = self.editwin.root
42+
self.cli_args = ''
4243

4344
if macosx.isCocoaTk():
4445
self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
@@ -137,19 +138,20 @@ def _run_module_event(self, event, *, customize=False):
137138
return 'break'
138139
if customize:
139140
title = f"Customize {self.editwin.short_title()} Run"
140-
run_args = CustomRun(self.shell.text, title).result
141+
run_args = CustomRun(self.shell.text, title,
142+
cli_args=self.cli_args).result
141143
if not run_args: # User cancelled.
142144
return 'break'
143-
cli_args, restart = run_args if customize else ([], True)
145+
self.cli_args, restart = run_args if customize else ([], True)
144146
interp = self.shell.interp
145147
if pyshell.use_subprocess and restart:
146148
interp.restart_subprocess(
147149
with_cwd=False, filename=
148150
self.editwin._filename_to_unicode(filename))
149151
dirname = os.path.dirname(filename)
150152
argv = [filename]
151-
if cli_args:
152-
argv += cli_args
153+
if self.cli_args:
154+
argv += self.cli_args
153155
interp.runcommand(f"""if 1:
154156
__file__ = {filename!r}
155157
import sys as _sys
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Minor improvement in IDLE by re-arranging `Run Customized` option menu

0 commit comments

Comments
 (0)