[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9173 - trunk/gnue-forms/src/uidrivers/curses/widgets
From: |
johannes |
Subject: |
[gnue] r9173 - trunk/gnue-forms/src/uidrivers/curses/widgets |
Date: |
Tue, 19 Dec 2006 02:44:53 -0600 (CST) |
Author: johannes
Date: 2006-12-19 02:44:52 -0600 (Tue, 19 Dec 2006)
New Revision: 9173
Modified:
trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py
trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
Log:
Proper restoring of cursor positions and selections
Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py 2006-12-18
15:28:49 UTC (rev 9172)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/_base.py 2006-12-19
08:44:52 UTC (rev 9173)
@@ -50,6 +50,8 @@
self.left = 0
self.width = 0
self.height = 0
+ self.last_position = None
+ self.last_selection = None
# -------------------------------------------------------------------------
@@ -107,6 +109,15 @@
self._uiDriver._focus_widget = self
self.__focus_index = index
+
+ # If there was a cursor position and a selection set while the ui was
+ # not ready for painting, restore to that position/selection before
+ # moving the focus
+ if self.last_position is not None:
+ self._ui_set_cursor_position_(index, self.last_position)
+ if self.last_selection is not None:
+ self._ui_set_selected_area_(index, *self.last_selection)
+
self._call_widget_(index, '_ui_set_focus_')
# -------------------------------------------------------------------------
@@ -178,8 +189,6 @@
UIWidget._fkeypress(self, key, shift, ctrl, meta)
-
-
# -------------------------------------------------------------------------
# Get the minimum size of a widget
# -------------------------------------------------------------------------
Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2006-12-18
15:28:49 UTC (rev 9172)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2006-12-19
08:44:52 UTC (rev 9173)
@@ -49,7 +49,6 @@
if not build:
build = self.__build_default
- gDebug(2, "building ENTRY: %s (%s)" % (spacer, self._gfObject.name))
(self.label, self.widget) = build(spacer * (self._gfObject._gap + 1))
return self.widget
@@ -145,7 +144,13 @@
def _ui_set_cursor_position_(self, index, position):
- self._call_widget_(index, '_ui_set_cursor_position_', position)
+ # If the UI is not ready for painting, remember the requested position
+ # for later restoring
+ if not self.ready():
+ self.last_position = position
+ else:
+ self.last_position = None
+ self._call_widget_(index, '_ui_set_cursor_position_', position)
# -------------------------------------------------------------------------
@@ -154,7 +159,13 @@
def _ui_set_selected_area_(self, index, selection1, selection2):
- self._call_widget_(index, '_ui_set_selected_area_', selection1,
+ # If the UI is not ready for painting, remember the requested selection
+ # for later restoring
+ if not self.ready():
+ self.last_selection = (selection1, selection2)
+ else:
+ self.last_selection = None
+ self._call_widget_(index, '_ui_set_selected_area_', selection1,
selection2)
# -------------------------------------------------------------------------
@@ -165,7 +176,7 @@
self._call_widget_(index, '_ui_cut_')
- # -------------------------------------------------------------------------
+# -------------------------------------------------------------------------
def _ui_copy_(self, index):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9173 - trunk/gnue-forms/src/uidrivers/curses/widgets,
johannes <=