[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/designer/src/forms/wizards AddBlock.py Add...
From: |
Jason Cater |
Subject: |
gnue/designer/src/forms/wizards AddBlock.py Add... |
Date: |
Fri, 16 Aug 2002 00:51:14 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/08/16 00:51:13
Modified files:
designer/src/forms/wizards: AddBlock.py AddDataSource.py
AddDropDown.py CreateSchema.py
Added files:
designer/src/forms/wizards: AddBox.py AddLabel.py
Log message:
fixed the mouse hanging issue with wizards; started wizard validation;
implemented several new plug-ins for forms; added wrapped-text support to the
wizard page drawing code; misc wizard fixes
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/AddBox.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/AddLabel.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/AddBlock.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/AddDataSource.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/AddDropDown.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/wizards/CreateSchema.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gnue/designer/src/forms/wizards/AddBlock.py
diff -c gnue/designer/src/forms/wizards/AddBlock.py:1.1
gnue/designer/src/forms/wizards/AddBlock.py:1.2
*** gnue/designer/src/forms/wizards/AddBlock.py:1.1 Tue Jul 9 00:03:45 2002
--- gnue/designer/src/forms/wizards/AddBlock.py Fri Aug 16 00:51:12 2002
***************
*** 0 ****
--- 1,79 ----
+ #
+ # 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/AddBlock.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
+
+
+ class AddBlockWizard(FormTemplate):
+
+
+
+ ###############
+ #
+ # Initialize any runtime variables
+ #
+ def Start(self, root, current):
+ self.form = root
+ self.current = current
+
+
+ ###############
+ #
+ # We have all the data, so generate our widget.
+ #
+ def Finalize(self):
+
+
+ # Find or create parent block...
+ page = self.current.findParentOfType('GFPage')
+ block = self.AddElement('block', page)
+
+ return 1
+
+
+
+ ############
+ #
+ # Basic information about this template
+ #
+ TemplateInformation = {
+ 'Product': 'forms',
+ 'BaseClass' : AddBlockWizard,
+ 'Name' : 'Add Block',
+ 'Description' : 'Inserts a Block',
+ 'Version' : VERSION,
+ 'Author' : 'The GNUe Designer Team',
+ 'Behavior': TEMPLATE,
+ 'Location' : 'Tools|Insert|Block'
+ }
+
Index: gnue/designer/src/forms/wizards/AddDataSource.py
diff -c gnue/designer/src/forms/wizards/AddDataSource.py:1.1
gnue/designer/src/forms/wizards/AddDataSource.py:1.2
*** gnue/designer/src/forms/wizards/AddDataSource.py:1.1 Tue Jul 9
00:03:45 2002
--- gnue/designer/src/forms/wizards/AddDataSource.py Fri Aug 16 00:51:12 2002
***************
*** 0 ****
--- 1,178 ----
+ #
+ # 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/AddDataSource.py
+ #
+ # DESCRIPTION:
+ # Add a DataSource entry to a form, creating any datasources if necessary.
+ #
+ # 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 id/field/[Existing Datasource/New Datasource /Static Set]
+ # 1. Select / create datasource
+ #
+
+ class AddDataSourceWizard(FormTemplate):
+
+
+ # The first step in our wizard.
+ # The template parser will initially
+ # call GetStep(FIRST_STEP).
+ FIRST_STEP = '0'
+
+
+ ###############
+ #
+ # Initialize any runtime variables
+ #
+ def Start(self, root, current):
+ self.form = root
+ self.current = current
+ self.__getExistingDatasources()
+
+
+ ###############
+ #
+ # Return the markup for a specific page
+ #
+ def GetStep(self, stepCode):
+
+ #
+ # Step #1 / Get Title, et al
+ #
+ if stepCode == '0':
+
+ if self.__firstConnection:
+ self.variables['connection'] == self.__firstConnection
+
+ return { 'title': 'Add DataSource',
+ 'content': (WizardText('To create your DataSource, I need to
know some basic information.\n\n'
+ 'What connection should this form use
to connect to the \ndatabase?'),
+ WizardInput('connection',label='Connection:',
required=1,
+ set=self.GetAvailableConnections()),
+ WizardText('You may be asked to login to this
connection.')),
+ 'prev': None,
+ 'next': '1' }
+
+ #
+ # Step #2 [New Datasource] / Get Table
+ #
+ elif stepCode == '1':
+ return { 'title': 'Select Validator Table/Source',
+ 'content': (WizardText('Now, please select the table the
DataSource will\nuse to populate its data set.'),
+ WizardInput('table', label='Table:', required=1,
lines=5,
+
set=self.GetAvailableSources(self.variables['connection'])), ),
+ 'prev': '0',
+ 'next': '2' }
+
+
+ #
+ # Step #3 [New Datasouce] / Get key/description fields
+ #
+ elif stepCode == '2':
+
+ if not hasattr (self.variables,'name'):
+ self.variables['name'] = 'dts_%s' % self.variables['table']
+
+ return { 'title': 'Select Key/Description fields',
+ 'content': (WizardText('What shall I call this datasource?'),
+ WizardInput('name', label='Name:', required=1)),
+ 'prev': '1',
+ 'next': None }
+
+
+ ###############
+ #
+ # Verify contents of current step
+ # Return None if no problems, otherwise
+ # return a tuple of error message strings
+ #
+ def ValidateStep(self, stepCode):
+
+ # TODO: This should validate step 1:fixed to verify the dataset is valid
+ 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):
+
+ #
+ # Set up or retrieve our datasource
+ #
+
+ # Create new datasource
+ datasource = self.AddElement('datasource', self.form,
+ { 'name': self.variables['name'],
+ 'database': self.variables['connection'],
+ 'table': self.variables['table'] } )
+
+
+ return 1
+
+
+ ###############
+ #
+ # Internal stuff
+ # Get a list of all existing datasources
+ #
+ def __getExistingDatasources(self):
+ self.__firstConnection = None
+ for child in self.form._children:
+ if child._type == 'GFDataSource' and hasattr(child,'table'):
+ if not self.__firstConnection:
+ self.__firstConnection = child.database
+ break
+
+
+
+
+
+ ############
+ #
+ # Basic information about this template
+ #
+ TemplateInformation = {
+ 'Product': 'forms',
+ 'BaseClass' : AddDataSourceWizard,
+ 'Name' : 'Add a new Data Source',
+ 'Description' : 'Inserts a new DataSource',
+ 'Version' : VERSION,
+ 'Author' : 'The GNUe Designer Team',
+ 'Behavior': WIZARD,
+ 'Location' : 'Tools|Insert|Datasource'
+ }
+
Index: gnue/designer/src/forms/wizards/AddDropDown.py
diff -c gnue/designer/src/forms/wizards/AddDropDown.py:1.5
gnue/designer/src/forms/wizards/AddDropDown.py:1.6
*** gnue/designer/src/forms/wizards/AddDropDown.py:1.5 Wed Aug 7 19:29:18 2002
--- gnue/designer/src/forms/wizards/AddDropDown.py Fri Aug 16 00:51:12 2002
***************
*** 60,67 ****
self.current = current
self.x = x
self.y = y
! self.width = 10
! self.height = 1
self.__getExistingDatasources()
--- 60,67 ----
self.current = current
self.x = x
self.y = y
! self.width = width
! self.height = height
self.__getExistingDatasources()
***************
*** 88,95 ****
self.variables['connection'] == self.__firstConnection
return { 'title': 'Add Dropdown Entry',
! 'content': (WizardText('To create your dropdown, I need to
know some\nbasic information. '
! 'First, what field will \nstore the
dropdown\'s value?'),
WizardInput('name', label='Field name:',
required=1,
size=40),
WizardText('Where will this dropdown pull its
data?'),
--- 88,95 ----
self.variables['connection'] == self.__firstConnection
return { 'title': 'Add Dropdown Entry',
! 'content': (WizardText('To create your dropdown, I need to
know some basic information. '
! 'First, what field will store the
dropdown\'s value?'),
WizardInput('name', label='Field name:',
required=1,
size=40),
WizardText('Where will this dropdown pull its
data?'),
***************
*** 267,283 ****
# Create the dropdown
#
! # TODO: Make sure self.current produces a Block
! self.AddElement('datasource', self.current.findChildOfType('GFBlock'),
{ 'name': 'fld%s' % self.variables['name'],
'field': self.variables['name'],
'x': self.x,
'y': self.y,
'width': self.width or 10,
'height': 1,
'fk_source': datasource.name,
! 'fk_key': key,
! 'fk_description': descr } )
return 1
--- 267,291 ----
# Create the dropdown
#
! # Make sure we find a Block
! block = self.current.findParentOfType('GFBlock')
! if not block:
! block =
self.current.findParentOfType('GFPage').findChildOfType('GFBlock')
! if not block:
! # Create a block
! block = self.AddElement('block',
self.current.findParentOfType('GFPage'))
!
! self.AddElement('entry', self.current.findChildOfType('GFBlock'),
{ 'name': 'fld%s' % self.variables['name'],
'field': self.variables['name'],
+ 'style': 'dropdown',
'x': self.x,
'y': self.y,
'width': self.width or 10,
'height': 1,
'fk_source': datasource.name,
! 'fk_key': keyfield,
! 'fk_description': descrfield } )
return 1
Index: gnue/designer/src/forms/wizards/CreateSchema.py
diff -c gnue/designer/src/forms/wizards/CreateSchema.py:1.8
gnue/designer/src/forms/wizards/CreateSchema.py:1.9
*** gnue/designer/src/forms/wizards/CreateSchema.py:1.8 Tue Jul 30 15:33:59 2002
--- gnue/designer/src/forms/wizards/CreateSchema.py Fri Aug 16 00:51:12 2002
***************
*** 95,102 ****
#
if step == '0':
! content = [WizardText('This will create a GNUe schema definition \n'+
! 'according to the needs of this form.\n\n'),
WizardInput('file',label='File Name:',required=1,size=20)]
return { 'title': 'Create Schema Definition',
--- 95,102 ----
#
if step == '0':
! content = [WizardText('This will create a GNUe schema definition '+
! 'according to the needs of this form.'),
WizardInput('file',label='File Name:',required=1,size=20)]
return { 'title': 'Create Schema Definition',
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/designer/src/forms/wizards AddBlock.py Add...,
Jason Cater <=