[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/GObjects.py common/src/GParser....
From: |
Jason Cater |
Subject: |
gnue common/src/GObjects.py common/src/GParser.... |
Date: |
Tue, 26 Nov 2002 18:45:21 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/11/26 18:45:21
Modified files:
common/src : GObjects.py GParser.py GRootObj.py
forms/samples/intro: intro.gfd
forms/src : GFForm.py GFParser.py
forms/src/GFObjects: GFLayout.py
forms/src/uidrivers/wx: UIdriver.py
forms/utils : gfd04to05.py
Log message:
Moved to namespaces for layout management in forms
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GObjects.py.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GParser.py.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GRootObj.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/intro/intro.gfd.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.207&tr2=1.208&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFParser.py.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFLayout.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.217&tr2=1.218&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/utils/gfd04to05.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnue/common/src/GObjects.py
diff -c gnue/common/src/GObjects.py:1.43 gnue/common/src/GObjects.py:1.44
*** gnue/common/src/GObjects.py:1.43 Wed Nov 20 22:47:46 2002
--- gnue/common/src/GObjects.py Tue Nov 26 18:45:20 2002
***************
*** 181,187 ****
except AttributeError:
try:
if self._xmlchildnamespace:
! if not xmlnamespaces.hasattr(self._xmlchildnamespace):
i = 0
ns = "out"
while ns in xmlnamespaces.values():
--- 181,187 ----
except AttributeError:
try:
if self._xmlchildnamespace:
! if not xmlnamespaces.has_key(self._xmlchildnamespace):
i = 0
ns = "out"
while ns in xmlnamespaces.values():
***************
*** 189,194 ****
--- 189,197 ----
ns = "out%s" % i
xmlnamespaces[self._xmlnamespace] = ns
xmlnsdef = ' xmlns:%s="%s"' % (ns, self._xmlchildnamespace)
+ elif self._xmlchildnamespaces:
+ pass
+
except AttributeError:
pass
***************
*** 199,205 ****
pos = indent
attrs = self.__dict__.keys()
attrs.sort()
!
# Make 'name' first
if 'name' in attrs:
attrs.pop(attrs.index('name'))
--- 202,208 ----
pos = indent
attrs = self.__dict__.keys()
attrs.sort()
!
# Make 'name' first
if 'name' in attrs:
attrs.pop(attrs.index('name'))
Index: gnue/common/src/GParser.py
diff -c gnue/common/src/GParser.py:1.51 gnue/common/src/GParser.py:1.52
*** gnue/common/src/GParser.py:1.51 Sat Nov 16 10:44:02 2002
--- gnue/common/src/GParser.py Tue Nov 26 18:45:20 2002
***************
*** 90,96 ****
# Set up some namespace-related stuff for the parsers
parser.setFeature(xml.sax.handler.feature_namespaces, 1)
!
# Allow for parameter external entities
## Does not work with expat!!! ##
##parser.setFeature(xml.sax.handler.feature_external_pes, 1)
--- 90,96 ----
# Set up some namespace-related stuff for the parsers
parser.setFeature(xml.sax.handler.feature_namespaces, 1)
!
# Allow for parameter external entities
## Does not work with expat!!! ##
##parser.setFeature(xml.sax.handler.feature_external_pes, 1)
***************
*** 119,125 ****
# Set the object's attributes
object.__dict__.update(attributes)
!
if initialize:
GDebug.printMesg(10,"Initializing the object tree starting at %s"
%(object))
object.phaseInit(dh._phaseInitCount)
--- 119,125 ----
# Set the object's attributes
object.__dict__.update(attributes)
!
if initialize:
GDebug.printMesg(10,"Initializing the object tree starting at %s"
%(object))
object.phaseInit(dh._phaseInitCount)
***************
*** 160,165 ****
--- 160,166 ----
self.xmlElements = {}
self.xmlMasqueradeNamespaceElements = None
+ self.xmlNamespaceAttributesAsPrefixes = 0
self.xmlStack = []
self.nameStack = []
***************
*** 167,178 ****
self.uniqueIDs = {}
self.root = None
self._phaseInitCount = 0
!
self._requiredTags = []
self._singleInstanceTags = []
self._tagCounts = {}
!
#
# Called by client code to get the "root" node
#
--- 168,179 ----
self.uniqueIDs = {}
self.root = None
self._phaseInitCount = 0
!
self._requiredTags = []
self._singleInstanceTags = []
self._tagCounts = {}
!
#
# Called by client code to get the "root" node
#
***************
*** 200,215 ****
self._singleInstanceTags.append(element)
except KeyError:
pass
!
def finalValidation(self):
for element in self._singleInstanceTags:
if self._tagCounts[element] > 1:
raise MarkupError, _("File has multiple instances of <%s> when only
one allowed") % (element)
!
for element in self._requiredTags:
if self._tagCounts[element] < 1:
raise MarkupError, _("File is missing required tag <%s>") % (element)
!
#
# Called by the internal SAX parser whenever
--- 201,216 ----
self._singleInstanceTags.append(element)
except KeyError:
pass
!
def finalValidation(self):
for element in self._singleInstanceTags:
if self._tagCounts[element] > 1:
raise MarkupError, _("File has multiple instances of <%s> when only
one allowed") % (element)
!
for element in self._requiredTags:
if self._tagCounts[element] < 1:
raise MarkupError, _("File is missing required tag <%s>") % (element)
!
#
# Called by the internal SAX parser whenever
***************
*** 232,240 ****
--- 233,243 ----
except KeyError:
raise MarkupError, _('Error processing <%s> tag [I do not know what a
<%s> tag does]') % (name, name)
+ xmlns = {}
for qattr in saxattrs.keys():
attrns, attr = qattr
+
encoding= sys.getdefaultencoding()
if encoding == 'ascii':
encoding = 'iso8859-1' # TODO: fix this when we have [common]
section
***************
*** 243,261 ****
except:
pass
! # Typecasting, anyone? If attribute should be int, make it an int
! try:
! attrs[attr] =
baseAttrs[attr].get('Typecast',GTypecast.text)(saxattrs[qattr].encode(encoding))
# default(baseAttrs[attr],'Typecast',GTypecast.text)(saxattrs[qattr])
! loadedxmlattrs[attr] = attrs[attr]
! except KeyError:
! raise MarkupError, _('Error processing <%s> tag [I do not recognize
the "%s" attribute') % (name, attr)
! except:
! raise MarkupError, _('Error processing <%s> tag [invalid type for
"%s" attribute; value is "%s"]') % (name, attr, saxattrs[qattr])
!
! # If this attribute must be unique, check for duplicates
! if baseAttrs[attr].get('Unique',0): # default
(baseAttrs[attr],'Unique',0):
! if self.uniqueIDs.has_key('%s' % (saxattrs[qattr])):
! raise MarkupError, _('Error processing <%s> tag ["%s" attribute
should be unique; duplicate value is "%s"]') % (name, attr, saxattrs[qattr])
for attr in baseAttrs.keys():
if not attrs.has_key(attr):
--- 246,273 ----
except:
pass
! if attrns:
! if not self.xmlNamespaceAttributesAsPrefixes:
! raise "Unexpected namespace an attribute"
! prefix = attrns.split(':')[-1] + '__' + attr
! attrs[prefix] = saxattrs[qattr]
! xmlns[prefix] = attrns
!
! else:
!
! # Typecasting, anyone? If attribute should be int, make it an int
! try:
! attrs[attr] =
baseAttrs[attr].get('Typecast',GTypecast.text)(saxattrs[qattr].encode(encoding))
# default(baseAttrs[attr],'Typecast',GTypecast.text)(saxattrs[qattr])
! loadedxmlattrs[attr] = attrs[attr]
! except KeyError:
! raise MarkupError, _('Error processing <%s> tag [I do not
recognize the "%s" attribute') % (name, attr)
! except:
! raise MarkupError, _('Error processing <%s> tag [invalid type for
"%s" attribute; value is "%s"]') % (name, attr, saxattrs[qattr])
!
! # If this attribute must be unique, check for duplicates
! if baseAttrs[attr].get('Unique',0): # default
(baseAttrs[attr],'Unique',0):
! if self.uniqueIDs.has_key('%s' % (saxattrs[qattr])):
! raise MarkupError, _('Error processing <%s> tag ["%s" attribute
should be unique; duplicate value is "%s"]') % (name, attr, saxattrs[qattr])
for attr in baseAttrs.keys():
if not attrs.has_key(attr):
***************
*** 268,273 ****
--- 280,286 ----
elif baseAttrs[attr].get('Required', 0): #default(baseAttrs[attr],
'Required', 0):
raise MarkupError, _('Error processing <%s> tag [required
attribute "%s" not present]') % (name, attr)
+ attrs['_xmlnamespaces'] = xmlns
if self.bootstrapflag:
if self.xmlStack[0] != None:
Index: gnue/common/src/GRootObj.py
diff -c gnue/common/src/GRootObj.py:1.6 gnue/common/src/GRootObj.py:1.7
*** gnue/common/src/GRootObj.py:1.6 Mon Nov 4 09:55:51 2002
--- gnue/common/src/GRootObj.py Tue Nov 26 18:45:20 2002
***************
*** 42,47 ****
--- 42,48 ----
self._rname = rootName
self.__xmlElementCallback = xmlElementCallback
self._xmlParser = xmlParser
+ self._xmlnamespaces = {}
# This will store any "global myVar" that the triggers execute.
self._globalRuntimeNamespace = {}
***************
*** 51,57 ****
def dumpXML(self, treeDump=1, gap=" "):
return GObj.dumpXML(self, self.__xmlElementCallback(),
! treeDump, gap, xmlnamespaces={})
--- 52,58 ----
def dumpXML(self, treeDump=1, gap=" "):
return GObj.dumpXML(self, self.__xmlElementCallback(),
! treeDump, gap, xmlnamespaces=self._xmlnamespaces)
Index: gnue/forms/samples/intro/intro.gfd
diff -c gnue/forms/samples/intro/intro.gfd:1.10
gnue/forms/samples/intro/intro.gfd:1.11
*** gnue/forms/samples/intro/intro.gfd:1.10 Mon Nov 25 23:14:40 2002
--- gnue/forms/samples/intro/intro.gfd Tue Nov 26 18:45:20 2002
***************
*** 1,10 ****
<?xml version="1.0"?>
! <!-- GNUe Forms 0.5.0 Migration Tool
! Saved on: 2002-11-22 00:01:37 -->
<form tabbed="top" title="Welcome to GNUe Forms">
! <trigger name="PigLatin" type="NAMED"><![CDATA[#
# from Joe Strout's Python Tidbits (http://www.strout.net/python/)
#
--- 1,10 ----
<?xml version="1.0"?>
! <!-- GNUe Designer (0.1.0)
! Form saved on: 2001-11-20 17:14:37 -->
<form tabbed="top" title="Welcome to GNUe Forms">
! <trigger type="NAMED" name="PigLatin">#
# from Joe Strout's Python Tidbits (http://www.strout.net/python/)
#
***************
*** 17,23 ****
import string
s = SampleBlock.NameEntry.get()
! if len(s) > 4:
out = ''
for word in string.splitfields(s,' '):
--- 17,23 ----
import string
s = SampleBlock.NameEntry.get()
! try:
out = ''
for word in string.splitfields(s,' '):
***************
*** 44,50 ****
# remove up to the first vowel to make suffix
p = 0
! while p < len(word) and word[p] not in "aoeuiyAOEUIY":
p = p+1
if not p:
--- 44,50 ----
# remove up to the first vowel to make suffix
p = 0
! while p < len(word) and word[p] not in "aoeuiyAOEUIY":
p = p+1
if not p:
***************
*** 60,70 ****
out = out + ' ' + word
! else:
out = "Name not long enough."
SampleBlock.CodeNameEntry.set(string.strip(out))
! ]]></trigger>
! <trigger name="MyFortune" type="NAMED"><![CDATA[
Fortunes = ['You will have a long and fruitful life with GNUe.',
'GNUe will solve your next IT problem.',
'Why you not use GNUe before now?',
--- 60,70 ----
out = out + ' ' + word
! except:
out = "Name not long enough."
SampleBlock.CodeNameEntry.set(string.strip(out))
! </trigger>
! <trigger type="NAMED" name="MyFortune">
Fortunes = ['You will have a long and fruitful life with GNUe.',
'GNUe will solve your next IT problem.',
'Why you not use GNUe before now?',
***************
*** 87,133 ****
val = "Please enter a valid birth year first."
SampleBlock.FortuneEntry.set(val)
! ]]></trigger>
! <logic>
<block name="Block_1">
! <field name="Entry_1" default="Press 'Page Down' for a demo"/>
</block>
<block name="SampleBlock">
! <field name="NameEntry">
! <trigger name="Trigger_1" src="PigLatin" type="PRE-FOCUSOUT"/>
! </field>
! <field name="YearEntry"/>
! <field name="CodeNameEntry"/>
! <field name="FortuneEntry"/>
</block>
! </logic>
! <layout>
! <page name="Welcome">
! <label name="Label_1" text="Welcome to GNU Enterprise!" width="26" x="6"
! y="1"/>
! <label name="Label_3" text="This is a placeholder form." width="34"
! x="3" y="4"/>
! <box name="Box_1" height="9" label="Demo" width="38" x="1" y="2"/>
! <label name="Label_8" text="You would normally invoke Forms" width="34"
! x="3" y="5"/>
! <label name="Label_9" text="by double-clicking a GFD file" width="34"
! x="3" y="6"/>
! <label name="Label_10" text="or by typing 'gnue-forms <file>'."
! width="34" x="3" y="7"/>
! <entry block="Block_1" field="Entry_1" width="34" x="3" y="9"/>
! </page>
! <page name="Sample">
! <box name="Box_2" height="8" label="Sample" width="38" x="1" y="0"/>
! <label name="Label_5" text="Your Name: " width="10" x="3" y="2"/>
! <label name="Label_6" text="Year you were born:" width="20" x="3"
y="3"/>
! <label name="Label_7" text="Your Code Name:" width="15" x="3" y="5"/>
! <entry block="SampleBlock" field="NameEntry" width="23" x="14" y="2"/>
! <entry block="SampleBlock" field="YearEntry" width="6" x="22" y="3"/>
! <button name="btnClear" height="1" label="Fortune" trigger="MyFortune"
! width="8" x="29" y="3"/>
! <entry block="SampleBlock" field="CodeNameEntry" width="34" x="3"
y="6"/>
! <entry block="SampleBlock" field="FortuneEntry" height="4" width="36"
! x="2" y="8"/>
! </page>
! </layout>
</form>
--- 87,125 ----
val = "Please enter a valid birth year first."
SampleBlock.FortuneEntry.set(val)
! </trigger>
! <page name="Welcome">
<block name="Block_1">
! <entry name="Entry_1" x="3" y="9" width="34" default="Press 'Page Down'
for a demo"/>
</block>
+ <label x="6" y="1" width="26" name="Label_1"
+ text="Welcome to GNU Enterprise!"/>
+ <label x="3" y="4" width="34" name="Label_3"
+ text="This is a placeholder form."/>
+ <box x="1" y="2" width="38" label="Demo" name="Box_1" height="9"/>
+ <label x="3" y="5" width="34" name="Label_8"
+ text="You would normally invoke Forms"/>
+ <label x="3" y="6" width="34" name="Label_9"
+ text="by double-clicking a GFD file"/>
+ <label x="3" y="7" width="34" name="Label_10"
+ text="or by typing 'gnue-forms <file>'."/>
+ </page>
+ <page name="Sample">
+ <box x="1" y="0" width="38" label="Sample" name="Box_2" height="8"/>
+ <label x="3" y="2" width="10" name="Label_5" text="Your Name: "/>
+ <label x="3" y="3" width="20" name="Label_6" text="Your birth year:"/>
+ <label x="3" y="5" width="15" name="Label_7" text="Your Code Name:"/>
<block name="SampleBlock">
! <entry x="14" y="2" name="NameEntry" width="23">
! <trigger type="PRE-FOCUSOUT" name="Trigger_1" src="PigLatin"/>
! </entry>
! <entry name="YearEntry" x="20" y="3" width="5"/>
! <button x="28" y="3" trigger="MyFortune" width="9" label="Fortune"
! name="btnClear" height="1"/>
! <entry name="CodeNameEntry" x="3" y="6" width="34"/>
! <entry name="FortuneEntry" x="2" y="8" width="36" height="4"/>
</block>
! </page>
</form>
+
+
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.207 gnue/forms/src/GFForm.py:1.208
*** gnue/forms/src/GFForm.py:1.207 Mon Nov 25 00:29:20 2002
--- gnue/forms/src/GFForm.py Tue Nov 26 18:45:20 2002
***************
*** 73,78 ****
--- 73,83 ----
self._triggerns={}
+
+ # Hackery until proper layout support is added
+ self._xmlnamespaces = {'c': 'GNUe:Forms:Character'}
+
+
# The "None" init gives datasources time to setup master/detail
self._inits = [self.primaryInit, None, self.secondaryInit]
Index: gnue/forms/src/GFObjects/GFLayout.py
diff -c gnue/forms/src/GFObjects/GFLayout.py:1.2
gnue/forms/src/GFObjects/GFLayout.py:1.3
*** gnue/forms/src/GFObjects/GFLayout.py:1.2 Thu Nov 21 21:57:24 2002
--- gnue/forms/src/GFObjects/GFLayout.py Tue Nov 26 18:45:20 2002
***************
*** 42,50 ****
self._pageList = []
def _buildObject(self):
return GFObj._buildObject(self)
def initialize(self):
! pass
--- 42,80 ----
self._pageList = []
def _buildObject(self):
+
+ # TODO: This is temporary until layout management support works
+ self.walk(_addxy)
+
return GFObj._buildObject(self)
def initialize(self):
! self._xmlchildnamespaces = self._findNamespaces(self)
!
!
! # Find the xml namespace in use by any child objects
! def _findNamespaces(self, object):
! ns = {}
! for child in object._children:
! try:
! if child._xmlnamespaces:
! ns.update(list(child._xmlnamespaces))
! else:
! ns.update(self._findNamespace(child))
! except AttributeError:
! pass
! return ns
!
!
+ # TODO: Temporary until layout mgmt works
+ def _addxy(object):
+ for attr in ('x','y','height','width'):
+ try:
+ v = int(object.__dict__['Char__%s' % attr])
+ object.__dict__['Char__%s' % attr] = v
+ object.__dict__[attr] = v
+ object.__dict__['_Layout__%s' % attr] = v
+ except KeyError:
+ pass
Index: gnue/forms/src/GFParser.py
diff -c gnue/forms/src/GFParser.py:1.92 gnue/forms/src/GFParser.py:1.93
*** gnue/forms/src/GFParser.py:1.92 Mon Nov 25 23:23:33 2002
--- gnue/forms/src/GFParser.py Tue Nov 26 18:45:20 2002
***************
*** 231,255 ****
'Description': 'The justification of the label. Can be one of '
'the following: {left}, {right}, or {center}. '
'Requires that the {width} attribute be set.'},
! 'width': {
! 'Typecast': GTypecast.whole,
! 'Description': 'The width of the label in text columns. '
! 'Defaults to the width of the text. Only really
'
! 'useful when used with the {alignment}
attribute.' },
'rows': {
'Typecast': GTypecast.whole,
'Description': 'Overrides the rows setting defined at the
block level. ' },
'rowSpacer': {
'Typecast': GTypecast.whole,
! 'Description': 'Overriders the rowSpace setting defined at the
block level.' },
! 'x': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! 'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
--- 231,255 ----
'Description': 'The justification of the label. Can be one of '
'the following: {left}, {right}, or {center}. '
'Requires that the {width} attribute be set.'},
! ## 'width': {
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The width of the label in text columns. '
! ## 'Defaults to the width of the text. Only
really '
! ## 'useful when used with the {alignment}
attribute.' },
'rows': {
'Typecast': GTypecast.whole,
'Description': 'Overrides the rows setting defined at the
block level. ' },
'rowSpacer': {
'Typecast': GTypecast.whole,
! 'Description': 'Overriders the rowSpace setting defined at the
block level.' } },
! ## 'x': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! ## 'y': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text row starting position of the
widget. Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
***************
*** 409,421 ****
'Typecast': GTypecast.name,
'Required': 1,
'Description': 'The name of the block that this ties to.' },
! 'height': {
! 'Typecast': GTypecast.whole,
! 'Default': 1,
! 'Description': 'The height of the entry in text rows. ' },
! 'width': {
! 'Typecast': GTypecast.whole,
! 'Description': 'The width of the entry in text columns.' },
'focusorder': {
'Typecast': GTypecast.whole,
'Description': 'TODO'},
--- 409,421 ----
'Typecast': GTypecast.name,
'Required': 1,
'Description': 'The name of the block that this ties to.' },
! ## 'height': {
! ## 'Typecast': GTypecast.whole,
! ## 'Default': 1,
! ## 'Description': 'The height of the entry in text rows. ' },
! ## 'width': {
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The width of the entry in text columns.' },
'focusorder': {
'Typecast': GTypecast.whole,
'Description': 'TODO'},
***************
*** 451,490 ****
'use {dropdown} you are required to use both
the '
'{fk_source}, {fk_key}, and {fk_description} '
'attributes. The {label} style implies the '
! '{readonly} attribute.' },
! 'x': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text column starting position of the '
! 'widget. Based upon leftmost column of screen '
! 'being 0.' },
! 'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text row starting position of the widget. '
! 'Based upon the top row of the screen being 0.'
} },
'ParentTags': ('page',),
'Description': 'An {entry} is the visual counterpart to a {field}.'
},
'scrollbar': {
'BaseClass': GFObjects.GFScrollBar,
'Attributes': {
! 'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The width of the box in text columns.' },
! 'height': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The height of the box in text rows.' },
! 'x': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! 'y': {
'Required': 1,
'Typecast': GTypecast.whole,
! 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
--- 451,494 ----
'use {dropdown} you are required to use both
the '
'{fk_source}, {fk_key}, and {fk_description} '
'attributes. The {label} style implies the '
! '{readonly} attribute.' } },
! ## 'x': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text column starting position of the '
! ## 'widget. Based upon leftmost column of screen
'
! ## 'being 0.' },
! ## 'y': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text row starting position of the
widget. '
! ## 'Based upon the top row of the screen being
0.' } },
'ParentTags': ('page',),
'Description': 'An {entry} is the visual counterpart to a {field}.'
},
'scrollbar': {
'BaseClass': GFObjects.GFScrollBar,
'Attributes': {
! 'block': {
'Required': 1,
'Typecast': GTypecast.whole,
! 'Description': 'The block to which this scrollbar scrolls.' }
},
! ## 'width': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The width of the box in text columns.' },
! ## 'height': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The height of the box in text rows.' },
! ## 'x': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! ## 'y': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text row starting position of the
widget. Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
***************
*** 498,522 ****
'label': {
'Typecast': GTypecast.text,
'Description': 'An optional text label that will be displayed
on the border.' },
! 'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The width of the box in text columns.' },
! 'height': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The height of the box in text rows.' },
'focusorder': {
'Typecast': GTypecast.whole,
! 'Description': 'TODO' },
! 'x': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! 'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
--- 502,526 ----
'label': {
'Typecast': GTypecast.text,
'Description': 'An optional text label that will be displayed
on the border.' },
! ## 'width': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The width of the box in text columns.' },
! ## 'height': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The height of the box in text rows.' },
'focusorder': {
'Typecast': GTypecast.whole,
! 'Description': 'TODO' } },
! ## 'x': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0. ' },
! ## 'y': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text row starting position of the
widget. Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
***************
*** 533,555 ****
'Description': 'TODO'},
'label': {
'Typecast': GTypecast.name,
! 'Description': 'The text that should appear on the button' },
! 'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The width of the entry in text columns.' },
! 'height': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The height of the entry in text rows. ' },
! 'x': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0.' },
! 'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole,
! 'Description': 'The text row starting position of the widget.
Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
--- 537,559 ----
'Description': 'TODO'},
'label': {
'Typecast': GTypecast.name,
! 'Description': 'The text that should appear on the button' } },
! ## 'width': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The width of the entry in text columns.' },
! ## 'height': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The height of the entry in text rows. ' },
! ## 'x': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text column starting position of the
widget. Based upon leftmost column of screen being 0.' },
! ## 'y': {
! ## 'Required': 1,
! ## 'Typecast': GTypecast.whole,
! ## 'Description': 'The text row starting position of the
widget. Based upon the top row of the screen being 0.' } },
'ParentTags': ('page',),
'Description': 'TODO' },
***************
*** 797,804 ****
--- 801,813 ----
class xmlFormsHandler (GParser.xmlHandler):
def __init__(self):
+
GParser.xmlHandler.__init__(self)
+
+ # This is a temp thing until we figure out
+ # how to better do layout namespaces
+ self.xmlNamespaceAttributesAsPrefixes = 1
self.xmlElements = getXMLelements()
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.217
gnue/forms/src/uidrivers/wx/UIdriver.py:1.218
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.217 Mon Nov 25 11:44:18 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py Tue Nov 26 18:45:20 2002
***************
*** 356,363 ****
self._mainToolBar.Realize()
! width = int(self._form.width)
! height = int(self._form.height)
formSize = wxSize(width*self.widgetWidth,
(height+self.menu_sb_space)*self.widgetHeight)
--- 356,363 ----
self._mainToolBar.Realize()
! width = self._form.width
! height = self._form.height
formSize = wxSize(width*self.widgetWidth,
(height+self.menu_sb_space)*self.widgetHeight)
***************
*** 778,785 ****
object = event.object
style = self.alignmentStyle[object.alignment]
newWidget = wxStaticText(event.container, -1, str(object.text),
! wxPoint(object.x*event.widgetWidth,
!
(object.y+spacer+(spacer*object._gap))*event.widgetHeight),
wxSize(self.itemWidth,self.itemHeight), style)
return newWidget
--- 778,785 ----
object = event.object
style = self.alignmentStyle[object.alignment]
newWidget = wxStaticText(event.container, -1, str(object.text),
! wxPoint(object.Char__x*event.widgetWidth,
!
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight),
wxSize(self.itemWidth,self.itemHeight), style)
return newWidget
***************
*** 797,813 ****
##
## TODO: Commented out prior to 0.4.0 release
## newPanel = wxPanel(event.container,-1,
! ##
wxPoint(object.x*event.widgetWidth+(event.widgetWidth/2),
! ##
(object.y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
! ## wxSize((object.width-1)*event.widgetWidth,
! ## (object.height-1)*event.widgetHeight))
## newWidget = wxStaticBox(newPanel,-1,str(object.label),
## wxPoint(0,0),
newWidget = wxStaticBox(event.container,-1,str(object.label),
!
wxPoint(object.x*event.widgetWidth+(event.widgetWidth/2),
!
(object.y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
! wxSize((object.width-1)*event.widgetWidth,
! (object.height-1)*event.widgetHeight))
## return newPanel
return newWidget
--- 797,813 ----
##
## TODO: Commented out prior to 0.4.0 release
## newPanel = wxPanel(event.container,-1,
! ##
wxPoint(object.Char__x*event.widgetWidth+(event.widgetWidth/2),
! ##
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
! ## wxSize((object.Char__width-1)*event.widgetWidth,
! ## (object.Char__height-1)*event.widgetHeight))
## newWidget = wxStaticBox(newPanel,-1,str(object.label),
## wxPoint(0,0),
newWidget = wxStaticBox(event.container,-1,str(object.label),
!
wxPoint(object.Char__x*event.widgetWidth+(event.widgetWidth/2),
!
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
! wxSize((object.Char__width-1)*event.widgetWidth,
! (object.Char__height-1)*event.widgetHeight))
## return newPanel
return newWidget
***************
*** 821,828 ****
def _createWidget(self, event, spacer):
object = event.object
newWidget =wxScrollBar(event.container,-1,
!
wxPoint(object.x*event.widgetWidth,(object.y+spacer)*event.widgetHeight),
!
wxSize(object.width*event.widgetWidth,object.height*event.widgetHeight),
wxSB_VERTICAL)
return newWidget
--- 821,828 ----
def _createWidget(self, event, spacer):
object = event.object
newWidget =wxScrollBar(event.container,-1,
!
wxPoint(object.Char__x*event.widgetWidth,(object.Char__y+spacer)*event.widgetHeight),
!
wxSize(object.Char__width*event.widgetWidth,object.Char__height*event.widgetHeight),
wxSB_VERTICAL)
return newWidget
***************
*** 835,842 ****
def _createWidget(self, event, spacer):
object = event.object
newWidget = wxButton(event.container,-1,str(object.label),
!
wxPoint(object.x*event.widgetWidth,(object.y+spacer)*event.widgetHeight),
!
wxSize(object.width*event.widgetWidth,object.height*event.widgetHeight)
)
if event.initialize:
self._eventHandler = event.eventHandler
--- 835,842 ----
def _createWidget(self, event, spacer):
object = event.object
newWidget = wxButton(event.container,-1,str(object.label),
!
wxPoint(object.Char__x*event.widgetWidth,(object.Char__y+spacer)*event.widgetHeight),
!
wxSize(object.Char__width*event.widgetWidth,object.Char__height*event.widgetHeight)
)
if event.initialize:
self._eventHandler = event.eventHandler
***************
*** 889,896 ****
object = event.object
style = object.style
! defaultPoint = wxPoint(object.x*event.widgetWidth,
!
(object.y+spacer+(object._gap*spacer))*event.widgetHeight)
defaultSize = wxSize(self.itemWidth,self.itemHeight+1)
if style == 'dropdown':
--- 889,896 ----
object = event.object
style = object.style
! defaultPoint = wxPoint(object.Char__x*event.widgetWidth,
!
(object.Char__y+spacer+(object._gap*spacer))*event.widgetHeight)
defaultSize = wxSize(self.itemWidth,self.itemHeight+1)
if style == 'dropdown':
***************
*** 925,931 ****
else: # Normal text box
if event.initialize:
styles = wxTE_PROCESS_TAB
! if object.height > 1:
styles = styles|wxTE_MULTILINE
value = "" ## object.getValue()
else:
--- 925,931 ----
else: # Normal text box
if event.initialize:
styles = wxTE_PROCESS_TAB
! if hasattr(object,'Char__height') and object.Char__height > 1:
styles = styles|wxTE_MULTILINE
value = "" ## object.getValue()
else:
***************
*** 1173,1179 ****
not event.ControlDown() and \
not event.AltDown() and \
int (gConfigForms('enterIsNewLine')) and \
! object.height > 1:
command = 'NEWLINE'
--- 1173,1179 ----
not event.ControlDown() and \
not event.AltDown() and \
int (gConfigForms('enterIsNewLine')) and \
! object.Char__height > 1:
command = 'NEWLINE'
Index: gnue/forms/utils/gfd04to05.py
diff -c gnue/forms/utils/gfd04to05.py:1.9 gnue/forms/utils/gfd04to05.py:1.10
*** gnue/forms/utils/gfd04to05.py:1.9 Mon Nov 25 11:44:18 2002
--- gnue/forms/utils/gfd04to05.py Tue Nov 26 18:45:21 2002
***************
*** 89,95 ****
self._parent = newparent
def toXML(self, dest=sys.stdout, gap=" "):
! dest.write("%s<%s" % (gap[:-2],self._tag))
indent = len("%s<%s" % (gap[:-2],self._tag))
pos = indent
--- 89,98 ----
self._parent = newparent
def toXML(self, dest=sys.stdout, gap=" "):
! if self._tag == 'layout':
! dest.write('%s<%s xmlns:c="GNUe:Layout:Char"' % (gap[:-2],self._tag))
! else:
! dest.write("%s<%s" % (gap[:-2],self._tag))
indent = len("%s<%s" % (gap[:-2],self._tag))
pos = indent
***************
*** 103,109 ****
if attribute[0] == "_":
continue
val = self._properties[attribute]
! addl = ' %s="%s"' % (attribute, saxutils.escape('%s' % val))
if len(addl) + pos > 78:
dest.write("\n" + " " * indent + addl)
pos = indent
--- 106,116 ----
if attribute[0] == "_":
continue
val = self._properties[attribute]
! if attribute in ('x','y','width','height'):
! ns = 'c:'
! else:
! ns = ""
! addl = ' %s%s="%s"' % (ns,attribute, saxutils.escape('%s' % val))
if len(addl) + pos > 78:
dest.write("\n" + " " * indent + addl)
pos = indent
***************
*** 272,278 ****
for old in triggerReplacements.keys():
new = triggerReplacements[old]
! object._text = re.sub('%s([. =])' % old.replace('.','\\.'), new + '\\1',
object._text)
parser = make_parser()
formloader = Forms04Loader()
--- 279,285 ----
for old in triggerReplacements.keys():
new = triggerReplacements[old]
! object._text = re.sub('%s([. =])' % old.replace('.','\\.'), new + '\\1',
object._text)
parser = make_parser()
formloader = Forms04Loader()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/GObjects.py common/src/GParser....,
Jason Cater <=