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

datamine: stop all search threads when quitting

else the python process won't quit until all searches are done,
even though the datamine window has been dismissed.

Changeset 7389cfe3a8bc

Parent 1625a49de779

by TK Soh

Changes to one file · Browse files at 7389cfe3a8bc Showing diff from parent 1625a49de779 Diff from another changeset...

Change 1 of 3 Show Entire File hggtk/​datamine.py Stacked
 
38
39
40
41
 
42
43
44
 
77
78
79
 
 
 
 
80
81
82
 
339
340
341
342
 
343
344
 
 
 
 
 
 
 
 
345
346
347
 
38
39
40
 
41
42
43
44
 
77
78
79
80
81
82
83
84
85
86
 
343
344
345
 
346
347
348
349
350
351
352
353
354
355
356
357
358
359
@@ -38,7 +38,7 @@
    def get_tbbuttons(self):   self.stop_button = self.make_toolbutton(gtk.STOCK_STOP, 'Stop', - self._stop_search, tip='Stop operation on current tab') + self._stop_current_search, tip='Stop operation on current tab')   return [   self.make_toolbutton(gtk.STOCK_FIND, 'New Search',   self._search_clicked, tip='Open new search tab'), @@ -77,6 +77,10 @@
  self.stop_button.set_sensitive(False)   return vbox   + def _destroying(self, gtkobj): + self._stop_all_searches() + GDialog._destroying(self, gtkobj) +   def ann_header_context_menu(self, treeview):   _menu = gtk.Menu()   _button = gtk.CheckMenuItem("Filename") @@ -339,9 +343,17 @@
  self.curpath = fromutf(model[iter][self.COL_PATH])   self.stbar.set_status_text(toutf(model[iter][self.COL_TOOLTIP]))   - def _stop_search(self, button, widget): + def _stop_current_search(self, button, widget):   num = self.notebook.get_current_page()   frame = self.notebook.get_nth_page(num) + self._stop_search(frame) + + def _stop_all_searches(self): + for num in xrange(self.notebook.get_n_pages()): + frame = self.notebook.get_nth_page(num) + self._stop_search(frame) + + def _stop_search(self, frame):   if hasattr(frame, '_mythread') and frame._mythread:   frame._mythread.terminate()   frame._mythread.join()