commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7417 - in trunk/gnue-forms/src: . dialogs uidrivers/_base uidriv


From: johannes
Subject: [gnue] r7417 - in trunk/gnue-forms/src: . dialogs uidrivers/_base uidrivers/gtk2 uidrivers/win32 uidrivers/wx
Date: Tue, 19 Apr 2005 08:48:13 -0500 (CDT)

Author: johannes
Date: 2005-04-19 08:48:11 -0500 (Tue, 19 Apr 2005)
New Revision: 7417

Added:
   trunk/gnue-forms/src/uidrivers/wx/about.py
Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFInstance.py
   trunk/gnue-forms/src/dialogs/__init__.py
   trunk/gnue-forms/src/uidrivers/_base/UIdriver.py
   trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py
   trunk/gnue-forms/src/uidrivers/gtk2/about.py
   trunk/gnue-forms/src/uidrivers/win32/UIdriver.py
   trunk/gnue-forms/src/uidrivers/wx/UIdriver.py
Log:
Replaced dialogs for about and showMessage with an uidriver specific 
implementation


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2005-04-19 11:28:40 UTC (rev 7416)
+++ trunk/gnue-forms/src/GFForm.py      2005-04-19 13:48:11 UTC (rev 7417)
@@ -1313,13 +1313,10 @@
     @param modal: whether the dialog should be modal or not
     @return: None
     """
-    if dialogName == '_about' and \
-      hasattr(self._instance._uiinstance, 'aboutBox'):
-      self._instance._uiinstance.aboutBox(parameters, self)
-    else:
-      self._instance.activateForm(dialogName, parameters, modal)
 
+    self._instance._uiinstance.showAbout (**parameters)
 
+
   #---------------------------------------------------------------------------
   # Close this copy of gnue-forms
   #---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2005-04-19 11:28:40 UTC (rev 7416)
+++ trunk/gnue-forms/src/GFInstance.py  2005-04-19 13:48:11 UTC (rev 7417)
@@ -195,6 +195,10 @@
       filename    = os.path.join (basedir, dialogName)
       (name, ext) = os.path.splitext (dialogName)
 
+      # Skip those dialogs already implemented by the UI drivers
+      if name in ['about', 'messageBox']:
+        continue
+
       if os.path.isfile (filename) and ext == '.py':
         dialog = dyn_import ('gnue.forms.dialogs.%s' % name)
 
@@ -986,18 +990,13 @@
 
   def executeAbout (self, event):
     parameters = {
-      'appversion'  : VERSION,
-      'ui_driver'   : self._uiinstance.name,
       'name'        : event._form.title or "Unknown",
       'formversion' : event._form.getOption ('version') or "Unknown",
       'author'      : event._form.getOption ('author') or "Unknown",
       'description' : event._form.getOption ('description') or "Unknown",
     }
 
-    if hasattr (self._uiinstance, 'aboutBox'):
-      self._uiinstance.aboutBox (parameters, event._form)
-    else:
-      self.activateForm ('_about', parameters, modal = True)
+    self._uiinstance.showAbout (**parameters)
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/dialogs/__init__.py
===================================================================
--- trunk/gnue-forms/src/dialogs/__init__.py    2005-04-19 11:28:40 UTC (rev 
7416)
+++ trunk/gnue-forms/src/dialogs/__init__.py    2005-04-19 13:48:11 UTC (rev 
7417)
@@ -1 +1 @@
-DIALOGS = ['about', 'jumpto', 'messageBox',]
\ No newline at end of file
+DIALOGS = ['jumpto']

Modified: trunk/gnue-forms/src/uidrivers/_base/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/UIdriver.py    2005-04-19 11:28:40 UTC 
(rev 7416)
+++ trunk/gnue-forms/src/uidrivers/_base/UIdriver.py    2005-04-19 13:48:11 UTC 
(rev 7417)
@@ -30,6 +30,7 @@
 from gnue.common.apps import errors
 
 from gnue.forms.GFForm import *
+from gnue.forms import VERSION
 
 # =============================================================================
 # Exceptions
@@ -533,19 +534,66 @@
     else:
       self._showException (group, name, message, detail)
 
+
   # ---------------------------------------------------------------------------
   # Show a message of a given kind
   # ---------------------------------------------------------------------------
 
   def showMessage (self, message, kind = 'Info', title = None, cancel = False):
     """
