commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8700 - trunk/gnue-forms/src/uidrivers/qt3


From: johannes
Subject: [gnue] r8700 - trunk/gnue-forms/src/uidrivers/qt3
Date: Tue, 26 Sep 2006 08:53:32 -0500 (CDT)

Author: johannes
Date: 2006-09-26 08:53:31 -0500 (Tue, 26 Sep 2006)
New Revision: 8700

Modified:
   trunk/gnue-forms/src/uidrivers/qt3/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/qt3/dialogs.py
Log:
Implemented the versatile input dialog as well as the LoginHandler


Modified: trunk/gnue-forms/src/uidrivers/qt3/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/UILoginHandler.py        2006-09-26 
09:35:35 UTC (rev 8699)
+++ trunk/gnue-forms/src/uidrivers/qt3/UILoginHandler.py        2006-09-26 
13:53:31 UTC (rev 8700)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - QT 3 UI Driver - Login Handler
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2005 Free Software Foundation
 #
+# This file is part of GNU Enterprise
+#
 # GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
 # License as published by the Free Software Foundation; either
@@ -16,235 +19,58 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# UIwxpython.py
-#
-# DESCRIPTION:
-# A QT based user interface driver for GNUe forms.
-#
-# NOTES:
-#
+# $Id$
 
-import string, os
+import os.path
 
-from qt import *
-
 from gnue.common.datasources import GLoginHandler
-from gnue.common.apps import GConfig
-from QTApp import *
+from gnue.common.apps import GConfig, i18n
+from gnue.forms.uidrivers.qt3 import dialogs, QTApp
 
-# Shortcut
-images_dir = GConfig.getInstalledBase('forms_images','common_images') + '/'
 
+# =============================================================================
+# This class implements a login handler for QT3
+# =============================================================================
 
-#####################################################################
-##
-## Login Support
-##
-## Everything below this point is in support of the wx drivers
-## UILoginHandler
-##  
-#####################################################################
-
-#
-# UILoginHandler
-#
 class UILoginHandler(GLoginHandler.LoginHandler):
-  def __init__(self, qtApp = None):
-    if qtApp is None:
-      self._qtapp = getQtApp()
-    self.dlg = None
+    """
+    Implementation of a LoginHandler for QT3
+    """
 
-  def getLogin(self, loginData, errortext=None):
-      if len(loginData[1]):
-        loginMesg = _('Login required for\n"%s"') % (loginData[1])
-      else:
-        loginMesg = _('Login required for %s') % (loginData[0])
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-      self.dlg = QDialog(None, _("GNU Enterprise: Login to %s") % 
loginData[0], 1)
-      self.dlg.setCaption ( _("GNU Enterprise: Login to %s") % loginData[0])
+    def __init__(self):
 
-      if os.path.isabs(gConfigForms('loginPNG')):
-        imageFile = gConfigForms('loginPNG')
-      else:
-        imageFile = images_dir+gConfigForms('loginPNG')
+        # Make sure to have an application instance available
+        self.app = QTApp.getQtApp()
 
-      bmp = QPixmap(imageFile)
-      messageField = WrappedStaticText(self.dlg, str(loginMesg), 300)
+    
+    # -------------------------------------------------------------------------
+    # Override virtual methods
+    # -------------------------------------------------------------------------
 
-      self.textctrlList = []
-      labelList = []
+    def _askLogin_(self, title, fields):
 
-      dlgWidth = max(bmp.width(), messageField.width()+20)
+        lfields = fields [:]
+        if lfields [0][2] != 'image':
+            imageFile = gConfigForms('loginPNG')
+            if not os.path.exists (imageFile):
+                imageFile = os.path.join (os.path.normpath ( \
+                    GConfig.getInstalledBase ('forms_images', 
'common_images')),
+                    gConfigForms ('loginPNG'))
 
-      dlgHeight = bmp.height() + messageField.height() + 80
+            if os.path.exists (imageFile):
+                lfields.insert (0, (None, imageFile, 'image', None, None, []))
 
