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

hggtk: remove redundant pygtk.require()

We do this check in hgtk before any dialog modules are loaded.

Changeset 0ca65325372d

Parent 69f96fd0ba09

by Steve Borho

Changes to 14 files · Browse files at 0ca65325372d Showing diff from parent 69f96fd0ba09 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​about.py Stacked
 
8
9
10
11
12
13
14
 
8
9
10
 
11
12
13
@@ -8,7 +8,6 @@
 import sys    import pygtk -pygtk.require('2.0')  import gtk  import shlib  from mercurial.i18n import _
 
6
7
8
9
10
11
12
 
6
7
8
 
9
10
11
@@ -6,7 +6,6 @@
   import os  import pygtk -pygtk.require('2.0')  import gtk  import gobject  import pango
Change 1 of 1 Show Entire File hggtk/​clone.py Stacked
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import os  import pango
Change 1 of 1 Show Entire File hggtk/​dialog.py Stacked
 
15
16
17
18
19
20
21
 
15
16
17
 
18
19
20
@@ -15,7 +15,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    import pygtk -pygtk.require("2.0")  import gtk  from gtklib import MessageDialog  from mercurial.i18n import _
Change 1 of 1 Show Entire File hggtk/​gtklib.py Stacked
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require('2.0')  import gtk  import gobject  import pango
Change 1 of 1 Show Entire File hggtk/​hgcmd.py Stacked
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import gobject  import pango
Change 1 of 1 Show Changes Only hggtk/​hginit.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
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
 #  # TortoiseHg dialog to initialize a repo  #  # Copyright (C) 2008 TK Soh <teekaysoh@gmail.com>  #    import pygtk -pygtk.require("2.0")  import os  import gtk  from dialog import error_dialog, info_dialog  from mercurial import hg, ui, util  from mercurial.i18n import _  from hglib import toutf, fromutf, RepoError  import shlib    class InitDialog(gtk.Window):   """ Dialog to add tag to Mercurial repo """   def __init__(self, cwd='', repos=[]):   """ Initialize the Dialog """   gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)     # set dialog title and icon   self.cwd = cwd and cwd or os.getcwd()   title = 'hg init - %s' % toutf(self.cwd)   self.set_title(title)   shlib.set_tortoise_icon(self, 'menucreaterepos.ico')     # preconditioning info   self._dest_path = os.path.abspath(repos and repos[0] or os.getcwd())     # build dialog   self._create()     def _create(self):   self.set_default_size(350, 150)   self.connect('destroy', gtk.main_quit)     # add toolbar with tooltips   self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()     self._btn_init = self._toolbutton(   gtk.STOCK_NEW,   _('Create'),   self._btn_init_clicked,   tip=_('Create a new repository in destination directory'))   tbuttons = [   self._btn_init,   ]   for btn in tbuttons:   self.tbar.insert(btn, -1)   sep = gtk.SeparatorToolItem()   sep.set_expand(True)   sep.set_draw(False)   vbox = gtk.VBox()   self.add(vbox)   vbox.pack_start(self.tbar, False, False, 2)     # clone source   srcbox = gtk.HBox()   lbl = gtk.Label(_(' Destination :'))   lbl.set_property('width-chars', 12)   lbl.set_alignment(0, 0.5)   self._dest_input = gtk.Entry()   self._dest_input.set_text(toutf(self._dest_path))   self._dest_input.set_position(-1)     self._btn_dest_browse = gtk.Button("...")   self._btn_dest_browse.connect('clicked', self._btn_dest_clicked)   srcbox.pack_start(lbl, False, False)   srcbox.pack_start(self._dest_input, True, True)   srcbox.pack_end(self._btn_dest_browse, False, False, 5)   vbox.pack_start(srcbox, False, False, 2)     # options   option_box = gtk.VBox()   self._opt_specialfiles = gtk.CheckButton(   _('Add special files (.hgignore, ...)'))   self._opt_oldrepoformat = gtk.CheckButton(   _('Make repo compatible with Mercurial 1.0'))   option_box.pack_start(self._opt_specialfiles, False, False)   option_box.pack_start(self._opt_oldrepoformat, False, False)   vbox.pack_start(option_box, False, False, 15)     # set option states   self._opt_specialfiles.set_active(True)   try:   usefncache = ui.ui().configbool('format', 'usefncache', True)   self._opt_oldrepoformat.set_active(not usefncache)   except:   pass     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 _btn_dest_clicked(self, button):   """ select source folder to clone """   dialog = gtk.FileChooserDialog(title=None,   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.cwd)   response = dialog.run()   if response == gtk.RESPONSE_OK:   self._dest_input.set_text(dialog.get_filename())   self._dest_input.set_position(-1)   dialog.destroy()     def _btn_init_clicked(self, toolbutton, data=None):   # gather input data   dest = fromutf(self._dest_input.get_text())     # verify input   if dest == "":   error_dialog(self, _('Destination path is empty'),   _('Please enter the directory path'))   self._dest_input.grab_focus()   return False     # start   u = ui.ui()     # fncache is the new default repo format in Mercurial 1.1   if self._opt_oldrepoformat.get_active():   u.setconfig('format', 'usefncache', 'False')     try:   hg.repository(u, dest, create=1)   except RepoError, inst:   error_dialog(self, _('Unable to create new repository'), str(inst))   return False   except util.Abort, inst:   error_dialog(self, _('Error when creating repository'), str(inst))   return False   except:   import traceback   error_dialog(self, _('Error when creating repository'),   traceback.format_exc())   return False     # create the .hg* file, mainly to workaround   # Explorer's problem in creating files with name   # begins with a dot.   if self._opt_specialfiles.get_active():   hgignore = os.path.join(dest, '.hgignore')   if not os.path.exists(hgignore):   try:   open(hgignore, 'wb')   except:   pass     info_dialog(self, _('New repository created'),   _('in directory %s') % toutf(os.path.abspath(dest)))    def run(cwd='', files=[], **opts):   dialog = InitDialog(cwd, repos=files)   dialog.show_all()   gtk.gdk.threads_init()   gtk.gdk.threads_enter()   gtk.main()   gtk.gdk.threads_leave()    if __name__ == "__main__":   import sys   opts = {}   opts['cwd'] = os.getcwd()   opts['files'] = sys.argv[1:]   run(**opts)
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import os  import sys
Change 1 of 1 Show Entire File hggtk/​merge.py Stacked
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import sys  from dialog import *
Change 1 of 1 Show Entire File hggtk/​recovery.py Stacked
 
6
7
8
9
10
11
12
 
6
7
8
 
9
10
11
@@ -6,7 +6,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import gobject  import pango
Change 1 of 1 Show Entire File hggtk/​serve.py Stacked
 
6
7
8
9
10
11
12
 
6
7
8
 
9
10
11
@@ -6,7 +6,6 @@
 #    import pygtk -pygtk.require("2.0")  import gtk  import gobject  import httplib
Change 1 of 1 Show Entire File hggtk/​tagadd.py Stacked
 
5
6
7
8
9
10
11
 
5
6
7
 
8
9
10
@@ -5,7 +5,6 @@
 #    import pygtk -pygtk.require("2.0")  import os  import gtk  from dialog import question_dialog, error_dialog, info_dialog
 
8
9
10
11
12
13
14
 
8
9
10
 
11
12
13
@@ -8,7 +8,6 @@
   import os  import pygtk -pygtk.require('2.0')  import gtk  import cStringIO  
Change 1 of 1 Show Entire File hggtk/​update.py Stacked
 
5
6
7
8
9
10
11
12
 
5
6
7
 
 
8
9
10
@@ -5,8 +5,6 @@
 #    import pygtk -pygtk.require("2.0") -  import os  import sys  import gtk