-    This function calls the UI driver's implementation of the _showMessage
-    method. See _showMessage () for a detailed doc.
+    Show a message box of a given kind and returning a value corresponding with
+    the button pressed to quit the dialog.
+
+    @param message: the text of the message box
+    @param kind: type of the message box. Valid types are: 'Info', 'Warning',
+        'Question', 'Error'
+    @param title: title of the message box
+    @param cancel: If True a cancel button will be added to the dialog
+
+    @return: Depending on the button pressed to quit the message.
+        True : Ok-, Close- or Yes-Button
+        False: No-Button
+        None : Cancel-Button
     """
+
     return self._showMessage (message, kind, title, cancel)
 
 
   # ---------------------------------------------------------------------------
+  
+  def _showMessage (self, message, kind = 'Info', title = None, cancel = 
False):
+
+    raise ImplementationError, (self.name, '_showMessage')
+
+
+  # ---------------------------------------------------------------------------
+  # Show an about dialog
+  # ---------------------------------------------------------------------------
+
+  def showAbout (self, name = u_("Unknown"), appversion = VERSION,
+      formversion = "?", author = "Unknown", description = "Unknown"):
+    """
+    Displays an about dialog for the current application as defined by the
+    given parameter dictionary.
+
+    @param name: name of the application
+    @param appversion: version of the application (GNUe Forms)
+    @param formversion: version of the form
+    @param author: author of the form
+    @param description: text describing the form
+    """
+
+    self._showAbout (name, appversion, formversion, author, description)
+
+
+  # ---------------------------------------------------------------------------
+
+  def _showAbout (self, name, appversion, formversion, author, description):
+
+    raise ImplementationError, (self.name, '_showAbout')
+
+
+  # ---------------------------------------------------------------------------
   # gotoPage
   # ---------------------------------------------------------------------------
 
@@ -632,22 +680,3 @@
     """
     raise ImplementationError, (self.name, '_showException')
 
-
-  # ---------------------------------------------------------------------------
-  # Implementation of showMessage ()
-  # ---------------------------------------------------------------------------
-  
-  def _showMessage (self, message, kind = 'Info', title = None, cancel = 
False):
-    """
-    This function must be implemented by a UI driver class and shows a messages
-    of a given kind.
-
-    @param message: the text of the message
-    @param kind: type of the message. Valid types are 'Info', 'Warning',
-        'Question', 'Error'
-    @param title: title of the message
-    @param cancel: If True something like a cancel button should be available
-    @return: True if the Ok-, Close-, or Yes-button was pressed, False if the
-        No-button was pressed or None if the Cancel-button was pressed.
-    """
-    raise ImplementationError, (self.name, '_showMessage')

Modified: trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py     2005-04-19 11:28:40 UTC 
(rev 7416)
+++ trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py     2005-04-19 13:48:11 UTC 
(rev 7417)
@@ -321,12 +321,16 @@
   # Display an about box
   # ---------------------------------------------------------------------------
 
-  def aboutBox (self, params, form):
-    dialog = about.AboutBox (params, form)
-    dialog.run ()
-    dialog.destroy ()
+  def _showAbout (self, name, appversion, formversion, author, description):
 
+    dialog = about.AboutBox (name, appversion, formversion, author, 
description)
+    try:
+      dialog.run ()
 
+    finally:
+      dialog.destroy ()
+
+
   # ---------------------------------------------------------------------------
   # Make sure strings get converted to unicode
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/gtk2/about.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/about.py        2005-04-19 11:28:40 UTC 
(rev 7416)
+++ trunk/gnue-forms/src/uidrivers/gtk2/about.py        2005-04-19 13:48:11 UTC 
(rev 7417)
@@ -36,8 +36,11 @@
   # Constructor
   # ---------------------------------------------------------------------------
 
-  def __init__ (self, params, form):
-    title = u_("About %s") % params.get ('name', 'Unknown')
+  def __init__ (self, name, appversion, formversion, author, description):
+    """
+    """
+
+    title = u_("About %s") % name
     gtk.Dialog.__init__ (self, title, None, gtk.DIALOG_MODAL,
                          (gtk.STOCK_OK, gtk.RESPONSE_OK))
     self.set_border_width (5)