-      xSpacing = 0
-      ySpacing = 0
-      fieldLabelWidth = 0
-
-      for prompt in loginData[2]:
-        s = QLabel('%s:' % prompt[1], self.dlg)
-        labelList.append(s)
-        t = QLineEdit(self.dlg)
-        t.setFixedWidth(150)
-        if prompt[2]:
-          t.setEchoMode(QLineEdit.Password)
-
-        myID = len(self.textctrlList)
-        self.textctrlList.append(t)
-##        EVT_CHAR(t, LoginFieldHandler(self, myID).loginFieldEventTrap)
-
-        fieldLabelWidth = max(fieldLabelWidth,
-                  s.width() + t.width() + 10)
-
-        dlgWidth = max(dlgWidth, \
-                       s.width() + t.width() + 20)
-
-        xSpacing = max(xSpacing, s.width())
-        ySpacing = max(ySpacing, s.height())
-        ySpacing = max(ySpacing, t.height())
-
-
-##      loginId = wxNewId()
-##      cancelId = wxNewId()
-
-      loginButton = QPushButton(self.dlg)
-      loginButton.setText(_('Login'))
-      loginButton.show()
-      cancelButton = QPushButton(self.dlg)
-      cancelButton.setText(_('Cancel'))
-      cancelButton.show()
-
-      QObject.connect(loginButton, SIGNAL("clicked()"),
-                     self.loginButtonEventTrap)
-      QObject.connect(cancelButton, SIGNAL("clicked()"),
-                     self.loginCancelEventTrap)
-      
-      dlgWidth = max(dlgWidth, loginButton.width() +
-                            cancelButton.width() + 6) + 20
-
-      dlgHeight += max(loginButton.height(),
-                       cancelButton.height()) - 6
-
-      if errortext:
-        errorField = WrappedStaticText(self.dlg, str(errortext), 300)
-##        errorField.SetForegroundColour(wxColour(223,0,0))
-
-        dlgWidth = max(dlgWidth, errorField.width()+10)
-        dlgHeight += errorField.height() + 6
-
-
-      firstY = bmp.height() + messageField.height() + 50
-      lastY = firstY
-      xSpacing += 10   # Add whitespace between widgets
-      ySpacing += 6    # Add whitespace between widgets
-      xPos = dlgWidth/2 - fieldLabelWidth/2
-
-
-      # Move the fields and labels into position
-      for i in range(0, len(self.textctrlList)):
-        dlgHeight = dlgHeight + ySpacing
-        labelList[i].move(xPos, lastY)
-        self.textctrlList[i].move(xPos + xSpacing, lastY)
-        lastY = lastY + ySpacing
-        self.textctrlList[i].show()
-        
-      if errortext:
-        errorField.move(
-          dlgWidth/2 - errorField.width()/2,
-                lastY+3)
-
-      # Set the focus to the first text entry field
-      self.textctrlList[0].setFocus()
-
-      # Create and position the logo
-      img = QLabel(self.dlg)
-      img.setFrameRect(QRect(dlgWidth-bmp.width()/2, 12, bmp.width(), 
bmp.height()))
-      img.setPixmap(bmp)
-      
-      img.show()
-
-      # Move the various widgets into position
-      messageField.move(
-        dlgWidth/2 - messageField.width()/2,
-                30 + bmp.height())
-
-      cancelButton.move(
-         dlgWidth - 10 - cancelButton.width(),
-                dlgHeight - 10 - max(loginButton.height(),
-                                            cancelButton.height()))
-
-      loginButton.move(
-        dlgWidth - 16 - cancelButton.width() - \
-                loginButton.width(),
-                dlgHeight - 10 - max(loginButton.height(),
-                                            cancelButton.height()))
-
-      self.loginButton = loginButton
-
-      self.dlg.setFixedSize(dlgWidth, dlgHeight)
-
-      # If user cancels, this will be set to 0
-      self._accept = 0
-      completed = self.dlg.exec_loop()
-
-      if completed == QDialog.Rejected:
-        raise GLoginHandler.UserCanceledLogin
-
-      rv = {}
-      for i in range(0, len(loginData[2])):
-        rv[loginData[2][i][0]] = unicode(self.textctrlList[i].text())
-
-      return rv
-
-
-  #
-  # Called when user clicks "login"
-  #
-  def loginButtonEventTrap(self):
-    self.dlg.accept()
-
-  #
-  # Called when user clicks "cancel"
-  #
-  def loginCancelEventTrap(self):
-    self.dlg.reject()
-
-  #
-  # TODO: This is a hack required because windows
-  # TODO: seems to have issues with wxWidgets dialogs
-  #
-  def destroyLoginDialog(self):
-    self.dlg.hide()
-
-
+        dialog = dialogs.InputDialog(title, lfields)
     
