Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

hggtk: get rid of close buttons on toolbar

Changeset 88e98adbc4b2

Parent 4301178886fd

by Germ├бn P├│o-Caama├▒o

Changes to 11 files · Browse files at 88e98adbc4b2 Showing diff from parent 4301178886fd Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​backout.py Stacked
 
34
35
36
37
38
39
40
41
 
42
43
44
 
76
77
78
79
80
81
82
83
84
 
34
35
36
 
 
 
 
 
37
38
39
40
 
72
73
74
 
 
 
75
76
77
@@ -34,11 +34,7 @@
  tbuttons = [   self._toolbutton(gtk.STOCK_GO_BACK, 'Backout',   self._backout_clicked, - 'Backout selected changeset'), - sep, - self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, - 'Close Window') + 'Backout selected changeset')   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -76,9 +72,6 @@
  ' effect of the change being backed out.')   vbox.pack_start(frame, True, True, 4)   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def set_notify_func(self, func, *args):   self.notify_func = func   self.notify_args = args
Change 1 of 2 Show Entire File hggtk/​clone.py Stacked
 
68
69
70
71
72
73
74
75
76
77
78
79
80
 
185
186
187
188
189
190
191
192
193
 
68
69
70
 
 
 
 
 
 
 
71
72
73
 
178
179
180
 
 
 
181
182
183
@@ -68,13 +68,6 @@
  ]   for btn in tbuttons:   self.tbar.insert(btn, -1) - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self.tbar.insert(sep, -1) - button = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, tip='Close Application') - self.tbar.insert(button, -1)   vbox = gtk.VBox()   self.add(vbox)   vbox.pack_start(self.tbar, False, False, 2) @@ -185,9 +178,6 @@
  vbox.pack_end(self._remote_cmd, False, False, 1)   vbox.pack_end(lbl, False, False, 1)   - def _close_clicked(self, toolbutton, data=None): - gtk.main_quit() -   def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):   if menu:
Change 1 of 2 Show Entire File hggtk/​gdialog.py Stacked
 
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
 
312
313
314
315
316
317
318
319
320
321
322
323
 
283
284
285
 
 
 
 
 
 
 
 
 
 
 
 
 
286
287
288
 
299
300
301
 
 
 
 
 
 
302
303
304
@@ -283,19 +283,6 @@
  tbuttons = self.get_tbbuttons()   for tbutton in tbuttons:   toolbar.insert(tbutton, -1) - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - toolbar.insert(sep, -1) - if self.main: - name = 'Quit' - tip = 'Close Application' - else: - name = 'Close' - tip = 'Close Window' - button = self.make_toolbutton(gtk.STOCK_CLOSE, name, - self._quit_clicked, tip=tip) - toolbar.insert(button, -1)   self.toolbar = toolbar   vbox.pack_start(toolbar, False, False, 0)   @@ -312,12 +299,6 @@
  self.connect('delete_event', self.should_live)     - - def _quit_clicked(self, button, data=None): - if not self.should_live(): - self.destroy() - -   def _destroying(self, gtkobj):   try:   settings = self.save_settings()
Change 1 of 3 Show Entire File hggtk/​hgemail.py Stacked
 
31
32
33
34
35
36
37
38
39
40
41
42
 
44
45
46
47
48
49
 
50
51
52
 
174
175
176
177
178
179
180
181
182
 
31
32
33
 
 
 
 
 
 
34
35
36
 
38
39
40
 
 
 
41
42
43
44
 
166
167
168
 
 
 
169
170
171
@@ -31,12 +31,6 @@
  self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()   - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, 'Close Window') -   tbuttons = [   self._toolbutton(gtk.STOCK_GOTO_LAST, 'Send',   self._on_send_clicked, @@ -44,9 +38,7 @@
  gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_PREFERENCES, 'configure',   self._on_conf_clicked, - 'Configure email settings'), - sep, - self._btn_close + 'Configure email settings')   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -174,9 +166,6 @@
    self.connect('map_event', self._on_window_map_event)   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock)   tbutton.set_label(label)