@@ -48,16 +51,14 @@
     tbl.set_border_width (8)
     tbl.set_col_spacings (8)
 
-    params ['ui_driver'] = 'GTK2'
-
     labels = []
     items  = []
 
     labels.append (self._newLabel (u_("Version:"), tbl, 0, 1, 0, 1))
     labels.append (self._newLabel (u_("Driver:"), tbl, 0, 1, 1, 2))
 
-    items.append (self._newLabel (params ['appversion'], tbl, 1, 2, 0, 1))
-    items.append (self._newLabel (params ['ui_driver'], tbl, 1, 2, 1, 2))
+    items.append (self._newLabel (appversion, tbl, 1, 2, 0, 1))
+    items.append (self._newLabel (u'GTK', tbl, 1, 2, 1, 2))
 
     box.add (tbl)
     tbl.show ()
@@ -75,10 +76,11 @@
     labels.append (self._newLabel (u_("Author:"),      tbl, 0, 1, 2, 3))
     labels.append (self._newLabel (u_("Description:"), tbl, 0, 1, 3, 4))
 
-    items.append (self._newLabel (params ['name'],        tbl, 1, 2, 0, 1))
-    items.append (self._newLabel (params ['formversion'], tbl, 1, 2, 1, 2))
-    items.append (self._newLabel (params ['author'],      tbl, 1, 2, 2, 3))
-    l = self._newLabel (params ['description'], tbl, 1, 2, 3, 4)
+    items.append (self._newLabel (name,        tbl, 1, 2, 0, 1))
+    items.append (self._newLabel (formversion, tbl, 1, 2, 1, 2))
+    items.append (self._newLabel (author,      tbl, 1, 2, 2, 3))
+
+    l = self._newLabel (description, tbl, 1, 2, 3, 4)
     l.set_line_wrap (True)
     items.append (l)
 
@@ -124,17 +126,9 @@
     return result
 
 if __name__ == '__main__':
-  parameters = {
-    'appversion'  : 'app-version',
-    'ui_driver'   : 'ui-driver-name',
-    'name'        : "form-name",
-    'formversion' : "form-version",
-    'author'      : "form-author",
-    'description' : "this is a description to the form. it "
-                    "could be a much "
-                    "longer text than one would excpet."
-  }
+  desc = "this is a description to the form. it " \
+         "could be a much longer text than one would excpet."
 
-  x = AboutBox (parameters, None)
+  x = AboutBox ('form-name', 'app-version', 'form-version', 'author', desc)
   x.run ()
   x.destroy ()

Modified: trunk/gnue-forms/src/uidrivers/win32/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/UIdriver.py    2005-04-19 11:28:40 UTC 
(rev 7416)
+++ trunk/gnue-forms/src/uidrivers/win32/UIdriver.py    2005-04-19 13:48:11 UTC 
(rev 7417)
@@ -27,7 +27,7 @@
 
 import sys
 import string
-import types
+import types
 
 from gnue.common.apps import i18n
 from gnue.forms.uidrivers._base import Exceptions
@@ -83,17 +83,17 @@
 # All UIs must provide this class
 #
 class GFUserInterface(commonToolkit.GFUserInterface):
