commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8156 - in trunk/gnue-forms: images/default po src/uidrivers/wx26


From: johannes
Subject: [gnue] r8156 - in trunk/gnue-forms: images/default po src/uidrivers/wx26 src/uidrivers/wx26/widgets
Date: Thu, 9 Feb 2006 13:24:42 -0600 (CST)

Author: johannes
Date: 2006-02-09 13:24:41 -0600 (Thu, 09 Feb 2006)
New Revision: 8156

Added:
   trunk/gnue-forms/images/default/gnue-16x16.png
   trunk/gnue-forms/images/default/gnue-32x32.png
   trunk/gnue-forms/images/default/gnue-64x64.png
Modified:
   trunk/gnue-forms/po/de.po
   trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
   trunk/gnue-forms/src/uidrivers/wx26/dialogs.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
Log:
Added iconbundle for forms; wx26 driver: changed about dialog, added 
default icons to forms; always raise a form to the front when it is 
shown.


Added: trunk/gnue-forms/images/default/gnue-16x16.png
===================================================================
(Binary files differ)


Property changes on: trunk/gnue-forms/images/default/gnue-16x16.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/gnue-forms/images/default/gnue-32x32.png
===================================================================
(Binary files differ)


Property changes on: trunk/gnue-forms/images/default/gnue-32x32.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/gnue-forms/images/default/gnue-64x64.png
===================================================================
(Binary files differ)


Property changes on: trunk/gnue-forms/images/default/gnue-64x64.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/gnue-forms/po/de.po
===================================================================
--- trunk/gnue-forms/po/de.po   2006-02-09 19:21:06 UTC (rev 8155)
+++ trunk/gnue-forms/po/de.po   2006-02-09 19:24:41 UTC (rev 8156)
@@ -43,7 +43,7 @@
 
 #: GFClient.py:147
 msgid "Unable to load UI driver: %s"
-msgstr "UI Treiber %s konnte nicht geladen werden"
+msgstr "UI Treiber konnte nicht geladen werden: %s"
 
 #: GFClient.py:191
 msgid "No Forms Definition File Specified."

Modified: trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-02-09 19:21:06 UTC 
(rev 8155)
+++ trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-02-09 19:24:41 UTC 
(rev 8156)
@@ -21,6 +21,7 @@
 #
 # $Id$
 
+import os.path
 from gnue.forms.uidrivers._base import Exceptions
 
 try:
@@ -34,6 +35,7 @@
 
 from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
 from gnue.forms.uidrivers.wx26 import dialogs, UISplashScreen
+from gnue.common.apps import GConfig
 
 
 # =============================================================================
@@ -215,7 +217,10 @@
 
   def _showAbout (self, name, appversion, formversion, author, description):
 
-    dlg = dialogs.AboutBox (name, appversion, formversion, author, description)
+    iDir = GConfig.getInstalledBase ('forms_images', 'common_images')
+    icon = os.path.join (iDir, 'gnue-icon.png')
+    
+    dlg = dialogs.AboutBox (name, appversion, author, description, icon)
     try:
       dlg.ShowModal ()
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/dialogs.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/dialogs.py      2006-02-09 19:21:06 UTC 
(rev 8155)
+++ trunk/gnue-forms/src/uidrivers/wx26/dialogs.py      2006-02-09 19:24:41 UTC 
(rev 8156)
@@ -21,8 +21,8 @@
 #
 # $Id$
 
-import textwrap
 import wx
+import os
 
 from gnue.forms import VERSION
 from gnue.common.apps import GConfig
@@ -42,69 +42,80 @@
   # Constructor
   # ---------------------------------------------------------------------------
 
-  def __init__ (self, name = "Unknown", appversion = VERSION,
-      formversion = "?", author = "Unknown", description = 'n/a'):
+  def __init__ (self, appname, appvers = None, author = None, descr = None,
+      icon = None):
     """
-    @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 appname: name of the application
+    @param appvers: version of the application
+    @param author: author of the application
     @param description: text describing the form
+    @param icon: path to the appication's icon
     """
 
-    title = u_("About %s") % name
-    wx.Dialog.__init__ (self, None, -1, title, size = wx.Size (400, 200))
+    wx.Dialog.__init__ (self, None, wx.ID_ANY, u_("About %s") % appname)
 
-    self.SetIcon (wx.ArtProvider.GetIcon (wx.ART_INFORMATION,
-      wx.ART_FRAME_ICON))
+    dlgSz = wx.BoxSizer (wx.VERTICAL)
+    sizer = wx.BoxSizer (wx.VERTICAL)
 
