changeset 225:f958ce12ba5a

Implement an own ListWalker class Allow to handle focus changed via a callback method in the widget class.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 05 Apr 2013 20:14:20 +0200 (2013-04-05)
parents c8f85809607b
children f8571308abef
files getan/walker.py
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getan/walker.py	Fri Apr 05 20:14:20 2013 +0200
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+#
+# (c) 2013 by Björn Ricks <bjoern.ricks@intevation.de>
+#
+# This is Free Software licensed under the terms of GPLv3 or later.
+# For details see LICENSE coming with the source of 'getan'.
+#
+import logging
+
+import urwid
+
+
+logger = logging.getLogger(__name__)
+
+class ListWalker(urwid.SimpleListWalker):
+
+    def __init__(self, content, widget=None):
+        logger.info("Init ListWalker")
+        super(ListWalker, self).__init__(content)
+        self.widget = widget
+        self.position = None
+
+    def set_focus(self, position):
+        super(ListWalker, self).set_focus(position)
+        if self.widget and self.position != position:
+            self.position = position
+            self.widget.content_focus_changed()
+
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)