-
-  _MBOX_KIND = {'Info'    : {'type'   : _('Info'),
+
+  _MBOX_KIND = {'Info'    : {'type'   : _('Info'),
                              'icon'   : win32con.MB_ICONINFORMATION,
                              'buttons': win32con.MB_OK},
-                'Warning' : {'type'   : _('Warning'),
+                'Warning' : {'type'   : _('Warning'),
                              'icon'   : win32con.MB_ICONWARNING,
                              'buttons': win32con.MB_OK},
-                'Question': {'type'   : _('Question'),
+                'Question': {'type'   : _('Question'),
                              'icon'   : win32con.MB_ICONQUESTION,
                              'buttons': win32con.MB_YESNO},
-                'Error'   : {'type'   : _('Error'),
+                'Error'   : {'type'   : _('Error'),
                              'icon'   : win32con.MB_ICONERROR,
                              'buttons': win32con.MB_OK}}
 
@@ -101,14 +101,14 @@
                win32con.IDYES   : True,
                win32con.IDNO    : False,
                win32con.IDCANCEL: None }
-
+
   _message_map = { win32con.WM_VSCROLL    : OnWMVScroll,
                    win32con.WM_MENUSELECT : OnWMMenuselect,
                    win32con.WM_NOTIFY     : OnWMNotify,
                    win32con.WM_DESTROY    : OnWMDestroy,
                    win32con.WM_CLOSE      : OnWMClose,
                    win32con.WM_SIZE       : OnWMSize,
-                   win32con.WM_COMMAND    : OnWMCommand }
+                   win32con.WM_COMMAND    : OnWMCommand }
 
   _wndclass = None
 
@@ -129,7 +129,7 @@
 
     self._disabledColour = afxres.AFX_IDC_COLOR_LIGHTGRAY
     self._win32app = getWin32App()
-    win32gui.InitCommonControls()
+    win32gui.InitCommonControls()
     
     try:
       icon = win32gui.LoadImage(0, sys.prefix+'\py.ico', win32con.IMAGE_ICON,
@@ -153,31 +153,31 @@
 #    if not self._disableSplash:
 #      self.splash = UIWXSplashScreen()
 
-
-    font_name = gConfigForms('faceName')
-    if not font_name:
-      # explicite boolean check forces generated report parameter dialog
-      # to use ANSI_VAR_FONT (GConfig typecast initialization problem...)
+
+    font_name = gConfigForms('faceName')
+    if not font_name:
+      # explicite boolean check forces generated report parameter dialog
+      # to use ANSI_VAR_FONT (GConfig typecast initialization problem...)
       if gConfigForms ('fixedWidthFont') == True:
-        fnt = win32con.ANSI_FIXED_FONT
+        fnt = win32con.ANSI_FIXED_FONT
       else:
-        fnt = win32con.ANSI_VAR_FONT
-
-      lf = win32gui.GetObject(win32gui.GetStockObject(fnt))
-      font_name = lf.lfFaceName
-
-      #~ print lf.lfHeight, lf.lfWidth, \
-        #~ lf.lfEscapement, lf.lfOrientation, lf.lfWeight, \
-        #~ lf.lfItalic, lf.lfUnderline, lf.lfStrikeOut, lf.lfCharSet, \
-        #~ lf.lfOutPrecision, lf.lfClipPrecision, lf.lfQuality, \
-        #~ lf.lfPitchAndFamily, lf.lfFaceName 
-
-    #~ print 'font_name=',font_name
-    
-    font_spec = {'name':font_name, 'height':int(gConfigForms('pointSize'))}
+        fnt = win32con.ANSI_VAR_FONT
+
+      lf = win32gui.GetObject(win32gui.GetStockObject(fnt))
+      font_name = lf.lfFaceName
+
+      #~ print lf.lfHeight, lf.lfWidth, \
+        #~ lf.lfEscapement, lf.lfOrientation, lf.lfWeight, \
+        #~ lf.lfItalic, lf.lfUnderline, lf.lfStrikeOut, lf.lfCharSet, \
+        #~ lf.lfOutPrecision, lf.lfClipPrecision, lf.lfQuality, \
+        #~ lf.lfPitchAndFamily, lf.lfFaceName 
+
+    #~ print 'font_name=',font_name
+    
+    font_spec = {'name':font_name, 'height':int(gConfigForms('pointSize'))}
     self._font = win32ui.CreateFont(font_spec)
-
 
+
     #
     # Create a dummy window used to compute sizes
     #
@@ -235,12 +235,12 @@
       if len(self._win32app._MainWindowList) == 0:
         win32gui.PostQuitMessage(0) # Terminate the app.
 
-    for window in self._win32app._MainWindowList:
-      # TODO: needs more work in case we have
-      # TODO: started a dialog from another dialog
+    for window in self._win32app._MainWindowList:
+      # TODO: needs more work in case we have
+      # TODO: started a dialog from another dialog
       window.Enable(1)
-
 
+
   def _beep(self):
     win32gui.MessageBeep(0)
 
@@ -268,7 +268,7 @@
   #
   def formAlert(self, event):
     self._beep()
-    ui = self._gfObjToUIWidget[event._form]
+    ui = self._gfObjToUIWidget[event._form]
     if hasattr (ui, 'statusBar'):
       win32gui.SendMessage(ui.statusBar.GetHwnd(), commctrl.SB_SETTEXT, 0, 
textEncode(event.data))
 
@@ -341,26 +341,50 @@
     @return: True if the Ok-, Close-, or Yes-button was pressed, False if the
         No-button was pressed or None if the Cancel-button was pressed.
     """
-    mbRec  = self._MBOX_KIND.get (kind)
+    mbRec  = self._MBOX_KIND.get (kind)
     flags = win32con.MB_TASKMODAL | mbRec['icon'] | mbRec['buttons']
-
+
     if title is not None and len (title):
       if isinstance (title, types.StringType):
-        title = unicode (title, i18n.encoding)
+        title = unicode (title, i18n.encoding)
     else:
       title = mbRec['type']
 
     cButtons = [win32con.MB_OKCANCEL, win32con.MB_YESNOCANCEL]
-
-    if cancel and not mbRec ['buttons'] in cButtons:
-      if mbRec ['buttons'] == win32con.MB_OK:
+
+    if cancel and not mbRec ['buttons'] in cButtons:
+      if mbRec ['buttons'] == win32con.MB_OK:
         flags = flags | win32con.MB_OKCANCEL
       elif mbRec ['buttons'] == win32con.MB_YESNO:
         flags = flags | win32con.MB_YESNOCANCEL
-
+
     res = win32gui.MessageBox(0, message, title, flags)
 
     return self._RESPONSE [res]
 
   def _showException (self, group, name, message, detail):
     self.showMessage (detail, kind = 'Error')
+
+  def _showAbout (self, name, appversion, formversion, author, description):
+
+    print "Hi!"
+
+    message = "%(tVersion)s %(appversion)s\n" \
+              "%(tDriver)s win32\n" \
+              "%(tName)s %(name)s\n" \
+              "%(tVersion)s %(formversion)s\n" \
+              "%(tAuthor)s %(author)s\n" \
+              "%(tDescription)s %(description)s\n" \
+              % {'tVersion': u_("Version:"),
+                 'tDriver': u_("Driver:"),
+                 'tName': u_("Name:"),
+                 'tAuthor': u_("Author"),
+                 'tDescription': u_("Description:"),
+                 'appversion': appversion,
+                 'formversion': formversion,
+                 'name': name,
+                 'author': author,
+                 'description': description}
+    print "Message:", message
+
+    self._showMessage (message, title = u_("About %s") % name)

Modified: trunk/gnue-forms/src/uidrivers/wx/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/UIdriver.py       2005-04-19 11:28:40 UTC 
(rev 7416)
+++ trunk/gnue-forms/src/uidrivers/wx/UIdriver.py       2005-04-19 13:48:11 UTC 
(rev 7417)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - wx UI Driver - User Interface
 #
-# 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,16 +19,10 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2005 Free Software Foundation
-#
-# DESCRIPTION:
-# A wxPython based user interface driver for GNUe forms.
-#
-# NOTES:
-#
 # $Id$
 
-import sys, os
+import sys
+import os
 import string
 
 from gnue.forms.uidrivers._base import Exceptions
@@ -50,6 +47,7 @@
 from gnue.forms.uidrivers.wx.UIWXSplashScreen import *
 from gnue.forms.uidrivers.wx.widgets._base  import *
 from gnue.forms.uidrivers.wx.common import _eventObjTowxWindow
+from gnue.forms.uidrivers.wx import about
 from PrintForm import printForm
 
 from common import wxEncode
@@ -280,6 +278,21 @@
 
 
   # ---------------------------------------------------------------------------
+  # Display an about box
+  # ---------------------------------------------------------------------------
+
+  def _showAbout (self, name, appversion, formversion, author, description):
+    
+    dialog = about.AboutBox (name, appversion, formversion, author, 
description)
+    try:
+      dialog.ShowModal ()
+
+    finally:
+      dialog.Destroy ()
+
+
+
+  # ---------------------------------------------------------------------------
   # Show an exception
   # TODO: please implement a better dialog box, i.e. add a button for
   #       detail-display and so on

Added: trunk/gnue-forms/src/uidrivers/wx/about.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/about.py  2005-04-19 11:28:40 UTC (rev 
7416)
+++ trunk/gnue-forms/src/uidrivers/wx/about.py  2005-04-19 13:48:11 UTC (rev 
7417)
@@ -0,0 +1,122 @@
+# GNU Enterprise Forms - wx UI Driver - About Box
+#
+# 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
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+
+import textwrap
+
+from wxPython import __version__ as WXVERSION
+from wxPython.wx import *
+
+from gnue.forms import VERSION
+from gnue.common.apps import GConfig
+from gnue.forms.uidrivers.wx.common import wxEncode
+
+# =============================================================================
+# This class implements an about dialog for the wx UI driver
+# =============================================================================
+
+class AboutBox (wxDialog):
+
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, name = "Unknown", appversion = VERSION,
+      formversion = "?", author = "Unknown", description = 'n/a'):
+    """
+    @param name: name of the application
+    @param appversion: version of the application (GNUe Forms)
+    @param formversion: version of the form
+    @param author: author of the form
+    @param description: text describing the form
+    """
+
+    title = wxEncode (u_("About %s") % name)
+    wxDialog.__init__ (self, None, -1, title, size = wxSize (400, 200))
+
+    topSizer   = wxBoxSizer (wxVERTICAL)
+    innerSizer = wxBoxSizer (wxVERTICAL)
+
+    gfBox = wxStaticBox (self, -1, ' GNUe Forms ')
+    gfBoxSizer = wxStaticBoxSizer (gfBox, wxVERTICAL)
+
+    gfFlex = wxFlexGridSizer (2, 2, 4, 10)
+    gfFlex.Add (wxStaticText (self, -1, wxEncode (u_("Version:"))))
+    gfFlex.Add (wxStaticText (self, -1, appversion))
+    gfFlex.Add (wxStaticText (self, -1, wxEncode (u_("Driver:"))))
+    gfFlex.Add (wxStaticText (self, -1, "wxPython %s" % WXVERSION))
+
+    gfBoxSizer.Add (gfFlex, 1, wxALL, 8)
+
+    innerSizer.Add (gfBoxSizer, 0, wxEXPAND | wxBOTTOM, 4)
+
+    fiBox = wxStaticBox (self, -1, wxEncode (u_(' Form Information ')))
+    fiBoxSizer = wxStaticBoxSizer (fiBox, wxVERTICAL)
+
+    # Make sure to have a seriously sized description
+    descr = '\n'.join (textwrap.wrap (description, 78))
+
+    fiFlex = wxFlexGridSizer (4, 2, 4, 10)
+    fiFlex.Add (wxStaticText (self, -1, wxEncode (u_("Name:"))))
+    fiFlex.Add (wxStaticText (self, -1, name))
+    fiFlex.Add (wxStaticText (self, -1, wxEncode (u_("Version:"))))
+    fiFlex.Add (wxStaticText (self, -1, formversion))
+    fiFlex.Add (wxStaticText (self, -1, wxEncode (u_("Author:"))))
+    fiFlex.Add (wxStaticText (self, -1, author))
+    fiFlex.Add (wxStaticText (self, -1, wxEncode (u_("Description:"))))
+    fiFlex.Add (wxStaticText (self, -1, descr))
+
+    fiBoxSizer.Add (fiFlex, 1, wxALL, 8)
+
+    innerSizer.Add (fiBoxSizer, 1, wxEXPAND | wxALL)
+
+    buttonSizer = wxBoxSizer (wxHORIZONTAL)
+    buttonSizer.Add (wxButton (self, wxID_OK, "OK"), 0, wxALL, 8)
+
+    topSizer.Add (innerSizer, 1, wxEXPAND | wxALL, 8)
+
+    topSizer.Add (buttonSizer, 0, wxALIGN_RIGHT)
+
+    self.SetSizer (topSizer)
+    topSizer.SetSizeHints (self)
+
+
+# =============================================================================
+# Module self test
+# =============================================================================
+
+if __name__ == '__main__':
+  app = wxPySimpleApp ()
+
+  desc = "This is a quite long description of the application.\n" \
+         "It also contains newlines as well as a lot of text. This text " \
+         "get's continued in the third line too.\n" \
+         "WWWWWWW WWWWWWW WWWWWWWWWWWW WWWWWWW WWWWWWWWWW WWWWWWW WWWWWWW" \
+         "WWWW WWWWW WWWW! And here comes the rest. Here we go."
+
+  dialog = AboutBox ('FooBar', author = 'BarBaz', description = desc)
+  try:
+    dialog.ShowModal ()
+  finally:
+    dialog.Destroy ()
+
+  app.MainLoop ()


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





reply via email to

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