[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5052 - in trunk: gnue-common/module/base gnue-common/src gnue-common/sr
From: |
jcater |
Subject: |
r5052 - in trunk: gnue-common/module/base gnue-common/src gnue-common/src/apps gnue-common/src/formatting gnue-forms/src gnue-forms/src/GFObjects gnue-forms/src/uidrivers/wx |
Date: |
Thu, 29 Jan 2004 14:46:37 -0600 (CST) |
Author: jcater
Date: 2004-01-29 14:46:35 -0600 (Thu, 29 Jan 2004)
New Revision: 5052
Modified:
trunk/gnue-common/module/base/__init__.py
trunk/gnue-common/src/__init__.py
trunk/gnue-common/src/apps/GBaseApp.py
trunk/gnue-common/src/apps/GConfig.py
trunk/gnue-common/src/apps/__init__.py
trunk/gnue-common/src/formatting/GTypecast.py
trunk/gnue-forms/src/GFClient.py
trunk/gnue-forms/src/GFConfig.py
trunk/gnue-forms/src/GFDisplayHandler.py
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFInstance.py
trunk/gnue-forms/src/GFKeyMapper.py
trunk/gnue-forms/src/GFLibrary.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
trunk/gnue-forms/src/GFParser.py
trunk/gnue-forms/src/__init__.py
trunk/gnue-forms/src/uidrivers/wx/common.py
Log:
* Start of a basic code audit; cleaning up to make more readable
* Added typecast support to GConfig
* Added True/False constants for python versions that don't support it (2.1)
Modified: trunk/gnue-common/module/base/__init__.py
===================================================================
--- trunk/gnue-common/module/base/__init__.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-common/module/base/__init__.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -0,0 +1,34 @@
+#
+# 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-2004 Free Software Foundation
+#
+# FILE:
+# __init__.py
+#
+# DESCRIPTION:
+"""
+GNUe base module. All gnue.* modules depend on gnue.common, so import
gnue.<whatever>" will cause gnue.common.apps to be loaded. This sets up a GNUe
environment.
+"""
+#
+# NOTES:
+#
+
+
+# Init stuff like _() and True/False (for python <2.2)
+import gnue.common.apps as _init
Modified: trunk/gnue-common/src/__init__.py
===================================================================
--- trunk/gnue-common/src/__init__.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-common/src/__init__.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -18,9 +18,14 @@
#
# Copyright 2001-2004 Free Software Foundation
#
+# Description:
+"""
+GNUe Common is a set of python modules that provide a
+large amount of functionality usefull in many python
+programs.
+"""
-
#
# CREATING A RELEASE:
# 1. Change _version to be the current version number
@@ -33,12 +38,6 @@
-"""
-GNUe Common is a set of python modules that provide a
-large amount of functionality usefull in many python
-programs.
-"""
-
_version = (0,5,2)
_release = 1
Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-common/src/apps/GBaseApp.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -22,13 +22,13 @@
# GBaseApp.py
#
# DESCRIPTION:
-# Class that provides a basis for GNUe applications.
-#
-# NOTES:
-# Typically, this class will not be called; rather, a tool will
-# be a GClientApp or GServerApp.
-#
+"""
+Class that provides a basis for GNUe applications.
+Typically, this class will not be called; rather, a tool will
+be a GClientApp or GServerApp.
+"""
+
from gnue.common.apps import GConfig
#
# I18N, L10N support
@@ -103,36 +103,36 @@
# argument follows option?, default value,
# argument name, help message]
self._base_options = [
- [ 'version',None,'version',0,0, None,
+ [ 'version',None,'version',False,0, None,
_('Displays the version information for this program.') ],
- [ 'debug_level',None,'debug-level',1,0, "level",
+ [ 'debug_level',None,'debug-level',True,0, "level",
_('Enables debugging messages. Argument specifies the ') + \
_('level of messages to display (e.g., "--debug-level 5" displays
') + \
_('all debugging messages at level 5 or below.)') ],
- [ 'debug_file',None,'debug-file',1,None, "file",
+ [ 'debug_file',None,'debug-file',True,None, "file",
_('Sends all debugging messages to a specified file ') + \
_('(e.g., "--debug-file trace.log" sends all output to
"trace.log")') ],
- [ 'help', None, 'help', 0, None, None,
+ [ 'help', None, 'help', False, None, None,
_('Displays this help screen.') ],
- [ 'configuration_options', None, 'configuration-options', 0, None,
None,
+ [ 'configuration_options', None, 'configuration-options', True, None,
None,
_('Displays a list of valid configuration file entries, their
purpose, and their default values.') ],
- [ 'man_page', None, 'generate-man-page', 0, None, None,
+ [ 'man_page', None, 'generate-man-page', False, None, None,
_('Generates a groff-formatted man page as a file in the current
directory.') ],
- [ 'profile', None, 'profile', 0, None, None,
+ [ 'profile', None, 'profile', False, None, None,
_("Run Python's built-in profiler and display the resulting ") + \
_("run statistics.") ],
- [ 'debugger', None, 'interactive-debugger', 0, None, None,
+ [ 'debugger', None, 'interactive-debugger', False, None, None,
_("Run the app inside Python's built-in debugger ")],
]
if self.USE_DATABASE_OPTIONS:
self.USE_CONNECTIONS = 1
self._base_options += [
- [ 'username', 'u', 'username', 1, '', 'name',
+ [ 'username', 'u', 'username', True, '', 'name',
_('Username used to log into the database. Note that if '
'specified, this will be used for all databases. If not '
'supplied, the program will prompt for username.')],
- [ 'password', None, 'password', 1, '', 'passwd',
+ [ 'password', None, 'password', True, '', 'passwd',
_('Password used to log into the database. Note that if '
'specified, this will be used for all databases. If not '
'supplied, the program will prompt for password if needed.'
@@ -142,7 +142,7 @@
if self.USE_CONNECTIONS:
self._base_options += [
- [ 'connections', None, 'connections', 1, None, "loc",
+ [ 'connections', None, 'connections', True, None, "loc",
_('Specifies the location of the connection definition file. ') + \
_('<loc> may specify a file name ') + \
'(/usr/local/gnue/etc/connections.conf),' + \
@@ -260,7 +260,7 @@
lang = [locale.getdefaultlocale()[0]]
global catalog, textEncoding
catalog =
gettext.translation('gnue',paths.data+'/share/locale',languages=lang)
- catalog.install(unicode=1)
+ catalog.install(unicode=True)
textEncoding = gConfig('textEncoding')
if not catalog.charset():
raise InvalidFormatError, "Translation file is badly formatted for
unicode operation"
Modified: trunk/gnue-common/src/apps/GConfig.py
===================================================================
--- trunk/gnue-common/src/apps/GConfig.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-common/src/apps/GConfig.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -75,7 +75,7 @@
# Create parser and populate it if it doesn't exist
#
if not self._loadedConfigs.has_key(configFilename):
- parser = ConfigParser()
+ parser = GConfigParser(defaults)
self._loadedConfigs[configFilename]=parser
@@ -181,6 +181,30 @@
return defaults
+class GConfigParser(ConfigParser):
+ """
+ Add support for our GTypecast systems to the generic ConfigParser
+ """
+ def __init__(self, defaults):
+ self.__defaults = defaults
+ ConfigParser.__init__(self)
+ typecasts = self.__typecasts = {}
+ for f in defaults:
+ try:
+ typecasts[f['Name'].lower()] = f['Typecast']
+ except KeyError:
+ typecasts[f['Name'].lower()] = str
+
+ def get(self, section, field):
+ try:
+ val = ConfigParser.get(self, section, field)
+ return self.__typecasts[field.lower()](val)
+ except KeyError:
+ return val
+ except ValueError:
+ raise ValueError, _("Config option %s is of wrong type in [%s]") %
(field, section)
+
+
class GConfigAlias:
def __init__(self, gconfig, name):
self._gConfig = gconfig
@@ -256,3 +280,6 @@
"common_images": os.path.join (paths.data, "share", "gnue", "images"),
"common_appbase": paths.data,
"common_shared": os.path.join (paths.data, "share", "gnue")}
+
+
+
\ No newline at end of file
Modified: trunk/gnue-common/src/apps/__init__.py
===================================================================
--- trunk/gnue-common/src/apps/__init__.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-common/src/apps/__init__.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -22,11 +22,20 @@
# __init__.py
#
# DESCRIPTION:
-#
+"""
+"""
# NOTES:
#
+
# Important for now _() to be defined here
import __builtin__
__builtin__.__dict__['_'] = lambda string:string
+# Python 2.2 introduced True/False types
+# For Python 2.0/2.1, we add them ourselves
+import sys
+if sys.hexversion < 0x02020000:
+ __builtin__['True'] = 1
+ __builtin__['False'] = 0
+
Modified: trunk/gnue-common/src/formatting/GTypecast.py
===================================================================
--- trunk/gnue-common/src/formatting/GTypecast.py 2004-01-29 18:50:23 UTC
(rev 5051)
+++ trunk/gnue-common/src/formatting/GTypecast.py 2004-01-29 20:46:35 UTC
(rev 5052)
@@ -22,13 +22,13 @@
# GTypecast.py
#
# DESCRIPTION:
-# Methods used to typecast data
+"""
+Methods used to typecast data
+"""
#
# NOTES:
# Currently used by Parser, but may be of use to other methods
#
-# HISTORY:
-#
import string
@@ -111,7 +111,7 @@
else:
# This may seem counter-intuitive, but if attribute was present
# without a specified value, then treat as true
- return 1
+ return True
#######################################################
Modified: trunk/gnue-forms/src/GFClient.py
===================================================================
--- trunk/gnue-forms/src/GFClient.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFClient.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,10 +22,11 @@
# GFClient.py
#
# DESCRIPTION:
-# Command line client startup file that parses args,
-# imports the required UI, configures the controling
-# GFInstance and passes control to it.
-#
+"""
+Command line client startup file that parses args,
+imports the required UI, configures the controling
+GFInstance and passes control to it.
+"""
# NOTES:
#
@@ -51,10 +52,10 @@
NAME = "GNUe Forms"
USAGE = GClientApp.USAGE + " file"
COMMAND_OPTIONS = [
- [ 'user_interface', 'u', 'interface', 1, None, 'type',
+ [ 'user_interface', 'u', 'interface', True, None, 'type',
_('The currently supported values for <type> are ') \
+'wx, gtk2, qt, win32, and curses' ],
- [ 'splash_screen','s','no-splash', 0, None, None,
+ [ 'splash_screen','s','no-splash', False, None, None,
_('Disables the splash screen')]
]
SUMMARY = \
@@ -75,9 +76,9 @@
#
self.ui_type = self.OPTIONS['user_interface']
if self.ui_type:
- SPECIFIC_UI = 1
+ SPECIFIC_UI = True
else:
- SPECIFIC_UI = 0
+ SPECIFIC_UI = False
self.ui_type = gConfigForms('DefaultUI')
while 1:
@@ -137,7 +138,7 @@
if gConfigForms('disableSplash') == '1':
- self.disableSplash = 1
+ self.disableSplash = True
else:
self.disableSplash = self.OPTIONS['splash_screen']
Modified: trunk/gnue-forms/src/GFConfig.py
===================================================================
--- trunk/gnue-forms/src/GFConfig.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFConfig.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,8 +22,11 @@
# GFConfig.py
#
# DESCRIPTION:
-# Valid configuration options for forms
-# (appears under [forms] section in gnue.conf)
+"""
+Valid configuration options for forms
+(appears under [forms] section in gnue.conf)
+"""
+# NOTES:
#
from gnue.common.formatting import GTypecast
@@ -34,7 +37,7 @@
'Comment' : 'Create new records in blocks automagically when you hit
the bottom',
'Description': 'Create new records in blocks automagically when you hit
the bottom.',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'RememberLastQuery',
'Type' : 'Setting',
@@ -43,14 +46,14 @@
+ 'last values entered for a query can be retrieved by '
+ 'doing an Enter-Query twice)',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'DisableSplash',
'Type' : 'Setting',
'Comment' : 'Disable the startup splashscreen.',
'Description': 'Disable the startup splashscreen.',
'Typecast' : GTypecast.boolean,
- 'Default' : 0 },
+ 'Default' : False },
{ 'Name' : 'AllowNumericFormulas',
'Type' : 'Setting',
@@ -59,7 +62,7 @@
+ 'last values entered for a query can be retrieved by '
+ 'doing an Enter-Query twice)',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'EnterIsNewLine',
'Type' : 'Setting',
@@ -67,7 +70,7 @@
'Description': 'If set then the enter key inputs a carrage return '
+ 'and line feed in mutli-line text boxes.',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'CacheDetailRecords',
'Type' : 'Setting',
@@ -85,7 +88,7 @@
+ 'and saves, then it will be available to your '
+ 'form much quicker.',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'DateEditMask',
'Type' : 'Setting',
@@ -321,7 +324,7 @@
'Comment' : 'Set to true if wxWindows clients should use a fixed width
font',
'Description': 'Set to true if wxWindows clients should use a fixed width
font',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
{ 'Name' : 'pointSize',
'Type' : 'Setting',
@@ -401,6 +404,6 @@
'Comment' : 'Use asterick (*) for wildcards in addition to percent (%)',
'Description': 'Use asterick (*) for wildcards in addition to percent (%)',
'Typecast' : GTypecast.boolean,
- 'Default' : 1 },
+ 'Default' : True },
)
Modified: trunk/gnue-forms/src/GFDisplayHandler.py
===================================================================
--- trunk/gnue-forms/src/GFDisplayHandler.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-forms/src/GFDisplayHandler.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -22,7 +22,9 @@
# GFDisplayHandler.py
#
# DESCRIPTION:
-#
+"""
+DisplayHandler classes for Forms input validation
+"""
# NOTES:
#
@@ -83,7 +85,7 @@
def getDisplayFiller(self, value):
- return self._buildDisplayHelper(value, 0)
+ return self._buildDisplayHelper(value, False)
def generateRefreshEvent(self):
@@ -116,12 +118,12 @@
# called when a widget first gets focus
#
def beginEdit(self, event):
- self.editing = 1
- self.modified = 0
+ self.editing = True
+ self.modified = False
# TODO: Replace with formatter
self.setValue(self.field.getValue())
- self.work = self._buildDisplayHelper(self.value, 1)
+ self.work = self._buildDisplayHelper(self.value, False)
self._buildDisplay()
self.cursor = len(self.display)
@@ -139,7 +141,7 @@
if not self._loadedAllowedValues:
self.field.allowedValues()
- self._loadedAllowedValues = 1
+ self._loadedAllowedValues = True
# If this event returns __error__, then
@@ -157,11 +159,11 @@
if self._buildValue():
if self.field._allowedValues and not
self.field._allowedValues.has_key(str(self.value)):
self.work = ""
- event.__error__ = 1
+ event.__error__ = True
event.__errortext__ = _("Invalid value '%s' for field") % self.value
return
- self.editing = 0
+ self.editing = False
event.__results__ = self.value
event.modified = self.modified
self.field.setValue(self.value)
@@ -178,14 +180,14 @@
value = event.text
if (self.field.readonly and not self.field._block.mode=='query'):
- event.__error__ = 1
+ event.__error__ = True
event.__errortext__ = _("Cannot modify field. Form is read only")
return
elif self.field.editOnNull and \
self.value != None and \
self.value != "" and \
not self.field._block._resultSet.current.isPending():
- event.__error__ = 1
+ event.__error__ = True
event.__errortext__ = _("Cannot modify field after initial creation.")
return
@@ -238,9 +240,9 @@
self.cursor += len(event.text)
- event.__dropped__ = 1
- event.refreshDisplay = 1
- self.modified = 1
+ event.__dropped__ = True
+ event.refreshDisplay = True
+ self.modified = True
self._buildDisplay()
# Insert text at defined position
@@ -271,14 +273,14 @@
self.moveCursorLeft(event)
if self.cursor != precurs:
- event.overstrike = 1
+ event.overstrike = True
event.text = ""
self.addText(event)
# Delete forward one character
def delete(self, event):
- event.overstrike = 1
+ event.overstrike = True
event.text = ""
self.addText(event)
@@ -293,44 +295,44 @@
pass
- def moveCursor(self, event, selecting=0):
+ def moveCursor(self, event, selecting=False):
if not selecting:
self.selection1 = None
self.cursor = min(event.position, len(self.display))
- event.refreshDisplay = 1
+ event.refreshDisplay = True
- def moveCursorLeft(self, event, selecting=0):
+ def moveCursorLeft(self, event, selecting=False):
if not selecting:
self.selection1 = None
if self.cursor > 0:
self.cursor -= 1
- event.refreshDisplay = 1
+ event.refreshDisplay = True
- def moveCursorRight(self, event, selecting=0):
+ def moveCursorRight(self, event, selecting=False):
if not selecting:
self.selection1 = None
if self.cursor < len(self.display):
self.cursor += 1
- event.refreshDisplay = 1
+ event.refreshDisplay = True
- def moveCursorToEnd(self, event, selecting=0):
+ def moveCursorToEnd(self, event, selecting=False):
if not selecting:
self.selection1 = None
self.cursor = len(self.display)
- event.refreshDisplay = 1
+ event.refreshDisplay = True
- def moveCursorToBegin(self, event, selecting=0):
+ def moveCursorToBegin(self, event, selecting=False):
if not selecting:
self.selection1 = None
self.cursor = 0
- event.refreshDisplay = 1
+ event.refreshDisplay = True
#####################
@@ -363,7 +365,7 @@
event.position = self.selection1
else:
event.position = self.selection2
- self.moveCursor(event,1)
+ self.moveCursor(event, True)
# Select the entire text of the entry and move
@@ -371,7 +373,7 @@
def selectAll(self, event):
self.selection1 = 0
- self.moveCursorToEnd(event,1)
+ self.moveCursorToEnd(event, True)
self.selection2 = self.cursor
@@ -381,7 +383,7 @@
if self.selection1 == None:
self.selection1 = self.cursor
- self.moveCursorLeft(event, 1)
+ self.moveCursorLeft(event, True)
self.selection2 = self.cursor
@@ -391,7 +393,7 @@
if self.selection1 == None:
self.selection1 = self.cursor
- self.moveCursorRight(event,1)
+ self.moveCursorRight(event, True)
self.selection2 = self.cursor
@@ -401,7 +403,7 @@
if self.selection1 == None:
self.selection1 = self.cursor
- self.moveCursorToBegin(event,1)
+ self.moveCursorToBegin(event, True)
self.selection2 = self.cursor
@@ -411,7 +413,7 @@
if self.selection1 == None:
self.selection1 = self.cursor
- self.moveCursorToEnd(event,1)
+ self.moveCursorToEnd(event, True)
self.selection2 = self.cursor
@@ -422,7 +424,7 @@
self.dispatchEvent(events.Event('setCLIPBOARD',
text=self.display[sel1:sel2]))
- event.refreshDisplay = 0
+ event.refreshDisplay = False
def clipboardCut(self, event):
@@ -446,15 +448,15 @@
self.entry = entry # Our entry
self.field = entry._field
- self.editing = 0 # In editing mode??
- self.modified = 0 # Have we been modified??
+ self.editing = False # In editing mode??
+ self.modified = False # Have we been modified??
self.value = None # The latest db-compat value
self.work = "" # Our working value
self.display = "" # The latest display-formatted value
self.selection1 = None # Start of highlight
self.selection2 = None # End of highlight
self.cursor = 0 # Cursor position
- self._loadedAllowedValues = 0 # the allowed values already been loaded
+ self._loadedAllowedValues = False # the allowed values already been loaded
# TODO: replace w/an event that asks the
# TODO: UIdriver if this should happen!
@@ -497,7 +499,7 @@
def _buildValue(self):
self.value = self.work
- return 1
+ return True
def _buildDisplayHelper(self, value, editing):
if value == None:
@@ -507,9 +509,9 @@
def _buildDisplay(self):
if self.editing:
- self.display = self._buildDisplayHelper(self.work, 1)
+ self.display = self._buildDisplayHelper(self.work, True)
else:
- self.display = self._buildDisplayHelper(self.value, 0)
+ self.display = self._buildDisplayHelper(self.value, False)
@@ -619,13 +621,13 @@
def _buildValue(self):
if not len(self.work):
self.value = None
- return 1
+ return True
try:
self.value = float(self.work)
- return 1
+ return True
except ValueError:
- return 0
+ return False
@@ -728,7 +730,7 @@
self.work = self.field._allowedValues[str(self.value)]
except KeyError:
self.work = ""
- event.__error__ = 1
+ event.__error__ = True
event.__errortext__ = _("Invalid value '%s' for keyed pull-down
field") % self.value
self._buildDisplay()
@@ -760,11 +762,11 @@
def _buildDisplay(self):
if self.editing:
- self.display = self._buildDisplayHelper(self.work, 1)
+ self.display = self._buildDisplayHelper(self.work, True)
if self.cursor > len(self.work):
self.work = self.display
else:
- self.display = self._buildDisplayHelper(self.value, 0)
+ self.display = self._buildDisplayHelper(self.value, False)
def replaceText(self, event):
@@ -788,8 +790,8 @@
try:
self.value = self.field._allowedValuesReverse[self.display]
except KeyError:
- return 0
- return 1
+ return False
+ return True
@@ -818,21 +820,21 @@
# Force to 0 or 1
self.value = self._sanitizeValue(value)
- self.modified = 0
+ self.modified = False
self._buildDisplay()
def _sanitizeValue(self, value):
if ("%s" % value)[:1] in self.trueValues:
- return 1
+ return True
elif ("%s" % value)[:1] in self.falseValues:
- return 0
+ return False
else:
- return value and 1 or 0
+ return value and True or False
def _buildValue(self):
self.value = self.work
- return 1
+ return True
# TODO: Replace with format mask
@@ -849,15 +851,15 @@
self.work = int(not self.work)
else:
self.work = self._sanitizeValue(event.data[1])
- self.modified = 1
+ self.modified = True
self._buildDisplay()
- event.refreshDisplay=1
+ event.refreshDisplay=True
def beginEdit(self, event):
- self.editing = 1
- self.modified = 0
+ self.editing = True
+ self.modified = False
self.setValue(self.field.getValue())
@@ -880,23 +882,23 @@
return
- def moveCursor(self, event, selecting=0):
+ def moveCursor(self, event, selecting=False):
return
- def moveCursorLeft(self, event, selecting=0):
+ def moveCursorLeft(self, event, selecting=False):
return
- def moveCursorRight(self, event, selecting=0):
+ def moveCursorRight(self, event, selecting=False):
return
- def moveCursorToEnd(self, event, selecting=0):
+ def moveCursorToEnd(self, event, selecting=False):
return
- def moveCursorToBegin(self, event, selecting=0):
+ def moveCursorToBegin(self, event, selecting=False):
return
@@ -955,7 +957,7 @@
event.text = self.dispatchEvent(events.Event('getClipboard'))
if event.text != None:
self.work = self._sanitizeValue(event.data)
- self.modified = 1
+ self.modified = True
self._buildDisplay()
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFForm.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,9 +22,10 @@
# GFForm.py
#
# DESCRIPTION:
-# Class that contains the internal python object representation of a GNUE Form
-# built from GFObjects
-#
+"""
+Class that contains the internal python object representation of a GNUe Form
+built from GFObjects
+"""
# NOTES:
#
@@ -68,7 +69,7 @@
self._triggerDictionary = {}
# Insert/Overwrite mode
- self._insertMode = 1
+ self._insertMode = True
# Focus information
self._currentPage = None
@@ -91,7 +92,7 @@
# Trigger support
#
self._triggerns={}
- self._triggerGlobal = 1 # Put this object into the global namespace by
it's name
+ self._triggerGlobal = True # Put this object into the global namespace by
it's name
self._validTriggers = { 'ON-STARTUP': 'On-Startup',
'ON-ACTIVATION': 'On-Activation',
@@ -100,64 +101,64 @@
'POST-COMMIT': 'Post-Commit' }
self._triggerFunctions = {'setFocus':{'function':self.triggerSetFocus,
- 'global': 1,
+ 'global': True,
},
'getAuthenticatedUser':{'function':self.triggerGetAuthenticatedUser,
- 'global': 1,
+ 'global': True,
},
'getCurrentEntry':{'function':self.triggerGetCurrentEntry,
- 'global': 1,
+ 'global': True,
},
'getCurrentBlock':{'function':self.triggerGetCurrentBlock,
- 'global': 1,
+ 'global': True,
},
'getCurrentPage':{'function':self.triggerGetCurrentPage,
- 'global': 1,
+ 'global': True,
},
'setStatusText':{'function':self.triggerSetStatusText,
- 'global': 1,
+ 'global': True,
},
'getParameter':{'function':self.getParameter,
- 'global': 1,
+ 'global': True,
},
'setParameter':{'function':self.triggerSetParameter,
- 'global': 1,
+ 'global': True,
},
'showMessage':{'function':self.triggerShowMessageBox,
- 'global': 1,
+ 'global': True,
},
'commit':{'function':self.commit,
- 'global': 1,
+ 'global': True,
},
'close':{'function':self.triggerClose,
- 'global': 1,
+ 'global': True,
},
'getFeature':{'function':self.triggerGetFeature,
- 'global': 1,
+ 'global': True,
},
'setFeature':{'function':self.triggerSetFeature,
- 'global': 1,
+ 'global': True,
},
'runForm':{'function':self.triggerRunForm,
- 'global': 1,
+ 'global': True,
} ,
'activateDialog':{'function':self.triggerActivateDialog,
- 'global': 1,
+ 'global': True,
} ,
'activateTrigger':{'function':self.fireTrigger,
- 'global': 1,
+ 'global': True,
} ,
'initQuery':{'function':self.initQuery,
},
}
self._features = {
- 'GUI:MENUBAR:SUPPRESS': 0,
- 'GUI:TOOLBAR:SUPPRESS': 0,
- 'GUI:STATUSBAR:SUPPRESS': 0,
+ 'GUI:MENUBAR:SUPPRESS': False,
+ 'GUI:TOOLBAR:SUPPRESS': False,
+ 'GUI:STATUSBAR:SUPPRESS': False,
}
- self._in_trigger_lock = 0
+ self._in_trigger_lock = False
#
# primaryInit
@@ -307,7 +308,7 @@
#self._instance.dispatchEvent(event)
if event.__error__:
- return 1
+ return True
fieldChange = widget != self._currentEntry
try:
@@ -315,7 +316,7 @@
except AttributeError:
# Buttons don't have a block, but also
# don't trigger a block change
- blockChange = 0
+ blockChange = False
pageChange = widget._page != self._currentPage
if fireFocusTriggers:
@@ -582,7 +583,7 @@
def nextEntry(self):
nextEntry = None
firstEntry = None
- keepNext = 0
+ keepNext = False
if self._currentBlock.transparent:
@@ -601,7 +602,7 @@
firstEntry = object
if object == self._currentEntry:
- keepNext = 1
+ keepNext = True
continue
if keepNext:
@@ -648,7 +649,7 @@
# Find the first navigable field prior to the
# field losing focus
#
- keepNext = 0
+ keepNext = False
for object in source:
# Put the first field as the next to rollover
if ((object._navigable) and (not object.hidden) and ((not
object.readonly) or
@@ -852,7 +853,7 @@
print "Already called by a trigger"
return
- self._in_trigger_lock = 1
+ self._in_trigger_lock = True
focus = object._object
if focus._type=='GFField':
@@ -867,7 +868,7 @@
self.changeFocus(focus,1)
self.dispatchEvent('gotoENTRY',object=self._currentEntry,_form=self)
- self._in_trigger_lock = 0
+ self._in_trigger_lock = False
#
# allow the trigger to get a handle to
Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFInstance.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,10 +22,11 @@
# GFInstance.py
#
# DESCRIPTION:
-# GFInstance manages forms instances in a 1:N relationship.
-# It sits between the UI and the form and passes events
-# between the two in a semi-intelligent manner.
-#
+"""
+GFInstance manages forms instances in a 1:N relationship.
+It sits between the UI and the form and passes events
+between the two in a semi-intelligent manner.
+"""
# NOTES:
# Once all the events are moved back in here
# make the next/prec methods more generic in the GFForm
Modified: trunk/gnue-forms/src/GFKeyMapper.py
===================================================================
--- trunk/gnue-forms/src/GFKeyMapper.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFKeyMapper.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,8 +22,10 @@
# GFKeyMapper.py
#
# DESCRIPTION:
-# Handles physical to logical key mapping for GNUe Forms.
-# Also performs logical key to Events mapping.
+"""
+Handles physical to logical key mapping for GNUe Forms.
+Also performs logical key to Events mapping.
+"""
#
# NOTES:
#
@@ -33,19 +35,22 @@
from gnue.common.apps import GDebug
-#
-# Used by the loadUserKeyMap function.
-#
class InvalidKeystrokeName(StandardError):
+ """
+ Exception class used by the loadUserKeyMap function.
+ """
pass
-
-#
-# A basic key mapper. This will normally
-# serve most UI's input needs.
-#
+
+##
+##
+##
class BaseKeyMapper:
-
+ """
+ A basic key mapper. This will normally
+ serve most UI's input needs.
+ """
+
def __init__(self, userKeyMap):
self.__functionMap = userKeyMap
self.__keyTranslations = {}
@@ -92,17 +97,17 @@
keys = string.split(val,'-')
base = None
- shifted = 0
- meta = 0
- ctrl = 0
+ shifted = False
+ meta = False
+ ctrl = False
for key in keys:
if key in ('CTRL','CONTROL'):
- ctrl = 1
+ ctrl = True
elif key in ('META','ALT'):
- meta = 1
+ meta = True
elif key in ('SHFT','SHIFT'):
- shifted = 1
+ shifted = True
elif vk.__dict__.has_key(key):
base = vk.__dict__[key]
elif len(key) == 1:
@@ -128,9 +133,9 @@
# Just in case...
usermap.update( {
- (vk.TAB, 0, 0, 0) : 'NEXTENTRY',
- (vk.ENTER, 0, 0, 0) : 'NEXTENTRY',
- (vk.RETURN, 0, 0, 0) : 'NEXTENTRY'} )
+ (vk.TAB, False, False, False) : 'NEXTENTRY',
+ (vk.ENTER, False, False, False) : 'NEXTENTRY',
+ (vk.RETURN, False, False, False) : 'NEXTENTRY'} )
self.setUserKeyMap(usermap)
@@ -182,7 +187,7 @@
# This needs to stay as simple as possible
# as it gets called for each keystroke
#
- def getEvent(self, basekey, shift=0, ctrl=0, meta=0):
+ def getEvent(self, basekey, shift=False, ctrl=False, meta=False):
try:
return self._translatedUserKeyMap[(basekey, shift, ctrl, meta)]
except KeyError:
@@ -206,12 +211,14 @@
#####################################################################
#
-# Create a container class for the
-# Virtual Key definitions... this
-# is to keep our namespace clean.
#
class _VirtualKeys:
-
+ """
+ Create a container class for the
+ Virtual Key definitions... this
+ is to keep our namespace clean.
+ """
+
def __init__(self):
self.F1 = -999
self.F2 = -998
@@ -251,11 +258,16 @@
#
vk = _VirtualKeys()
+
#
# Given a keycode value (e.g., -999), return
# the text representation as a string (e.g., 'F1')
#
def reverseLookup(keyvalue):
+ """
+ Given a keycode value (e.g., -999), return
+ the text representation as a string (e.g., 'F1')
+ """
# This is done for efficiency of real-time lookups;
# i.e., we don't often do reverseLookups, but a
@@ -276,45 +288,45 @@
DefaultMapping = {
# (Key, Shifted, Ctrl'd, Meta/Alt'd)
- (vk.A, 0, 1, 0) : 'SELECTALL',
- (vk.C, 0, 1, 0) : 'COPY',
- (vk.V, 0, 1, 0) : 'PASTE',
- (vk.X, 0, 1, 0) : 'CUT',
- (vk.PAGEUP, 1, 0, 0) : 'JUMPROWSUP',
- (vk.PAGEDOWN, 1, 0, 0) : 'JUMPROWSDOWN',
- (vk.PAGEUP, 0, 1, 0) : 'PREVPAGE',
- (vk.PAGEDOWN, 0, 1, 0) : 'NEXTPAGE',
- (vk.PAGEUP, 0, 0, 0) : 'PREVBLOCK',
- (vk.PAGEDOWN, 0, 0, 0) : 'NEXTBLOCK',
- (vk.TAB, 0, 0, 0) : 'NEXTENTRY',
- (vk.ENTER, 0, 0, 0) : 'NEXTENTRY',
- (vk.RETURN, 0, 0, 0) : 'NEXTENTRY',
- (vk.TAB, 1, 0, 0) : 'PREVENTRY',
- (vk.LEFT, 0, 0, 0) : 'CURSORLEFT',
- (vk.RIGHT, 0, 0, 0) : 'CURSORRIGHT',
- (vk.END, 0, 0, 0) : 'CURSOREND',
- (vk.HOME, 0, 0, 0) : 'CURSORHOME',
- (vk.LEFT, 1, 0, 0) : 'SELECTLEFT',
- (vk.RIGHT, 1, 0, 0) : 'SELECTRIGHT',
- (vk.END, 1, 0, 0) : 'SELECTTOEND',
- (vk.HOME, 1, 0, 0) : 'SELECTTOHOME',
- (vk.BACKSPACE,0, 0, 0) : 'BACKSPACE',
- (vk.INSERT, 0, 0, 0) : 'MODETOGGLE',
- (vk.DELETE, 0, 0, 0) : 'DELETE',
- (vk.UP, 0, 0, 0) : 'PREVRECORD',
- (vk.DOWN, 0, 0, 0) : 'NEXTRECORD',
- (vk.UP, 0, 1, 0) : 'FIRSTRECORD',
- (vk.DOWN, 0, 1, 0) : 'LASTRECORD',
- (vk.F2, 0, 0, 0) : 'JUMPPROMPT',
- (vk.F5, 0, 0, 0) : 'MARKFORDELETE',
- (vk.F6, 0, 0, 0) : 'COMMIT',
- (vk.F8, 0, 0, 0) : 'ENTERQUERY',
- (vk.F8, 1, 0, 0) : 'COPYQUERY',
- (vk.F9, 0, 0, 0) : 'EXECQUERY',
- (vk.F9, 1, 0, 0) : 'CANCELQUERY',
- (vk.F11, 0, 0, 0) : 'ROLLBACK',
- (vk.F12, 0, 0, 0) : 'NEWRECORD',
- (vk.ENTER, 1, 0, 0) : 'NEWLINE',
+ (vk.A, False, True, False) : 'SELECTALL',
+ (vk.C, False, True, False) : 'COPY',
+ (vk.V, False, True, False) : 'PASTE',
+ (vk.X, False, True, False) : 'CUT',
+ (vk.PAGEUP, True, False, False) : 'JUMPROWSUP',
+ (vk.PAGEDOWN, True, False, False) : 'JUMPROWSDOWN',
+ (vk.PAGEUP, False, True, False) : 'PREVPAGE',
+ (vk.PAGEDOWN, False, True, False) : 'NEXTPAGE',
+ (vk.PAGEUP, False, False, False) : 'PREVBLOCK',
+ (vk.PAGEDOWN, False, False, False) : 'NEXTBLOCK',
+ (vk.TAB, False, False, False) : 'NEXTENTRY',
+ (vk.ENTER, False, False, False) : 'NEXTENTRY',
+ (vk.RETURN, False, False, False) : 'NEXTENTRY',
+ (vk.TAB, True, False, False) : 'PREVENTRY',
+ (vk.LEFT, False, False, False) : 'CURSORLEFT',
+ (vk.RIGHT, False, False, False) : 'CURSORRIGHT',
+ (vk.END, False, False, False) : 'CURSOREND',
+ (vk.HOME, False, False, False) : 'CURSORHOME',
+ (vk.LEFT, True, False, False) : 'SELECTLEFT',
+ (vk.RIGHT, True, False, False) : 'SELECTRIGHT',
+ (vk.END, True, False, False) : 'SELECTTOEND',
+ (vk.HOME, True, False, False) : 'SELECTTOHOME',
+ (vk.BACKSPACE,False, False, False) : 'BACKSPACE',
+ (vk.INSERT, False, False, False) : 'MODETOGGLE',
+ (vk.DELETE, False, False, False) : 'DELETE',
+ (vk.UP, False, False, False) : 'PREVRECORD',
+ (vk.DOWN, False, False, False) : 'NEXTRECORD',
+ (vk.UP, False, True, False) : 'FIRSTRECORD',
+ (vk.DOWN, False, True, False) : 'LASTRECORD',
+ (vk.F2, False, False, False) : 'JUMPPROMPT',
+ (vk.F5, False, False, False) : 'MARKFORDELETE',
+ (vk.F6, False, False, False) : 'COMMIT',
+ (vk.F8, False, False, False) : 'ENTERQUERY',
+ (vk.F8, True, False, False) : 'COPYQUERY',
+ (vk.F9, False, False, False) : 'EXECQUERY',
+ (vk.F9, True, False, False) : 'CANCELQUERY',
+ (vk.F11, False, False, False) : 'ROLLBACK',
+ (vk.F12, False, False, False) : 'NEWRECORD',
+ (vk.ENTER, True, False, False) : 'NEWLINE',
}
Modified: trunk/gnue-forms/src/GFLibrary.py
===================================================================
--- trunk/gnue-forms/src/GFLibrary.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFLibrary.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,7 +22,9 @@
# GFLibrary
#
# DESCRIPTION:
-# Supports importing of library items
+"""
+Adds support for importing of "library" items
+"""
#
# NOTES:
#
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -1,4 +1,4 @@
-#
+# #
# This file is part of GNU Enterprise.
#
# GNU Enterprise is free software; you can redistribute it
@@ -22,7 +22,9 @@
# GFBlock.py
#
# DESCRIPTION:
-#
+"""
+Classes making up the Block object
+"""
# NOTES:
#
# HISTORY:
@@ -51,7 +53,7 @@
GFContainer.__init__(self, parent, 'GFBlock')
self.mode = 'normal'
- self._convertAstericksToPercent = int(gConfigForms('AsterickWildcard'))
+ self._convertAstericksToPercent = gConfigForms('AsterickWildcard')
self._inits = [self.initialize]
@@ -112,9 +114,9 @@
'firstRecord':{'function':self.firstRecord,
'description':'Navigates the block
to the first record it contains.'},
'isEmpty':{'function':self.isEmpty,
- 'description':'Returns 1 if block is
empty.'},
+ 'description':'Returns True if block is
empty.'},
'isSaved':{'function':self.isSaved,
- 'description':'Returns 1 if block
contains no modified records.'},
+ 'description':'Returns True if block
contains no modified records.'},
'lastRecord':{'function':self.lastRecord,
'description':'Navigates the block to
the last record it contains.'},
'newRecord':{'function':self.newRecord,
@@ -259,7 +261,7 @@
self._currentRecord = self._resultSet.getRecordNumber()
for field in self._fieldList:
for entry in field._entryList:
- # This for loop is probably better somewhere else
+ # This loop is probably better somewhere else
entry.recalculateVisible( adjustment, self._currentRecord,
self._recordCount)
self._form.updateUIEntry(field)
self._form.refreshUIEvents()
@@ -450,11 +452,11 @@
#
# processRollback
#
- # if recovering=0, then the user requested a rollback
- # if recovering=1, then a commit or such failed and we need to clean up
+ # if recovering=False, then the user requested a rollback
+ # if recovering=True, then a commit or such failed and we need to clean up
# (but not lose state information)
#
- def processRollback(self, recovering=0):
+ def processRollback(self, recovering=False):
if not recovering:
self._currentRecord = 0
self._recordCount = 0
@@ -618,8 +620,8 @@
class _BlockIter:
def __init__(self, block):
self.block = block
- self.new = 1
- self.done = 0
+ self.new = True
+ self.done = False
print "Iterator created"
def __iter__(self):
@@ -630,15 +632,15 @@
raise StopIteration
elif self.new:
self.block.jumpRecord(0)
- self.new = 0
+ self.new = False
elif self.block._resultSet.isLastRecord():
- self.done = 1
+ self.done = True
raise StopIteration
else:
self.block.nextRecord()
if self.block.isEmpty() and self.block._resultSet.isLastRecord():
- self.done = 1
+ self.done = True
raise StopIteration
return self.block
Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/GFParser.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -22,14 +22,15 @@
# GFParser.py
#
# DESCRIPTION:
-# Class that contains a sax based xml processor for GNUe forms
-#
-# NOTES:
-# 1. Designer uses the 'Positionable' attribute. It is specific to
-# forms+designer and is not part of the GParser spec. If set to
-# true, then this object is a visible, movable, sizable attribute.
-#
+"""
+Class that contains a sax based xml processor for GNUe forms
+NOTES:
+ * Designer uses the 'Positionable' attribute. It is specific to
+ forms+designer and is not part of the GParser spec. If set to
+ true, then this object is a visible, movable, sizable attribute.
+"""
+
from gnue.common.datasources import GDataSource
from gnue.common.definitions import GParser
from gnue.common.formatting import GTypecast
@@ -81,8 +82,8 @@
xmlElements = {
'form': {
'BaseClass': GFForm.GFForm,
- 'Required': 1,
- 'SingleInstance': 1,
+ 'Required': True,
+ 'SingleInstance': True,
'Attributes': {
'title': {
'Typecast': GTypecast.text,
@@ -91,13 +92,13 @@
'Description': 'The title of the form.' },
'readonly': {
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Label': _('Read Only'),
'Description': 'If set to {Y}, then no modifications to data '
'by the end user will be allowed. The form will '
'become a query-only form.' },
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'A unique name or ID for the form.' },
'style': {
@@ -112,17 +113,17 @@
'logic': {
'BaseClass': GFObjects.GFLogic,
- 'Required': 1,
- 'Importable': 1,
- 'SingleInstance': 1,
+ 'Required': True,
+ 'Importable': True,
+ 'SingleInstance': True,
'ParentTags': ('form',),
'Description': 'TODO' },
'layout': {
'BaseClass': GFObjects.GFLayout,
- 'Required': 1,
- 'Importable': 1,
- 'SingleInstance': 1,
+ 'Required': True,
+ 'Importable': True,
+ 'SingleInstance': True,
'ParentTags': ('form',),
'Description': 'TODO' ,
'Attributes': {
@@ -142,17 +143,17 @@
'page': {
'BaseClass': GFObjects.GFPage,
- 'Required': 1,
- 'Importable': 1,
+ 'Required': True,
+ 'Importable': True,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'A unique ID for the widget. This is only useful
'
'when importing pages from a library.' },
'transparent':{
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Description': 'If set, then you can tab out of the page via
next- '
'or previous-field events. Makes navigation in '
'mutlipage forms easier. If false, focus stays '
@@ -174,12 +175,12 @@
'block': {
'BaseClass': GFObjects.GFBlock,
- 'Required': 1,
- 'Importable':1,
+ 'Required': True,
+ 'Importable': True,
'Attributes': {
'name': {
- 'Required': 1,
- 'Unique': 1,
+ 'Required': True,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'A unique ID (name) for the widget. '
'No blocks can share '
@@ -199,7 +200,7 @@
'individual widgets.' },
'transparent':{
'Typecast': GTypecast.boolean,
- 'Default': 1,
+ 'Default': True,
'Description': 'If set, then you can tab out of the block via
next- '
'or previous-field events. Makes navigation in '
'multiblock forms easier. If false, focus stays '
@@ -207,13 +208,13 @@
'another block' },
'restrictDelete':{
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Label': _('Prevent Deletes'),
'Description': 'If set then the user will be unable to request '
'that a record be deleted via the user
interface.' },
'restrictInsert':{
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Label': _('Prevent Inserts'),
'Description': 'If set then the user will be unable to request '
'that new records be inserted into the block.' },
@@ -230,11 +231,11 @@
'BaseClass': GFObjects.GFLabel,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'The unique ID of the label.' },
'text': {
- 'Required': 1,
+ 'Required': True,
'Typecast': GTypecast.text,
'Description': 'The text to be displayed.' },
'alignment': {
@@ -260,14 +261,14 @@
'Label': _('Row Spacing'),
'Description': 'Overriders the rowSpace setting defined at the
block level.' } },
## 'x': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
## 'y': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
@@ -276,8 +277,8 @@
'Importable':1,
'Attributes': {
'name': {
- 'Required': 1,
- 'Unique': 1,
+ 'Required': True,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'The unique ID of the entry. Referenced in '
'master/detail setups as well as triggers.' },
@@ -301,12 +302,12 @@
'Description': 'It defined the user will be unable to alter '
'the contents of this entry. Triggers can still '
'alter the value.',
- 'Default': 0 },
+ 'Default': False },
'required': {
'Description': 'This object cannot have an empty value prior '
'to a commit.',
'Typecast': GTypecast.boolean,
- 'Default': 0 },
+ 'Default': False },
'case': {
'Typecast': GTypecast.name,
'ValueSet': {
@@ -386,7 +387,7 @@
'defaultToLast': {
'Typecast': GTypecast.boolean,
'Label': _('Default to last entry?'),
- 'Default': 0,
+ 'Default': False,
'Description': 'If true, then new records will default to the '
'last value the user entered for this field. If '
'no new values have been entered, then defaults '
@@ -408,7 +409,7 @@
'ignoreCaseOnQuery': {
'Typecast': GTypecast.boolean,
'Label': _('Ignore Case on Queries'),
- 'Default': 0,
+ 'Default': False,
'Description': 'If defined the entry widget ignores the case '
'of the information entered into the query
mask.' },
'editOnNull': {
@@ -416,20 +417,20 @@
'is currently empty.',
'Label': _('Edit Only When Null'),
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Description': 'TODO' },
'ltrim': {
'Label': _('Trim left spaces'),
'Description': 'Trim extraneous space at '
'beginning of user input.',
'Typecast': GTypecast.boolean,
- 'Default': 0 },
+ 'Default': False },
'rtrim': {
'Label': _('Trim right spaces'),
'Description': 'Trim extraneous space at end '
'of user input.',
'Typecast': GTypecast.boolean,
- 'Default': 1 } },
+ 'Default': False } },
'ParentTags': ('block',),
'Description': 'TODO' },
@@ -439,26 +440,26 @@
'BaseClass': GFObjects.GFEntry,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'The unique ID of the entry.' },
'label': {
- 'Required': 0,
+ 'Required': False,
'Typecast': GTypecast.text,
'Description': 'The optional label displayed next to checkbox.'
},
'field': {
'Typecast': GTypecast.name,
'References': 'field.name',
- 'Required': 1,
+ 'Required': True,
'Description': 'The name of the field that this ties to.' },
'block': {
'Typecast': GTypecast.name,
- 'Required': 1,
+ 'Required': True,
'References': 'block.name',
'Description': 'The name of the block that this ties to.' },
## 'height': {
## 'Typecast': GTypecast.whole,
-## 'Default': 1,
+# ## 'Default': 1,
## 'Description': 'The height of the entry in text rows. ' },
## 'width': {
## 'Typecast': GTypecast.whole,
@@ -479,10 +480,10 @@
'Description': 'If false, the user will be unable to navigate '
'to this entry. Triggers can still '
'alter the value.',
- 'Default': 1 },
+ 'Default': True },
'hidden': {
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Description': 'If defined the entry widget will not be '
'displayed on the form. This is usefull for '
'fields the user doesn\'t need to know about '
@@ -503,17 +504,17 @@
'attributes. The {label} style implies the '
'{readonly} attribute.' } },
## 'x': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text column starting position of the '
## 'widget. Based upon leftmost column of screen '
## 'being 0.' },
## 'y': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text row starting position of the widget.
'
## 'Based upon the top row of the screen being
0.' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'An {entry} is the visual counterpart to a {field}.' },
@@ -521,31 +522,31 @@
'BaseClass': GFObjects.GFScrollBar,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'block': {
- 'Required': 1,
+ 'Required': True,
'Typecast': GTypecast.name,
'References': 'block.name',
'Description': 'The {block} to which this scrollbar scrolls.' }
},
## 'width': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The width of the box in text columns.' },
## 'height': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The height of the box in text rows.' },
## 'x': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
## 'y': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
@@ -553,50 +554,50 @@
'BaseClass': GFObjects.GFBox,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'label': {
'Typecast': GTypecast.text,
'Description': 'An optional text label that will be displayed
on the border.' },
## 'width': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The width of the box in text columns.' },
## 'height': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The height of the box in text rows.' },
'focusorder': {
'Typecast': GTypecast.whole,
'Description': 'TODO' } },
## 'x': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
## 'y': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
'image': {
'BaseClass': GFObjects.GFImage,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'field': {
'Typecast': GTypecast.name,
'References': 'field.name',
- 'Required': 1,
+ 'Required': True,
'Description': 'The name of the field that this ties to.' },
'block': {
'Typecast': GTypecast.name,
'References': 'block.name',
- 'Required': 1,
+ 'Required': True,
'Description': 'The name of the block that this ties to.' },
'type': {
'Typecast': GTypecast.name,
@@ -608,7 +609,7 @@
'focusorder': {
'Typecast': GTypecast.whole,
'Description': 'TODO' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
@@ -616,22 +617,22 @@
'BaseClass': GFObjects.GFComponent,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'field': {
'Typecast': GTypecast.name,
'References': 'field.name',
- 'Required': 1,
+ 'Required': True,
'Description': 'The name of the field that this ties to.' },
'block': {
'Typecast': GTypecast.name,
'References': 'block.name',
- 'Required': 1,
+ 'Required': True,
'Description': 'The name of the block that this ties to.' },
'mimetype': {
'Typecast': GTypecast.name,
- 'Required': 1,
+ 'Required': True,
'Description': 'TODO' },
'type': {
'Typecast': GTypecast.name,
@@ -644,7 +645,7 @@
'focusorder': {
'Typecast': GTypecast.whole,
'Description': 'TODO' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
@@ -653,7 +654,7 @@
'Importable':1,
'Attributes': {
'name': {
- 'Unique': 1,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'A unique ID for the widget. Useful for
importable buttons. ' },
'block': {
@@ -667,28 +668,28 @@
'Typecast': GTypecast.name,
'Description': 'The text that should appear on the button' } },
## 'width': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The width of the entry in text columns.' },
## 'height': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The height of the entry in text rows. ' },
## 'x': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0.' },
## 'y': {
-## 'Required': 1,
+## 'Required': True,
## 'Typecast': GTypecast.whole,
## 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
- 'Positionable': 1,
+ 'Positionable': True,
'ParentTags': ('page',),
'Description': 'TODO' },
'options': {
'BaseClass': GFObjects.GFOptions,
- 'UsableBySiblings': 1,
+ 'UsableBySiblings': True,
'ParentTags': ('form',),
'Description': 'TODO' },
@@ -696,13 +697,13 @@
'BaseClass': GFObjects.GFOption,
'Attributes': {
'name': {
- 'Required': 1,
+ 'Required': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
+ 'MixedContent': True,
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -718,8 +719,8 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'Deprecated': 'Use the <form> attribute "title" instead.',
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -736,8 +737,8 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -753,8 +754,8 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -770,8 +771,8 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -787,8 +788,8 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'ParentTags': ('options',),
'Description': 'TODO' },
@@ -804,31 +805,31 @@
'value': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
- 'MixedContent': 1,
- 'SingleInstance': 1,
+ 'MixedContent': True,
+ 'SingleInstance': True,
'ParentTags': ('options',),
'Description': 'TODO' },
'parameter': {
'BaseClass': GFObjects.GFParameter,
'Attributes': {
'name': {
- 'Required': 1,
- 'Unique': 1,
+ 'Required': True,
+ 'Unique': True,
'Typecast': GTypecast.name,
'Description': 'TODO' },
'required': {
'Typecast': GTypecast.boolean,
- 'Default': 0,
+ 'Default': False,
'Description': 'TODO' },
## 'limited': {
## 'Typecast': GTypecast.boolean,
-## 'Default': 0,
+## 'Default': False,
## 'Description': 'TODO' },
'default': {
'Typecast': GTypecast.text,
'Description': 'TODO' },
'description': {
-## 'Required': 1,
+## 'Required': True,
'Typecast': GTypecast.text,
'Description': 'TODO' },
## 'source': {
Modified: trunk/gnue-forms/src/__init__.py
===================================================================
--- trunk/gnue-forms/src/__init__.py 2004-01-29 18:50:23 UTC (rev 5051)
+++ trunk/gnue-forms/src/__init__.py 2004-01-29 20:46:35 UTC (rev 5052)
@@ -18,9 +18,10 @@
#
# Copyright 2001-2004 Free Software Foundation
#
+"""
+GNUe Forms base module
+"""
-
-
#
# CREATING A RELEASE:
# 1. Change _version to be the current version number
Modified: trunk/gnue-forms/src/uidrivers/wx/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/common.py 2004-01-29 18:50:23 UTC (rev
5051)
+++ trunk/gnue-forms/src/uidrivers/wx/common.py 2004-01-29 20:46:35 UTC (rev
5052)
@@ -22,10 +22,12 @@
# uidriver/wx/common.py
#
# DESCRIPTION:
-# Common Font and Event Handler routines
-# Part of a wxPython based user interface driver for GNUe forms.
+"""
+Common Font and Event Handler routines
+Part of a wxPython based user interface driver for GNUe forms.
+"""
+# NOTES:
#
-# NOTES:
import string
from wxPython.wx import *
@@ -81,7 +83,7 @@
_pointSize = 0
def getPointSize():
- return _pointSize or setPointSize(int(gConfigForms('pointSize')))
+ return _pointSize or setPointSize(gConfigForms('pointSize'))
def setPointSize(size):
global _pointSize
@@ -89,7 +91,7 @@
return size
def initFont(widget, affectsLayout=1):
- if int(gConfigForms('fixedWidthFont')):
+ if gConfigForms('fixedWidthFont'):
try:
enc=encodings[gConfigForms('textEncoding')]
except:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5052 - in trunk: gnue-common/module/base gnue-common/src gnue-common/src/apps gnue-common/src/formatting gnue-forms/src gnue-forms/src/GFObjects gnue-forms/src/uidrivers/wx,
jcater <=