Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

sync: connect command buttons to cmdui widget

Changeset 728278310e12

Parent f186ff1074b6

by Steve Borho

Changes to one file · Browse files at 728278310e12 Showing diff from parent f186ff1074b6 Diff from another changeset...

 
13
14
15
16
 
17
18
19
20
 
21
22
23
 
115
116
117
 
 
 
 
 
 
 
 
 
 
 
 
 
118
119
120
121
122
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
125
126
 
209
210
211
212
213
214
215
216
217
 
 
218
219
220
 
242
243
244
 
 
245
246
 
 
247
248
 
 
249
250
 
 
251
252
 
 
253
254
 
 
255
256
 
 
257
258
 
 
259
 
 
 
 
 
 
 
 
260
261
262
 
13
14
15
 
16
17
18
19
 
20
21
22
23
 
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
237
238
239
 
 
 
 
 
 
240
241
242
243
244
 
266
267
268
269
270
271
 
272
273
274
275
276
277
278
 
279
280
281
282
283
284
285
 
286
287
288
289
290
291
292
 
293
294
295
296
297
298
299
300
301
302
303
304
305
306
@@ -13,11 +13,11 @@
 from PyQt4.QtCore import *  from PyQt4.QtGui import *   -from mercurial import config, url, util +from mercurial import config, hg, ui, url, util    from tortoisehg.util import hglib  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib +from tortoisehg.hgqt import qtlib, cmdui, hgemail    try:   import iniparse @@ -115,12 +115,40 @@
  self.pullbutton.clicked.connect(self.pullclicked)   self.outbutton.clicked.connect(self.outclicked)   self.pushbutton.clicked.connect(self.pushclicked) + self.emailbutton.clicked.connect(self.emailclicked) + + self.opbuttons = (self.inbutton, self.pullbutton, + self.outbutton, self.pushbutton, + self.emailbutton) + + cmd = cmdui.Widget() + cmd.commandStarted.connect(self.commandStarted) + cmd.commandFinished.connect(self.commandFinished) + cmd.commandCanceling.connect(self.commandCanceled) + layout.addWidget(cmd) + cmd.setHidden(True) + self.cmd = cmd     self.refresh()   if 'default' in self.paths:   self.setUrl(self.paths['default'])   self.curalias = 'default'   + def commandStarted(self): + for b in self.opbuttons: + b.setEnabled(False) + self.cmd.show_output(True) + + def commandFinished(self, wrapper): + for b in self.opbuttons: + b.setEnabled(True) + if wrapper.data is not 0: + self.cmd.show_output(True) + + def commandCanceled(self): + for b in self.opbuttons: + b.setEnabled(True) +   def refresh(self):   fn = os.path.join(self.root, '.hg', 'hgrc')   fn, cfg = loadIniFile([fn], self) @@ -209,12 +237,8 @@
  if event.matches(QKeySequence.Refresh):   self.refresh()   elif event.key() == Qt.Key_Escape: - if self.thread and self.thread.isRunning(): - self.thread.terminate() - # This can lockup, so stop waiting after 2sec - self.thread.wait( 2000 ) - self.finished() - self.thread = None + if self.cmd.core.is_running(): + self.cmd.core.cancel()   elif self.closeonesc:   self.close()   else: @@ -242,21 +266,41 @@
  self.curuser, self.curpw = '', ''     def inclicked(self): + if self.cmd.core.is_running(): + return   url = self.currentUrl(False) - print 'hg incoming', url + cmdline = ['--repository', self.root, 'incoming', url] + self.cmd.run(cmdline)     def pullclicked(self): + if self.cmd.core.is_running(): + return   url = self.currentUrl(False) - print 'hg pull', url + cmdline = ['--repository', self.root, 'pull', url] + self.cmd.run(cmdline)     def outclicked(self): + if self.cmd.core.is_running(): + return   url = self.currentUrl(False) - print 'hg outgoing', url + cmdline = ['--repository', self.root, 'outgoing', url] + self.cmd.run(cmdline)     def pushclicked(self): + if self.cmd.core.is_running(): + return   url = self.currentUrl(False) - print 'hg push', url + cmdline = ['--repository', self.root, 'push', url] + self.cmd.run(cmdline)   + def emailclicked(self): + try: + _ui = ui.ui() + repo = hg.repository(_ui, path=self.root) + except error.RepoError: + return + dialog = hgemail.EmailDialog(_ui, repo, None, self) + dialog.exec_()    class SaveDialog(QDialog):   def __init__(self, root, alias, url, parent):