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

sync: single function for filling combo box

This fixes a number of bugs. I tried to show path aliases in the drop
down list, but GTK does not seem to allow showing text that is not the
same that is used by the text entry.

Changeset b43d92124781

Parent e7e82226b776

by Steve Borho

Changes to one file · Browse files at b43d92124781 Showing diff from parent e7e82226b776 Diff from another changeset...

Change 1 of 5 Show Entire File hggtk/​synch.py Stacked
 
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
 
150
151
152
 
 
 
 
 
 
 
153
154
155
 
224
225
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
228
229
 
440
441
442
443
444
445
446
447
448
449
450
451
452
453
 
454
455
456
 
537
538
539
540
541
542
543
544
545
 
546
547
548
 
114
115
116
 
117
118
 
119
120
 
 
 
 
 
 
121
122
123
 
124
125
 
126
127
 
128
129
 
 
 
 
 
 
 
 
 
 
 
130
131
132
133
 
135
136
137
138
139
140
141
142
143
144
145
146
147
 
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
 
447
448
449
 
 
 
 
 
 
 
 
 
 
 
450
451
452
453
 
534
535
536
 
 
 
 
 
 
537
538
539
540
@@ -114,35 +114,20 @@
  revbox.pack_start(lbl, False, False)     # revisions combo box - self.pathlist = gtk.ListStore(str, bool) + self.pathlist = gtk.ListStore(str, str, bool)   self._pathbox = gtk.ComboBoxEntry(self.pathlist, 0) - self._pathbox.set_row_separator_func(lambda model, iter: model[iter][1]) + self._pathbox.set_row_separator_func(lambda model, iter: model[iter][2])   self._pathtext = self._pathbox.get_child() - - # support dropping of repos or bundle files - self.drag_dest_set(gtk.DEST_DEFAULT_ALL, - [("text/uri-list", 0, 1)], gtk.gdk.ACTION_COPY) - self.connect('drag_data_received', self._drag_receive) - + self.fill_path_combo()   defrow = None   defpushrow = None - for row, (name, path) in enumerate(self.paths): + for iter, (path, name, sep) in enumerate(self.pathlist):   if name == 'default': - defrow = row + defrow = iter   if defpushrow is None: - defpushrow = row + defpushrow = iter   elif name == 'default-push': - defpushrow = row - self.pathlist.append([path, False]) - - sympaths = [x[1] for x in self.paths] - separator = False - for p in self._recent_src: - if p not in sympaths: - if not separator: - self.pathlist.append(['-'*20, True]) - separator = True - self.pathlist.append([p, False]) + defpushrow = iter     if repos:   self._pathtext.set_text(repos[0]) @@ -150,6 +135,13 @@
  self._pathbox.set_active(defpushrow)   elif defrow is not None:   self._pathbox.set_active(defrow) + else: + self._pathbox.set_active(0) + + # support dropping of repos or bundle files + self.drag_dest_set(gtk.DEST_DEFAULT_ALL, + [("text/uri-list", 0, 1)], gtk.gdk.ACTION_COPY) + self.connect('drag_data_received', self._drag_receive)     # create checkbox to disable proxy   self._use_proxy = gtk.CheckButton("use proxy server") @@ -224,6 +216,21 @@
  self.connect('map', self.update_buttons)   self._last_drop_time = None   + def fill_path_combo(self): + self.pathlist.clear() + sympaths = [] + for name, path in self.paths: + sympaths.append(path) + self.pathlist.append([path, name, False]) + separator = False + for p in self._recent_src: + if p in sympaths: + continue + if not separator: + self.pathlist.append(['-'*20, '', True]) + separator = True + self.pathlist.append([p, '', False]) +   def _drag_receive(self, widget, context, x, y, selection, targetType, time):   if time != self._last_drop_time:   files = selection.get_uris() @@ -440,17 +447,7 @@
  dlg.run()   dlg.hide()   self.paths = self._get_paths() - self.pathlist.clear() - for row, (name, path) in enumerate(self.paths): - self.pathlist.append([path, False]) - sympaths = [x[1] for x in self.paths] - separator = False - for p in self._recent_src: - if p not in sympaths: - if not separator: - self.pathlist.append(['-'*20, True]) - separator = True - self.pathlist.append([p, False]) + self.fill_path_combo()     def _email_clicked(self, toolbutton, data=None):   path = self._pathtext.get_text() @@ -537,12 +534,7 @@
  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]) + self.fill_path_combo()     def write(self, msg, append=True):   msg = toutf(msg)