Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

thgconfig: cleanup code for adding rows to the table in PathEditDialog

Changeset 3b5a1a370036

Parent 2b38e360d4ee

by Yuki KODAMA

Changes to one file · Browse files at 3b5a1a370036 Showing diff from parent 2b38e360d4ee Diff from another changeset...

 
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
 
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
@@ -251,64 +251,69 @@
  self.entries['Alias'][0].set_width_chars(18)   self.entries['URL'][0].set_width_chars(60)   self.entries['Port'][0].set_width_chars(8) + self.entries['User'][0].set_width_chars(18) + self.entries['Password'][0].set_width_chars(24)   self.entries['Password'][0].set_visibility(False)   + def createtable(cols=2): + newtable = gtk.Table(0, cols) + def addrow(header, cell): + row = newtable.get_property('n-rows') + newtable.set_property('n-rows', row + 1) + newtable.attach(header, 0, 1, row, row + 1, gtk.FILL, 0, 4, 2) + newtable.attach(cell, 1, 2, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 4, 2) + return newtable, addrow +   # table for main entries - toptable = gtk.Table(2, 2) + toptable, addrow = createtable()   self.vbox.pack_start(toptable, False, False, 2)     ## alias (and 'Browse...' button) - toptable.attach(self.entries['Alias'][1], 0, 1, 0, 1, gtk.FILL, 0, 4, 2)   hbox = gtk.HBox()   hbox.pack_start(self.entries['Alias'][0], False, False)   hbox.pack_start(gtk.Label(''))   browse = gtk.Button(_('Browse...'))   browse.connect('clicked', self.browse_clicked)   hbox.pack_start(browse, False, False) - toptable.attach(hbox, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, 0, 4, 2) + addrow(self.entries['Alias'][1], hbox)     ## final URL - toptable.attach(self.entries['URL'][1], 0, 1, 1, 2, gtk.FILL, 0, 4, 2) - toptable.attach(self.entries['URL'][0], 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, 0, 4, 2) + addrow(self.entries['URL'][1], self.entries['URL'][0])     self.expander = expander = gtk.Expander(_('URL Details'))   self.vbox.pack_start(expander, True, True, 2)     # table for separated entries - entrytable = gtk.Table(5, 2) + entrytable, addrow = createtable()   expander.add(entrytable)     ## path type   typelabel = gtk.Label(_('Type'))   typelabel.set_alignment(1, 0.5) - entrytable.attach(typelabel, 0, 1, 0, 1, gtk.FILL, 0, 4, 2)   self.protocolcombo = gtk.combo_box_new_text()   for name, label in self._protocols:   self.protocolcombo.append_text(label)   hbox = gtk.HBox()   hbox.pack_start(self.protocolcombo, False, False)   hbox.pack_start(gtk.Label('')) - entrytable.attach(hbox, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, 0, 4, 2) + addrow(typelabel, hbox)     ## host & port - entrytable.attach(self.entries['Host'][1], 0, 1, 1, 2, gtk.FILL, 0, 4, 2)   hbox = gtk.HBox() - hbox.pack_start(self.entries['Host'][0], True, True, 2) - hbox.pack_start(self.entries['Port'][1], False, False, 2) - hbox.pack_start(self.entries['Port'][0], False, False, 2) - entrytable.attach(hbox, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, 0, 2, 2) + hbox.pack_start(self.entries['Host'][0]) + hbox.pack_start(self.entries['Port'][1], False, False, 4) + hbox.pack_start(self.entries['Port'][0], False, False) + addrow(self.entries['Host'][1], hbox)     ## folder - entrytable.attach(self.entries['Folder'][1], 0, 1, 2, 3, gtk.FILL, 0, 4, 2) - entrytable.attach(self.entries['Folder'][0], 1, 2, 2, 3, gtk.FILL|gtk.EXPAND, 0, 4, 2) + addrow(self.entries['Folder'][1], self.entries['Folder'][0])     ## username & password - entrytable.attach(self.entries['User'][1], 0, 1, 3, 4, gtk.FILL, 0, 4, 2)   hbox = gtk.HBox() - hbox.pack_start(self.entries['User'][0], False, False, 2) - hbox.pack_start(self.entries['Password'][1], False, False, 2) - hbox.pack_start(self.entries['Password'][0], False, False, 2) - entrytable.attach(hbox, 1, 2, 3, 4, gtk.FILL|gtk.EXPAND, 0, 2, 2) + hbox.pack_start(self.entries['User'][0], False, False) + hbox.pack_start(self.entries['Password'][1], False, False, 4) + hbox.pack_start(self.entries['Password'][0], False, False) + addrow(self.entries['User'][1], hbox)     # prepare to show   self.load_settings()