Index: config-extensions.def =================================================================== --- config-extensions.def (revision 60668) +++ config-extensions.def (working copy) @@ -48,6 +48,7 @@ enable=1 [ScriptBinding_cfgBindings] run-module= +restart-and-run-module= check-module= [CallTips] Index: ScriptBinding.py =================================================================== --- ScriptBinding.py (revision 60668) +++ ScriptBinding.py (working copy) @@ -44,8 +44,16 @@ menudefs = [ ('run', [None, ('Check Module', '<>'), - ('Run Module', '<>'), ]), ] + ('Run Module', '<>'), + ]), + ] + subprocess_only_menudefs = [ + ('run', [ + ('Restart Shell & Run Module', '<>'), + ]), + ] + def __init__(self, editwin): self.editwin = editwin # Provide instance variables referenced by Debugger @@ -53,6 +61,11 @@ self.flist = self.editwin.flist self.root = self.editwin.root + # only add 'Restart Shell & Run Module' to the menu if there is + # (or will be) a subprocess + if PyShell.use_subprocess: + editwin.fill_menus(self.subprocess_only_menudefs) + def check_module_event(self, event): filename = self.getfilename() if not filename: @@ -125,7 +138,10 @@ text.mark_set("insert", pos + "+1c") text.see(pos) - def run_module_event(self, event): + def restart_and_run_module_event(self, event): + return self.run_module_event(event, restart=True) + + def run_module_event(self, event, restart=False): """Run the module after setting up the environment. First check the syntax. If OK, make sure the shell is active and @@ -144,7 +160,7 @@ return shell = self.shell interp = shell.interp - if PyShell.use_subprocess: + if PyShell.use_subprocess and restart: shell.restart_shell() dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set...