Change 1 of 2 Show Entire File hggtk/​hgignore.py Stacked
 
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
42
43
44
 
157
158
159
160
161
162
163
164
165
 
26
27
28
 
 
 
 
 
 
29
30
31
32
 
 
 
33
34
35
36
 
149
150
151
 
 
 
152
153
154
@@ -26,19 +26,11 @@
  self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()   - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, 'Close Window') -   tbuttons = [   self._toolbutton(gtk.STOCK_REFRESH,   'Refresh',   self._refresh_clicked, - tip='Reload hgignore'), - sep, - self._btn_close + tip='Reload hgignore')   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -157,9 +149,6 @@
  except IOError:   pass   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock)   tbutton.set_label(label)
Change 1 of 2 Show Entire File hggtk/​merge.py Stacked
 
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
73
74
75
 
113
114
115
116
117
118
119
120
121
 
59
60
61
 
 
 
 
 
62
63
64
 
 
 
65
66
67
68
 
106
107
108
 
 
 
109
110
111
@@ -59,17 +59,10 @@
  self._btn_unmerge_clicked,   tip='Undo merging and return working directory to'   ' one of it parent revision') - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, tip='Close Application')   tbuttons = [   self._btn_merge,   gtk.SeparatorToolItem(), - self._btn_unmerge, - sep, - self._btn_close + self._btn_unmerge   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -113,9 +106,6 @@
  # show them all   self._refresh()   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):   if menu:
Change 1 of 2 Show Entire File hggtk/​recovery.py Stacked
 
75
76
77
78
79
80
81
82
83
84
85
86
87
 
101
102
103
104
105
106
107
108
109
 
75
76
77
 
 
 
 
 
 
 
78
79
80
 
94
95
96
 
 
 
97
98
99
@@ -75,13 +75,6 @@
  ]   for btn in tbuttons:   self.tbar.insert(btn, -1) - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self.tbar.insert(sep, -1) - button = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, tip='Close Application') - self.tbar.insert(button, -1)   vbox = gtk.VBox()   self.add(vbox)   vbox.pack_start(self.tbar, False, False, 2) @@ -101,9 +94,6 @@
  self.stbar = gtklib.StatusBar()   vbox.pack_start(self.stbar, False, False, 2)   - def _close_clicked(self, *args): - self._do_close() -   def _delete(self, widget, event):   self._do_close()   return True
Change 1 of 3 Show Entire File hggtk/​serve.py Stacked
 
75
76
77
78
79
80
81
82
83
84
85
 
88
89
90
91
92
93
94
95
 
146
147
148
149
150
151
152
153
154
155
 
75
76
77
 
 
 
 
 
78
79
80
 
83
84
85
 
 
86
87
88
 
