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

hgtk: replace question_dialog with gdialog.Confirm

the dialogs served the same purpose, but Confirm is a bit nicer
and it has proper keyboard accelerators.

Fixes #31

Changeset 1e7a7033f60a

Parent b3eaebd77fd1

by Steve Borho

Changes to 10 files · Browse files at 1e7a7033f60a Showing diff from parent b3eaebd77fd1 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​clone.py Stacked
 
7
8
9
10
 
11
12
13
 
7
8
9
 
10
11
12
13
@@ -7,7 +7,7 @@
 import gtk  import os  import pango -from dialog import question_dialog, error_dialog, info_dialog +from dialog import error_dialog  from mercurial import hg, ui, cmdutil, util  from mercurial.i18n import _  import shlib
Change 1 of 1 Show Entire File hggtk/​dialog.py Stacked
 
83
84
85
86
87
88
89
90
 
83
84
85
 
 
 
 
 
@@ -83,8 +83,3 @@
 def warning_dialog(parent, primary, secondary):   """ Display a warning dialog with the given message. """   return _message_dialog(parent, gtk.MESSAGE_WARNING, primary, secondary) - -def question_dialog(parent, primary, secondary): - """ Display a dialog with the given question. """ - return _message_dialog(parent, gtk.MESSAGE_QUESTION, primary, secondary, - gtk.BUTTONS_YES_NO)
 
7
8
9
10
 
11
12
13
 
7
8
9
 
10
11
12
13
@@ -7,7 +7,7 @@
 import gtk  import Queue  import sys -from dialog import question_dialog, error_dialog +from dialog import error_dialog  from mercurial import util  from mercurial.i18n import _  import shlib
Change 1 of 3 Show Entire File hggtk/​merge.py Stacked
 
6
7
8
9
 
10
11
12
 
13
14
15
 
194
195
196
197
198
 
 
199
200
201
 
218
219
220
221
222
 
 
223
224
225
 
6
7
8
 
9
10
11
12
13
14
15
16
 
195
196
197
 
 
198
199
200
201
202
 
219
220
221
 
 
222
223
224
225
226
@@ -6,10 +6,11 @@
   import gtk  import sys -from dialog import error_dialog, question_dialog +from dialog import error_dialog  from mercurial.node import short, nullrev  from mercurial.i18n import _  from mercurial import util, hg, ui +import gdialog  import hgcmd  import shlib  import histselect @@ -194,8 +195,8 @@
  _('please select revision to unmerge'))   return   - response = question_dialog(self, _('Undo merge'), - _('and checkout revision %s?') % rev) + response = gdialog.Confirm(_('undo merge'), [], self, + _('and checkout revision %s?') % rev).run()   if response != gtk.RESPONSE_YES:   return   @@ -218,8 +219,8 @@
  _('please enter revision to merge'))   return   - response = question_dialog(self, _('Really want to merge?'), - _('with revision %s') % rev) + response = gdialog.Confirm(_('merge'), [], self, + _('with revision %s') % rev).run()   if response != gtk.RESPONSE_YES:   return  
Change 1 of 3 Show Entire File hggtk/​recovery.py Stacked
 
13
14
15
16
 
17
 
18
19
20
 
113
114
115
116
117
118
 
 
 
119
120
121
 
132
133
134
135
136
137
 
 
 
138
139
140
 
13
14
15
 
16
17
18
19
20
21
 
114
115
116
 
 
 
117
118
119
120
121
122
 
133
134
135
 
 
 
136
137
138
139
140
141
@@ -13,8 +13,9 @@
 import threading  from mercurial.i18n import _  from mercurial import hg, ui, util -from dialog import error_dialog, question_dialog +from dialog import error_dialog  from hglib import HgThread, toutf, RepoError, rootpath +import gdialog  import shlib  import gtklib   @@ -113,9 +114,9 @@
  return tbutton     def _clean_clicked(self, toolbutton, data=None): - response = question_dialog(self, _('Clean repository'), - "%s ?" % os.path.basename(self.root)) - if not response == gtk.RESPONSE_YES: + response = gdialog.Confirm(_('Clean repository'), [], self, + "%s ?" % os.path.basename(self.root)).run() + if response != gtk.RESPONSE_YES:   return   try:   repo = hg.repository(ui.ui(), path=self.root) @@ -132,9 +133,9 @@
  shlib.shell_notify([self.root])     def _rollback_clicked(self, toolbutton, data=None): - response = question_dialog(self, _('Rollback repository'), - "%s ?" % os.path.basename(self.root)) - if not response == gtk.RESPONSE_YES: + response = gdialog.Confirm(_('Rollback repository'), [], self, + "%s ?" % os.path.basename(self.root)).run() + if response != gtk.RESPONSE_YES:   return   cmd = ['rollback']   self._exec_cmd(cmd, postfunc=self._notify)
