def execute(self, p_conn): debug_on_event = p_conn.get_debug_on_event() data = Data() data.set_data("debug_on_event", debug_on_event) self.emit_("debug_on_event_update_request", data)
def _check_dbwhere(self, p_curdbwhere): #FIXME: documentacion predbwhere = self.__predbwhere if p_curdbwhere != predbwhere: data = Data() data.set_data("where", p_curdbwhere) self.emit_("where_changed", data) self.__predbwhere = p_curdbwhere
def _check_dbstack(self, p_curdbstack): #FIXME: documentacion predbstack = self.__predbstack if p_curdbstack != predbstack: data = Data() data.set_data("stack", p_curdbstack) self.emit_("stack_changed", data) self.__predbstack = p_curdbstack
def _check_dbstatus(self, p_curdbstatus): #FIXME: documentacion #OJO: Puede que cambien los breakpoints y no se emita la sennal. # Esto no es problema, porque no tiene solucion en Octave_3.2.3. predbstatus = self.__predbstatus if p_curdbstatus != predbstatus: data = Data() data.set_data("breakpoints", p_curdbstatus) self.emit_("breakpoints_changed", data) self.__predbstatus = p_curdbstatus
def execute(self, p_conn): # FIXME: re-implementar este metodo haciendo # uso de 'p_conn.is_file_in_loadpath' funcname = self.__funcname if funcname[1]: real = "['%s', filemarker(), '%s']" % (funcname[0], funcname[1]) else: real = "'%s'" % funcname[0] dbstatus = p_conn.dbstatus(real) lines = [] if dbstatus: file_ = dbstatus[0]["file"] if (funcname[1] or file_): # Esto es evitando funciones definidas # en el CommandWindow. if not file_: file_ = p_conn.file_in_loadpath("'%s'" % self.__filename) if self.__file == file_: lines = dbstatus[0]["lines"] data = Data() data.set_data("file", self.__file) data.set_data("function", funcname[1] if funcname[1] else funcname[0]) data.set_data("lines", lines) self.emit_("breakpoints_update_request", data)
def execute(self, p_conn): if "is patch for Octave-3.2.3": dbwhere = p_conn.dbwhere() if p_conn.dbstack()["frames"] else {} #dbwhere = p_conn.dbwhere() # Puede hacer un beep! file_ = self.__file positions = [] current = False if dbwhere and dbwhere["file"] == file_: pos = (dbwhere["line"], dbwhere["column"]) if None not in pos: positions.append(pos) current = True data = Data() data.set_data("positions", positions) data.set_data("current", current) self.emit_("stack_update_request", data) return file_ = self.__file omit = self.__omit omit = str(omit) if omit else "" dbstack = p_conn.dbstack(omit) positions = [] frames = dbstack["frames"] current = bool(frames and frames[0]["file"] == file_) for frame in frames: if frame["file"] == file_: positions.append((frame["line"], frame["column"])) data = Data() data.set_data("positions", positions) data.set_data("current", current) self.emit_("stack_update_request", data)
def run(self): """ Este metodo es el que mantiene mediante un ciclo principal la comunicacion con 'Octave', el mismo se ejecuta en un hilo diferente del hilo en el que corre la aplicacion. Se encarga de enviar los comandos a 'Octave' y de mostrar su salida en el 'CommandWindow'. """ tail = self.__tail tail_prio = self.__tail_prio term = self.__term buff = term.buff sent, pass_ = True, False bitwise_2or = TerminalState.READY | TerminalState.DEBUGGING bitwise_3or = bitwise_2or | TerminalState.WAITING_FOR_COMPLETE_STATMENT self._init_oct() while self.__continue: if tail: term.feed_child(tail.pop(0)) sent, pass_ = True, False time.sleep(0.001) text = buff.get_all() if text: self._print(text) count, pass_ = 0, True if term.state_ & bitwise_3or and pass_ and not buff.get_char_count(): count += 1 if count > 29: self._check_state(term.state_) if term.state_ & bitwise_2or: not_clean = False while not tail_prio.is_empty(): not_clean = bool(tail_prio.extract().execute(self)) sent = True if not_clean: break if not_clean: pass_ = False elif sent: curdir = self.get_curdir() vars_ = self.get_vars() curdbstatus = self.dbstatus() curdbstack = self.dbstack() curdbwhere = self.dbwhere() if curdbstack["frames"] else {} # Tiene que ser el primero. data = Data() data.set_data("curdir", curdir) data.set_data("vars", vars_) data.set_data("breakpoints", curdbstatus) data.set_data("stack", curdbstack) data.set_data("where", curdbwhere) self.emit_("changed", data) self._check_dir(curdir) self._check_vars(vars_) self._check_dbstatus(curdbstatus) self._check_dbstack(curdbstack) self._check_dbwhere(curdbwhere) sent = False else: # TerminalState.WAITING_FOR_COMPLETE_STATMENT pass count = 30 continue self._check_state(TerminalState.BUSY) # FIXME: CREO que deberia encerrarse entre # gtk.gdk.threads_enter() y gtk.gdk.threads_leave() self.__mwindow.close_now() # Cerramos la aplicacion.