def __init__(self, parent=None, fname=None, wdir=None, commands=[], interact=False, debug=False, path=[]): ExternalShellBase.__init__(self, parent, wdir, history_filename='.history_ec.py') self.shell.set_externalshell(self) self.toggle_globals_explorer(False) self.interact_check.setChecked(interact) self.debug_check.setChecked(debug) self.monitor_socket = None self.interpreter = fname is None self.fname = startup.__file__ if fname is None else fname if self.interpreter: self.interact_check.hide() self.debug_check.hide() self.terminate_button.hide() self.commands = ["import sys", "sys.path.insert(0, '')"] + commands # Additional python path list self.path = path
def get_toolbar_buttons(self): ExternalShellBase.get_toolbar_buttons(self) if self.namespacebrowser_button is None and self.stand_alone: self.namespacebrowser_button = create_toolbutton(self, get_icon('dictedit.png'), self.tr("Variables"), tip=self.tr("Show/hide global variables explorer"), toggled=self.toggle_globals_explorer) if self.cwd_button is None: self.cwd_button = create_toolbutton(self, get_std_icon('DirOpenIcon'), self.tr("Working directory"), tip=self.tr("Set current working directory"), triggered=self.set_current_working_directory) if self.terminate_button is None: self.terminate_button = create_toolbutton(self, get_icon('terminate.png'), self.tr("Terminate"), tip=self.tr("Attempts to terminate the process.\n" "The process may not exit as a result of " "clicking this button\n" "(it is given the chance to prompt " "the user for any unsaved files, etc).")) buttons = [self.cwd_button] if self.namespacebrowser_button is not None: buttons.append(self.namespacebrowser_button) buttons += [self.run_button, self.options_button, self.terminate_button, self.kill_button] return buttons
def set_buttons_runnning_state(self, state): ExternalShellBase.set_buttons_runnning_state(self, state) self.interact_check.setEnabled(not state) self.debug_check.setEnabled(not state) self.terminate_button.setEnabled(state) if not state: self.toggle_globals_explorer(False) self.globalsexplorer_button.setEnabled(state)
def __init__(self, parent=None, fname=None, wdir=None, commands=[], interact=False, debug=False, path=[], ipython=False, arguments=None, stand_alone=True, umd_enabled=True, umd_namelist=[], umd_verbose=True): self.namespacebrowser = None # namespace browser widget! self.fname = startup.__file__ if fname is None else fname self.stand_alone = stand_alone self.umd_enabled = umd_enabled self.umd_namelist = umd_namelist self.umd_verbose = umd_verbose self.namespacebrowser_button = None self.cwd_button = None self.terminate_button = None ExternalShellBase.__init__(self, parent, wdir, history_filename='.history.py') self.nsb_timer = QTimer(self) # Namespace browser auto-refresh timer self.nsb_timer.setInterval(3000) if arguments is not None: assert isinstance(arguments, basestring) self.arguments = arguments self.ipython = ipython if self.ipython: interact = False self.shell.set_externalshell(self) self.toggle_globals_explorer(False) self.interact_action.setChecked(interact) self.debug_action.setChecked(debug) self.monitor_socket = None self.interpreter = fname is None if self.interpreter: self.terminate_button.hide() self.commands = ["import sys", "sys.path.insert(0, '')"] + commands # Additional python path list self.path = path
def get_toolbar_buttons(self): ExternalShellBase.get_toolbar_buttons(self) self.globalsexplorer_button = create_toolbutton(self, get_icon('dictedit.png'), self.tr("Variables"), tip=self.tr("Show/hide global variables explorer"), toggled=self.toggle_globals_explorer) self.terminate_button = create_toolbutton(self, get_icon('terminate.png'), self.tr("Terminate"), tip=self.tr("Attempts to terminate the process.\n" "The process may not exit as a result of clicking " "this button\n(it is given the chance to prompt " "the user for any unsaved files, etc).")) self.interact_check = QCheckBox(self.tr("Interact"), self) self.debug_check = QCheckBox(self.tr("Debug"), self) return [self.interact_check, self.debug_check, self.globalsexplorer_button, self.run_button, self.terminate_button, self.kill_button]
def set_buttons_runnning_state(self, state): ExternalShellBase.set_buttons_runnning_state(self, state) self.interact_action.setEnabled(not state and not self.interpreter) self.debug_action.setEnabled(not state and not self.interpreter) self.args_action.setEnabled(not state and (not self.interpreter or self.ipython)) if state: if self.arguments: argstr = self.tr("Arguments: %1").arg(self.arguments) else: argstr = self.tr("No argument") else: argstr = self.tr("Arguments...") self.args_action.setText(argstr) self.terminate_button.setEnabled(state) if not state: self.toggle_globals_explorer(False) self.cwd_button.setEnabled(state) if self.namespacebrowser_button is not None: self.namespacebrowser_button.setEnabled(state)
def get_toolbar_buttons(self): ExternalShellBase.get_toolbar_buttons(self) self.globalsexplorer_button = create_toolbutton( self, get_icon('dictedit.png'), self.tr("Variables"), tip=self.tr("Show/hide global variables explorer"), toggled=self.toggle_globals_explorer) self.terminate_button = create_toolbutton( self, get_icon('terminate.png'), self.tr("Terminate"), tip=self.tr("Attempts to terminate the process.\n" "The process may not exit as a result of clicking " "this button\n(it is given the chance to prompt " "the user for any unsaved files, etc).")) self.interact_check = QCheckBox(self.tr("Interact"), self) self.debug_check = QCheckBox(self.tr("Debug"), self) return [ self.interact_check, self.debug_check, self.globalsexplorer_button, self.run_button, self.terminate_button, self.kill_button ]
def closeEvent(self, event): ExternalShellBase.closeEvent(self, event) self.disconnect(self.nsb_timer, SIGNAL("timeout()"), self.namespacebrowser.refresh_table)
def transcode(self, bytes): if os.name == 'nt': return encoding.transcode(str(bytes.data()), 'cp850') else: return ExternalShellBase.transcode(self, bytes)
def __init__(self, parent=None, wdir=None): ExternalShellBase.__init__(self, parent, wdir, history_filename='.history_ec')
def __init__(self, parent=None, wdir=None, path=[]): ExternalShellBase.__init__(self, parent, wdir, history_filename='.history') # Additional python path list self.path = path