[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8401 - trunk/gnue-common/src/logic
From: |
reinhard |
Subject: |
[gnue] r8401 - trunk/gnue-common/src/logic |
Date: |
Thu, 13 Apr 2006 15:07:05 -0500 (CDT) |
Author: reinhard
Date: 2006-04-13 15:07:05 -0500 (Thu, 13 Apr 2006)
New Revision: 8401
Added:
trunk/gnue-common/src/logic/actions.py
Log:
First chunk of the new attepmt for a menu/toolbar handling system.
Added: trunk/gnue-common/src/logic/actions.py
===================================================================
--- trunk/gnue-common/src/logic/actions.py 2006-04-13 01:17:51 UTC (rev
8400)
+++ trunk/gnue-common/src/logic/actions.py 2006-04-13 20:07:05 UTC (rev
8401)
@@ -0,0 +1,207 @@
+# GNU Enterprise Common Library - Menus And Toolbars
+#
+# Copyright 2000-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: GDataSource.py 8315 2006-03-31 17:14:37Z reinhard $
+"""
+Classes for the menu and toolbar object trees.
+"""
+
+from gnue.common.definitions import GObjects
+from gnue.common.formatting import GTypecast
+
+
+# =============================================================================
+# <menu>
+# =============================================================================
+
+class GMenu(GObjects.GObj):
+ """
+ A Menu that can either be the menu bar, a context menu, or a submenu.
+ """
+
+ # -------------------------------------------------------------------------
+ # Constructor
+ # -------------------------------------------------------------------------
+
+ def __init__(self, parent = None, type = "GCMenu"):
+ """
+ Create a GMenu instance.
+ """
+ GObjects.GObj.__init__(self, parent, type)
+
+
+# =============================================================================
+# <menuitem>
+# =============================================================================
+
+class GMenuItem(GObjects.GObj):
+ """
+ An item in a menu that fires a trigger when selected.
+ """
+
+ # -------------------------------------------------------------------------
+ # Constructor
+ # -------------------------------------------------------------------------
+
+ def __init__(self, parent = None, type = "GCMenu"):
+ """
+ Create a GMenuItem instance.
+ """
+ GObjects.GObj.__init__(self, parent, type)
+
+ # trigger support
+ self._triggerProperties = {
+ 'enabled': {
+ 'get':self.__trigger_get_enabled,
+ 'set':self.__trigger_set_enabled}}
+
+
+ # -------------------------------------------------------------------------
+ # Trigger functions
+ # -------------------------------------------------------------------------
+
+ def __trigger_get_enabled(self):
+ return self.enabled
+
+ # -------------------------------------------------------------------------
+
+ def __trigger_set_enabled(self, value):
+ self.enabled = value
+
+
+# =============================================================================
+# XML Element dictionary
+# =============================================================================
+
+def getXMLelements(updates = {}):
+
+ xmlElements = {
+ 'menu': {
+ 'Description': u_(
+ "A menu or submenu containing menu items and/or submenus"),
+ 'BaseClass' : GMenu,
+ 'ParentTags' : None,
+ 'Attributes' : {
+ 'name': {
+ 'Label' : u_("Name"),
+ 'Description': u_("Name of this element"),
+ 'Typecast' : GTypecast.name,
+ 'Required' : True,
+ 'Unique' : True},
+ 'label': {
+ 'Label' : u_("Label"),
+ 'Description': u_("Text to use if this is a submenu"),
+ 'Typecast' : GTypecast.text}}},
+ 'menuitem': {
+ 'Description': u_(
+ "A menu item that fires a trigger when selected"),
+ 'BaseClass' : GMenu,
+ 'ParentTags' : ['menu'],
+ 'Attributes' : {
+ 'name': {
+ 'Label' : u_("Name"),
+ 'Description': u_("Name of this element"),
+ 'Typecast' : GTypecast.name,
+ 'Required' : True,
+ 'Unique' : True},
+ 'icon': {
+ 'Label' : u_("Icon"),
+ 'Description': u_(
+ "Icon to display besides this menu item"),
+ 'Typecast' : GTypecast.name},
+ 'label': {
+ 'Label' : u_("Label"),
+ 'Description': u_("Text to use for this menu item"),
+ 'Typecast' : GTypecast.text},
+ 'description': {
+ 'Label' : u_("Description"),
+ 'Description': u_(
+ "Text to display in the status bar for this menu "
+ "item"),
+ 'Typecast' : GTypecast.text},
+ 'action': {
+ 'Label' : u_("Action"),
+ 'Description': u_(
+ "Name of the trigger to run whenever this menu "
+ "item is selected"),
+ 'Typecast' : GTypecast.name,
+ 'References' : 'trigger.name'},
+ 'enabled': {
+ 'Label' : u_("Enabled"),
+ 'Description': u_(
+ "Determines whether this menu item will be "
+ "enabled by default"),
+ 'Typecast' : GTypecast.boolean,
+ 'Default' : False}}},
+ 'toolbar': {
+ 'Description': u_("A toolbar containing tool buttons"),
+ 'BaseClass' : GToolbar,
+ 'ParentTags' : None,
+ 'Attributes' : {
+ 'name': {
+ 'Label' : u_("Name"),
+ 'Description': u_("Name of this element"),
+ 'Typecast' : GTypecast.name,
+ 'Required' : True,
+ 'Unique' : True}}},
+ 'toolbutton': {
+ 'Description': u_("A button on a toolbar"),
+ 'BaseClass' : GToolButton,
+ 'ParentTags' : ['toolbar'],
+ 'Attributes' : {
+ 'name': {
+ 'Label' : u_("Name"),
+ 'Description': u_("Name of this element"),
+ 'Typecast' : GTypecast.name,
+ 'Required' : True,
+ 'Unique' : True},
+ 'icon': {
+ 'Label' : u_("Icon"),
+ 'Description': u_("Icon to display on the button"),
+ 'Typecast' : GTypecast.name},
+ 'label': {
+ 'Label' : u_("Label"),
+ 'Description': u_("Text to display on the button"),
+ 'Typecast' : GTypecast.text},
+ 'description': {
+ 'Label' : u_("Description"),
+ 'Description': u_(
+ "Text to display in a tooltip window"),
+ 'Typecast' : GTypecast.text},
+ 'action': {
+ 'Label' : u_("Action"),
+ 'Description': u_(
+ "Name of the trigger to run whenever this button "
+ "is clicked"),
+ 'Typecast' : GTypecast.name,
+ 'References' : 'trigger.name'},
+ 'enabled': {
+ 'Label' : u_("Enabled"),
+ 'Description': u_(
+ "Determines whether this button will be enabled "
+ "by default"),
+ 'Typecast' : GTypecast.boolean,
+ 'Default' : False}}}}
+
+ for alteration in updates.keys():
+ xmlElements[alteration].update(updates[alteration])
+
+ return xmlElements
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8401 - trunk/gnue-common/src/logic,
reinhard <=