Changeset 14f9ae5699c1…
Parent 6f5b11cd6a37…
by
Changes to 2 files · Browse files at 14f9ae5699c1 Showing diff from parent 6f5b11cd6a37 Diff from another changeset...
@@ -39,7 +39,15 @@ hbox.pack_start(lb, False, False, 4)
self.vbox.pack_start(hbox, False, False, 4)
- tv = gtk.TreeView(model)
+ mainhbox = gtk.HBox()
+ self.vbox.pack_start(mainhbox)
+
+ leftvbox = gtk.VBox()
+ rightvox = gtk.VBox()
+ mainhbox.pack_start(leftvbox, True, True)
+ mainhbox.pack_start(rightvox, False, False)
+
+ tv = self.tv = gtk.TreeView(model)
tv.set_headers_visible(False)
cr = gtk.CellRendererToggle()
@@ -67,13 +75,45 @@ vbox.set_border_width(4)
vbox.pack_start(tv)
- self.vbox.pack_start(vbox, True, True)
+ leftvbox.pack_start(vbox, True, True)
+
+ self.up_button = gtk.ToolButton(gtk.STOCK_GO_UP)
+ self.up_button.connect('clicked', self.up_clicked)
+ self.down_button = gtk.ToolButton(gtk.STOCK_GO_DOWN)
+ self.down_button.connect('clicked', self.down_clicked)
+
+ rightvox.pack_start(self.up_button, False, False)
+ rightvox.pack_start(self.down_button, False, False)
self.show_all()
def update_buttons(self):
self._btn_apply.set_sensitive(self.dirty)
+ def up_clicked(self, button):
+ model, seliter = self.tv.get_selection().get_selected()
+ i = model.get_iter_first()
+ if model.get_path(seliter) == model.get_path(i):
+ return
+ while True:
+ next = model.iter_next(i)
+ if next == None:
+ return
+ if model.get_path(next) == model.get_path(seliter):
+ model.swap(i, next)
+ self._btn_apply.set_sensitive(True)
+ self.dirty = True
+ return
+ i = next
+
+ def down_clicked(self, button):
+ model, seliter = self.tv.get_selection().get_selected()
+ next = model.iter_next(seliter)
+ if next:
+ model.swap(seliter, next)
+ self._btn_apply.set_sensitive(True)
+ self.dirty = True
+
def _btn_apply_clicked(self, button, data=None):
self.apply_func()
self.dirty = False
|
@@ -247,23 +247,33 @@ def close(dialog, response_id):
dialog.destroy()
- model = gtk.ListStore(
- gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING)
+ columns = {}
+ columns['graph'] = (self.graphcol, _('Graph'), 'graphcol', 'graph')
- model.append([self.graphcol, _('Graph'), 'graphcol'])
- def column(col, default, text):
+ def column(col, 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('msg', True, _('Summary'))
- column('user', True, _('User'))
- column('date', False, _('Local Date'))
- column('utc', False, _('UTC Date'))
- column('age', True, _('Age'))
- column('tag', False, _('Tags'))
+ columns[col] = (vis, text, prop, col)
+
+ column('rev', _('Revision Number'))
+ column('id', _('Changeset ID'))
+ column('branch', _('Branch Name'))
+ column('msg', _('Summary'))
+ column('user', _('User'))
+ column('date', _('Local Date'))
+ column('utc', _('UTC Date'))
+ column('age', _('Age'))
+ column('tag', _('Tags'))
+
+ model = gtk.ListStore(
+ gobject.TYPE_BOOLEAN,
+ gobject.TYPE_STRING,
+ gobject.TYPE_STRING,
+ gobject.TYPE_STRING)
+
+ for c in self.graphview.get_columns():
+ vis, text, prop, col = columns[c]
+ model.append([vis, text, prop, col])
self.details_model = model
@@ -273,8 +283,12 @@
def apply_details(self):
if self.details_model:
+ columns = []
+ for show, uitext, property, colname in self.details_model:
+ columns.append(colname)
+ self.graphview.set_columns(columns)
reload = False
- for show, uitext, property in self.details_model:
+ for show, uitext, property, colname in self.details_model:
if property == 'graphcol':
if self.graphcol != show:
self.graphcol = show
|
Loading...