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

status: add checkbox on filelist header to select all files

this replaces the Select and Deselect toolbuttons.

Changeset b1473f46bd61

Parent 13746bb5a4b7

by TK Soh

Changes to 2 files · Browse files at b1473f46bd61 Showing diff from parent 13746bb5a4b7 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​commit.py Stacked
 
221
222
223
224
225
226
227
228
 
221
222
223
 
 
224
225
226
@@ -221,8 +221,6 @@
  self.get_toolbutton('Re_vert').set_sensitive(not merged)   self.get_toolbutton('_Add').set_sensitive(not merged)   self.get_toolbutton('_Remove').set_sensitive(not merged) - self.get_toolbutton('_Select').set_sensitive(not merged) - self.get_toolbutton('_Deselect').set_sensitive(not merged)     if merged:   # select all changes if repo is merged
Change 1 of 6 Show Entire File hggtk/​status.py Stacked
 
158
159
160
161
162
163
164
165
166
167
168
 
256
257
258
259
 
260
261
 
262
263
 
264
265
266
 
312
313
314
 
315
316
317
 
342
343
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
346
347
 
350
351
352
 
353
354
355
 
820
821
822
823
 
824
825
826
 
158
159
160
 
 
 
 
 
161
162
163
 
251
252
253
 
254
255
 
256
257
258
259
260
261
262
 
308
309
310
311
312
313
314
 
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
 
370
371
372
373
374
375
376
 
841
842
843
 
844
845
846
847
@@ -158,11 +158,6 @@
  tip='move selected files to other directory'),   self.make_toolbutton(gtk.STOCK_DELETE, '_Remove',   self._remove_clicked, tip='remove'), - gtk.SeparatorToolItem(), - self.make_toolbutton(gtk.STOCK_YES, '_Select', - self._sel_desel_clicked, True, tip='select'), - self.make_toolbutton(gtk.STOCK_NO, '_Deselect', - self._sel_desel_clicked, False, tip='deselect'),   gtk.SeparatorToolItem()]     self.showdiff_toggle = gtk.ToggleToolButton(gtk.STOCK_JUSTIFY_FILL) @@ -256,11 +251,12 @@
  stat_cell = gtk.CellRendererText()     if self.count_revs() < 2: - col0 = gtk.TreeViewColumn('select', toggle_cell) + col0 = gtk.TreeViewColumn('', toggle_cell)   col0.add_attribute(toggle_cell, 'active', 0) - col0.set_sort_column_id(0) + #col0.set_sort_column_id(0)   col0.set_resizable(False)   self.tree.append_column(col0) + self.selcb = self._add_header_checkbox(col0, self._sel_clicked)     col1 = gtk.TreeViewColumn('st', stat_cell)   col1.add_attribute(stat_cell, 'text', 1) @@ -312,6 +308,7 @@
  self._diffpane.pack2(diff_frame, True, True)   self._diffpane.set_position(self._setting_pos)   self._diffpane_moved_id = self._diffpane.connect('notify::position', self._diffpane_moved) + self.tree.set_headers_clickable(True)   return self._diffpane     @@ -342,6 +339,29 @@
    return hbox   + def _add_header_checkbox(self, col, post=None, pre=None, toggle=False): + def cbclick(hdr, cb): + state = cb.get_active() + if pre: + pre(state) + if toggle: + cb.set_active(not state) + if post: + post(not state) + + cb = gtk.CheckButton(col.get_title()) + cb.show() + col.set_widget(cb) + wgt = cb.get_parent() + while wgt: + if type(wgt) == gtk.Button: + wgt.connect("clicked", cbclick, cb) + return cb + wgt = wgt.get_parent() + print "Warning: checkbox action not connected" + return + +   def _update_check_count(self):   file_count = 0   check_count = 0 @@ -350,6 +370,7 @@
  if row[0]:   check_count = check_count + 1   self.counter.set_text(_('%d selected, %d total') % (check_count, file_count)) + self.selcb.set_active(file_count == check_count)     def prepare_display(self):   self._ready = True @@ -820,7 +841,7 @@
  self.reload_status()     - def _sel_desel_clicked(self, toolbutton, state): + def _sel_clicked(self, state):   for entry in self.model : entry[0] = state   self._update_check_count()   return True