-    topSizer   = wx.BoxSizer (wx.VERTICAL)
-    innerSizer = wx.BoxSizer (wx.VERTICAL)
+    dlgSz.Add (sizer, 1, wx.ALIGN_CENTER | wx.ALL, 12)
+    
+    if icon is not None and os.path.exists (icon):
+      sizer.Add (wx.StaticBitmap (self, wx.ID_STATIC,
+        wx.Image (icon).ConvertToBitmap ()), 0, wx.ALIGN_CENTER | wx.BOTTOM, 6)
 
-    gfBox = wx.StaticBox (self, -1, ' GNUe Forms ')
-    gfBoxSizer = wx.StaticBoxSizer (gfBox, wx.VERTICAL)
+    bold = wx.SystemSettings.GetFont (wx.SYS_DEFAULT_GUI_FONT)
+    bold.SetWeight (wx.FONTWEIGHT_BOLD)
 
-    gfFlex = wx.FlexGridSizer (2, 2, 4, 10)
-    gfFlex.Add (wx.StaticText (self, -1, u_("Version:")))
-    gfFlex.Add (wx.StaticText (self, -1, appversion))
-    gfFlex.Add (wx.StaticText (self, -1, u_("Driver:")))
-    gfFlex.Add (wx.StaticText (self, -1, "wx %s" % wx.__version__))
+    # On Windows the SMALL_FONT is really too small
+    if '__WXMSW__' in wx.PlatformInfo:
+      small = wx.NORMAL_FONT
+    else:
+      small = wx.SMALL_FONT
 
-    gfBoxSizer.Add (gfFlex, 1, wx.ALL, 8)
+    # Application name
+    s = wx.StaticText (self, -1, appname)
+    s.SetFont (bold)
+    sizer.Add (s, 0, wx.ALIGN_CENTER)
 
-    innerSizer.Add (gfBoxSizer, 0, wx.EXPAND | wx.BOTTOM, 4)
+    # Application version
+    if appvers:
+      s = wx.StaticText (self, -1, u_("Version: %s") % appvers)
+      s.SetFont (small)
+      sizer.Add (s, 0, wx.ALIGN_CENTER)
 
-    fiBox = wx.StaticBox (self, -1, u_(' Form Information '))
-    fiBoxSizer = wx.StaticBoxSizer (fiBox, wx.VERTICAL)
+    # Author of the application
+    if author:
+      sizer.Add (wx.StaticText (self, -1, author), 0,
+          wx.ALIGN_CENTER | wx.TOP, 6)
 
-    # Make sure to have a seriously sized description
-    descr = '\n'.join (textwrap.wrap (description, 78))
+    # Description of the application
+    if descr:
+      sizer.Add (wx.StaticText (self, -1, descr, wx.DefaultPosition,
+          wx.DefaultSize, wx.ALIGN_CENTRE), 0, wx.ALIGN_CENTER | wx.TOP, 6)
 
-    fiFlex = wx.FlexGridSizer (4, 2, 4, 10)
-    fiFlex.Add (wx.StaticText (self, -1, u_("Name:")))
-    fiFlex.Add (wx.StaticText (self, -1, name))
-    fiFlex.Add (wx.StaticText (self, -1, u_("Version:")))
-    fiFlex.Add (wx.StaticText (self, -1, formversion))
-    fiFlex.Add (wx.StaticText (self, -1, u_("Author:")))
-    fiFlex.Add (wx.StaticText (self, -1, author))
-    fiFlex.Add (wx.StaticText (self, -1, u_("Description:")))
-    fiFlex.Add (wx.StaticText (self, -1, descr))
+    # The GNUe Forms version
+    sizer.Add (wx.StaticLine (self, -1, wx.DefaultPosition, wx.DefaultSize,
+        wx.LI_HORIZONTAL), 0, wx.EXPAND|wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 
6)
 
-    fiBoxSizer.Add (fiFlex, 1, wx.ALL, 8)
+    s = wx.StaticText (self, -1, "GNU Enterprise Forms")
+    s.SetFont (bold)
+    sizer.Add (s, 0, wx.ALIGN_CENTER)
 
-    innerSizer.Add (fiBoxSizer, 1, wx.EXPAND | wx.ALL)
+    wxv = ".".join (["%s" % e for e in wx.VERSION])
+    uni = 'unicode' in wx.PlatformInfo and 'Unicode' or 'Ansi'
 
