# HG changeset patch
# User Steve Borho <st...@borho.org>
# Date 1253679040 18000
# Node ID 86291cc9b5be14fd9245d171b33247bc654d663e
# Parent  2bfe0921b4cec3f908fe260da66785eddd7477f5
history: start integration of sync bar

Offer "90%" of the features of the synchronize tool inside changelog.
This patch is mostly a UI mockup.  The buttons do not work and it lacks
tooltips.

diff -r 2bfe0921b4ce -r 86291cc9b5be tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py        Tue Sep 22 13:30:26 2009 -0500
+++ b/tortoisehg/hgtk/history.py        Tue Sep 22 23:10:40 2009 -0500
@@ -12,7 +12,7 @@
 import pango
 import StringIO
 
-from mercurial import ui, hg, cmdutil, commands, extensions, util, match
+from mercurial import ui, hg, cmdutil, commands, extensions, util, match, url
 
 from tortoisehg.util.i18n import _
 from tortoisehg.util import hglib, paths
@@ -104,6 +104,8 @@
             
         fnc = self.toggle_view_column
         return [(_('View'), [
+            (_('Sync Bar'), True, self.toggle_show_syncbar, [],
+                self.show_syncbar),
             (_('Filter Bar'), True, self.toggle_show_filterbar, [],
                 self.show_filterbar),
             ('----', None, None, None, None),
@@ -171,6 +173,11 @@
         if self.filterbox is not None:
             self.filterbox.set_property('visible', self.show_filterbar)
 
+    def toggle_show_syncbar(self, button):
+        self.show_syncbar = button.get_active()
+        if self.syncbox is not None:
+            self.syncbox.set_property('visible', self.show_syncbar)
+
     def more_clicked(self, button, data=None):
         self.graphview.next_revision_batch(self.limit)
 
@@ -336,6 +343,8 @@
 
         self.filterbox.set_property('visible', self.show_filterbar)
         self.filterbox.set_no_show_all(True)
+        self.syncbox.set_property('visible', self.show_syncbar)
+        self.syncbox.set_no_show_all(True)
 
         for col in ('rev', 'date', 'id', 'branch', 'utc', 'age', 'tag'):
             if col in self.showcol:
@@ -365,6 +374,7 @@
         settings['glog-hpane'] = self.hpaned.get_position()
         settings['branch-color'] = self.graphview.get_property('branch-color')
         settings['show-filterbar'] = self.show_filterbar
+        settings['show-syncbar'] = self.show_syncbar
         settings['graphcol'] = self.graphcol
         settings['compactgraph'] = self.compactgraph
         for col in ('rev', 'date', 'id', 'branch', 'utc', 'age', 'tag'):
@@ -379,6 +389,7 @@
         self.setting_hpos = settings.get('glog-hpane', -1)
         self.branch_color = settings.get('branch-color', False)
         self.show_filterbar = settings.get('show-filterbar', True)
+        self.show_syncbar = settings.get('show-syncbar', True)
         self.graphcol = settings.get('graphcol', True)
         self.compactgraph = settings.get('compactgraph', False)
         self.showcol = {}
@@ -606,6 +617,55 @@
         self.tree.connect('thg-parent', self.thgparent)
         self.connect('thg-refresh', self.thgrefresh)
 
+        self.syncbox = gtk.HBox()
+        syncbox = self.syncbox
+
+        incoming = gtk.ToolButton(gtk.STOCK_GO_DOWN)
+        pull = gtk.ToolButton(gtk.STOCK_GOTO_BOTTOM)
+        outgoing = gtk.ToolButton(gtk.STOCK_GO_UP)
+        push = gtk.ToolButton(gtk.STOCK_GOTO_TOP)
+        syncbox.pack_start(incoming, False)
+        syncbox.pack_start(pull, False)
+        syncbox.pack_start(outgoing, False)
+        syncbox.pack_start(push, False)
+
+        ## target path combobox
+        urllist = gtk.ListStore(str, str)
+        urlcombo = gtk.ComboBoxEntry(urllist, 0)
+        cell = gtk.CellRendererText()
+        urlcombo.pack_end(cell, False)
+        urlcombo.add_attribute(cell, 'text', 1)
+        syncbox.pack_start(urlcombo, True, True, 2)
+
+        for alias, path in self.repo.ui.configitems('paths'):
+            path = url.hidepassword(path)
+            urllist.append([hglib.toutf(path), hglib.toutf(alias)])
+            if alias == 'default':
+                urlcombo.set_active(len(urllist)-1)
+
+        syncbox.pack_start(gtk.Label(_('After Pull:')), False, False, 2)
+        self.ppulldata = [('none', _('Nothing')), ('update', _('Update'))]
+        ppull = self.repo.ui.config('tortoisehg', 'postpull', 'none')
+        if 'fetch' in self.exs or 'fetch' == ppull:
+            self.ppulldata.append(('fetch', _('Fetch')))
+        if 'rebase' in self.exs or 'rebase' == ppull:
+            self.ppulldata.append(('rebase', _('Rebase')))
+
+        self.ppullcombo = gtk.combo_box_new_text()
+        ppullcombo = self.ppullcombo
+        for (index, (name, label)) in enumerate(self.ppulldata):
+            ppullcombo.insert_text(index, label)
+
+        for (index, (name, label)) in enumerate(self.ppulldata):
+            if ppull == name:
+                pos = index
+                break;
+        else:
+            pos = [index for (index, (name, label))
+                    in enumerate(self.ppulldata) if name == 'none'][0]
+        ppullcombo.set_active(pos)
+        syncbox.pack_start(ppullcombo, False, False, 2)
+
         self.filterbox = gtk.HBox()
         filterbox = self.filterbox
 
@@ -671,6 +731,7 @@
         filterbox.pack_start(entry, True)
 
         midpane = gtk.VBox()
+        midpane.pack_start(syncbox, False, False, 0)
         midpane.pack_start(filterbox, False, False, 0)
         midpane.pack_start(self.graphview, True, True, 0)
         midpane.show_all()

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to