commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r10007 - in trunk/gnue-forms/src: GFObjects uidrivers/curses/widg


From: reinhard
Subject: [gnue] r10007 - in trunk/gnue-forms/src: GFObjects uidrivers/curses/widgets uidrivers/gtk2/widgets uidrivers/html/widgets uidrivers/qt3/widgets uidrivers/qt4/widgets uidrivers/win32/widgets uidrivers/wx26/widgets
Date: Mon, 26 Oct 2009 16:19:20 -0500 (CDT)

Author: reinhard
Date: 2009-10-26 16:19:19 -0500 (Mon, 26 Oct 2009)
New Revision: 10007

Modified:
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/html/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/qt3/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/qt4/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
If a grid contains an entry of style "label", highlight the current record.
This makes it possible to use the grid much like a listbox with several
columns, except that the labels in the grid cannot receive the focus. Currently
only implemented for wx26.


Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2009-10-25 15:37:02 UTC (rev 
10006)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2009-10-26 21:19:19 UTC (rev 
10007)
@@ -261,6 +261,9 @@
                     # Set widgets to editable or non-editable
                     self.__update_editable(refresh_start)
 
+                # Let the marker for the current row in grids follow.
+                self.ui_set_current_row()
+
         finally:
             # If this was the currently focused widget, move the focus along
             if self._form.get_focus_object() is self:
@@ -415,7 +418,20 @@
 
         self.uiWidget._ui_focus_out_(self._visibleIndex)
 
+    # -------------------------------------------------------------------------
 
+    def ui_set_current_row(self):
+        """
+        Notify the UI widget about the row on screen containing the current
+        record.
+        """
+
+        if self.__current_row_enabled:
+            self.uiWidget._ui_set_current_row_(self._visibleIndex)
+        else:
+            self.uiWidget._ui_set_current_row_(-1)
+
+
 # =============================================================================
 # Base class for all widgets bound to a field
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py      2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py      2009-10-26 
21:19:19 UTC (rev 10007)
@@ -135,7 +135,13 @@
         self._call_widget_(index, '_ui_focus_out_')
         self.__focus_index = None
 
+    # -------------------------------------------------------------------------
 
+    def _ui_set_current_row_(self, index):
+        
+        pass
+
+
     # -------------------------------------------------------------------------
     # Set text for widget
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py        2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py        2009-10-26 
21:19:19 UTC (rev 10007)
@@ -218,7 +218,13 @@
       if isinstance (item, gtk.Entry):
         item.select_region (0,0)
 
+  # -------------------------------------------------------------------------
 
+  def _ui_set_current_row_(self, index):
+      
+    pass
+
+
   # ---------------------------------------------------------------------------
   # Set the value of a widget
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/_base.py        2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/_base.py        2009-10-26 
21:19:19 UTC (rev 10007)
@@ -149,7 +149,13 @@
         widget = self.widgets[index]
         assert gDebug (6, "Lose focus: %s" % widget)
 
+    # -------------------------------------------------------------------------
 
+    def _ui_set_current_row_(self, index):
+      
+        pass
+
+
     # 
---------------------------------------------------------------------------
     # Set the value of a widget
     # 
---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/_base.py 2009-10-25 15:37:02 UTC 
(rev 10006)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/_base.py 2009-10-26 21:19:19 UTC 
(rev 10007)
@@ -81,8 +81,14 @@
             label.show()
             widget.hide()
 
+    # -------------------------------------------------------------------------
 
+    def _ui_set_current_row_(self, index):
+      
+        pass
 
+
+
 # =============================================================================
 # Base class for H/V-Boxes in a managed layout
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/qt4/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt4/widgets/_base.py 2009-10-25 15:37:02 UTC 
(rev 10006)
+++ trunk/gnue-forms/src/uidrivers/qt4/widgets/_base.py 2009-10-26 21:19:19 UTC 
(rev 10007)
@@ -81,8 +81,14 @@
             label.show()
             widget.hide()
 
+    # -------------------------------------------------------------------------
 
+    def _ui_set_current_row_(self, index):
+      
+        pass
 
+
+
 # =============================================================================
 # Base class for H/V-Boxes in a managed layout
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2009-10-26 
21:19:19 UTC (rev 10007)
@@ -732,6 +732,9 @@
         # If we are in a grid, exchange entry widget with the label
         assert gDebug(6, "_ui_focus_out_ not implemented for win32 driver yet")
 
+    def _ui_set_current_row_(self, index):
+        pass
+
     def _ui_set_value_(self, index, value):
         widget = self.widgets[index]
         widget.SetValue(textEncode(value))

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2009-10-26 
21:19:19 UTC (rev 10007)
@@ -164,7 +164,13 @@
             widget._gnue_label_.Show()
             widget.GetContainingSizer().Layout()
 
+    # -------------------------------------------------------------------------
 
+    def _ui_set_current_row_(self, index):
+        
+        pass
+
+
     # -------------------------------------------------------------------------
     # Add a widget into a vertical box sizer
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2009-10-25 
15:37:02 UTC (rev 10006)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2009-10-26 
21:19:19 UTC (rev 10007)
@@ -69,6 +69,9 @@
         if self.in_grid:
             self.widget._gnue_label_ = self.label
 
+        self.__current_row = None
+        self.__current_row_color_save = None
+
         # We return the entry object here, since we will bind events to it
         # later
         return self.widget
@@ -632,6 +635,39 @@
 
 
     # -------------------------------------------------------------------------
+    # Mark the current row for label style entries
+    # -------------------------------------------------------------------------
+
+    def _ui_set_current_row_(self, index):
+        
+        # If we are a label in a grid, change the background color.
+        if self.in_grid and self._gfObject.style.lower() == 'label':
+            # Reset old current row to normal color.
+            if self.__current_row is not None:
+                widget = self.widgets[self.__current_row]
+                widget.SetForegroundColour(wx.NullColour)
+                widget._gnue_label_.SetForegroundColour(wx.NullColour)
+                widget.GetParent().SetBackgroundColour(
+                        self.__current_row_color_save)
+
+            # Set new current row to specific color.
+            if index == -1:
+                self.__current_row = None
+                self.__current_row_color_save = None
+            else:
+                self.__current_row = index
+                widget = self.widgets[index]
+                self.__current_row_color_save = \
+                        widget.GetParent().GetBackgroundColour()
+                widget.SetForegroundColour(
+                    wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))
+                widget._gnue_label_.SetForegroundColour(
+                    wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))
+                widget.GetParent().SetBackgroundColour(
+                    wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))
+
+
+    # -------------------------------------------------------------------------
     # Get the minimum size of a widget
     # -------------------------------------------------------------------------
 





reply via email to

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