-    buttonSizer = wx.BoxSizer (wx.HORIZONTAL)
-    buttonSizer.Add (wx.Button (self, wx.ID_OK, "OK"), 0, wx.ALL, 8)
+    s = wx.StaticText (self, -1, "Version %s / %s %s - %s" \
+        % (VERSION, wx.PlatformInfo [1], wxv, uni))
+    s.SetFont (small)
+    sizer.Add (s, 0, wx.ALIGN_CENTER)
 
-    topSizer.Add (innerSizer, 1, wx.EXPAND | wx.ALL, 8)
+    # Ok button
+    sizer.Add (self.CreateButtonSizer (wx.OK), 0, wx.ALIGN_CENTER | wx.TOP, 12)
 
-    topSizer.Add (buttonSizer, 0, wx.ALIGN_RIGHT)
+    self.SetSizerAndFit (dlgSz)
+    self.CenterOnScreen ()
 
-    self.SetSizer (topSizer)
-    topSizer.SetSizeHints (self)
 
-
 # =============================================================================
 # Class implementing a versatile input dialog
 # =============================================================================
@@ -198,13 +209,19 @@
     topSizer.Add (wx.StaticLine (self, wx.ID_STATIC, wx.DefaultPosition,
       wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 8)
 
-    buttonSizer = self.CreateButtonSizer (wx.OK | (cancel and wx.CANCEL or 0))
+    buttonSizer = self.CreateButtonSizer (wx.OK | (cancel and wx.CANCEL or 0) |
+        wx.NO_DEFAULT)
     topSizer.Add (buttonSizer, 0, wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, 8)
 
     self.SetSizerAndFit (topSizer)
 
+    if self.__controls:
+      self.__controls [0].SetFocus ()
 
+    self.CenterOnScreen ()
 
+
+
   # ---------------------------------------------------------------------------
   # Add a centered, static label or warning
   # ---------------------------------------------------------------------------
@@ -591,11 +608,9 @@
 
   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."
+         "get's continued in the third line too.\n"
 
-  dialog = AboutBox ('FooBar', author = 'BarBaz', description = desc)
+  dialog = AboutBox ('FooBar', '1.0.3', 'BarBaz', desc)
   try:
     dialog.ShowModal ()
   finally:

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-02-09 19:21:06 UTC 
(rev 8155)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-02-09 19:24:41 UTC 
(rev 8156)
@@ -22,7 +22,9 @@
 # $Id$
 
 import wx
+import os.path
 
+from gnue.common.apps import GConfig
 from gnue.forms.uidrivers.wx26.MenuBar import MenuBar
 from gnue.forms.uidrivers.wx26.ToolBar import ToolBar
 from gnue.forms.uidrivers.wx26.widgets._base import UIHelper
@@ -111,10 +113,35 @@
     self._sizers = [(self.mainWindow, topSizer), (newWidget,
         newWidget.pageSizer)]
 
+    self.mainWindow.SetIcons (self.__loadIcons ())
+
+
     return newWidget
 
 
   # ---------------------------------------------------------------------------
+  # Load an icon bundle for this form
+  # ---------------------------------------------------------------------------
+
+  def __loadIcons (self):
+
+    idir = GConfig.getInstalledBase ('forms_images', 'common_images')
+    iconBundle = wx.IconBundle ()
+
+    for sz in [16, 32, 64]:
+      fn = os.path.join (idir, 'forms', 'default', 'gnue-%sx%s.png' % (sz, sz))
+      if os.path.exists (fn):
+        # On wxMSW loading an icon directly from a file doesn't work, so we
+        # need to copy the icons from a bitmap on the fly
+        icon = wx.Icon (fn, wx.BITMAP_TYPE_PNG)
+        icon.CopyFromBitmap (wx.Image (fn).ConvertToBitmap ())
+
+        iconBundle.AddIcon (icon)
+
+    return iconBundle
+
+
+  # ---------------------------------------------------------------------------
   # Set sizers, specify the size hints and fit all child controls
   # ---------------------------------------------------------------------------
 
@@ -133,6 +160,7 @@
 
     self.containerFrame.Fit ()
     self.containerFrame.Show ()
+    self.mainWindow.Raise ()
 
 
   # ---------------------------------------------------------------------------
@@ -143,6 +171,7 @@
 
     self.containerFrame.Fit ()
     self.containerFrame.ShowModal ()
+    self.mainWindow.Raise ()
 
 
   # ---------------------------------------------------------------------------
@@ -364,6 +393,7 @@
     self._uiForm._request ('PAGE', data = event.GetSelection ())
 
 
+
 # =============================================================================
 # Widget configuration
 # =============================================================================





reply via email to

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