commit-gnue
[Top][All Lists]
Advanced

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

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


From: johannes
Subject: [gnue] r8780 - trunk/gnue-forms/src/uidrivers/qt3/widgets
Date: Fri, 13 Oct 2006 04:29:51 -0500 (CDT)

Author: johannes
Date: 2006-10-13 04:29:50 -0500 (Fri, 13 Oct 2006)
New Revision: 8780

Modified:
   trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py
Log:
Added ListBox widgets


Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py 2006-10-13 08:37:47 UTC 
(rev 8779)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/entry.py 2006-10-13 09:29:50 UTC 
(rev 8780)
@@ -97,7 +97,14 @@
         result = ComboBox(parent, self)
         return (None, result)
 
+    # -------------------------------------------------------------------------
 
+    def __build_listbox(self, parent):
+
+        result = ListBox(parent, self)
+        return (None, result)
+
+
     # -------------------------------------------------------------------------
     # Enable/disable this entry
     # -------------------------------------------------------------------------
@@ -460,7 +467,58 @@
         self.setCurrentText(value)
 
 
+# =============================================================================
+# Listbox widgets
+# =============================================================================
 
+class ListBox(ChoiceEntry, qt.QListBox):
+    """
+    Listbox widgets
+    """
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, parent, ui_widget):
+
+        qt.QListBox.__init__(self, parent)
+        ChoiceEntry.__init__(self, ui_widget, qt.QListBox)
+        self.update_choices()
+
+        self.connect(self, qt.SIGNAL('highlighted(int)'), 
self.__on_highlighted)
+
+
+    # -------------------------------------------------------------------------
+    # Event-Handler
+    # -------------------------------------------------------------------------
+
+    def __on_highlighted(self, index):
+        self.ui_widget._request('REPLACEVALUE',
+                text=unicode(self.currentText()))
+
+
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
+
+    def _clear_(self):
+        self.clear()
+
+    # -------------------------------------------------------------------------
+
+    def _append_(self, key, description):
+        self.insertItem(description)
+
+    # -------------------------------------------------------------------------
+
+    def _ui_set_value_(self, value):
+        self.update_choices()
+        self.setCurrentItem(self.findItem(value))
+
+
+
+
 # =============================================================================
 # Keymapper configuration: Translate from QT to our virtual keystrokes
 # =============================================================================





reply via email to

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