Change 1 of 2 Show Entire File hggtk/​serve.py Stacked
 
17
18
19
20
 
 
21
22
23
 
149
150
151
152
 
153
154
155
156
 
 
157
158
 
 
159
160
161
 
17
18
19
 
20
21
22
23
24
 
150
151
152
 
153
154
 
 
 
155
156
157
158
159
160
161
162
163
@@ -17,7 +17,8 @@
 import time  import hglib  import shlib -from dialog import question_dialog, error_dialog +import gdialog +from dialog import error_dialog  from mercurial.i18n import _  from mercurial import hg, ui, commands, cmdutil, util  from mercurial.hgweb import server @@ -149,13 +150,14 @@
  check if server is running, or to terminate if running   '''   if gservice and not gservice.stopped: - if question_dialog(self, _('Really Exit?'), + ret = gdialog.Confirm(_('Really Exit?'), [], self,   _('Server process is still running\n' - 'Exiting will stop the server.')) != gtk.RESPONSE_YES: - return False - else: + 'Exiting will stop the server.')).run() + if ret == gtk.RESPONSE_YES:   self._stop_server()   return True + else: + return False   else:   return True  
Change 1 of 1 Show Entire File hggtk/​synch.py Stacked
 
13
14
15
16
 
17
18
19
 
13
14
15
 
16
17
18
19
@@ -13,7 +13,7 @@
 import threading  from mercurial.i18n import _  from mercurial import hg, ui, util, extensions, url -from dialog import error_dialog, question_dialog, info_dialog +from dialog import error_dialog, info_dialog  from hglib import HgThread, fromutf, toutf, rootpath, RepoError  import shlib  import gtklib
Change 1 of 1 Show Entire File hggtk/​tagadd.py Stacked
 
6
7
8
9
 
10
11
12
 
6
7
8
 
9
10
11
12
@@ -6,7 +6,7 @@
   import os  import gtk -from dialog import question_dialog, error_dialog, info_dialog +from dialog import error_dialog, info_dialog  from mercurial import hg, ui, cmdutil, util  from mercurial.i18n import _  from mercurial.node import short, nullid
 
13
14
15
16
 
17
18
 
19
20
21
 
429
430
431
432
433
 
 
 
434
435
436
 
448
449
450
451
452
453
454
 
13
14
15
 
16
17
18
19
20
21
22
 
430
431
432
 
 
433
434
435
436
437
438
 
450
451
452
 
453
454
455
@@ -13,9 +13,10 @@
 import threading  from mercurial.i18n import _  from mercurial import hg, ui, util, url -from dialog import error_dialog, question_dialog +from dialog import error_dialog  from hglib import RepoError, toutf, fromutf, rootpath  import shlib +import gdialog  import iniparse    _unspecstr = _('<unspecified>') @@ -429,8 +430,9 @@
    def should_live(self, *args):   if self.dirty: - if question_dialog(self, _('Quit without saving?'), - _('Yes to abandon changes, No to continue')) != gtk.RESPONSE_YES: + ret = gdialog.Confirm(_('quit without saving?'), [], self, + _('Yes to abandon changes, No to continue')).run() + if ret != gtk.RESPONSE_YES:   self.emit_stop_by_name('response')   return True   if len(args) == 2 and args[1] == gtk.RESPONSE_YES: @@ -448,7 +450,6 @@
  u.config('ui', 'editor') or   os.environ.get('EDITOR', 'vi'))   if os.path.basename(editor) in ('vi', 'vim', 'hgeditor'): - import gdialog   gdialog.Prompt(_('No visual editor configured'),   _('Please configure a visual editor.'), self).run()   self.focus_field('tortoisehg.editor')
Change 1 of 2 Show Entire File hggtk/​update.py Stacked
 
7
8
9
10
 
11
12
13
14
15
16
 
17
18
19
 
163
164
165
166
167
 
 
168
169
170
 
7
8
9
 
10
11
12
13
14
15
16
17
18
19
20
 
164
165
166
 
 
167
168
169
170
171
@@ -7,13 +7,14 @@
 import os  import sys  import gtk -from dialog import error_dialog, question_dialog +from dialog import error_dialog  from mercurial import util, hg, ui  from mercurial.node import short, nullrev  from mercurial.i18n import _  from hglib import rootpath, toutf, RepoError  import shlib  import hgcmd +import gdialog    class UpdateDialog(gtk.Window):   """ Dialog to update Mercurial repo """ @@ -163,8 +164,8 @@
  _('please enter revision to update to'))   return   - response = question_dialog(self, _('Really want to update?'), - _('to revision %s') % rev) + response = gdialog.Confirm(_('update'), [], self, + _('to revision %s') % rev).run()   if response != gtk.RESPONSE_YES:   return