def __thread_exit(self, process, rc): self.set_status("%s\nProcess terminated%s" % ( shorten_text(self.cmdline, 60), " with return code %d" % rc if rc is not None else "")) if self.process is process: self.thread = None self.process = None self.output.stop()
def run(self, cmdline, env=None, cwd=None): if self.process: return self.process = run_shell_command(cmdline, env=env, cwd=cwd) self.thread = threading.Thread(target=self.__thread, args=(self.process,)) self.thread.start() self.cmdline = cmdline self.set_status(shorten_text(cmdline, 60) + "\nRunning (pid %d)" % self.process.pid) self.Clear() self.output.start()
def GetDyanmicEditMenuItems(self): items = [] if self.path: items.extend([ MenuItem(ID.COPY_FILE_PATH, "Copy File Path"), MenuItem(ID.OPEN_CONTAINING_FOLDER, "Open Containing Folder"), MenuItem(ID.OPEN_IN_WEB_VIEW, "Preview in Web View"), MenuSeparator, ]) selected = self.GetSelectedFirstLine() if selected: selected = shorten_text(selected, 40) items.append(MenuItem(ID.WEB_SEARCH, "Web Search for %s" % repr(selected)[1:])) return items