def _getMacroResult(self, macro): ret = None if macro.info.hasResult(): ret = macro.getResult() if ret is None: return None if macro.info.getResult().type == 'File': commit_cmd = macro.info.hints['commit_cmd'] if commit_cmd is None: return ret local_f_name = ret[0] remote_f_name = ret[1] line_nb = ret[3] commit = CommitFile(commit_cmd, local_f_name, remote_f_name) self.pending_commits.update({remote_f_name: commit}) ip = genutils.get_ipapi() editor = genutils.get_editor() cmd = 'edit -x -n %s %s' % (line_nb, local_f_name) if editor not in self.console_editors: cmd = 'bg _ip.magic("' + cmd + '")' ip.magic(cmd) # The return value of the macro was saved in a file and opened # with edit so we don't return anything to avoid big outputs # to the console ret = None return ret
def _getMacroResult(self, macro): ret = None if macro.info.hasResult(): ret = macro.getResult() if ret is None: return None if macro.info.getResult().type == 'File': commit_cmd = macro.info.hints['commit_cmd'] if commit_cmd == None: return ret local_f_name = ret[0] remote_f_name = ret[1] line_nb = ret[3] commit = CommitFile(commit_cmd, local_f_name, remote_f_name) self.pending_commits.update({ remote_f_name : commit }) ip = genutils.get_ipapi() editor = genutils.get_editor() cmd = 'edit -x -n %s %s' % (line_nb, local_f_name) if not editor in self.console_editors: cmd = 'bg _ip.magic("' + cmd + '")' ip.magic(cmd) # The return value of the macro was saved in a file and opened # with edit so we don't return anything to avoid big outputs # to the console ret = None return ret
def _updateState(self, old_sw_state, new_sw_state, silent=False): user_ns = genutils.get_ipapi().user_ns if new_sw_state == RUNNING_STATE: user_ns['DOOR_STATE'] = "" else: user_ns['DOOR_STATE'] = " (OFFLINE)" if not self.isConsoleReady(): self._spock_state = new_sw_state return ss = self._spock_state if ss is not None and ss != new_sw_state and not silent: if ss == RUNNING_STATE: self.write_asynch("\nConnection to door '%s' was lost.\n" % self.getSimpleName()) elif new_sw_state == RUNNING_STATE: self.write_asynch("\nConnection to the door (%s) has " \ "been restablished\n" % self.getSimpleName()) self._spock_state = new_sw_state