-    
-class WrappedStaticText(QLabel):
-  def __init__(self, parent, label, width):
-    QLabel.__init__(self, label, parent)
+        try:
+          dialog.exec_loop()
+          result = dialog.inputData
 
-##    QLabel.setFixedWidth(width)
+        finally:
+          del dialog
 
-    textSoFar = ""
-    thisLine = ""
-    for part in string.split(label,'\n'):
-      for word in string.split(part):
-        self.setText(thisLine + word)
-        if self.width() > width:
-          textSoFar += thisLine + " \n"
-          thisLine = word + " "
-        else:
-          thisLine += word + " "
-
-      textSoFar += thisLine + " \n"
-      thisLine = ""
-
-    if len(textSoFar):
-      self.setText(string.replace(textSoFar,' \n','\n')[:-1])
-    else:
-      self.setText("")
-
+        return result


Property changes on: trunk/gnue-forms/src/uidrivers/qt3/UILoginHandler.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/uidrivers/qt3/dialogs.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/dialogs.py       2006-09-26 09:35:35 UTC 
(rev 8699)
+++ trunk/gnue-forms/src/uidrivers/qt3/dialogs.py       2006-09-26 13:53:31 UTC 
(rev 8700)
@@ -25,8 +25,9 @@
 """
 
 import qt
+import gnue
 
-__all__ = ['ExceptionDialog']
+__all__ = ['ExceptionDialog', 'InputDialog']
 
 # =============================================================================
 # Exception display dialog
@@ -38,9 +39,9 @@
     available via a detail button.
     """
 
