[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/designer/src Designer.py Instance.py MenuB...
From: |
Jason Cater |
Subject: |
gnue/designer/src Designer.py Instance.py MenuB... |
Date: |
Mon, 22 Jul 2002 14:38:41 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/07/22 14:38:41
Modified files:
designer/src : Designer.py Instance.py MenuBar.py
designer/src/forms: TemplateSupport.py __init__.py
designer/src/forms/wizards: AddDropDown.py
designer/src/navigator: __init__.py
designer/src/schema: __init__.py
Added files:
designer/src/forms/wizards: AddEntry.py
Log message:
reworked menubar support so toolbar buttons can be mapped to menus;
fixed the Instance import problem; misc other fixes
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/Designer.py.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/Instance.py.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/MenuBar.py.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/TemplateSupport.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/__init__.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/wizards/AddEntry.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/wizards/AddDropDown.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/navigator/__init__.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/schema/__init__.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/designer/src/Designer.py
diff -c gnue/designer/src/Designer.py:1.49 gnue/designer/src/Designer.py:1.50
*** gnue/designer/src/Designer.py:1.49 Mon Jul 22 00:09:40 2002
--- gnue/designer/src/Designer.py Mon Jul 22 14:38:41 2002
***************
*** 245,251 ****
alltypes.append(type)
# Keep a dict of Extension::Handler mappings
! self.toolExtensionMapping[type] = string.split(tool.__name__,'.')[-1]
--- 245,251 ----
alltypes.append(type)
# Keep a dict of Extension::Handler mappings
! self.toolExtensionMapping[type] = tool.properties.module
***************
*** 282,288 ****
# Create a new instance
#
def newInstance(self, module, *args, **parms):
! c = dyn_import("gnue.designer.%s.%s" % (module, 'Instance')).Instance
return c(self, *args, **parms)
--- 282,288 ----
# Create a new instance
#
def newInstance(self, module, *args, **parms):
! c = dyn_import("gnue.designer.%s.Instance" % module).Instance
return c(self, *args, **parms)
Index: gnue/designer/src/Instance.py
diff -c gnue/designer/src/Instance.py:1.59 gnue/designer/src/Instance.py:1.60
*** gnue/designer/src/Instance.py:1.59 Fri Jul 19 19:21:12 2002
--- gnue/designer/src/Instance.py Mon Jul 22 14:38:41 2002
***************
*** 392,398 ****
def OnNew(self, event):
! self._app.newInstance(self._fileNewMap[event.GetId()].__name__)
def OnSave(self, event):
--- 392,398 ----
def OnNew(self, event):
! self._app.newInstance(self._fileNewMap[event.GetId()])
def OnSave(self, event):
Index: gnue/designer/src/MenuBar.py
diff -c gnue/designer/src/MenuBar.py:1.27 gnue/designer/src/MenuBar.py:1.28
*** gnue/designer/src/MenuBar.py:1.27 Fri Jul 19 19:21:12 2002
--- gnue/designer/src/MenuBar.py Mon Jul 22 14:38:41 2002
***************
*** 40,45 ****
--- 40,46 ----
# Keep track of user-installed + sys-installed wizards/tools
self._menuMappings = {}
+ self._eventMappings = {}
# So we can honor the module's requested order for the tool menu
self._toolMenuOrder = []
***************
*** 78,83 ****
--- 79,88 ----
ID_PASTE = wxNewId()
ID_PASTE_SPECIAL = wxNewId()
ID_DELETE = wxNewId()
+
+ # Project menu
+ ID_NEW_PROJECT = wxNewId()
+ ID_OPEN_PROJECT = wxNewId()
# Debug menu
ID_RUN = wxNewId()
***************
*** 114,139 ****
self._file.Append(ID_EXIT, _("E&xit"), _("Exit GNUe Designer"))
! EVT_MENU (frame, ID_NEW_WIZARD, frame._app.OnWizard)
! EVT_MENU (frame, ID_OPEN, frame._app.OnOpen)
! EVT_MENU (frame, ID_SAVE, frame.OnSave)
! EVT_MENU (frame, ID_SAVE_AS, frame.OnSaveAs)
! EVT_MENU (frame, ID_SAVE_ALL, frame._app.OnSaveAll)
! EVT_MENU (frame, ID_CLOSE, frame.OnClose)
! EVT_MENU (frame, ID_EXIT, frame._app.OnExit)
! # Set up out MRU list
frame._app.mru.addMenu(self._fileRecent, frame)
frame._fileNewMap = {}
for tool in SupportedTools:
id = wxNewId()
! frame._fileNewMap[id] = tool
self._fileNew.Append(id, '&%s' % tool.properties.nickname,
_('Create a new %s') % string.lower(tool.properties.nickname))
! EVT_MENU (frame, id, frame.OnNew)
!
## self._fileNew.Append(ID_NEW_FORM,_('&Form'), _("Create a new form"))
## self._fileNew.Append(ID_NEW_REPORT,_('&Report'), _("Create a new
report"))
--- 119,144 ----
self._file.Append(ID_EXIT, _("E&xit"), _("Exit GNUe Designer"))
! self.__addMenuEvent('File|New|Wizard', ID_NEW_WIZARD,
frame._app.OnWizard)
! self.__addMenuEvent('File|Open', ID_OPEN, frame._app.OnOpen)
! self.__addMenuEvent('File|Save', ID_SAVE, frame.OnSave)
! self.__addMenuEvent('File|Save As', ID_SAVE_AS, frame.OnSaveAs)
! self.__addMenuEvent('File|Save All', ID_SAVE_ALL, frame._app.OnSaveAll)
! self.__addMenuEvent('File|Close', ID_CLOSE, frame.OnClose)
! self.__addMenuEvent('File|Exit', ID_EXIT, frame._app.OnExit)
! # Set up our MRU list
frame._app.mru.addMenu(self._fileRecent, frame)
frame._fileNewMap = {}
for tool in SupportedTools:
id = wxNewId()
! frame._fileNewMap[id] = tool.properties.module
self._fileNew.Append(id, '&%s' % tool.properties.nickname,
_('Create a new %s') % string.lower(tool.properties.nickname))
! self.__addMenuEvent('File|New|%s' % tool, id, frame.OnNew)
!
## self._fileNew.Append(ID_NEW_FORM,_('&Form'), _("Create a new form"))
## self._fileNew.Append(ID_NEW_REPORT,_('&Report'), _("Create a new
report"))
***************
*** 147,159 ****
id = wxNewId()
self._fileConnect.Append(id, conn, _("Login to %s connection") % conn)
frame.connectionMap[id] = conn
! EVT_MENU(frame, id, frame.OnConnectTo)
self._file.Enable(ID_RELOAD,0)
self._help = wxMenu()
self._help.Append(ID_ABOUT, _("&About..."), _("More information about
GNUe Designer"))
! EVT_MENU (frame, ID_ABOUT, frame._app.OnAbout)
self._edit = wxMenu()
self._edit.Append(ID_CUT, _("C&ut"), _("Cut the current object and move
to the clipboard"))
--- 152,165 ----
id = wxNewId()
self._fileConnect.Append(id, conn, _("Login to %s connection") % conn)
frame.connectionMap[id] = conn
! self.__addMenuEvent('File|Connect To|%s' % conn, id, frame.OnConnectTo)
!
self._file.Enable(ID_RELOAD,0)
self._help = wxMenu()
self._help.Append(ID_ABOUT, _("&About..."), _("More information about
GNUe Designer"))
! self.__addMenuEvent('Help|About', ID_ABOUT, frame._app.OnAbout)
self._edit = wxMenu()
self._edit.Append(ID_CUT, _("C&ut"), _("Cut the current object and move
to the clipboard"))
***************
*** 171,176 ****
--- 177,186 ----
self._edit.Enable(ID_DELETE,0)
+ # TODO: Implement projects
+ self._project = wxMenu()
+
+
self._tools = wxMenu()
for location in self._toolMenuOrder:
***************
*** 183,207 ****
tool.tooltip, tool.checkable)
tool.menu = menu
self._tools.AppendItem(menu)
! EVT_MENU(frame, tool.wxId, tool.run)
tool.finalize()
!
self._tools.AppendSeparator()
self._debug = wxMenu()
self._debug.Append(ID_RUN, _('&Run'), _("Run the current form"))
! EVT_MENU (frame, ID_RUN, frame.OnDebugRun)
menumap = { '': (self, {}),
'File': (self._file,{}),
'File|New': (self._fileNew,{}),
'Edit': (self._edit,{}),
'Debug': (self._debug,{}),
'Tools': (self._tools,{}),
'Help': (self._help, {})}
! basemenuorder = ['File','Edit','Debug','Tools']
for location in self._menuMappings.keys():
last = None
--- 193,219 ----
tool.tooltip, tool.checkable)
tool.menu = menu
self._tools.AppendItem(menu)
! self.__addMenuEvent('%s|%s' % (location, tool.title),
! tool.wxId, tool.run)
tool.finalize()
!
self._tools.AppendSeparator()
self._debug = wxMenu()
self._debug.Append(ID_RUN, _('&Run'), _("Run the current form"))
! self.__addMenuEvent('Debug|Run', ID_RUN, frame.OnDebugRun)
menumap = { '': (self, {}),
'File': (self._file,{}),
'File|New': (self._fileNew,{}),
'Edit': (self._edit,{}),
+ 'Project': (self._project,{}),
'Debug': (self._debug,{}),
'Tools': (self._tools,{}),
'Help': (self._help, {})}
! basemenuorder = ['File','Edit','Debug','Project', 'Tools']
for location in self._menuMappings.keys():
last = None
***************
*** 239,245 ****
# Data is a location pointer
wizard = self._menuMappings[data]
menu.Append(wizard.wxId, wizard.title, wizard.tooltip)
! EVT_MENU(frame, wizard.wxId, wizard.run)
# Add the Help menu
--- 251,258 ----
# Data is a location pointer
wizard = self._menuMappings[data]
menu.Append(wizard.wxId, wizard.title, wizard.tooltip)
! self.__addMenuEvent('%s|%s' % (location, wizard.title),
! wizard.wxId, wizard.run)
# Add the Help menu
***************
*** 254,259 ****
--- 267,281 ----
pass
+ def __addMenuEvent(self, location, wxId, method):
+ self._eventMappings[location] = method
+ EVT_MENU(self._frame, wxId, method)
+
+
+ def simulateMenuEvent(self, location):
+ self._eventMappings[location](None)
+
+
def addTool(self, toolFrame, title):
location = 'Tools|%s' % title
***************
*** 261,267 ****
self._toolMenuOrder.append(location)
return self._menuMappings[location]
!
#
# Convenience methods to make the main menu bar appear to be a menu
container
#
--- 283,289 ----
self._toolMenuOrder.append(location)
return self._menuMappings[location]
!
#
# Convenience methods to make the main menu bar appear to be a menu
container
#
Index: gnue/designer/src/forms/TemplateSupport.py
diff -c gnue/designer/src/forms/TemplateSupport.py:1.1
gnue/designer/src/forms/TemplateSupport.py:1.2
*** gnue/designer/src/forms/TemplateSupport.py:1.1 Fri Jun 28 00:03:38 2002
--- gnue/designer/src/forms/TemplateSupport.py Mon Jul 22 14:38:41 2002
***************
*** 44,49 ****
class FormTemplate(TemplateBase):
# Initialize user code
! def Start(self, form):
pass
--- 44,82 ----
class FormTemplate(TemplateBase):
# Initialize user code
! def Start(self, root, current):
pass
+
+
+
+ ###########################################################
+ #
+ # Base class for a form template which first lets user
+ # "pick" a position/size.
+ #
+ # Wizards using this template should not use the Start()
+ # initialization methods, but instead should use the
+ # StartWithPositioning().
+ #
+ ###########################################################
+ class FormPrePositioningTemplate(FormTemplate):
+
+ # Initialize user code
+ def Start(self, root, current):
+ # __pos is set in __init__ (by passed values)
+ return self.StartWithPositioning(root, current,
+ **self.__pos)
+
+
+ def StartWithPositioning(self, root, current, x=0, y=0, width=10, height=1):
+ pass
+
+
+ def __init__(self, *args, **params):
+ # The form LayoutEditor passes the _pos_ information for us...
+ if params.has_key('_pos_'):
+ self.__pos = params['_pos_']
+ del params['_pos_']
+ FormTemplate.__init__(self, *args, **params)
+
Index: gnue/designer/src/forms/__init__.py
diff -c gnue/designer/src/forms/__init__.py:1.7
gnue/designer/src/forms/__init__.py:1.8
*** gnue/designer/src/forms/__init__.py:1.7 Fri Jun 28 00:03:38 2002
--- gnue/designer/src/forms/__init__.py Mon Jul 22 14:38:41 2002
***************
*** 34,39 ****
--- 34,40 ----
class FormToolProperties: #(_BaseInstance.ToolProperties):
+ module = 'forms'
application = 'GNUe Forms'
nickname = 'Form'
description = 'GNUe Form Definition'
Index: gnue/designer/src/forms/wizards/AddDropDown.py
diff -c gnue/designer/src/forms/wizards/AddDropDown.py:1.1
gnue/designer/src/forms/wizards/AddDropDown.py:1.2
*** gnue/designer/src/forms/wizards/AddDropDown.py:1.1 Tue Jul 9 00:03:45 2002
--- gnue/designer/src/forms/wizards/AddDropDown.py Mon Jul 22 14:38:41 2002
***************
*** 0 ****
--- 1,151 ----
+ #
+ # 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 2001-2002 Free Software Foundation
+ #
+ # FILE:
+ # forms/wizards/AddDropdown.py
+ #
+ # DESCRIPTION:
+ # Implements a basic form template
+ #
+ # NOTES:
+ # While functional, the primary purpose of this wizard is
+ # as a "learning-by-example" tool.
+
+
+ from gnue.designer.forms.TemplateSupport import *
+ from gnue.designer import VERSION
+ import string
+
+ #
+ # Steps
+ #
+ # 0. Get Title Goto step 1
+ # 1. Select Connection Goto step 2
+ # 2. Select Table Goto step 3
+ # 3. Select Fields Goto step 4 or 7
+ # 4. Select Master Goto step 5
+ # 5. Select Master Keys Goto step 6
+ # 6. Select Detail Keys Goto step 7
+ # 7. Add another? Goto step 1,2, or 8
+ # 8. Complete.
+ #
+
+
+ class AddDropDownWizard(FormPrePositioningTemplate):
+
+
+ # The first step in our wizard.
+ # The template parser will initially
+ # call GetStep(FIRST_STEP).
+ FIRST_STEP = '0'
+
+
+ ###############
+ #
+ # Initialize any runtime variables
+ #
+ def StartWithPositioning(self, root, current,
+ x=0, y=0, width=10, height=1):
+ self.form = root
+ self.current = current
+ self.x = x
+ self.y = y
+ self.width = 10
+ self.height = 1
+
+
+
+ ###############
+ #
+ # Return the markup for a specific page
+ #
+ def GetStep(self, step):
+
+ #
+ # Step #0 / Get Name
+ #
+ if step == '0':
+
+ content = [WizardText('This will insert a new page.'),
+ WizardInput('name',label='Object Name:',required=1,size=20)]
+
+ if hasattr(self.form,'tabbed') and self.form.tabbed:
+ content.append(WizardInput('caption', label='Tab Caption: ',
required=1,
+ size=20))
+
+ return { 'title': 'Add Page',
+ 'content': content,
+ 'prev': None,
+ 'next': None }
+
+
+
+ ###############
+ #
+ # Verify contents of current step
+ # Return None if no problems, otherwise
+ # return a tuple of error message strings
+ #
+ def ValidateStep(self, stepCode):
+
+ # The Simple wizard uses basic "required"
+ # settings in the page markup, so doesn't
+ # need any special validation.
+ return None
+
+
+
+ ###############
+ #
+ # We have all the data, so generate our form. This
+ # is called after the user clicks the "Finish" button.
+ # No more user input is allowed at this point.
+ #
+ def Finalize(self):
+
+ attrs = {'name': self.variables['name'] or 'Dropdown_1'}
+
+ try:
+ attrs['caption'] = self.variables['caption'] or 'New Tab'
+ except KeyError:
+ pass
+
+ page = self.AddElement('page', self.form, attrs)
+
+ return 1
+
+
+
+
+ ############
+ #
+ # Basic information about this template
+ #
+ TemplateInformation = {
+ 'Product': 'forms',
+ 'BaseClass' : AddDropDownWizard,
+ 'Name' : 'Add Bound Drop Down',
+ 'Description' : 'Inserts a bound dropdown',
+ 'Version' : VERSION,
+ 'Author' : 'The GNUe Designer Team',
+ 'Behavior': WIZARD,
+ 'Location' : 'Tools|Insert|Drop Down Entry'
+ }
+
Index: gnue/designer/src/navigator/__init__.py
diff -c gnue/designer/src/navigator/__init__.py:1.4
gnue/designer/src/navigator/__init__.py:1.5
*** gnue/designer/src/navigator/__init__.py:1.4 Tue Jan 22 14:19:15 2002
--- gnue/designer/src/navigator/__init__.py Mon Jul 22 14:38:41 2002
***************
*** 36,41 ****
--- 36,42 ----
class NavigatorToolProperties: #(_BaseInstance.ToolProperties):
+ module = 'navigator'
application = 'GNUe Navigator'
nickname = 'Navigation'
description = 'GNUe Process Definition'
Index: gnue/designer/src/schema/__init__.py
diff -c gnue/designer/src/schema/__init__.py:1.1
gnue/designer/src/schema/__init__.py:1.2
*** gnue/designer/src/schema/__init__.py:1.1 Thu Jun 27 18:48:18 2002
--- gnue/designer/src/schema/__init__.py Mon Jul 22 14:38:41 2002
***************
*** 31,36 ****
--- 31,37 ----
class SchemaToolProperties:
+ module = 'schema'
application = 'GNUe Schema'
nickname = 'Schema'
description = 'GNUe Schema Definition'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/designer/src Designer.py Instance.py MenuB...,
Jason Cater <=