139
140
141
 
 
 
 
142
143
144
@@ -75,11 +75,6 @@
  'Configure',   self._on_conf_clicked,   None) - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._button_close = self._toolbutton(gtk.STOCK_CLOSE, 'Quit', - self._close_clicked)     tbuttons = [   self._button_start, @@ -88,8 +83,6 @@
  self._button_browse,   gtk.SeparatorToolItem(),   self._button_conf, - sep, - self._button_close,   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -146,10 +139,6 @@
  tbutton.connect('clicked', handler, userdata)   return tbutton   - def _close_clicked(self, *args): - if self._server_stopped() == True: - gtk.main_quit() -   def _delete(self, widget, event):   if self._server_stopped() == True:   gtk.main_quit()
Change 1 of 1 Show Changes Only hggtk/​synch.py Stacked
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
 
 
 
 
 
 
 
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
 #  # Repository synchronization dialog for TortoiseHg  #  # Copyright (C) 2007 Steve Borho <steve@borho.org>  # Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>  #    try:   import pygtk   pygtk.require("2.0")  except:   pass    import gtk  import gobject  import pango  import Queue  import os  import threading  from mercurial import hg, ui, util, extensions  from mercurial.repo import RepoError  from dialog import error_dialog, question_dialog, info_dialog  from hglib import HgThread, toutf  import shlib  import gtklib    class SynchDialog(gtk.Window):   def __init__(self, cwd='', root = '', repos=[]):   """ Initialize the Dialog. """   gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)     shlib.set_tortoise_icon(self, 'menusynch.ico')   self.root = root   self.cwd = cwd   self.selected_path = None   self.hgthread = None     # persistent app data   self._settings = shlib.Settings('synch')   self._recent_src = self._settings.mrul('src_paths')     self.set_default_size(610, 400)     self.paths = self._get_paths()   self.origchangecount = len(self.repo.changelog)     # load the fetch extension explicitly   extensions.load(self.ui, 'fetch', None)     name = self.repo.ui.config('web', 'name') or os.path.basename(root)   self.set_title("TortoiseHg Synchronize - " + name)     self.connect('delete-event', self._delete)     # 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_GO_DOWN,   'Incoming',   self._incoming_clicked,   tip='Display changes that can be pulled'   ' from selected repository'),   self._toolbutton(gtk.STOCK_GOTO_BOTTOM,   ' Pull ',   self._pull_clicked,   self._pull_menu(),   tip='Pull changes from selected'   ' repository'),   gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_GO_UP,   'Outgoing',   self._outgoing_clicked,   tip='Display local changes that will be pushed'   ' to selected repository'),   self._toolbutton(gtk.STOCK_GOTO_TOP,   'Push',   self._push_clicked,   tip='Push local changes to selected'   ' repository'),   self._toolbutton(gtk.STOCK_GOTO_LAST,   'Email',   self._email_clicked,   tip='Email local outgoing changes to'   ' one or more recipients'),   gtk.SeparatorToolItem(),   self._stop_button,   gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_PREFERENCES,   'Configure',   self._conf_clicked,   tip='Configure peer repository paths'),   gtk.SeparatorToolItem(),   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self.tbar.insert(sep, -1) - button = self._toolbutton(gtk.STOCK_CLOSE, 'Quit', - self._close_clicked, tip='Quit Application') - self.tbar.insert(button, -1)   vbox = gtk.VBox()   self.add(vbox)   vbox.pack_start(self.tbar, False, False, 2)     # revision input   revbox = gtk.HBox()   lbl = gtk.Button("Remote Path:")   lbl.unset_flags(gtk.CAN_FOCUS)   lbl.connect('clicked', self._btn_remotepath_clicked)     # revisions combo box   self.pathlist = gtk.ListStore(str)   self._pathbox = gtk.ComboBoxEntry(self.pathlist, 0)   self._pathtext = self._pathbox.get_child()     defrow = None   defpushrow = None   for row, (name, path) in enumerate(self.paths):   if name == 'default':   defrow = row   if defpushrow is None:   defpushrow = row   elif name == 'default-push':   defpushrow = row   self.pathlist.append([path])     if repos:   self._pathtext.set_text(repos[0])   elif defrow is not None:   self._pathbox.set_active(defrow)   elif defpushrow is not None:   self._pathbox.set_active(defpushrow)     sympaths = [x[1] for x in self.paths]   for p in self._recent_src:   if p not in sympaths:   self.pathlist.append([p])     # create checkbox to disable proxy   self._use_proxy = gtk.CheckButton("use proxy server")   if ui.ui().config('http_proxy', 'host', ''):   self._use_proxy.set_active(True)   else:   self._use_proxy.set_sensitive(False)     revbox.pack_start(lbl, False, False)   revbox.pack_start(self._pathbox, True, True)   revbox.pack_end(self._use_proxy, False, False)   vbox.pack_start(revbox, False, False, 2)     expander = gtk.Expander('Advanced Options')   expander.set_expanded(False)   hbox = gtk.HBox()   expander.add(hbox)     revvbox = gtk.VBox()   revhbox = gtk.HBox()   self._reventry = gtk.Entry()   self._force = gtk.CheckButton('Force pull or push')   self.tips.set_tip(self._force, 'Run even when remote repository'   ' is unrelated.')     revhbox.pack_start(gtk.Label('Target Revision:'), False, False, 2)   revhbox.pack_start(self._reventry, True, True, 2)   eventbox = gtk.EventBox()   eventbox.add(revhbox)   self.tips.set_tip(eventbox, 'A specific revision up to which you'   ' would like to push or pull.')   revvbox.pack_start(eventbox, True, True, 8)   revvbox.pack_start(self._force, False, False, 2)   hbox.pack_start(revvbox, True, True, 4)     frame = gtk.Frame('Incoming/Outgoing')   hbox.pack_start(frame, False, False, 2)     self._showpatch = gtk.CheckButton('Show Patches')   self._newestfirst = gtk.CheckButton('Show Newest First')   self._nomerge = gtk.CheckButton('Show No Merges')     hbox = gtk.HBox()   hbox.pack_start(self._showpatch, False, False, 2)   hbox.pack_start(self._newestfirst, False, False, 2)   hbox.pack_start(self._nomerge, False, False, 2)   frame.add(hbox)   vbox.pack_start(expander, False, False, 2)     # hg output window   scrolledwindow = gtk.ScrolledWindow()   scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   self.textview = gtk.TextView(buffer=None)   self.textview.set_editable(False)   self.textview.modify_font(pango.FontDescription("Monospace"))   scrolledwindow.add(self.textview)   self.textview.set_editable(False)   self.textbuffer = self.textview.get_buffer()   vbox.pack_start(scrolledwindow, True, True)     self.buttonhbox = gtk.HBox()   self.viewpulled = gtk.Button('View Pulled Revisions')   self.viewpulled.connect('clicked', self._view_pulled_changes)   self.updatetip = gtk.Button('Update to Tip')   self.updatetip.connect('clicked', self._update_to_tip)   self.buttonhbox.pack_start(self.viewpulled, False, False, 2)   self.buttonhbox.pack_start(self.updatetip, False, False, 2)   vbox.pack_start(self.buttonhbox, False, False, 2)     self.stbar = gtklib.StatusBar()   vbox.pack_start(self.stbar, False, False, 2)   self.connect('map', self.update_buttons)     def update_buttons(self, *args):   self.buttonhbox.hide()   self.repo.invalidate()   tip = len(self.repo.changelog)   if self.origchangecount == tip:   self.viewpulled.hide()   else:   self.buttonhbox.show()   self.viewpulled.show()     self.repo.dirstate.invalidate()   parent = self.repo.changectx(None).parents()[0].rev()   if parent == tip-1:   self.updatetip.hide()   else:   self.buttonhbox.show()   self.updatetip.show()     def _view_pulled_changes(self, button):   from history import GLog   revs = (len(self.repo.changelog)-1, self.origchangecount)   opts = {'revrange' : revs}   dialog = GLog(self.ui, self.repo, self.cwd, [], opts, False)   dialog.display()     def _update_to_tip(self, button):   self.repo.invalidate()   wc = self.repo.changectx(None)   pl = wc.parents()   p1, p2 = pl[0], self.repo.changectx('tip')   pa = p1.ancestor(p2)   warning = ''   flags = []   if len(pl) > 1:   warning = "Outstanding uncommitted merges"   elif pa != p1 and pa != p2:   warning = "Update spans branches"   if warning:   flags = ['--clean']   msg = 'Lose all changes in your working directory?'   warning += ', requires clean checkout'   if question_dialog(self, msg, warning) != gtk.RESPONSE_YES:   return   self.write("", False)     # execute command and show output on text widget   gobject.timeout_add(10, self.process_queue)     cmdline = ['update', '-v', '-R', self.repo.root] + flags + ['tip']   self.hgthread = HgThread(cmdline)   self.hgthread.start()   self.stbar.begin()   self.stbar.set_status_text('hg ' + ' '.join(cmdline))     def _pull_menu(self):   menu = gtk.Menu()     self._pull_fetch = gtk.CheckMenuItem("Do fetch")   menu.append(self._pull_fetch)   self._pull_update = gtk.CheckMenuItem("Update to new tip")   menu.append(self._pull_update)     # restore states from previous session   st = self._settings.get_value('_pull_update_state', False)   self._pull_update.set_active(st)     menu.show_all()   return menu     def _get_paths(self, sort="value"):   """ retrieve symbolic paths """   try:   self.ui = ui.ui()   self.repo = hg.repository(self.ui, path=self.root)   paths = self.repo.ui.configitems('paths')   if sort:   if sort == "value":   sortfunc = lambda a,b: cmp(a[1], b[1])   elif sort == "name":   sortfunc = lambda a,b: cmp(a[0], b[0])   else:   raise "unknown sort key '%s'" % sort   paths.sort(sortfunc)   return paths   except RepoError:   return None     def _btn_remotepath_clicked(self, button):   """ select source folder to clone """   dialog = gtk.FileChooserDialog(title="Select Repository",   action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,   buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,   gtk.STOCK_OPEN,gtk.RESPONSE_OK))   dialog.set_default_response(gtk.RESPONSE_OK)   dialog.set_current_folder(self.root)   response = dialog.run()   if response == gtk.RESPONSE_OK:   self._pathtext.set_text(dialog.get_filename())   dialog.destroy()     def _close_clicked(self, toolbutton, data=None):   self._do_close()     def _do_close(self):   if self._cmd_running():   error_dialog(self, "Can't close now", "command is running")   else:   self._save_settings()   gtk.main_quit()     def _save_settings(self):   self._settings.set_value('_pull_update_state',   self._pull_update.get_active())   self._settings.write()     def _delete(self, widget, event):   self._do_close()   return True     def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):   if menu:   tbutton = gtk.MenuToolButton(stock)   tbutton.set_menu(menu)   else:   tbutton = gtk.ToolButton(stock)     tbutton.set_label(label)   if tip:   tbutton.set_tooltip(self.tips, tip)   tbutton.connect('clicked', handler, userdata)   return tbutton     def _get_advanced_options(self):   opts = {}   if self._showpatch.get_active():   opts['patch'] = ['--patch']   if self._nomerge.get_active():   opts['no-merges'] = ['--no-merges']   if self._force.get_active():   opts['force'] = ['--force']   if self._newestfirst.get_active():   opts['newest-first'] = ['--newest-first']   target_rev = self._reventry.get_text().strip()   if target_rev != "":   opts['rev'] = ['--rev', target_rev]     return opts     def _pull_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   if self._pull_fetch.get_active():   cmd = ['fetch', '--message', 'merge']   else:   cmd = ['pull']   cmd += aopts.get('force', [])   if self._pull_update.get_active():   cmd.append('--update')   cmd += aopts.get('rev', [])   self._exec_cmd(cmd)     def _push_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['push']   cmd += aopts.get('rev', [])   cmd += aopts.get('force', [])   self._exec_cmd(cmd)     def _conf_clicked(self, toolbutton, data=None):   newpath = self._pathtext.get_text()   for name, path in self.paths:   if path == newpath:   newpath = None   break   from thgconfig import ConfigDialog   dlg = ConfigDialog(self.root, True)   dlg.show_all()   if newpath:   dlg.new_path(newpath)   else:   dlg.focus_field('paths.default')   dlg.run()   dlg.hide()   self.paths = self._get_paths()   self.pathlist.clear()   for row, (name, path) in enumerate(self.paths):   self.pathlist.append([path])     def _email_clicked(self, toolbutton, data=None):   path = self._pathtext.get_text()   if not path:   info_dialog(self, 'No repository selected',   'Select a peer repository to compare with')   self._pathbox.grab_focus()   return   from hgemail import EmailDialog   dlg = EmailDialog(self.root, ['--outgoing', path])   dlg.set_transient_for(self)   dlg.show_all()   dlg.present()   dlg.set_transient_for(None)     def _incoming_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['incoming']   cmd += aopts.get('rev', [])   cmd += aopts.get('patch', [])   cmd += aopts.get('no-merges', [])   cmd += aopts.get('force', [])   cmd += aopts.get('newest-first', [])   self._exec_cmd(cmd)     def _outgoing_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['outgoing']   cmd += aopts.get('rev', [])   cmd += aopts.get('patch', [])   cmd += aopts.get('no-merges', [])   cmd += aopts.get('force', [])   cmd += aopts.get('newest-first', [])   self._exec_cmd(cmd)     def _stop_clicked(self, toolbutton, data=None):   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', '')   use_proxy = self._use_proxy.get_active()   text_entry = self._pathbox.get_child()   remote_path = str(text_entry.get_text())     cmdline = cmd[:]   cmdline += ['--verbose', '--repository', self.root]   if proxy_host and not use_proxy:   cmdline += ["--config", "http_proxy.host="]   cmdline += [remote_path]     # show command to be executed   self.write("", False)     # execute command and show output on text widget   gobject.timeout_add(10, self.process_queue)   self.hgthread = HgThread(cmdline, parent=self)   self.hgthread.start()   self.stbar.begin()   self.stbar.set_status_text('hg ' + ' '.join(cmd + [remote_path]))     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)     # save path to recent list in history   self._recent_src.add(src)   self._settings.write()     # update drop-down list   self.pathlist.clear()   sympaths = [x[1] for x in ui.ui().configitems('paths')]   paths = list(set(sympaths + [x for x in self._recent_src]))   paths.sort()   for p in paths:   self.pathlist.append([p])     def write(self, msg, append=True):   msg = toutf(msg)   if append:   enditer = self.textbuffer.get_end_iter()   self.textbuffer.insert(enditer, msg)   self.textview.scroll_to_mark(self.textbuffer.get_insert(), 0)   else:   self.textbuffer.set_text(msg)     def process_queue(self):   """   Handle all the messages currently in the queue (if any).   """   self.hgthread.process_dialogs()   while self.hgthread.getqueue().qsize():   try:   msg = self.hgthread.getqueue().get(0)   self.write(msg)   except Queue.Empty:   pass     if self._cmd_running():   return True   else:   # Update button states   self.update_buttons()   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    def run(cwd='', root='', files=[], **opts):   dialog = SynchDialog(cwd, root, files)   dialog.show_all()   gtk.gdk.threads_init()   gtk.gdk.threads_enter()   gtk.main()   gtk.gdk.threads_leave()    if __name__ == "__main__":   run(**{})
Change 1 of 3 Show Entire File hggtk/​tagadd.py Stacked
 
48
49
50
51
52
53
54
55
56
57
58
59
 
66
67
68
69
70
71
 
72
73
74
 
149
150
151
152
153
154
155
156
157
 
48
49
50
 
 
 
 
 
 
51
52
53
 
60
61
62
 
 
 
63
64
65
66
 
141
142
143
 
 
 
144
145
146
@@ -48,12 +48,6 @@
  self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()   - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, tip='Close Application') -   self._btn_addtag = self._toolbutton(   gtk.STOCK_ADD,   'Add', @@ -66,9 +60,7 @@
  tip='Remove tag from repository')   tbuttons = [   self._btn_addtag, - self._btn_rmtag, - sep, - self._btn_close, + self._btn_rmtag   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -149,9 +141,6 @@
  continue   self._tagslist.append([tagname])   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def _btn_tag_clicked(self, button):   """ select tag from tags dialog """   import tags
Change 1 of 2 Show Entire File hggtk/​update.py Stacked
 
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
113
114
115
116
117
118
119
120
121
 
56
57
58
 
 
 
 
 
59
60
 
 
61
62
63
 
106
107
108
 
 
 
109
110
111
@@ -56,15 +56,8 @@
  'Update',   self._btn_update_clicked,   tip='Update working directory to selected revision') - sep = gtk.SeparatorToolItem() - sep.set_expand(True) - sep.set_draw(False) - self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', - self._close_clicked, tip='Close Application')   tbuttons = [   self._btn_update, - sep, - self._btn_close,   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -113,9 +106,6 @@
  # show them all   self._refresh()   - def _close_clicked(self, toolbutton, data=None): - self.destroy() -   def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):   if menu: