Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

taskbar: hook up taskbarui dialog

Changeset b179a5cc1e71

Parent 9c45f864ab67

by Steve Borho

Changes to 2 files · Browse files at b179a5cc1e71 Showing diff from parent 9c45f864ab67 Diff from another changeset...

Change 1 of 4 Show Entire File taskbar.py Stacked
 
39
40
41
 
42
43
44
 
91
92
93
94
95
96
 
 
 
 
 
97
98
99
 
102
103
104
105
 
 
 
 
106
107
108
 
130
131
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
134
135
 
39
40
41
42
43
44
45
 
92
93
94
 
 
 
95
96
97
98
99
100
101
102
 
105
106
107
 
108
109
110
111
112
113
114
 
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@@ -39,6 +39,7 @@
  0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \   0, 0, hinst, None)   UpdateWindow(self.hwnd) + self.guithread = None   self._DoCreateIcons()     def _DoCreateIcons(self): @@ -91,9 +92,11 @@
  def OnCommand(self, hwnd, msg, wparam, lparam):   id = LOWORD(wparam)   if id == 1023: - # place holder for options dialog - msg = "TortoiseHG options dialog in construction" - win32ui.MessageBox(msg, 'TortoiseHG options...', win32con.MB_OK) + if not self.guithread or not self.guithread.isAlive(): + self.launchgui() + else: + msg = "TortoiseHG options dialog already running" + win32ui.MessageBox(msg, 'TortoiseHG options...', win32con.MB_OK)   elif id == 1025:   self.exit_application()   else: @@ -102,7 +105,10 @@
  def exit_application(self):   if self.stop_pipe_server():   DestroyWindow(self.hwnd) - print "Goodbye" + if self.guithread and self.guithread.isAlive(): + import gobject + gobject.idle_add(self.dialog.destroy) + print "Goodbye"     def stop_pipe_server(self):   print "Stopping pipe server..." @@ -130,6 +136,21 @@
  else:   return True   + def launchgui(self): + def launch(): + import gtk + from hggtk import taskbarui, hgtk + dlg = taskbarui.TaskBarUI(rpcserver.logq) + dlg.show_all() + dlg.connect('destroy', gtk.main_quit) + self.dialog = dlg + gtk.gdk.threads_init() + gtk.gdk.threads_enter() + gtk.main() + gtk.gdk.threads_leave() + + self.guithread = thread2.Thread(target=launch) + self.guithread.start()     def start_pipe_server(self):   def servepipe():
 
26
27
28
 
 
 
 
 
29
30
31
 
45
46
47
 
48
49
50
51
52
53
 
54
55
56
 
62
63
64
65
 
66
67
68
 
26
27
28
29
30
31
32
33
34
35
36
 
50
51
52
53
54
 
55
56
57
 
58
59
60
61
 
67
68
69
 
70
71
72
73
@@ -26,6 +26,11 @@
   PIPEBUFSIZE = 4096   +logq = Queue.Queue(0) +def logmsg(msg): + if logq.qsize() < 100: + ts = '[%s] ' % time.strftime('%c') + logq.put(ts + msg)    def update_batch(batch):   '''updates thgstatus for all paths in batch''' @@ -45,12 +50,12 @@
  if roots:   _ui = ui.ui();   for r in sorted(roots): + logmsg('Updating ' + r)   shlib.update_thgstatus(_ui, r, wait=False) - print "updated repo %s" % r   if notifypaths:   time.sleep(2)   shlib.shell_notify(list(notifypaths)) - print "shell notified" + logmsg('Shell notified')    requests = Queue.Queue(0)  _abort_request = r';:;:; Quit ;:;:;' # any invalid path would do @@ -62,7 +67,7 @@
  batch = []   r = requests.get()   if r == _abort_request: - print 'Updater thread quiting' + logmsg('Updater thread quiting')   return   print "got request %s (first in batch)" % r   batch.append(r)