Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc2, 0.4rc3, and 0.4rc4

hggtk/recovery: add button to stop command execution

Changeset 5ec68ec91303

Parent 6bcc04ed89e1

by TK Soh

Changes to one file · Browse files at 5ec68ec91303 Showing diff from parent 6bcc04ed89e1 Diff from another changeset...

Change 1 of 4 Show Entire File hggtk/​recovery.py Stacked
 
44
45
46
 
 
 
47
48
49
 
66
67
68
 
 
69
70
71
 
156
157
158
159
 
 
 
 
 
 
 
160
161
162
 
193
194
195
 
 
 
196
197
198
 
44
45
46
47
48
49
50
51
52
 
69
70
71
72
73
74
75
76
 
161
162
163
 
164
165
166
167
168
169
170
171
172
173
 
204
205
206
207
208
209
210
211
212
@@ -44,6 +44,9 @@
  # toolbar   self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips() + self._stop_button = self._toolbutton(gtk.STOCK_STOP, + 'Stop', self._stop_clicked, tip='Stop the hg operation') + self._stop_button.set_sensitive(False)   tbuttons = [   self._toolbutton(gtk.STOCK_CLEAR,   'clean', @@ -66,6 +69,8 @@
  self._verify_clicked,   tip='Validate repository consistency'),   gtk.SeparatorToolItem(), + self._stop_button, + gtk.SeparatorToolItem(),   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -156,7 +161,13 @@
  cmd = ['verify']   self._exec_cmd(cmd)   - def _exec_cmd(self, cmd, postfunc=None): + def _stop_clicked(self, toolbutton, data=None): + if self.hgthread and self.hgthread.isAlive(): + self.hgthread.terminate() + self._stop_button.set_sensitive(False) + + def _exec_cmd(self, cmd, postfunc=None): + self._stop_button.set_sensitive(True)   cmdline = cmd   cmdline.append('--verbose')   cmdline.append('--repository') @@ -193,6 +204,9 @@
  pass   if threading.activeCount() == 1:   self.stbar.end() + self._stop_button.set_sensitive(False) + if self.hgthread.return_code() is None: + self.write("[command interrupted]")   return False # Stop polling this function   else:   return True