-    _TITLE = {'system'     : _("GNUe Internal System Error"),
-              'admin'      : _("GNUe Unexpected Error"),
-              'application': _("GNUe Application Error")}
+    _TITLE = {'system'     : u_("GNUe Internal System Error"),
+              'admin'      : u_("GNUe Unexpected Error"),
+              'application': u_("GNUe Application Error")}
 
     _FORMAT = {
        'system': u_("An unexpected internal error has occured:\n%s.\n"
@@ -113,3 +114,455 @@
             self.det.setText (u_('>> Detail'))
 
         self.showExtension(view)
+
+
+# =============================================================================
+# LineEdit widget for InputDialog
+# =============================================================================
+
+class IDLineEdit(qt.QLineEdit):
+    """
+    LineEdit control for InputDialogs which automatically updates the input
+    data dictionary on changes of the text.
+
+    Signals:
+
+    on_enter(QWidget): Emitted when the Enter/Return key was hit
+    """
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, name, default, elements, password, ddict, parent):
+
+        qt.QLineEdit.__init__(self, default or '', parent, name)
+
+        if password:
+            self.setEchoMode(qt.QLineEdit.Password)
+
+        if elements and elements [0][0]:
+            qt.QToolTip.add(self, elements[0][0])
+
+        self.ddict = ddict
+        self.ddict[name] = default or ''
+
+        self.connect(self, qt.SIGNAL('textChanged(const QString &)'),
+                self.__on_text_change)
+        self.connect(self, qt.SIGNAL('returnPressed()'),
+                self.__on_return_pressed)
+
+    # -------------------------------------------------------------------------
+    # Event Slots
+    # -------------------------------------------------------------------------
+
+    def __on_text_change(self, text):
+        self.ddict[self.name()] = unicode(text)
+
+    # -------------------------------------------------------------------------
+
+    def __on_return_pressed(self):
+        self.emit(qt.PYSIGNAL('on_enter(QWidget)'), (self,))
+
+
+# =============================================================================
+# Combobox Widget for InputDialog
+# =============================================================================
+
+class IDComboBox(qt.QComboBox):
+    """
+    A ComboBox Widget for InputDialogs.
+
+    Such a ComboBox automatically manages the allowed values as defined by the
+    input data dictionary.
+
+    Signals:
+
+    on_enter(QWidget):  Emitted when Enter/Return-Key was hit
+    update_depending(QWidget, int): Emitted when a value has been selected.
+        The int argument is the index of the selected value.
+    """
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, name, master, allowed, default, tip, ddict, parent):
+
+        qt.QComboBox.__init__(self, False, parent, name)
+
+        self.ddict = ddict
+        self._master  = master
+        self._allowed = allowed
+        self._default = default
+        self._keys = []
+
+        if tip:
+            qt.QToolTip.add(self, tip)
+
+        self.connect(self, qt.SIGNAL('activated(int)'), self.__on_selected)
+
+        self.update_widget()
+
+
+    # -------------------------------------------------------------------------
+    # Rebuild the contents of the combobox
+    # -------------------------------------------------------------------------
+
+    def update_widget(self):
+        """
+        Reset the allowed values of the ComboBox depending on the master-value
+        or (if no master is available) the predefined allowed values.
+        """
+
+        name = self.name()
+        self.clear()
+
+        if self._master:
+            values = self._allowed.get(self.ddict.get(self._master), {})
+        else:
+            values = self._allowed
+
+        if values:
+            self._keys = []
+            for (k, v) in values.items():
+                self._keys.append(k)
+                self.insertItem(v)
+
+            if self._default in values:
+                self.setCurrentItem(self._keys.index(self._default))
+                self.ddict[name] = self._default
+            else:
+                self.ddict[name] = self._keys[0]
+                self.setCurrentItem(0)
+
+        else:
+            if name in self.ddict:
+                del self.ddict[name]
+
+        self.setEnabled(len(values) > 0)
+
+
+    # -------------------------------------------------------------------------
+    # Event-Handlers
+    # -------------------------------------------------------------------------
+
+    def keyPressEvent(self, event):
+        """
+        If the Enter- or Return-Key is pressed the KeyEvent is consumed and an
+        on_enter signal is emitted.
+        """
+        if event.key() in [qt.Qt.Key_Return, qt.Qt.Key_Enter]:
+            self.emit(qt.PYSIGNAL('on_enter(QWidget)'), (self,))
+        else:
+            qt.QComboBox.keyPressEvent(self, event)
+
+
+    # -------------------------------------------------------------------------
+    # Slots
+    # -------------------------------------------------------------------------
+
+    def __on_selected(self, index):
+
+        new = self._keys[index]
+        self.ddict[self.name()] = new
+        self.emit(qt.PYSIGNAL('update_depending(QWidget, int)'), (self,index))
+
+
+
+# =============================================================================
+# Class implementing a versatile input dialog
+# =============================================================================
+
+class InputDialog (qt.QDialog):
+    """
+    Dialog class prompting the user for a given number of fields. These field
+    definitions are specified as follows:
+
+    A field definition is a tuple having these elements:
+    - fieldlabel: This text will be used as label in the left column
+    - fieldname: This is the key in the result-dictionary to contain the value
+        entered by the user
+    - fieldtype: Currently these types are supported:
+        - label: The contents of 'fieldlabel' as static text
+        - warning: The contents of 'fieldlabel' as static text, formatted as
+            warning
+        - string: A text entry control
+        - password: A text entry control with obscured characters
+        - dropdown: Foreach element given in 'elements' a separate ComboBox
+            control will be created, where each one has it's own dictionary of
+            allowed values. If a value is selected in one control, all others
+            are synchronized to represent the same key-value.
+    - default: Default value to use
+    - masterfield: Used for 'dropdowns'. This item specifies another field
+        definition acting as master field. If this master field is changed, the
+        allowedValues of this dropdown will be changed accordingly. If a
+        masterfield is specified the 'allowedValues' dictionaries are built
+        like {master1: {key: value, key: value, ...}, master2: {key: value,
+        ...}}
+    - elements: sequence of input element tuples (label, allowedValues). This
+        is used for dropdowns only. 'label' will be used as ToolTip for the
+        control and 'allowedValues' gives a dictionary with all valid keys to
+        be selected in the dropdown.
+
+    @return: If closed by 'Ok' the result is a dictionary with all values
+        entered by the user, where the "fieldname"s will be used as keys. If
+        the user has not selected a value from a dropdown (i.e. it has no
+        values to select) there will be no such key in the result dictionary.
+        If the dialog is canceled ('Cancel'-Button) the result will be None.
+    """
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__ (self, title, fields, cancel = True):
+        """
+        Create a new input dialog
+
+        @param title: Dialog title
+        @param fields: sequence of field definition tuples
+        @param cancel: If True add a Cancel button to the dialog
+        """
+
+        qt.QDialog.__init__ (self)
+
+        self.setCaption(title)
+        self.setIcon(qt.QMessageBox.standardIcon(qt.QMessageBox.Question))
+
+        self.top_sizer = qt.QVBoxLayout(self, 8)
+
+        self.grid = qt.QGridLayout()
+        bbox = qt.QHBoxLayout()
+        bbox.addStretch(1)
+
+        self.top_sizer.addLayout(self.grid)
+
+        sep = qt.QFrame(self, "separatorline")
+        sep.setFrameStyle(qt.QFrame.HLine | qt.QFrame.Sunken)
+        self.top_sizer.addWidget(sep)
+
+        self.top_sizer.addLayout(bbox)
+
+        cancel = qt.QPushButton(u_('Cancel'), self)
+        cancel.setDefault(False)
+        cancel.setAutoDefault(False)
+        self.connect(cancel, qt.SIGNAL('clicked()'), self.reject)
+        bbox.addWidget(cancel)
+
+        ok = qt.QPushButton(u_('Ok'), self)
+        ok.setDefault(False)
+        ok.setAutoDefault(False)
+        self.connect(ok, qt.SIGNAL('clicked()'), qt.SLOT('accept()'))
+        bbox.addWidget(ok)
+
+        self.inputData   = {}
+        self.__dropdowns = {}
+        self.__entries = []
+
+        row = 0
+        for (label, name, fieldtype, default, master, elements) in fields:
+            ftp = fieldtype.lower()
+
+            if ftp in ['label', 'warning']:
+                self.__addText(row, label, ftp == 'warning')
+
+            elif ftp == 'image':
+                self.__addImage(row, name)
+
+            elif ftp in ['string', 'password']:
+                self.__addString(row, label, name, default, elements, ftp !=
+                        'string')
+
+            elif ftp == 'dropdown':
+                self.__addChoice(row, label, name, default, master, elements)
+
+            row += 1
+
+        if self.__entries:
+            self.__focus(self.__entries[0])
+
+
+    # -------------------------------------------------------------------------
+    # If the dialog is dismissed, clear the input data
+    # -------------------------------------------------------------------------
+
+    def reject(self):
+        """
+        Cancel the dialog and clear the input data dictionary
+        """
+
+        self.inputData = None
+        qt.QDialog.reject(self)
+
+
+    # -------------------------------------------------------------------------
+    # Add a centered, static label or warning
+    # -------------------------------------------------------------------------
+
+    def __addText(self, row, label, warning=False):
+
+        text = qt.QLabel(label, self)
+        text.setAlignment(qt.Qt.AlignHCenter)
+        self.grid.addMultiCellWidget(text, row, row, 0, 1)
+
+        if warning:
+            text.setPaletteForegroundColor(qt.QColor('red'))
+
+
+    # -------------------------------------------------------------------------
+    # Add a text control for a string or a password
+    # -------------------------------------------------------------------------
+
+    def __addString(self, row, label, name, default, elements, pwd=False):
+
+        text = qt.QLabel(label, self)
+        self.grid.addWidget(text, row, 0)
+
+        entry = IDLineEdit(name, default, elements, pwd, self.inputData, self)
+        self.grid.addWidget(entry, row, 1)
+
+        self.connect(entry, qt.PYSIGNAL('on_enter(QWidget)'),
+                self.__on_enter)
+
+        self.__entries.append(entry)
+
+
+    # -------------------------------------------------------------------------
+    # Add a series of dropdowns into a single row
+    # -------------------------------------------------------------------------
+
+    def __addChoice(self, row, label, name, default, master, elements):
+
+        text = qt.QLabel(label, self)
+        self.grid.addWidget(text, row, 0)
+
+        hbox = qt.QHBoxLayout()
+        self.grid.addLayout(hbox, row, 1)
+
+        perMaster = self.__dropdowns.setdefault(master, {})
+        perRow    = perMaster.setdefault(name, [])
+
+        border = 0
+        for (tip, allowedValues) in elements:
+            widget = IDComboBox(name, master, allowedValues, default, tip,
+                    self.inputData, self)
+            self.connect(widget, qt.PYSIGNAL('update_depending(QWidget, int)'),
+                    self.__update_depending)
+            self.connect(widget, qt.PYSIGNAL('on_enter(QWidget)'),
+                    self.__on_enter)
+
+            perRow.append(widget)
+
+            hbox.addWidget(widget)
+            self.__entries.append(widget)
+
+
+    # -------------------------------------------------------------------------
+    # Add a centered image to the dialog
+    # -------------------------------------------------------------------------
+
+    def __addImage (self, row, imageURL):
+
+        image = qt.QLabel('', self)
+        image.setAlignment(qt.Qt.AlignHCenter)
+        image.setPixmap(qt.QPixmap(imageURL))
+        self.grid.addMultiCellWidget(image, row, row, 0, 1)
+
+
+    # -------------------------------------------------------------------------
+    # If <Enter> is pressed within a text control, move the focus
+    # -------------------------------------------------------------------------
+  
+    def __on_enter(self, entry):
+
+        next = None
+        start = self.__entries.index(entry)+1
+        if start < len(self.__entries):
+            for i in range(start, len(self.__entries)):
+                if self.__entries[i].isEnabled():
+                    next = self.__entries[i]
+                    break
+
+        if next is not None:
+            self.__focus(next)
+        else:
+            self.accept()
+
+    # -------------------------------------------------------------------------
+    # Focus a given widget
+    # -------------------------------------------------------------------------
+
+    def __focus(self, widget):
+        widget.setFocus()
+
+        if isinstance(widget, qt.QLineEdit):
+            widget.selectAll()
+
+    # -------------------------------------------------------------------------
+    # Update all depending combo boxes
+    # -------------------------------------------------------------------------
+
+    def __update_depending(self, widget, index):
+
+        for item in self.__dropdowns[widget._master][widget.name()]:
+          item.setCurrentItem(index)
+
+        master = widget.name()
+
+        if master in self.__dropdowns:
+            for name in self.__dropdowns[master].keys():
+                drops = self.__dropdowns[master][name]
+                for i in drops:
+                    i.update_widget()
+
+
+# =============================================================================
+# Module Self Test
+# =============================================================================
+
+if __name__ == '__main__':
+    import sys
+
+    cname = {'c1': 'demoa', 'c2': 'demob'}
+    ckey  = {'c1': 'ck-A' , 'c2': 'ck-B'}
+
+    wija = {'c1': {'04': '2004', '05': '2005'},
+            'c2': {'24': '2024', '25': '2025', '26': '2026'}}
+
+    codes = {'24': {'241': 'c-24-1', '242': 'c-24-2'},
+             '25': {'251': 'c-25-1'}}
+
+    fields = [('Foo!', '/home/johannes/gnue/share/gnue/images/gnue.png', 
'image',
+             None, None, []),
+            ('Username', '_username', 'string', None, None, \
+              [('Name of the user', None)]),
+            ('Password', '_password', 'password', 'foo', None, [('yeah',1)]),
+            ('Foobar', '_foobar', 'dropdown', 'frob', None, \
+                [('single', {'trash': 'Da Trash', 'frob': 'Frob'})]),
+            ('Multi', '_multi', 'dropdown', '100', None, \
+                [('name', {'50': 'A 50', '100': 'B 100', '9': 'C 9'}),
+                ('sepp', {'50': 'se 50', '100': 'se 100', '9': 'se 9'})]),
+            ('Noe', '_depp', 'label', 'furz', None, []),
+            ('Das ist jetzt ein Fehler', None, 'warning', None, None, []),
+
+            ('Firma', 'company', 'dropdown', 'c1', None,
+                [('Name', cname), ('Code', ckey)]),
+            ('Wirtschaftsjahr', 'wija', 'dropdown', '05', 'company',
+                [('Jahr', wija)]),
+            ('Codes', 'codes', 'dropdown', None, 'wija',
+                [('Code', codes)])
+                ]
+
+    app = qt.QApplication( sys.argv )
+    app.connect(app, qt.SIGNAL("lastWindowClosed()"), app, qt.SLOT("quit()"))
+    
+    dialog = InputDialog ('Foobar', fields)
+    try:
+        dialog.show()
+        print "Result:", dialog.inputData
+
+    finally:
+        app.quit()
+
+    app.exec_loop()





reply via email to

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