commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8809 - trunk/gnue-forms/src/uidrivers/qt3/widgets


From: johannes
Subject: [gnue] r8809 - trunk/gnue-forms/src/uidrivers/qt3/widgets
Date: Tue, 17 Oct 2006 04:33:47 -0500 (CDT)

Author: johannes
Date: 2006-10-17 04:33:47 -0500 (Tue, 17 Oct 2006)
New Revision: 8809

Modified:
   trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py
Log:
Keep in sync with the GF-focus


Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py 2006-10-17 09:25:01 UTC 
(rev 8808)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py 2006-10-17 09:33:47 UTC 
(rev 8809)
@@ -210,27 +210,40 @@
             # implemented by the class of this Mixin ?
             self.qt_class.keyPressEvent(self, event)
 
+
     # -------------------------------------------------------------------------
+    # Keep the GF-Focus in sync
+    # -------------------------------------------------------------------------
 
-    def mousePressEvent(self, event):
+    def focusInEvent(self, event):
         """
+        Keep the GF-Focus in sync with the QT3-focus
         """
 
         gf_object = self.ui_widget._gfObject
+        do_focus = gf_object._form._currentEntry != gf_object
 
         count = self.ui_widget.widgets.index(self)
         adjust = count - gf_object._visibleIndex
-        do_focus = gf_object._form._currentEntry != gf_object
-        
-        if do_focus:
-            self.ui_widget._request('FOCUS', data = self.ui_widget._gfObject)
 
+        if do_focus or adjust:
+            self.__focus_worker(do_focus, adjust)
+
+        self.qt_class.focusInEvent(self, event)
+
+
+    def __focus_worker(self, change_focus, adjust):
+
+        if change_focus:
+            try:
+                self._block_focus = True
+                self.ui_widget._request('FOCUS', data=self.ui_widget._gfObject)
+            finally:
+                self._block_focus = False
+
         if adjust:
-            self.ui_widget._request('JUMPRECORD', data = adjust)
+            self.ui_widget._request('JUMPRECORD', data=adjust)
 
-        if not do_focus:
-            self.qt_class.mousePressEvent(self, event)
-            # TODO: update the insertion point after moving the cursor
 
 
 





reply via email to

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