Changeset 009f8d1e9a66…
Parent 500bb7d6673e…
by
Changes to 2 files · Browse files at 009f8d1e9a66 Showing diff from parent 500bb7d6673e Diff from another changeset...
|
@@ -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()
+
|
@@ -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 = {}
|
Loading...