Changeset f693fbcda0e8…
Parent 14628c79d3f5…
by
Changes to one file · Browse files at f693fbcda0e8 Showing diff from parent 14628c79d3f5 Diff from another changeset...
@@ -83,19 +83,17 @@ self.output_text = QTextBrowser()
self.output_text.document().setDefaultStyleSheet(qtlib.thgstylesheet)
self.pmon = None
+ self.queue = []
### Public Methods ###
- def run(self, cmdline):
- '''Execute Mercurial command'''
- self.thread = thread.CmdThread(cmdline)
- self.thread.started.connect(self.command_started)
- self.thread.commandFinished.connect(self.command_finished)
- self.thread.outputReceived.connect(self.output_received)
- self.thread.errorReceived.connect(self.error_received)
- if hasattr(self, 'pmon'):
- self.thread.progressReceived.connect(self.progress_received)
- self.thread.start()
+ def run(self, cmdline, *cmdlines):
+ '''Execute or queue Mercurial command'''
+ self.queue.append(cmdline)
+ if len(cmdlines):
+ self.queue.extend(cmdlines)
+ if not self.is_running():
+ self.run_next()
def cancel(self):
'''Cancel running Mercurial command'''
@@ -111,6 +109,23 @@
### Private Method ###
+ def run_next(self):
+ try:
+ cmdline = self.queue.pop(0)
+ self.thread = thread.CmdThread(cmdline)
+ except IndexError:
+ return False
+
+ self.thread.started.connect(self.command_started)
+ self.thread.commandFinished.connect(self.command_finished)
+ self.thread.outputReceived.connect(self.output_received)
+ self.thread.errorReceived.connect(self.error_received)
+ if hasattr(self, 'pmon'):
+ self.thread.progressReceived.connect(self.progress_received)
+ self.thread.start()
+
+ return True
+
def append_output(self, msg, style=''):
msg = msg.replace('\n', '<br />')
self.output_text.insertHtml('<font style="%s">%s</font>' % (style, msg))
@@ -127,8 +142,9 @@ self.commandStarted.emit()
def command_finished(self, wrapper):
+ ret = wrapper.data
+
if hasattr(self, 'pmon'):
- ret = wrapper.data
if ret is None:
self.pmon.clear_progress()
if self.pmon.pbar.maximum() == 0: # busy indicator
@@ -145,6 +161,9 @@ status = _('Finished')
self.pmon.set_text(status)
+ if ret == 0 and self.run_next():
+ return # run next command
+
self.commandFinished.emit(wrapper)
def command_canceling(self):
@@ -236,8 +255,8 @@
### Public Methods ###
- def run(self, cmdline):
- self.core.run(cmdline)
+ def run(self, cmdline, *args):
+ self.core.run(cmdline, *args)
def cancel(self):
self.core.cancel()
|
Loading...