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

hggtk/synch: do not start command while one still running

Changeset 216dabd6cba8

Parent 5ec68ec91303

by TK Soh

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

Change 1 of 6 Show Entire File hggtk/​synch.py Stacked
 
33
34
35
 
36
37
38
 
318
319
320
321
 
322
323
324
 
423
424
425
426
 
427
428
429
430
 
 
 
 
 
431
432
433
 
453
454
455
 
 
 
 
 
 
456
457
458
 
490
491
492
493
 
 
 
494
495
496
 
498
499
500
501
502
503
504
505
 
33
34
35
36
37
38
39
 
319
320
321
 
322
323
324
325
 
424
425
426
 
427
428
429
430
431
432
433
434
435
436
437
438
439
 
459
460
461
462
463
464
465
466
467
468
469
470
 
502
503
504
 
505
506
507
508
509
510
 
512
513
514
 
 
515
516
517
@@ -33,6 +33,7 @@
  self.root = root   self.cwd = cwd   self.selected_path = None + self.hgthread = None     # persistent app data   self._settings = shlib.Settings('synch') @@ -318,7 +319,7 @@
  self._do_close()     def _do_close(self): - if threading.activeCount() != 1: + if self._cmd_running():   error_dialog(self, "Can't close now", "command is running")   return True   else: @@ -423,11 +424,16 @@
  self._exec_cmd(cmd)     def _stop_clicked(self, toolbutton, data=None): - if self.hgthread and self.hgthread.isAlive(): + if self._cmd_running():   self.hgthread.terminate()   self._stop_button.set_sensitive(False)     def _exec_cmd(self, cmd): + if self._cmd_running(): + error_dialog(self, "Can't run now", + "Pleas try again after the previous command is completed") + return +   self._stop_button.set_sensitive(True)     proxy_host = ui.ui().config('http_proxy', 'host', '') @@ -453,6 +459,12 @@
    self._add_src_to_recent(remote_path)   + def _cmd_running(self): + if self.hgthread and self.hgthread.isAlive(): + return True + else: + return False +   def _add_src_to_recent(self, src):   if os.path.exists(src):   src = os.path.abspath(src) @@ -490,7 +502,9 @@
  except Queue.Empty:   pass   - if threading.activeCount() == 1: + if self._cmd_running(): + return True + else:   # Update button states   self.update_buttons()   self.stbar.end() @@ -498,8 +512,6 @@
  if self.hgthread.return_code() is None:   self.write("[command interrupted]")   return False # Stop polling this function - else: - return True    def run(cwd='', root='', files=[], **opts):   dialog = SynchDialog(cwd, root, files)