commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r10051 - trunk/gnue-forms/src/uidrivers/wx26/widgets


From: reinhard
Subject: [gnue] r10051 - trunk/gnue-forms/src/uidrivers/wx26/widgets
Date: Tue, 24 Nov 2009 16:18:46 -0600 (CST)

Author: reinhard
Date: 2009-11-24 16:18:46 -0600 (Tue, 24 Nov 2009)
New Revision: 10051

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
Log:
Only make those widgets x-growable for which it really is useful.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2009-11-23 
09:49:21 UTC (rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2009-11-24 
22:18:46 UTC (rev 10051)
@@ -275,14 +275,20 @@
 
 
     # -------------------------------------------------------------------------
-    # Indicate whether this box is vertically growable
+    # Indicate whether this box is growable
     # -------------------------------------------------------------------------
 
-    def is_growable(self):
+    def can_grow_x(self):
 
         return False
 
+    # -------------------------------------------------------------------------
 
+    def can_grow_y(self):
+
+        return False
+
+
 # =============================================================================
 # Base class for managed boxes (vbox/hbox)
 # =============================================================================
@@ -401,6 +407,7 @@
 
         return False
 
+
     # -------------------------------------------------------------------------
     # Event-Handler
     # -------------------------------------------------------------------------
@@ -413,3 +420,24 @@
             block.next_record()
         else:
             block.prev_record()
+
+
+    # -------------------------------------------------------------------------
+    # Indicate whether this box is growable
+    # -------------------------------------------------------------------------
+
+    def can_grow_x(self):
+
+        for child in self._children:
+            if child.can_grow_x():
+                return True
+        return False
+
+    # -------------------------------------------------------------------------
+
+    def can_grow_y(self):
+
+        for child in self._children:
+            if child.can_grow_y():
+                return True
+        return False

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2009-11-23 09:49:21 UTC 
(rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2009-11-24 22:18:46 UTC 
(rev 10051)
@@ -113,7 +113,7 @@
         item = ui_widget.widget
         flags = wx.EXPAND
 
-        if not ui_widget.is_growable():
+        if not ui_widget.can_grow_y():
             box = wx.BoxSizer(wx.HORIZONTAL)
             box.Add(item, 1, wx.ALIGN_CENTER_VERTICAL)
             item = box

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2009-11-23 
09:49:21 UTC (rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2009-11-24 
22:18:46 UTC (rev 10051)
@@ -796,11 +796,24 @@
 
 
     # -------------------------------------------------------------------------
-    # Indicate whether this box is vertically growable
+    # Indicate whether this widget is growable
     # -------------------------------------------------------------------------
 
-    def is_growable(self):
+    def can_grow_x(self):
 
+        # Multiline entries are always growable.
+        if self._gfObject.style.lower() == 'multiline':
+            return True
+
+        if self.get_field_length() > 32:
+            return True
+
+        return False
+
+    # -------------------------------------------------------------------------
+
+    def can_grow_y(self):
+
         return (self._gfObject.style.lower() in ['multiline', 'listbox'])
 
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2009-11-23 09:49:21 UTC 
(rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2009-11-24 22:18:46 UTC 
(rev 10051)
@@ -306,11 +306,17 @@
     # Indicate whether this box is vertically growable
     # -------------------------------------------------------------------------
 
-    def is_growable(self):
+    def can_grow_x(self):
 
         return True
 
+    # -------------------------------------------------------------------------
 
+    def can_grow_y(self):
+
+        return True
+
+
 # =============================================================================
 # Configuration data
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py 2009-11-23 09:49:21 UTC 
(rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py 2009-11-24 22:18:46 UTC 
(rev 10051)
@@ -70,7 +70,7 @@
 
             item = ui_widget.widget
 
-            if ui_widget.is_growable():
+            if ui_widget.can_grow_y():
                 # For (vertically) growable widgets, let them expand.
                 flags = wx.EXPAND
             elif self._gfObject.has_label:
@@ -98,30 +98,12 @@
 
             self._sizer.Add(item, pos, span, flags)
 
-        # Only columns having a stretch greater than zero require a growable
-        # column.  Setting a stretch of 0 breaks the size calculation anyway.
-        if add and ui_widget.stretch:
-            # FIXME: If a stretch factor is used, the *whole* newly calculated
-            # size is distributed according to this stretch factor, instead of
-            # only the extra space.
-            # self._sizer.AddGrowableCol(self.last_item, ui_widget.stretch)
+        if add and ui_widget.can_grow_x():
             self._sizer.AddGrowableCol(self.last_item)
 
         self.last_item += add
 
 
-    # -------------------------------------------------------------------------
-    # Indicate whether this box is vertically growable
-    # -------------------------------------------------------------------------
-
-    def is_growable(self):
-
-        for child in self._children:
-            if child.is_growable():
-                return True
-        return False
-
-
 # =============================================================================
 # Configuration data
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py 2009-11-23 09:49:21 UTC 
(rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py 2009-11-24 22:18:46 UTC 
(rev 10051)
@@ -112,10 +112,10 @@
         if self.managed:
             # The border between the edge of the page and the nearest control
             # is 12 pixel according to GNOME Human Interface Guidlines.
-            sizer.Add(item, ui_widget.stretch, wx.EXPAND | wx.ALL, 12)
+            sizer.Add(item, 1, wx.EXPAND | wx.ALL, 12)
         else:
             flags = wx.ALIGN_CENTER | wx.EXPAND
-            if not ui_widget.is_growable():
+            if not ui_widget.can_grow_y():
                 box = wx.BoxSizer(wx.HORIZONTAL)
                 box.Add(item, 1, wx.ALIGN_CENTER_VERTICAL)
                 item = box

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py    2009-11-23 
09:49:21 UTC (rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py    2009-11-24 
22:18:46 UTC (rev 10051)
@@ -94,7 +94,7 @@
     # Indicate whether this widget is vertically growable
     # -------------------------------------------------------------------------
 
-    def is_growable(self):
+    def can_grow_y(self):
 
         return True
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2009-11-23 09:49:21 UTC 
(rev 10050)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2009-11-24 22:18:46 UTC 
(rev 10051)
@@ -62,7 +62,7 @@
             add = True
             # For growable widgets (like listboxes and multiline entries), it
             # looks better if the label is aligned to the top.
-            if ui_widget.is_growable():
+            if ui_widget.can_grow_y():
                 flags = wx.ALIGN_TOP
             else:
                 flags = wx.ALIGN_CENTER_VERTICAL
@@ -72,7 +72,7 @@
             add = True
             if isinstance(ui_widget, button.UIButton):
                 item = self.add_to_hbox(ui_widget.widget)
-                item = ui_widget.widget
+                #item = ui_widget.widget
             else:
                 item = ui_widget.widget
 
@@ -94,7 +94,7 @@
             else:
                 self._sizer.Add(item, pos, span, wx.EXPAND)
 
-        if add and ui_widget.is_growable():
+        if add and ui_widget.can_grow_y():
             # FIXME: If a stretch factor is used, the *whole* newly calculated
             # size is distributed according to this stretch factor, instead of
             # only the extra space.
@@ -104,18 +104,6 @@
         self.last_item += add
 
 
-    # -------------------------------------------------------------------------
-    # Indicate whether this box is vertically growable
-    # -------------------------------------------------------------------------
-
-    def is_growable(self):
-
-        for child in self._children:
-            if child.is_growable():
-                return True
-        return False
-
-
 # =============================================================================
 # Configuration data
 # =============================================================================





reply via email to

[Prev in Thread] Current Thread [Next in Thread]