# HG changeset patch
# User Adrian Buehlmann <adr...@cadifra.com>
# Date 1252346065 -7200
# Node ID 00fece8a505e953a2b1b5737f3be75016ae0e7dc
# Parent  2f94a4b0f9757dee019db0d6e66e3414774f7cb8
commit: Move parent frame to bottom of dialog

Since we now have an "advanced" frame, this IMHO looks a bit nicer.

Having the diff above the parents frame also fits with the mental model
of "the change is based on the parent revision(s)". Having status info
in (or at least near) the status bar is a good fit as well.

Maybe the M,R,?,I,A,!,C checkboxes should be moved to above the parent
frame next.

This patch additionally needs to tweak the toggle_view function, as
that function seems to get called before the parents_frame has been set
up (which lead to a traceback [1]). Luckily, this always happens in a
toggle_view call where there isn't any state change at all, so let's
just filter out non-state-change "toggles".

[1] AttributeError: 'GCommit' object has no attribute 'parents_frame'

diff --git a/hggtk/commit.py b/hggtk/commit.py
--- a/hggtk/commit.py
+++ b/hggtk/commit.py
@@ -298,20 +298,6 @@ class GCommit(GStatus):
         scroller.add(self.text)
         gtklib.addspellcheck(self.text, self.repo.ui)
 
-        self.parents_frame = gtk.Frame(_('Parent'))
-        parents_vbox = gtk.VBox(spacing=2)
-        self.parents_frame.add(parents_vbox)
-        def plabel():
-            w = gtk.Label()
-            w.set_selectable(True)
-            hb = gtk.HBox()
-            hb.pack_start(w, False, False, 4)
-            parents_vbox.pack_start(hb, False, False)
-            return w
-        self.parent1_label = plabel()
-        self.parent2_label = plabel()
-        vbox.pack_start(self.parents_frame, False, False)
-
         self.advanced_frame = gtk.Frame(_('Advanced'))
         adv_hbox = gtk.HBox(spacing=2)
         adv_hbox.pack_start(gtk.Label(_('Comitter:')), False, False, 2)
@@ -327,9 +313,26 @@ class GCommit(GStatus):
 
         self.vmenu.set_menu(self.view_menu())
 
+        vbox2 = gtk.VBox()
+        vbox2.pack_start(status_body)
+
+        self.parents_frame = gtk.Frame(_('Parent'))
+        parents_vbox = gtk.VBox(spacing=2)
+        self.parents_frame.add(parents_vbox)
+        def plabel():
+            w = gtk.Label()
+            w.set_selectable(True)
+            hb = gtk.HBox()
+            hb.pack_start(w, False, False, 4)
+            parents_vbox.pack_start(hb, False, False)
+            return w
+        self.parent1_label = plabel()
+        self.parent2_label = plabel()
+        vbox2.pack_start(self.parents_frame, False, False)
+
         self.vpaned = gtk.VPaned()
         self.vpaned.pack1(vbox, shrink=False)
-        self.vpaned.pack2(status_body, shrink=False)
+        self.vpaned.pack2(vbox2, shrink=False)
         gobject.idle_add(self.realize_settings)
         return self.vpaned
 
@@ -354,18 +357,21 @@ class GCommit(GStatus):
         return menu
 
     def toggle_view(self, button, type):
+        show = button.get_active()
+        fr = None
         if type == 'parents':
-            self.showparents = button.get_active()
-            if self.showparents:
-                self.parents_frame.show()
+            if self.showparents != show:
+                self.showparents = show
+                fr = self.parents_frame
+        elif type == 'advanced':
+            if self.showadvanced != show:
+                self.showadvanced = show
+                fr = self.advanced_frame
+        if fr is not None:
+            if show:
+                fr.show()
             else:
-                self.parents_frame.hide()
-        elif type == 'advanced':
-            self.showadvanced = button.get_active()
-            if self.showadvanced:
-                self.advanced_frame.show()
-            else:
-                self.advanced_frame.hide()
+                fr.hide()
 
     def changed_cb(self, combobox):
         model = combobox.get_model()

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to