commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8486 - in trunk/gnue-forms/src/uidrivers: _base/widgets wx26/wid


From: reinhard
Subject: [gnue] r8486 - in trunk/gnue-forms/src/uidrivers: _base/widgets wx26/widgets
Date: Wed, 24 May 2006 09:38:05 -0500 (CDT)

Author: reinhard
Date: 2006-05-24 09:38:04 -0500 (Wed, 24 May 2006)
New Revision: 8486

Added:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
Modified:
   trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
Log:
First steps towards a dynamic menu.


Modified: trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py       2006-05-24 
12:41:13 UTC (rev 8485)
+++ trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py       2006-05-24 
14:38:04 UTC (rev 8486)
@@ -99,7 +99,7 @@
         self._creationEvent.container = None
 
     #print "The container will be ",self._creationEvent.container
-    if not self._gfObject.hidden:
+    if not hasattr (self._gfObject, 'hidden') or not self._gfObject.hidden:
       for spacer in range(int(self._gfObject._rows)):
         newWidget = self.createWidget(self._creationEvent, spacer)
         self.widgets.append(newWidget)

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-05-24 12:41:13 UTC 
(rev 8485)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-05-24 14:38:04 UTC 
(rev 8486)
@@ -95,7 +95,8 @@
         self.statusBar.SetStatusWidths ([-1, 50, 50, 75, 75])
 
       if not self._form._features.get ('GUI:MENUBAR:SUPPRESS'):
-        MenuBar (self._uiDriver, self.mainWindow, self._form)
+        mb = MenuBar (self._uiDriver, self.mainWindow, self._form)
+        self.menuBar = mb.menubar
 
       if not self._form._features.get ('GUI:TOOLBAR:SUPPRESS'):
         tlb = ToolBar (self._uiDriver, self.__basePanel, self._form)

Added: trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2006-05-24 12:41:13 UTC 
(rev 8485)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2006-05-24 14:38:04 UTC 
(rev 8486)
@@ -0,0 +1,66 @@
+# GNU Enterprise Forms - wx 2.6 UI Driver - Menu widget
+#
+# Copyright 2001-2006 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 wx
+
+from gnue.forms.uidrivers.wx26.widgets._base import UIHelper
+
+
+# =============================================================================
+# Wrap an UI layer around a wxMenu widget
+# =============================================================================
+
+class UIMenu(UIHelper):
+    """
+    Implements a menu object.
+    """
+
+    # -------------------------------------------------------------------------
+    # Create a menu widget
+    # -------------------------------------------------------------------------
+
+    def _createWidget(self, event, spacer):
+        """
+        Creates a new Menu widget.
+        """
+
+        result = wx.Menu()
+        if isinstance(event.container, wx.Menu):
+            event.container.AppendMenu(wx.ID_ANY, self._gfObject.label, result)
+        else:
+            self._uiForm.menuBar.Append(result, self._gfObject.label)
+
+        self._containerToolkitWidget = result
+
+        return result
+
+
+# =============================================================================
+# Configuration data
+# =============================================================================
+
+configuration = {
+  'baseClass': UIMenu,
+  'provides' : 'GCMenu',
+  'container': 1,
+}


Property changes on: trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py     2006-05-24 
12:41:13 UTC (rev 8485)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py     2006-05-24 
14:38:04 UTC (rev 8486)
@@ -0,0 +1,82 @@
+# GNU Enterprise Forms - wx 2.6 UI Driver - MenuItem widget
+#
+# Copyright 2001-2006 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 wx
+
+from gnue.forms.uidrivers.wx26.widgets._base import UIHelper
+
+
+# =============================================================================
+# Wrap an UI layer around a wxMenu widget
+# =============================================================================
+
+class UIMenuItem(UIHelper):
+    """
+    Implements a menu item object.
+    """
+
+    # -------------------------------------------------------------------------
+    # Create a menu item widget
+    # -------------------------------------------------------------------------
+
+    def _createWidget(self, event, spacer):
+        """
+        Creates a new MenuItem widget.
+        """
+
+        if self._gfObject.label is not None:
+            result = wx.MenuItem(event.container, wx.ID_ANY,
+                    self._gfObject.label, self._gfObject.description or u"")
+    
+            if self._gfObject.icon:
+                image = wx.Image(self._gfObject.icon, wx.BITMAP_TYPE_PNG)
+                result.SetBitmap(image.ConvertToBitmap())
+
+            wx.EVT_MENU(wx.GetApp(), result.GetId(), self.__on_menu)
+
+            event.container.AppendItem(result)
+        else:
+            result = None
+            event.container.AppendSeparator()
+
+        return result
+
+
+    # -------------------------------------------------------------------------
+    # Events
+    # -------------------------------------------------------------------------
+
+    def __on_menu(self, event):
+
+        self._gfObject.fire()
+
+
+# =============================================================================
+# Configuration data
+# =============================================================================
+
+configuration = {
+  'baseClass': UIMenuItem,
+  'provides' : 'GCMenuItem',
+  'container': False
+}


Property changes on: trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
___________________________________________________________________
Name: svn:keywords
   + Id





reply via email to

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