[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9437 - in trunk/gnue-forms/src/uidrivers: gtk2 gtk2/widgets/form
From: |
reinhard |
Subject: |
[gnue] r9437 - in trunk/gnue-forms/src/uidrivers: gtk2 gtk2/widgets/form qt3 qt3/widgets win32/widgets/form wx wx/widgets/form wx26 wx26/widgets |
Date: |
Mon, 12 Mar 2007 03:46:53 -0500 (CDT) |
Author: reinhard
Date: 2007-03-12 03:46:52 -0500 (Mon, 12 Mar 2007)
New Revision: 9437
Removed:
trunk/gnue-forms/src/uidrivers/gtk2/MenuBar.py
trunk/gnue-forms/src/uidrivers/gtk2/ToolBar.py
trunk/gnue-forms/src/uidrivers/qt3/MenuBar.py
trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py
trunk/gnue-forms/src/uidrivers/wx/MenuBar.py
trunk/gnue-forms/src/uidrivers/wx/ToolBar.py
trunk/gnue-forms/src/uidrivers/wx26/MenuBar.py
trunk/gnue-forms/src/uidrivers/wx26/ToolBar.py
Modified:
trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/widget.py
trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py
trunk/gnue-forms/src/uidrivers/win32/widgets/form/widget.py
trunk/gnue-forms/src/uidrivers/wx/widgets/form/widget.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
Log:
Don't use old stle menu bar and toolbar any more.
Deleted: trunk/gnue-forms/src/uidrivers/gtk2/MenuBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/MenuBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/gtk2/MenuBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,159 +0,0 @@
-# GNU Enterprise Forms - GTK UI Driver - Menubar widget
-#
-# Copyright 2001-2007 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 gtk
-
-from gnue.forms.uidrivers._commonGuiToolkit.MenuBar import MenuBar as Base
-
-
-# =============================================================================
-# This class implements the menu bar widget for GTK
-# =============================================================================
-
-class MenuBar (Base):
-
- # ---------------------------------------------------------------------------
- # Create the menu
- # ---------------------------------------------------------------------------
-
- def init (self):
- self.handleBox = gtk.HandleBox ()
- self.menu = gtk.MenuBar ()
- self.handleBox.add (self.menu)
- self.menu.show ()
-
- self.container.content_table.attach (self.handleBox,
- # X direction Y direction
- 0, 1, 0, 1,
- gtk.EXPAND | gtk.FILL, 0,
- 0, 0)
- return self.menu
-
-
- # ---------------------------------------------------------------------------
- # Make sure to have a correct label
- # ---------------------------------------------------------------------------
-
- def correctLabel (self, label):
- return label.replace ('&', '_')
-
- # ---------------------------------------------------------------------------
- # Add a (sub)menu
- # ---------------------------------------------------------------------------
-
- def addMenu (self, name, parent):
- menuitem = gtk.MenuItem (self.correctLabel (name))
- menu = gtk.Menu ()
- menuitem.set_submenu (menu)
- parent.add (menuitem)
- return menu
-
-
- # ---------------------------------------------------------------------------
- # Add a menu item (action)
- # ---------------------------------------------------------------------------
-
- def addAction (self, name, parent, userAction):
- label = name
- hotkey = userAction.getHotKeyTuple ()
- iconloc = userAction.getIconLocation (size = "16x16")
-
- item = gtk.ImageMenuItem (self.correctLabel (label))
-
- if hotkey is not None:
- (base, shift, ctrl, meta) = hotkey
- mod = 0
- if shift: mod = mod | gtk.gdk.SHIFT_MASK
- if ctrl: mod = mod | gtk.gdk.CONTROL_MASK
- if meta: mod = mod | gtk.gdk.MOD1_MASK
-
- item.add_accelerator ('activate', self.container.accelGroup, base, mod,
- gtk.ACCEL_VISIBLE)
-
-
- parent.add (item)
-
- item.connect ('activate', self._menuHandler, userAction)
- item.connect ('select', self._selectHandler, userAction)
- item.connect ('deselect', self._deselectHandler, userAction)
-
- # Set the action icon if available
- if iconloc:
- icon = gtk.Image ()
- icon.set_from_file (iconloc)
-
- item.set_image (icon)
-
- return item
-
-
- # ---------------------------------------------------------------------------
- # Handle the activate-signal of menu items
- # ---------------------------------------------------------------------------
-
- def _menuHandler (self, menuItem, userAction):
-
- self._fire(userAction)
-
-
- # ---------------------------------------------------------------------------
- # Display the tooltip in the statusbar if a menu item get's selected
- # ---------------------------------------------------------------------------
-
- def _selectHandler (self, menuItem, userAction):
-
- self.container._show_tip (userAction.description)
-
-
- # ---------------------------------------------------------------------------
- # Clear the tooltip in the statusbar if a menu item get's deselected
- # ---------------------------------------------------------------------------
-
- def _deselectHandler (self, menuItem, userAction):
-
- self.container._show_tip ('')
-
-
- # ---------------------------------------------------------------------------
- # Add a separator
- # ---------------------------------------------------------------------------
-
- def addSeparator (self, parent):
- item = gtk.SeparatorMenuItem ()
- parent.add (item)
-
-
- # ---------------------------------------------------------------------------
- # Enable a menu item
- # ---------------------------------------------------------------------------
-
- def enableItem (self, item):
- item.set_sensitive (1)
-
-
- # ---------------------------------------------------------------------------
- # Disable a menu item
- # ---------------------------------------------------------------------------
-
- def disableItem (self, item):
- item.set_sensitive (0)
Deleted: trunk/gnue-forms/src/uidrivers/gtk2/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/ToolBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/gtk2/ToolBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,181 +0,0 @@
-# GNU Enterprise Forms - GTK UI Driver - Toolbar widget
-#
-# Copyright 2001-2007 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 gtk
-
-from gnue.common.apps import i18n
-from gnue.forms.uidrivers._commonGuiToolkit.ToolBar import ToolBar as Base
-
-# =============================================================================
-# This class implements the toolbar for GTK2
-# =============================================================================
-
-class ToolBar (Base):
-
- # ---------------------------------------------------------------------------
- # Create the toolbar
- # ---------------------------------------------------------------------------
-
- def init (self):
- handlebox = gtk.HandleBox ()
- self.toolbar = gtk.Toolbar ()
-
- self.toolbar.set_orientation (gtk.ORIENTATION_HORIZONTAL)
- self.toolbar.set_style (gtk.TOOLBAR_ICONS)
- self.toolbar.set_tooltips (True)
- handlebox.add (self.toolbar)
-
- self.container.content_table.attach (handlebox,
- # X direction Y direction
- 0, 1, 1, 2,
- gtk.EXPAND | gtk.FILL, 0,
- 0, 0)
- self.toolbar.show ()
- handlebox.show ()
-
- self.toolbar.set_show_arrow (False)
- self.tooltips = gtk.Tooltips ()
-
- return handlebox
-
-
- # ---------------------------------------------------------------------------
- # Add a menu item (action)
- # ---------------------------------------------------------------------------
-
- def addAction (self, name, userAction):
-
- assert gDebug (6, "TOOL: add action %s, %s" % \
- (repr (name), repr (userAction.description)))
-
- label = name
- toolTip = userAction.description
- iconloc = userAction.getIconLocation (size = "24x24")
-
- # Set the action icon if available
- if not iconloc:
- assert gDebug (1, "Can't add '%s' to toolbar; no icon" %
userAction.event)
- return
-
- icon = gtk.Image ()
- icon.set_from_file (iconloc)
-
- if userAction.canToggle:
- button = gtk.ToggleToolButton ()
- button._toggleHandler = button.connect ('toggled', self._toggleEvent,
- userAction)
- else:
- button = gtk.ToolButton ()
- button.connect ('clicked', self._buttonPress, userAction)
- button._toggleHandler = None
-
- button.set_icon_widget (icon)
- button.set_label (label)
- button.set_tooltip (self.tooltips, toolTip, None)
-
- self.toolbar.insert (button, -1)
-
- return button
-
-
- # ---------------------------------------------------------------------------
- # Event handler for toggle buttons
- # ---------------------------------------------------------------------------
-
- def _toggleEvent (self, button, userAction):
-
- self._fire(userAction, not button.get_active())
-
-
- # ---------------------------------------------------------------------------
- # Event handler for toolbar buttons
- # ---------------------------------------------------------------------------
-
- def _buttonPress (self, button, userAction):
-
- self._fire(userAction, False)
-
-
- # ---------------------------------------------------------------------------
- # Add a separator
- # ---------------------------------------------------------------------------
-
- def addSeparator (self):
-
- sep = gtk.SeparatorToolItem ()
- self.toolbar.insert (sep, -1)
-
-
- # ---------------------------------------------------------------------------
- # Enable a menu item
- # ---------------------------------------------------------------------------
-
- def enableItem (self, item):
-
- if item is not None:
- item.set_sensitive (1)
-
-
- # ---------------------------------------------------------------------------
- # Disable a menu item
- # ---------------------------------------------------------------------------
-
- def disableItem (self, item):
-
- if item is not None:
- item.set_sensitive (0)
-
-
- # ---------------------------------------------------------------------------
- # Set an item active
- # ---------------------------------------------------------------------------
-
- def startingItem (self, item):
-
- if item._toggleHandler:
- item.handler_block (item._toggleHandler)
-
- try:
- if item is not None:
- item.set_active (1)
-
- finally:
- if item._toggleHandler:
- item.handler_unblock (item._toggleHandler)
-
- # ---------------------------------------------------------------------------
- # Set an item inactive
- # ---------------------------------------------------------------------------
-
- def endingItem (self, item):
-
- if item._toggleHandler:
- item.handler_block (item._toggleHandler)
-
- try:
- if isinstance(item, gtk.ToggleToolButton):
- item.set_active (0)
-
- finally:
- if item._toggleHandler:
- item.handler_unblock (item._toggleHandler)
Modified: trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/widget.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/widget.py 2007-03-12
08:23:23 UTC (rev 9436)
+++ trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/widget.py 2007-03-12
08:46:52 UTC (rev 9437)
@@ -30,8 +30,6 @@
from gnue.common import events
from gnue.forms.uidrivers.gtk2 import dialogs
from gnue.forms.uidrivers.gtk2.widgets._base import UIHelper
-from gnue.forms.uidrivers.gtk2.MenuBar import MenuBar
-from gnue.forms.uidrivers.gtk2.ToolBar import ToolBar
_MBOX_KIND = {'info' : {'type' : gtk.MESSAGE_INFO,
@@ -143,16 +141,8 @@
# Add Statusbar, Toolbar and Menubar as requested and/or allowed
if self._form.style != 'dialog':
- if not self._form.findChildNamed('__main_menu__', 'GFMenu'):
- if not self._form._features ['GUI:MENUBAR:SUPPRESS']:
- MenuBar (self._uiDriver, self, self._form)
-
- if not self._form._features['GUI:TOOLBAR:SUPPRESS']:
- ToolBar (self._uiDriver, self, self._form)
-
if not self._form._features ['GUI:STATUSBAR:SUPPRESS']:
self.createStatusBar ()
-
self._eventHandler = event.eventHandler
self._wrapper.finalize ()
Deleted: trunk/gnue-forms/src/uidrivers/qt3/MenuBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/MenuBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/qt3/MenuBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,136 +0,0 @@
-# GNU Enterprise Forms - QT3 UI driver - MenuBar
-#
-# Copyright 2001-2007 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$
-"""
-Menu bar
-"""
-
-import qt
-from gnue.forms.uidrivers._commonGuiToolkit import MenuBar as _Base
-
-_ICON_CACHE = {}
-
-# =============================================================================
-# Implementation of the menu bar for qt3
-# =============================================================================
-
-class MenuBar(_Base.MenuBar):
-
- # -------------------------------------------------------------------------
- # Constructor
- # -------------------------------------------------------------------------
-
- def init(self):
- self.menubar = self.container.menuBar()
- self.__idmap = {}
- return self.menubar
-
- # -------------------------------------------------------------------------
- # Add a sub menu
- # -------------------------------------------------------------------------
-
- def addMenu(self, name, parent):
- """
- Add antoher menu to the given parent menu or menubar
-
- @param name: name of the menu
- @param parent: parent menu or menubar to append the new menu to
-
- @result: newly created menu
- """
-
- menu = qt.QPopupMenu(parent)
- parent.insertItem(name, menu)
- qt.QObject.connect(menu, qt.SIGNAL('activated(int)'),
- self.__item_selected)
- return menu
-
-
- # -------------------------------------------------------------------------
- # Add an action
- # -------------------------------------------------------------------------
-
- def addAction(self, name, parent, userAction):
- """
- Add a new menu item to a given menu.
-
- @param name: name of the menu item
- @param parent: menu to add this new item to
- @param userAction: userAction instance representing the new menu item
-
- @returns: the newly created menu item
- """
-
- iconloc = userAction.getIconLocation(size="16x16")
- label = name
-
- # Set the action icon if available
- if iconloc:
- icon = _ICON_CACHE.setdefault(iconloc,
- qt.QIconSet(qt.QPixmap(iconloc)))
- mid = parent.insertItem(icon, label)
- else:
- mid = parent.insertItem(label)
-
- hotkey = userAction.getHotKeyText({'PAGEDOWN': 'PgDown'})
- if hotkey:
- parent.setAccel(qt.QKeySequence(hotkey), mid)
-
- parent.setWhatsThis(mid, userAction.description or '')
-
- self.__idmap[mid] = userAction
-
- return (parent, mid)
-
- # -------------------------------------------------------------------------
- # Add a separator
- # -------------------------------------------------------------------------
-
- def addSeparator(self, parent):
- parent.insertSeparator()
-
-
- # -------------------------------------------------------------------------
- # Enable a menu item
- # -------------------------------------------------------------------------
-
- def enableItem(self, item):
- parent, mid = item
- parent.setItemEnabled(mid, True)
-
-
- # -------------------------------------------------------------------------
- # Disable a menu item
- # -------------------------------------------------------------------------
-
- def disableItem(self, item):
- parent, mid = item
- parent.setItemEnabled(mid, False)
-
-
- # -------------------------------------------------------------------------
- # A menu item was selected
- # -------------------------------------------------------------------------
-
- def __item_selected(self, itemid):
-
- self._fire(self.__idmap[itemid])
Deleted: trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,163 +0,0 @@
-# GNU Enterprise Forms - QT3 UI driver - ToolBar
-#
-# Copyright 2001-2007 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 qt
-
-from gnue.forms.uidrivers._commonGuiToolkit import ToolBar as _Base
-
-__all__ = ['ToolBar']
-
-_ICON_CACHE = {}
-
-# =============================================================================
-# ToolBar widget
-# =============================================================================
-
-class ToolBar(_Base.ToolBar):
- """
- Implementation of the QT3 tool bar
- """
-
- # -------------------------------------------------------------------------
- # Initialize the toolbar
- # -------------------------------------------------------------------------
-
- def init(self):
- """
- Create a new tool bar
- @returns: the QToolBar instance
- """
-
- self.toolbar = qt.QToolBar(u_("Forms Toolbar"), self.container)
- self.toolbar.show()
- return self.toolbar
-
-
- # -------------------------------------------------------------------------
- # Add a menu item (action)
- # -------------------------------------------------------------------------
-
- def addAction(self, name, userAction):
- """
- Add an action to the toolbar
-
- @param name: name of the action
- @param userAction: userAction instance representing the action to add
- """
-
- action = Action(self, name, userAction)
- return action
-
-
- # -------------------------------------------------------------------------
- # Add a separator
- # -------------------------------------------------------------------------
-
- def addSeparator(self):
- self.toolbar.addSeparator()
-
-
- # -------------------------------------------------------------------------
- # Enable a menu item
- # -------------------------------------------------------------------------
-
- def enableItem(self, item):
- item.setEnabled(True)
-
- # -------------------------------------------------------------------------
- # Disable a menu item
- # -------------------------------------------------------------------------
-
- def disableItem(self, item):
- item.setEnabled(False)
-
- # -------------------------------------------------------------------------
- # Set a toggle action to 'on'
- # -------------------------------------------------------------------------
-
- def startingItem(self, item):
- item.setOn(True)
-
- # -------------------------------------------------------------------------
- # Set a toggle action to 'off'
- # -------------------------------------------------------------------------
-
- def endingItem(self, item):
- item.setOn(False)
-
-
-# =============================================================================
-# Action
-# =============================================================================
-
-class Action(qt.QAction):
- """
- Implementation of an action used within a toolbar
- """
-
- # -------------------------------------------------------------------------
- # Constructor
- # -------------------------------------------------------------------------
-
- def __init__(self, parent, name, user_action):
-
- qt.QAction.__init__(self, parent.toolbar)
-
- self.parent = parent
- self.user_action = user_action
-
- iconloc = user_action.getIconLocation(size="24x24")
-
- # Set the action icon if available
- if iconloc:
- icon = _ICON_CACHE.setdefault(iconloc,
- qt.QIconSet(qt.QPixmap(iconloc)))
- self.setIconSet(icon)
- else:
- print u_("** WARNING: Cannot add '%s' to toolbar; no icon") \
- % user_action.event
-
- self.setText(name)
- if user_action.canToggle:
- self.setToggleAction(True)
-
- self.setToolTip(user_action.description or '')
-
- self.connect(self, qt.SIGNAL('activated()'), self.__activated)
-
- self.addTo(parent.toolbar)
-
- # -------------------------------------------------------------------------
- # String representation
- # -------------------------------------------------------------------------
-
- def __repr__(self):
- return "<Action %s (%s)>" % (self.user_action.event,
- self.user_action.canToggle)
-
- # -------------------------------------------------------------------------
- # Slot Implementations
- # -------------------------------------------------------------------------
-
- def __activated(self):
- self.parent._fire(self.user_action, False)
Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -29,8 +29,6 @@
from gnue.common.apps import GConfig
from gnue.forms.uidrivers.qt3 import dialogs, QTApp
-from gnue.forms.uidrivers.qt3.MenuBar import MenuBar
-from gnue.forms.uidrivers.qt3.ToolBar import ToolBar
from gnue.forms.uidrivers.qt3.widgets._base import UIHelper
# =============================================================================
@@ -106,13 +104,6 @@
self.__status_bar = self.main_window.statusBar()
self.__setup_status_bar()
- if not self._form.findChildNamed('__main_menu__', 'GFMenu'):
- if not self._form._features['GUI:MENUBAR:SUPPRESS']:
- MenuBar(self._uiDriver, self.main_window, self._form)
-
- if not self._form._features['GUI:TOOLBAR:SUPPRESS']:
- tlb = ToolBar(self._uiDriver, self.main_window, self._form)
-
if self._form._layout.tabbed != 'none':
self._container = qt.QTabWidget(self.main_widget)
self._container.setTabPosition( \
Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/form/widget.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/form/widget.py 2007-03-12
08:23:23 UTC (rev 9436)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/form/widget.py 2007-03-12
08:46:52 UTC (rev 9437)
@@ -41,8 +41,6 @@
from gnue.forms.uidrivers.win32 import dialogs
from gnue.forms.uidrivers.win32.common import *
from gnue.forms.uidrivers.win32.widgets._base import UIHelper, Win32Window
-from gnue.forms.uidrivers.win32.MenuBar import MenuBar
-from gnue.forms.uidrivers.win32.ToolBar import ToolBar
import wrappers
# Constants for GetDeviceCaps
@@ -137,13 +135,6 @@
# Add Statusbar, Toolbar and Menubar as requested and/or allowed
if self._form.style != 'dialog':
- if not self._form.findChildNamed('__main_menu__', 'GFMenu'):
- if not self._form._features['GUI:MENUBAR:SUPPRESS']:
- MenuBar(self._uiDriver, self.mainWindow, self._form)
-
- if not self._form._features['GUI:TOOLBAR:SUPPRESS']:
- ToolBar(self._uiDriver, self.mainWindow, self._form)
-
if not self._form._features['GUI:STATUSBAR:SUPPRESS']:
hinst = win32api.GetModuleHandle(None)
style = win32con.WS_CHILD | win32con.WS_VISIBLE |
commctrl.SBARS_SIZEGRIP
Deleted: trunk/gnue-forms/src/uidrivers/wx/MenuBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/MenuBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx/MenuBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,112 +0,0 @@
-#
-# 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.
-#
-# Copyright 2000-2007 Free Software Foundation
-#
-# FILE:
-# wx/MenuBar.py
-#
-# DESCRIPTION:
-# A generic UIdriver base for common message-based GUI toolkits.
-#
-# NOTES:
-#
-
-import string
-from wxPython.wx import *
-from gnue.forms.uidrivers._commonGuiToolkit.MenuBar import MenuBar as
_BaseMenuBar
-from common import wxEncode
-
-class MenuBar(_BaseMenuBar):
-
- # Create the menu
- def init(self):
- self.menu = menu = wxMenuBar()
- self.container.SetMenuBar(menu)
- return menu
-
- # Add a (sub)menu
- def addMenu(self, name, parent):
- menu = wxMenu()
- id = wxNewId()
- if parent == self.menu:
- parent.Append(menu, wxEncode(name))
- else:
- parent.AppendMenu(id, wxEncode(name), menu)
-
- return menu
-
- # Add a menu item (action)
- # NOTE: the _skipHotKey attribute is specific to wx's MenuBar code.
- # it is an internal workaround to a GTK+wx i18n bug.
- def addAction(self, name, parent, userAction, _skipHotkey=0):
- label = name
- hotkey = userAction.getHotKeyText()
- iconloc = userAction.getIconLocation(size="16x16")
-
- if hotkey and not _skipHotkey:
- label += '\t%s' % hotkey
-
- id = wxNewId()
- item = wxMenuItem(parent, id, wxEncode(label),
- wxEncode(userAction.description) or '')
-
- # Set the action icon if available
- if iconloc:
- try:
- # Some caching logic for faster second/third forms
- icon = _cachedIcons[iconloc]
- except KeyError:
- icon = wxImage(iconloc, wxBITMAP_TYPE_PNG).ConvertToBitmap()
- _cachedIcons[iconloc] = icon
- try:
- item.SetBitmap(icon)
- except AttributeError:
- # Good ol' wx 2.2 address@hidden@#
- pass
-
- try:
- parent.AppendItem(item)
- except:
- # Some i18n installations of WX don't like our hotkeys!
- # Damn GTK piece of crap
- if _skipHotkey:
- raise
- self.addAction(name, parent, userAction, _skipHotkey=1)
- return
-
- parent.SetLabel(id, wxEncode(label))
-
- EVT_MENU(self.driver._wxapp, id,
- lambda event, u=userAction: self._fire(u))
-
- return item
-
- # Add a separator
- def addSeparator(self, parent):
- parent.AppendSeparator()
-
- # Enable a menu item
- def enableItem(self, item):
- item.Enable(1)
-
- # Disable a menu item
- def disableItem(self, item):
- item.Enable(0)
-
-_cachedIcons = {}
Deleted: trunk/gnue-forms/src/uidrivers/wx/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/ToolBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx/ToolBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,108 +0,0 @@
-#
-# 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.
-#
-# Copyright 2000-2007 Free Software Foundation
-#
-# FILE:
-# wx/ToolBar.py
-#
-# DESCRIPTION:
-# A generic UIdriver base for common message-based GUI toolkits.
-#
-# NOTES:
-#
-
-import string, sys
-from wxPython.wx import *
-from gnue.forms.uidrivers._commonGuiToolkit.ToolBar import ToolBar as
_BaseToolBar
-from common import wxEncode
-
-class ToolBar(_BaseToolBar):
-
- # Create the menu
- def init(self):
- if sys.platform == 'win32':
- toolbar = wxToolBar(self.container, -1)
- toolbar.SetToolBitmapSize(wxSize(24,24))
- else:
- toolbar = wxToolBar(self.container,-1,
style=wxTB_HORIZONTAL|wxTB_DOCKABLE)
- self.toolbar = toolbar
- self.container.SetToolBar(toolbar)
- return toolbar
-
- # Add a menu item (action)
- def addAction(self, name, userAction):
- label = name
- iconloc = userAction.getIconLocation(size="24x24")
-
- id = wxNewId()
-
- event = 'request%s' % userAction.event
- if userAction.canToggle:
- EVT_MENU(self.driver._wxapp, id,
- lambda event, u=userAction, i=id, s=self.toolbar.GetToolState: \
- self._fire(u, not s(i)))
- else:
- EVT_MENU(self.driver._wxapp, id,
- lambda event, u=userAction: self._fire(u, False))
-
- # Set the action icon if available
- if iconloc:
- try:
- # Some caching logic for faster second/third forms
- icon = _cachedIcons[iconloc]
- except KeyError:
- icon = wxImage(iconloc, wxBITMAP_TYPE_PNG).ConvertToBitmap()
- _cachedIcons[iconloc] = icon
- else:
- print "** WARNING: Cannot add '%s' to toolbar; no icon" %
userAction.event
- return
-
-
- result = self.toolbar.AddSimpleTool(id, icon,
- wxEncode(userAction.description) or '',
- isToggle=(userAction.canToggle and 1 or 0))
-
- self.toolbar.Realize()
- return result
-
-
- # Add a separator
- def addSeparator(self):
- self.toolbar.AddSeparator()
-
- # Enable a menu item
- def enableItem(self, item):
- if item != None:
- self.toolbar.EnableTool(item.GetId(), 1)
-
- # Disable a menu item
- def disableItem(self, item):
- if item != None:
- self.toolbar.EnableTool(item.GetId(), 0)
-
- def startingItem(self, item):
- if item!=None:
- self.toolbar.ToggleTool(item.GetId(),1)
-
- def endingItem(self, item):
- if item!=None:
- self.toolbar.ToggleTool(item.GetId(),0)
-
-
-_cachedIcons = {}
Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/form/widget.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/widgets/form/widget.py 2007-03-12
08:23:23 UTC (rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx/widgets/form/widget.py 2007-03-12
08:46:52 UTC (rev 9437)
@@ -35,9 +35,6 @@
import wrappers
-from gnue.forms.uidrivers.wx.MenuBar import MenuBar
-from gnue.forms.uidrivers.wx.ToolBar import ToolBar
-
from gnue.forms.uidrivers.wx.PrintForm import printForm
@@ -126,16 +123,6 @@
newWidget = self._wrapper.pane
self._container = newWidget
- if self._form.style != 'dialog':
- if not self._form.findChildNamed('__main_menu__', 'GFMenu'):
- # Add the menu
- if not self._form._features['GUI:MENUBAR:SUPPRESS']:
- MenuBar(self._uiDriver, self.containerFrame, self._form)
-
- # and the Toolbar
- if not self._form._features['GUI:TOOLBAR:SUPPRESS']:
- ToolBar(self._uiDriver, self.containerFrame, self._form)
-
self._eventHandler = event.eventHandler
self._wrapper.finalize()
Deleted: trunk/gnue-forms/src/uidrivers/wx26/MenuBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/MenuBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx26/MenuBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,141 +0,0 @@
-# GNU Enterprise Forms - wx 2.6 UI Driver - Menubar
-#
-# Copyright 2001-2007 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._commonGuiToolkit import MenuBar as _Base
-
-# =============================================================================
-# Constants
-# =============================================================================
-
-_ICON_CACHE = {}
-
-# =============================================================================
-# Implementation of a Menubar using wx 2.6
-# =============================================================================
-
-class MenuBar (_Base.MenuBar):
-
-
- # ---------------------------------------------------------------------------
- # Create the main menu
- # ---------------------------------------------------------------------------
-
- def init (self):
- """
- Create a new menu bar and attach it to the bound container
-
- @return: the wx.MenuBar instance created
- """
-
- self.menubar = wx.MenuBar ()
- self.container.SetMenuBar (self.menubar)
-
- return self.menubar
-
-
- # ---------------------------------------------------------------------------
- # Add a new menu to a given parent
- # ---------------------------------------------------------------------------
-
- def addMenu (self, name, parent):
- """
- Add another menu to the given parent menu or menubar.
-
- @param name: name of the menu
- @param parent: parent menu or menubar to append the new menu to
-
- @result: newly created menu
- """
-
- result = wx.Menu ()
- if parent == self.menubar:
- parent.Append (result, name)
- else:
- parent.AppendMenu (wx.ID_ANY, name, result)
-
- return result
-
-
- # ---------------------------------------------------------------------------
- # Add a menu item to a given menu
- # ---------------------------------------------------------------------------
-
- def addAction (self, name, parent, userAction):
- """
- Add a new menu item to a given menu.
-
- @param name: name of the menu item
- @param parent: menu to add this new item to
- @param userAction: userAction instance representing the new menu item
-
- @returns: the newly created menu item
- """
-
- hotkey = userAction.getHotKeyText ()
- iconloc = userAction.getIconLocation (size = "16x16")
- label = hotkey and "%s\t%s" % (name, hotkey) or name
- help = userAction.description
-
- result = wx.MenuItem (parent, wx.ID_ANY, label, help)
-
- if iconloc:
- icon = _ICON_CACHE.setdefault (iconloc, wx.Image (iconloc,
- wx.BITMAP_TYPE_PNG).ConvertToBitmap ())
-
- result.SetBitmap (icon)
-
- wx.EVT_MENU (wx.GetApp (), result.GetId (),
- lambda event, u = userAction: self._fire (u))
-
- parent.AppendItem (result)
-
- return result
-
-
- # ---------------------------------------------------------------------------
- # Add a separator to the given parent menu
- # ---------------------------------------------------------------------------
-
- def addSeparator (self, parent):
-
- parent.AppendSeparator ()
-
-
- # ---------------------------------------------------------------------------
- # Enable a given menu item
- # ---------------------------------------------------------------------------
-
- def enableItem (self, item):
-
- item.Enable (True)
-
-
- # ---------------------------------------------------------------------------
- # Disable a given menu item
- # ---------------------------------------------------------------------------
-
- def disableItem (self, item):
-
- item.Enable (False)
Deleted: trunk/gnue-forms/src/uidrivers/wx26/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/ToolBar.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx26/ToolBar.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -1,191 +0,0 @@
-# GNU Enterprise Forms - wx 2.6 UI Driver - Toolbar
-#
-# Copyright 2001-2007 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._commonGuiToolkit import ToolBar as _Base
-
-# =============================================================================
-# Constants
-# =============================================================================
-
-_ICON_CACHE = {}
-
-
-# =============================================================================
-# Toolbar widget
-# =============================================================================
-
-class ToolBar (_Base.ToolBar):
- """
- wx 2.6 implementation of the generic toolbar.
- """
-
-
- # ---------------------------------------------------------------------------
- # Create the toolbar
- # ---------------------------------------------------------------------------
-
- def init (self):
- """
- Create a new toolbar.
-
- @returns: the newly created toolbar
- """
-
- # Make sure to disable the color-remapping in windows
- wx.SystemOptions.SetOption ('msw.remap', '0')
-
- self.toolbar = self.container.CreateToolBar()
- self.toolbar.SetToolBitmapSize ((24, 24))
-
- return self.toolbar
-
-
- # ---------------------------------------------------------------------------
- # Add an action to the toolbar
- # ---------------------------------------------------------------------------
-
- def addAction (self, name, userAction):
- """
- Add an action to the toolbar.
-
- @param name: name of the action
- @param userAction: userAction instance representing the action to add
-
- @returns: wx.ToolBarBaseTool instance with the added tool
- """
-
- label = name
- iconloc = userAction.getIconLocation (size = "24x24")
- event = 'request%s' % userAction.event
-
- if iconloc:
- icon = _ICON_CACHE.setdefault (iconloc, wx.Image (iconloc,
- wx.BITMAP_TYPE_PNG).ConvertToBitmap ())
-
- else:
- print u_("** WARNING: Cannot add '%s' to toolbar; no icon") \
- % userAction.event
- return
-
- descr = userAction.description and userAction.description or ''
- flags = userAction.canToggle and 1 or 0
-
- result = self.toolbar.AddSimpleTool (wx.ID_ANY, icon, descr, isToggle =
- flags)
- result.SetClientData (userAction)
-
- wx.EVT_TOOL (self.toolbar, result.GetId (), self.__clickEvent)
-
- return result
-
-
- # ---------------------------------------------------------------------------
- # Event processed on selecting a tool
- # ---------------------------------------------------------------------------
-
- def __clickEvent (self, event):
-
- item = self.toolbar.FindById (event.GetId ())
- action = item.GetClientData ()
-
- self._fire(action, action.canToggle \
- and not self.toolbar.GetToolState(item.GetId()))
-
-
-
- # ---------------------------------------------------------------------------
- # Finalize the toolbar creation process
- # ---------------------------------------------------------------------------
-
- def finalize (self):
- """
- After building the toolbar, make sure to realize all added tools
- """
-
- _Base.ToolBar.finalize (self)
- self.toolbar.Realize ()
-
-
- # ---------------------------------------------------------------------------
- # Add a separator to the toolbar
- # ---------------------------------------------------------------------------
-
- def addSeparator (self):
- """
- Add a separator to the toolbar
- """
-
- self.toolbar.AddSeparator ()
-
-
- # ---------------------------------------------------------------------------
- # Enable toolbar item
- # ---------------------------------------------------------------------------
-
- def enableItem (self, item):
- """
- Enable a toolbar item
- """
-
- if item is not None:
- self.toolbar.EnableTool (item.GetId (), True)
-
- # ---------------------------------------------------------------------------
- # Disable toolbar item
- # ---------------------------------------------------------------------------
-
- def disableItem (self, item):
- """
- Disable a toolbar item
- """
-
- if item is not None:
- self.toolbar.EnableTool (item.GetId (), False)
-
-
- # ---------------------------------------------------------------------------
- # Check a toggle button
- # ---------------------------------------------------------------------------
-
- def startingItem (self, item):
- """
- Check a toogle item in the toolbar
- """
-
- if item is not None:
- self.toolbar.ToggleTool (item.GetId (), True)
-
-
- # ---------------------------------------------------------------------------
- # Uncheck a toggle button
- # ---------------------------------------------------------------------------
-
- def endingItem (self, item):
- """
- Uncheck a toogle item in the toolbar
- """
-
- if item is not None:
- self.toolbar.ToggleTool (item.GetId (), False)
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-03-12 08:23:23 UTC
(rev 9436)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-03-12 08:46:52 UTC
(rev 9437)
@@ -31,8 +31,6 @@
from gnue.common.apps import GConfig
from gnue.forms import VERSION
from gnue.forms.uidrivers.wx26 import dialogs
-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
__all__ = ['UIForm']
@@ -161,13 +159,6 @@
self.__status_bar.SetFieldsCount(5)
self.__status_bar.SetStatusWidths([-1, 50, 50, 75, 75])
- if not self._form.findChildNamed('__main_menu__', 'GFMenu'):
- if not self._form._features.get('GUI:MENUBAR:SUPPRESS'):
- MenuBar(self._uiDriver, self.main_window, self._form)
-
- if not self._form._features.get ('GUI:TOOLBAR:SUPPRESS'):
- tlb = ToolBar(self._uiDriver, self.main_window, self._form)
-
# If the form is using tabs, we need to create a Notebook control as
# page container, otherwise we can just use the base panel
if self._form._layout.tabbed != 'none':
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9437 - in trunk/gnue-forms/src/uidrivers: gtk2 gtk2/widgets/form qt3 qt3/widgets win32/widgets/form wx wx/widgets/form wx26 wx26/widgets,
reinhard <=