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

history: add "Choose Details..." dialog to select the columns to show

Replaces "Features" and "Columns" menus with a single "View" menu.
Moves the column checkmarks into a dialog.

Changeset 009f8d1e9a66

Parent 500bb7d6673e

by Adrian Buehlmann

Changes to 2 files · Browse files at 009f8d1e9a66 Showing diff from parent 500bb7d6673e Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​histdetails.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
@@ -0,0 +1,77 @@
+# histdetails.py - TortoiseHg dialog for defining log viewing details +# +# Copyright 2009 Adrian Buehlmann <adrian@cadifra.com> +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. + +import gtk +import gobject + +from thgutil.i18n import _ + +from hggtk import gtklib + +class LogDetailsDialog(gtk.Dialog): + + def __init__(self, model, apply_func): + buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) + super(LogDetailsDialog, self).__init__( + flags=gtk.DIALOG_MODAL, buttons=buttons) + + self.apply_func = apply_func + self.dirty = False + + gtklib.set_tortoise_icon(self, 'general.ico') + gtklib.set_tortoise_keys(self) + + self._btn_apply = gtk.Button(_('Apply')) + self._btn_apply.set_sensitive(False) + self._btn_apply.connect('clicked', self._btn_apply_clicked) + self.action_area.pack_end(self._btn_apply) + + self.set_title(_('Log Details')) + + self.set_default_size(350, 120) + + hbox = gtk.HBox() + lb = gtk.Label(_('Columns') + ':') + hbox.pack_start(lb, False, False, 4) + self.vbox.pack_start(hbox, False, False, 4) + + tv = gtk.TreeView(model) + tv.set_headers_visible(False) + + cr = gtk.CellRendererToggle() + cr.set_property('activatable', True) + + def toggled(cell, path): + model[path][0] = not model[path][0] + self.dirty = True + self.update_buttons() + + cr.connect('toggled', toggled) + + show_col = gtk.TreeViewColumn('', cr, active=0) + tv.append_column(show_col) + + cr = gtk.CellRendererText() + info_col = gtk.TreeViewColumn('', cr, text=1) + tv.append_column(info_col) + + vbox = gtk.VBox() + vbox.set_border_width(4) + vbox.pack_start(tv) + + self.vbox.pack_start(vbox, True, True) + + self.show_all() + + def update_buttons(self): + self._btn_apply.set_sensitive(self.dirty) + + def _btn_apply_clicked(self, button, data=None): + self.apply_func() + self.dirty = False + self.update_buttons() +
Change 1 of 4 Show Entire File hggtk/​history.py Stacked
 
21
22
23
24
 
25
26
27
 
38
39
40
 
41
42
43
 
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 
107
108
 
 
 
109
110
111
 
201
202
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
205
206
 
21
22
23
 
24
25
26
27
 
38
39
40
41
42
43
44
 
93
94
95
 
96
 
 
 
 
 
 
 
 
 
 
97
98
99
100
101
102
103
104
105
 
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
@@ -21,7 +21,7 @@
   from hggtk import gdialog, gtklib, hgcmd, datamine, logfilter, gorev  from hggtk import backout, status, hgemail, tagadd, update, merge, archive -from hggtk import changeset, thgconfig, thgmq +from hggtk import changeset, thgconfig, thgmq, histdetails    def create_menu(label, callback):   menuitem = gtk.MenuItem(label, True) @@ -38,6 +38,7 @@
  self.origtip = len(self.repo)   self.ready = False   self.filterbox = None + self.details_model = None   os.chdir(self.repo.root)     # Load extension support for commands which need it @@ -92,20 +93,13 @@
  return tbar     def get_menu_list(self): - col = lambda x, y: self.showcol.get(x, y)   fnc = self.toggle_view_column - return [(_('Columns'), [ - (_('Graph'), True, self.toggle_graphcol, [], self.graphcol), - (_('Revision Number'), True, fnc, ['rev-column-visible'], col('rev', True)), - (_('Changeset ID'), True, fnc, ['id-column-visible'], col('id', False)), - (_('Branch Name'), True, fnc, ['branch-column-visible'], col('branch', False)), - (_('Local Date'), True, fnc, ['date-column-visible'], col('date', False)), - (_('UTC Date'), True, fnc, ['utc-column-visible'], col('utc', False)), - (_('Age'), True, fnc, ['age-column-visible'], col('age', True)), - (_('Tags'), True, fnc, ['tag-column-visible'], col('tag', False))]), - (_('Features'), [ + return [(_('View'), [   (_('Filter Bar'), True, self.toggle_show_filterbar, [],   self.show_filterbar), + ('----', None, None, None, None), + (_('Choose Details...'), False, self.details_clicked, [], None), + ('----', None, None, None, None),   (_('Compact Graph'), True, self.toggle_compactgraph, [],   self.compactgraph),   (_('Color by Branch'), True, self.toggle_branchcolor, [], @@ -201,6 +195,50 @@
  dlg = datamine.DataMineDialog(self.ui, self.repo, self.cwd, [], {})   dlg.display()   + def details_clicked(self, toolbutton, data=None): + self.show_details_dialog() + + def show_details_dialog(self): + + def close(dialog, response_id): + dialog.destroy() + + model = gtk.ListStore( + gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING) + + model.append([self.graphcol, _('Graph'), 'graphcol']) + def column(col, default, text): + prop = col + '-column-visible' + vis = self.graphview.get_property(prop) + model.append([vis, text, prop]) + column('rev', True, _('Revision Number')) + column('id', False, _('Changeset ID')) + column('branch', False, _('Branch Name')) + column('date', False, _('Local Date')) + column('utc', False, _('UTC Date')) + column('age', True, _('Age')) + column('tag', False, _('Tags')) + + self.details_model = model + + dlg = histdetails.LogDetailsDialog(model, self.apply_details) + dlg.connect('response', close) + dlg.show() + + def apply_details(self): + if self.details_model: + reload = False + for show, uitext, property in self.details_model: + if property == 'graphcol': + if self.graphcol != show: + self.graphcol = show + reload = True + else: + self.graphview.set_property(property, show) + self.showcol[property] = show + if reload: + self.reload_log() +   def filter_entry_activated(self, entry, combo):   'User pressed enter in the filter entry'   opts = {}