/[papo]/gnue/forms/src/GFParser.py
ViewVC logotype

Diff of /gnue/forms/src/GFParser.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by styxman, Thu Nov 14 22:16:53 2002 UTC revision 1.9.2.1 by anthonyl, Tue Mar 4 22:18:22 2003 UTC
# Line 16  Line 16 
16  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
17  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
18  #  #
19  # Copyright 2000-2002 Free Software Foundation  # Copyright 2000-2003 Free Software Foundation
20  #  #
21  # FILE:  # FILE:
22  # GFParser.py  # GFParser.py
23  #  #
24  # DESCRIPTION:  # DESCRIPTION:
25  # Class that contains a sax based xml processor for GNUE forms  # Class that contains a sax based xml processor for GNUe forms
26  #  #
27  # NOTES:  # NOTES:
28    # 1. Designer uses the 'Positionable' attribute. It is specific to
29    #    forms+designer and is not part of the GParser spec. If set to
30    #    true, then this object is a visible, movable, sizable attribute.
31  #  #
32    
33  from gnue.common import GDataSource, GParser, GMenu  from gnue.common import GDataSource, GParser, GMenu
# Line 36  from gnue.common import GTypecast, GTrig Line 39  from gnue.common import GTypecast, GTrig
39    
40    
41    
   
42  ########  ########
43  ########  Please keep this file neat !!!  ########  Please keep this file neat !!!
44  ########  ########
# Line 56  from gnue.common import GTypecast, GTrig Line 58  from gnue.common import GTypecast, GTrig
58  #  not want the loaded form to connect to databases, etc)  #  not want the loaded form to connect to databases, etc)
59  #######################################################  #######################################################
60    
61  def loadFile(buffer, app, initialize=1):  def loadFile(buffer, instance, initialize=1):
62    return GParser.loadXMLObject (buffer, xmlFormsHandler, 'GFForm', 'form',    return GParser.loadXMLObject (buffer, xmlFormsHandler, 'GFForm', 'form',
63             initialize, attributes={"_app": app,             initialize, attributes={"_instance": instance,
64                                 "_parameters": app._parameters,                                 "_parameters": instance._parameters,
65                                 "_connections": app.connections })                                 "_connections": instance.connections })
66    
67    
68  xmlElements = None  xmlElements = None
# Line 81  def getXMLelements(): Line 83  def getXMLelements():
83           'Attributes': {           'Attributes': {
84              'title': {              'title': {
85                 'Typecast': GTypecast.text,                 'Typecast': GTypecast.text,
86                 'Default': 'Untitled Form' },                 'Default': 'Untitled Form',
87                   'Description': 'The title of the form.' },
88              'readonly': {              'readonly': {
89                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
90                 'Default': 0 },                 'Default': 0,
91              'tabbed': {                 'Description': 'If set to {Y}, then no modifications to data '
92                                  'by the end user will be allowed. The form will '
93                                  'become a query-only form.' },
94                'name': {
95                   'Unique': 1,
96                   'Typecast': GTypecast.name,
97                   'Description': 'A unique ID for the form.' },
98                'style': {
99                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
100                 'ValueSet': {                 'ValueSet': {
101                    'left': {},                    'dialog': {} },
102                    'right': {},                 'Default': '',
103                    'bottom': {},                 'Description': ''  }, },
104                    'top': {} },           'ParentTags': None,
105                 'Default': "" },           'Description': 'TODO' },
106              'width': {  
107                 'Typecast': GTypecast.whole,        'logic': {
108                 'Default': 40 },           'BaseClass': GFObjects.GFLogic,
109              'height': {           'Required': 1,
110                 'Typecast': GTypecast.whole,           'Importable': 1,
111                 'Default': 12 } },           'SingleInstance': 1,
112           'ParentTags': None },           'ParentTags': ('layout',),
113             'Description': 'TODO' },
114    
115        'database': {        'layout': {
116           'BaseClass': GFObjects.GFDatabase,           'BaseClass': GFObjects.GFLayout,
117             'Required': 1,
118             'Importable': 1,
119             'SingleInstance': 1,
120             'ParentTags': ('layout',),
121             'Description': 'TODO' ,
122           'Attributes': {           'Attributes': {
123              'name': {             'tabbed': {
124                 'Required': 1,               'Typecast': GTypecast.name,
125                 'Unique': 1,               'ValueSet': {
126                 'Typecast': GTypecast.name },                  'left': {},
127              'provider': {                  'right': {},
128                 'Required': 1,                  'bottom': {},
129                 'Typecast': GTypecast.name },                  'top': {} },
130              'dbname': {             'Default': "",
131                 'Required': 0,             'Description': 'Allows a form to convert it\'s pages as '
132                 'Typecast': GTypecast.text },                          'notebook tabs. Allowed values are {left}, '
133              'service': {                          '{right}, {bottom}, {top}.' } } } ,
                'Required': 0,  
                'Typecast': GTypecast.text },  
             'comment': {  
                'Required': 0,  
                'Typecast': GTypecast.text },  
             'host': {  
                'Required': 0,  
                'Typecast': GTypecast.text } },  
          'ParentTags': ('form',) },  
134    
135        'page': {        'page': {
136           'BaseClass': GFObjects.GFPage,           'BaseClass': GFObjects.GFPage,
137           'Required': 1,           'Required': 1,
138           'Importable':1,           'Importable': 1,
139           'Attributes': {           'Attributes': {
140              'name': {              'name': {
141                 'Unique': 1,                 'Unique': 1,
142                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
143                   'Description': 'A unique ID for the widget. This is only useful '
144                                  'when importing pages from a library.' },
145                'transparent':{
146                   'Typecast': GTypecast.boolean,
147                   'Default': 0,
148                   'Description': 'If set, then you can tab out of the page via next- '
149                                  'or previous-field events. Makes navigation in '
150                                  'mutlipage forms easier. If false, focus stays '
151                                  'within a page until user explicitly moves to '
152                                  'another page' },
153                'style': {
154                   'Typecast': GTypecast.name,
155                   'ValueSet': {
156                       'normal': {},
157    ## TODO ##         'popup': {},
158                       },
159                   'Default': 'normal',
160                   'Description': 'The type of page '
161                                  'when importing pages from a library.' },
162              'caption': {              'caption': {
163                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
164           'ParentTags': ('form',) },                 'Description': 'For tabbed or popup pages, this contains the caption to use for the page.' } },
165             'ParentTags': ('layout',),
166             'Description': 'TODO' },
167    
168        'block': {        'block': {
169           'BaseClass': GFObjects.GFBlock,           'BaseClass': GFObjects.GFBlock,
# Line 145  def getXMLelements(): Line 173  def getXMLelements():
173              'name': {              'name': {
174                 'Required': 1,                 'Required': 1,
175                 'Unique': 1,                 'Unique': 1,
176                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
177                   'Description': 'A unique ID for the widget.The name of the '
178                                  'widget. No blocks can share '
179                                  'the same name without causing namespace '
180                                  'collisions in user triggers.' },
181              'rows': {              'rows': {
182                 'Typecast': GTypecast.whole},                 'Typecast': GTypecast.whole,
183                   'Description': 'Any widgets inside the block will display this '
184                                  'number of copies in a verticle column. Simulates '
185                                  'a grid entry system.'},
186              'rowSpacer': {              'rowSpacer': {
187                 'Typecast': GTypecast.whole },                 'Typecast': GTypecast.whole,
188              'transparentBlock':{                 'Description': 'Adjusts the vertical gap of this number of rows '
189                 'Typecast': GTypecast.boolean,                                'between duplicated widgets. Serves the same '
190                 'Default': 0 },                                'purpose as some of the gap attributes on '
191                                  'individual widgets.' },
192                'transparent':{
193                   'Typecast': GTypecast.boolean,
194                   'Default': 1,
195                   'Description': 'If set, then you can tab out of the block via next- '
196                                  'or previous-field events. Makes navigation in '
197                                  'mutliblock forms easier. If false, focus stays '
198                                  'within a block until user explicitly moves to '
199                                  'another block' },
200              'restrictDelete':{              'restrictDelete':{
201                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
202                 'Default': 0 },                 'Default': 0,
203                   'Description': 'If set then the user will be unable to request '
204                                   'that a record be deleted via the user interface.' },
205              'restrictInsert':{              'restrictInsert':{
206                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
207                 'Default': 0 },                 'Default': 0,
208                   'Description': 'If set then the user will be unable to request '
209                                  'that new records be inserted into the block.' },
210              'datasource': {              'datasource': {
211                 'References': (('datasource','name'),),                 'References': 'datasource.name',
212                 'Typecast': GTypecast.name } },                 'Typecast': GTypecast.name,
213           'ParentTags': ('page',) },                 'Description': 'The name of a datasource (defined in by a '
214                                  '{<datasource>} tag.) that provides this block '
215                                  'with it\'s data.' } },
216             'ParentTags': ('logic',),
217             'Description': 'TODO' },
218    
219        'label': {        'label': {
220           'BaseClass': GFObjects.GFLabel,           'BaseClass': GFObjects.GFLabel,
221           'Attributes': {           'Attributes': {
222              'name': {              'name': {
223                 'Unique': 1,                 'Unique': 1,
224                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
225                   'Description': 'The unique ID of the label.' },
226              'text': {              'text': {
227                 'Required': 1,                 'Required': 1,
228                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
229                   'Description': 'The text to be displayed.' },
230              'alignment': {              'alignment': {
231                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
232                 'ValueSet': {                 'ValueSet': {
233                    'left': {},                    'left': {},
234                    'right': {},                    'right': {},
235                    'center': {} },                    'center': {} },
236                 'Default': "left"},                 'Default': "left",
237              'width': {                 'Description': 'The justification of the label. Can be one of '
238                 'Typecast': GTypecast.whole },                                'the following: {left}, {right}, or {center}. '
239                                  'Requires that the {width} attribute be set.'},
240    ##            'width': {
241    ##               'Typecast': GTypecast.whole,
242    ##               'Description': 'The width of the label in text columns. '
243    ##                              'Defaults to the width of the text. Only really '
244    ##                              'useful when used with the {alignment} attribute.' },
245              'rows': {              'rows': {
246                 'Typecast': GTypecast.whole },                 'Typecast': GTypecast.whole,
247                   'Description': 'Overrides the rows setting defined at the block level. ' },
248              'rowSpacer': {              'rowSpacer': {
249                 'Typecast': GTypecast.whole },                 'Typecast': GTypecast.whole,
250              'x': {                 'Description': 'Overriders the rowSpace setting defined at the block level.' } },
251                 'Required': 1,  ##            'x': {
252                 'Typecast': GTypecast.whole },  ##               'Required': 1,
253              'y': {  ##               'Typecast': GTypecast.whole,
254                 'Required': 1,  ##               'Description': 'The text column starting position of the widget. Based upon leftmost column of screen being 0. ' },
255                 'Typecast': GTypecast.whole } },  ##            'y': {
256           'ParentTags': ('page','block',) },  ##               'Required': 1,
257    ##               'Typecast': GTypecast.whole,
258    ##               'Description': 'The text row starting position of the widget. Based upon the top row of the screen being 0.' } },
259             'Positionable': 1,
260             'ParentTags': ('page',),
261             'Description': 'TODO' },
262    
263        # If you implement a new entry "style", add to the entryStyles        'field': {
264        # structure after this list           'BaseClass': GFObjects.GFField,
       'entry': {  
          'BaseClass': GFObjects.GFEntry,  
265           'Importable':1,           'Importable':1,
266           'Attributes': {           'Attributes': {
267              'name': {              'name': {
268                 'Required': 1,                 'Required': 1,
269                 'Unique': 1,                 'Unique': 1,
270                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
271                   'Description': 'The unique ID of the entry. Referenced in '
272                                  'master/detail setups as well as triggers.' },
273              'field': {              'field': {
274                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
275              'height': {                 'Description': 'The name of the field in the datasource to '
276                 'Typecast': GTypecast.whole,                                'which this widget is tied.' },
                'Default': 1 },  
             'width': {  
                'Typecast': GTypecast.whole },  
277              'max_length': {              'max_length': {
                'Typecast': GTypecast.whole },  
             'visibleCount':{  
278                 'Typecast': GTypecast.whole,                 'Typecast': GTypecast.whole,
279                 'Deprecated': 'Use the <block> "rows" attribute instead.' },                 'Description': 'The maximum number of characters the user is '
280              'focusorder': {                                'allowed to enter into the entry.' },
281                 'Typecast': GTypecast.whole},              'min_length': {
282              'rows': {                 'Typecast': GTypecast.whole,
283                 'Typecast': GTypecast.whole},                 'Description': 'The minimum number of characters the user must '
284              'rowSpacer': {                                'enter into the entry.',
285                 'Typecast': GTypecast.whole },                 'Default': 0 },
286              'readonly': {              'readonly': {
287                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
288                   'Description': 'It defined the user will be unable to alter '
289                                  'the contents of this entry. Triggers can still '
290                                  'alter the value.',
291                 'Default': 0   },                 'Default': 0   },
292              'required': {              'required': {
293                 'Description': 'This object cannot have an empty value prior '                 'Description': 'This object cannot have an empty value prior '
294                                'to a commit.',                                'to a commit.',
295                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
                'Default': 0   },  
             'uppercase': {  
                'Deprecated': 'Use case="upper" instead.',  
                'Typecast': GTypecast.boolean,  
                'Default': 0   },  
             'lowercase': {  
                'Deprecated': 'Use case="lower" instead.',  
                'Typecast': GTypecast.boolean,  
                'Default': 0   },  
             'numeric': {  
                'Deprecated': 'Use typecast="number" instead',  
                'Typecast': GTypecast.boolean,  
296                 'Default': 0   },                 'Default': 0   },
             'hidden': {  
                'Typecast': GTypecast.boolean,  
                'Default': 0   },  
             'style': {  
                'Typecast': GTypecast.name,  
                'ValueSet': {  
                   'default': {},  
                   'dropdown': {},  
                   'checkbox': {},  
                   'textlookup': {},  
                   'label': {} },  
                'Default': 'default'},  
297              'case': {              'case': {
298                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
299                 'ValueSet': {                 'ValueSet': {
300                    'mixed': {},                    'mixed': {},
301                    'upper': {},                    'upper': {},
302                    'lower': {} },                    'lower': {} },
303                 'Default': 'mixed'},                 'Default': 'mixed',
304                   'Description': 'TODO'  },
305              'typecast': {              'typecast': {
306                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
307                 'ValueSet': {                 'ValueSet': {
308                    'text': {},                    'text': {},
309                    'number': {},                    'number': {},
310                    'date': {} },                    'date': {} },
311                 'Default': 'text'},                 'Default': 'text',
312                   'Description': 'The type of data the entry widget will accept. '
313                                  'Possible values are {text}, {number}, {date}.'},
314              'formatmask': {              'formatmask': {
315                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
316                   'Description': 'TODO' },
317              'inputmask': {              'inputmask': {
318                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
319                   'Description': 'TODO' },
320              'displaymask': {              'displaymask': {
321                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
322                   'Description': 'TODO' },
323              'value': {              'value': {
                'Typecast': GTypecast.text },  
             'foreign_key': {  
                'Typecast': GTypecast.name,  
                'Deprecated': 'Use fk_source="..." and fk_key="..." instead.' },  
             'foreign_key_description': {  
324                 'Typecast': GTypecast.text,                 'Typecast': GTypecast.text,
325                 'Deprecated': 'Use fk_description="..." instead.' },                 'Description': 'TODO' },
326    ##            'foreign_key': {
327    ##               'Typecast': GTypecast.name,
328    ##               'Deprecated': 'Use fk_source="..." and fk_key="..." instead.',
329    ##               'Description': 'Set in the format datasource.field This forces any '
330    ##                              'input into this entry to match the values stored '
331    ##                              'in the datasource.field' },
332    ##            'foreign_key_description': {
333    ##               'Typecast': GTypecast.text,
334    ##               'Deprecated': 'Use fk_description="..." instead.',
335    ##               'Description': 'The description used if a style of dropdown is '
336    ##                              'selected. This fields value is displayed in the '
337    ##                              'dropdown but the foreign_key value is actually '
338    ##                              'stored in the field. This allows you to display '
339    ##                              'something like the full name of a US state but '
340    ##                              'only store it\'s 2 character abrievation.' },
341              'fk_source': {              'fk_source': {
342                 'Typecast': GTypecast.name },                 'References': 'datasource.name',
343                   'Typecast': GTypecast.name,
344                   'Description': 'TODO' },
345              'fk_key': {              'fk_key': {
346                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
347                   'Description': 'TODO' },
348              'fk_description': {              'fk_description': {
349                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
350                   'Description': 'TODO' },
351                'fk_refresh': {
352                   'Typecast': GTypecast.name,
353                   'ValueSet': {
354                      'startup': {},
355                      'change': {},
356                      'commit': {} },
357                   'Default': 'startup',
358                   'Description': 'TODO' },
359              'default': {              'default': {
360                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
361                   'Description': 'The default value for any new records created. '
362                                  'If the field is visible the user can override '
363                                  'the value.' },
364              'queryDefault':{              'queryDefault':{
365                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
366                   'Description': 'The form will be populated with this value '
367                                  'automatically when a query is requested. If '
368                                  'the field is visible the user can still '
369                                  'override the value.' },
370              'sloppyQuery': {              'sloppyQuery': {
371                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
372                   'Description': 'When set, whatever value the user enters for '
373                                  'the query mask is rewritten with % between '
374                                  'each character. Thus {example} would be '
375                                  'queried as {%e%x%a%m%p%l%e%}' },
376              'ignoreCaseOnQuery': {              'ignoreCaseOnQuery': {
377                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
378                 'Default': 0 },                 'Default': 0,
379                   'Description': 'If defined the entry widget ignores the case '
380                                  'of the information entered into the query mask.' },
381              'editOnNull': {              'editOnNull': {
382                 'Description': 'Only allow this object to be edited if it '                 'Description': 'Only allow this object to be edited if it '
383                                'is currently empty.',                                'is currently empty.',
384                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
385                 'Default': 0 },                 'Default': 0,
386              'no_ltrim': {                 'Description': 'TODO' },
387                 'Description': 'Suppress trimming of extraneous space at '              'ltrim': {
388                   'Description': 'Trim extraneous space at '
389                                'beginning of user input.',                                'beginning of user input.',
390                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
391                 'Default': 0 },                 'Default': 0 },
392              'no_rtrim': {              'rtrim': {
393                 'Description': 'Suppress trimming of extraneous space at end '                 'Description': 'Trim extraneous space at end '
394                                'of user input.',                                'of user input.',
395                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
396                 'Default': 0 },                 'Default': 1 } },
397              'x': {           'ParentTags': ('block',),
398             'Description': 'TODO' },
399    
400          # If you implement a new entry "style", add to the entryStyles
401          # structure after this list
402          'entry': {
403             'BaseClass': GFObjects.GFEntry,
404             'Attributes': {
405                'name': {
406                   'Unique': 1,
407                   'Typecast': GTypecast.name,
408                   'Description': 'The unique ID of the entry.' },
409                'field': {
410                   'Typecast': GTypecast.name,
411                 'Required': 1,                 'Required': 1,
412                 'Typecast': GTypecast.whole },                 'Description': 'The name of the field that this ties to.' },
413              'y': {              'block': {
414                   'Typecast': GTypecast.name,
415                 'Required': 1,                 'Required': 1,
416                 'Typecast': GTypecast.whole } },                 'Description': 'The name of the block that this ties to.' },
417           'ParentTags': ('block','box') },  ##            'height': {
418    ##               'Typecast': GTypecast.whole,
419    ##               'Default': 1,
420    ##               'Description': 'The height of the entry in text rows. ' },
421    ##            'width': {
422    ##               'Typecast': GTypecast.whole,
423    ##               'Description': 'The width of the entry in text columns.' },
424                'focusorder': {
425                   'Typecast': GTypecast.whole,
426                   'Description': 'TODO'},
427                'rows': {
428                   'Typecast': GTypecast.whole,
429                   'Description': 'TODO'},
430                'rowSpacer': {
431                   'Typecast': GTypecast.whole,
432                   'Description': 'TODO' },
433                'navigable': {
434                   'Typecast': GTypecast.boolean,
435                   'Description': 'It false, the user will be unable to navigate '
436                                  'to this entry. Triggers can still '
437                                  'alter the value.',
438                   'Default': 1   },
439                'hidden': {
440                   'Typecast': GTypecast.boolean,
441                   'Default': 0,
442                   'Description': 'If defined the entry widget will not be '
443                                  'displayed on the form. This is usefull for '
444                                  'fields the user doesn\'t need to know about '
445                                  'that you wish to update via triggers.'   },
446                'style': {
447                   'Typecast': GTypecast.name,
448                   'ValueSet': {
449                      'default': {},
450                      'dropdown': {},
451                      'checkbox': {},
452                      'textlookup': {},
453                      'label': {} },
454                   'Default': 'default',
455                   'Description': 'The style of entry widget requested. Currently '
456                                  'either {text}, {label}, {checkbox}, or {dropdown}. To '
457                                  'use {dropdown} you are required to use both the '
458                                  '{fk_source}, {fk_key}, and {fk_description} '
459                                  'attributes. The {label} style implies the '
460                                  '{readonly} attribute.'  } },
461    ##            'x': {
462    ##               'Required': 1,
463    ##               'Typecast': GTypecast.whole,
464    ##               'Description': 'The text column starting position of the '
465    ##                              'widget. Based upon leftmost column of screen '
466    ##                              'being 0.' },
467    ##            'y': {
468    ##               'Required': 1,
469    ##               'Typecast': GTypecast.whole,
470    ##               'Description': 'The text row starting position of the widget. '
471    ##                              'Based upon the top row of the screen being 0.' } },
472             'Positionable': 1,
473             'ParentTags': ('page',),
474             'Description': 'An {entry} is the visual counterpart to a {field}.' },
475    
476        'scrollbar': {        'scrollbar': {
477           'BaseClass': GFObjects.GFScrollBar,           'BaseClass': GFObjects.GFScrollBar,
478           'Attributes': {           'Attributes': {
479              'width': {              'block': {
                'Required': 1,  
                'Typecast': GTypecast.whole },  
             'height': {  
                'Required': 1,  
                'Typecast': GTypecast.whole },  
             'x': {  
480                 'Required': 1,                 'Required': 1,
481                 'Typecast': GTypecast.whole },                 'Typecast': GTypecast.name,
482              'y': {                 'Description': 'The block to which this scrollbar scrolls.' },
                'Required': 1,  
                'Typecast': GTypecast.whole },  
483              'page': {              'page': {
484                'Required': 1,                 'Required': 1,
485                'Typecast': GTypecast.whole  } },                 'Typecast': GTypecast.whole  } },
486           'ParentTags': ('block') },  ##            'width': {
487    ##               'Required': 1,
488    ##               'Typecast': GTypecast.whole,
489    ##               'Description': 'The width of the box in text columns.' },
490    ##            'height': {
491    ##               'Required': 1,
492    ##               'Typecast': GTypecast.whole,
493    ##               'Description': 'The height of the box in text rows.' },
494    ##            'x': {
495    ##               'Required': 1,
496    ##               'Typecast': GTypecast.whole,
497    ##               'Description': 'The text column starting position of the widget. Based upon leftmost column of screen being 0. ' },
498    ##            'y': {
499    ##               'Required': 1,
500    ##               'Typecast': GTypecast.whole,
501    ##               'Description': 'The text row starting position of the widget. Based upon the top row of the screen being 0.' } },
502             'Positionable': 1,
503             'ParentTags': ('page',),
504             'Description': 'TODO' },
505    
506        'box': {        'box': {
507           'BaseClass': GFObjects.GFBox,           'BaseClass': GFObjects.GFBox,
508           'Attributes': {           'Attributes': {
509              'name': {              'name': {
510                 'Unique': 1,                 'Unique': 1,
511                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
512                   'Description': 'TODO' },
513              'label': {              'label': {
514                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
515              'width': {                 'Description': 'An optional text label that will be displayed on the border.' },
516                 'Required': 1,  ##            'width': {
517                 'Typecast': GTypecast.whole },  ##               'Required': 1,
518              'height': {  ##               'Typecast': GTypecast.whole,
519                 'Required': 1,  ##               'Description': 'The width of the box in text columns.' },
520                 'Typecast': GTypecast.whole },  ##            'height': {
521    ##               'Required': 1,
522    ##               'Typecast': GTypecast.whole,
523    ##               'Description': 'The height of the box in text rows.' },
524              'focusorder': {              'focusorder': {
525                 'Typecast': GTypecast.whole},                 'Typecast': GTypecast.whole,
526              'x': {                 'Description': 'TODO'  } },
527                 'Required': 1,  ##            'x': {
528                 'Typecast': GTypecast.whole },  ##               'Required': 1,
529              'y': {  ##               'Typecast': GTypecast.whole,
530                 'Required': 1,  ##               'Description': 'The text column starting position of the widget. Based upon leftmost column of screen being 0. ' },
531                 'Typecast': GTypecast.whole } },  ##            'y': {
532           'ParentTags': ('page','block',) },  ##               'Required': 1,
533    ##               'Typecast': GTypecast.whole,
534    ##               'Description': 'The text row starting position of the widget. Based upon the top row of the screen being 0.' } },
535             'Positionable': 1,
536             'ParentTags': ('page',),
537             'Description': 'TODO' },
538    
539        'button': {        'button': {
540           'BaseClass': GFObjects.GFButton,           'BaseClass': GFObjects.GFButton,
# Line 370  def getXMLelements(): Line 542  def getXMLelements():
542           'Attributes': {           'Attributes': {
543              'name': {              'name': {
544                 'Unique': 1,                 'Unique': 1,
545                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
546              'trigger': {                 'Description': 'A unique ID for the widget. Useful for importable buttons. ' },
                'Typecast': GTypecast.name },  
547              'focusorder': {              'focusorder': {
548                 'Typecast': GTypecast.whole},                 'Typecast': GTypecast.whole,
549                   'Description': 'TODO'},
550              'label': {              'label': {
551                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
552              'width': {                 'Description': 'The text that should appear on the button' } },
553                 'Required': 1,  ##            'width': {
554                 'Typecast': GTypecast.whole },  ##               'Required': 1,
555              'height': {  ##               'Typecast': GTypecast.whole,
556                 'Required': 1,  ##               'Description': 'The width of the entry in text columns.' },
557                 'Typecast': GTypecast.whole },  ##            'height': {
558              'x': {  ##               'Required': 1,
559                 'Required': 1,  ##               'Typecast': GTypecast.whole,
560                 'Typecast': GTypecast.whole },  ##               'Description': 'The height of the entry in text rows. ' },
561              'y': {  ##            'x': {
562                 'Required': 1,  ##               'Required': 1,
563                 'Typecast': GTypecast.whole } },  ##               'Typecast': GTypecast.whole,
564           'ParentTags': ('page','block','box') },  ##               'Description': 'The text column starting position of the widget. Based upon leftmost column of screen being 0.' },
565    ##            'y': {
566    ##               'Required': 1,
567    ##               'Typecast': GTypecast.whole,
568    ##               'Description': 'The text row starting position of the widget. Based upon the top row of the screen being 0.' } },
569             'Positionable': 1,
570             'ParentTags': ('page',),
571             'Description': 'TODO' },
572    
573        'options': {        'options': {
574           'BaseClass': GFObjects.GFOptions,           'BaseClass': GFObjects.GFOptions,
575           'UsableBySiblings': 1,           'UsableBySiblings': 1,
576           'ParentTags': ('form',) },           'ParentTags': ('form',),
577             'Description': 'TODO' },
578    
579        'option': {        'option': {
580           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
581           'Attributes': {           'Attributes': {
582              'name': {              'name': {
583                 'Required': 1,                 'Required': 1,
584                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
585                   'Description': 'TODO' },
586              'value': {              'value': {
587                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
588                   'Description': 'TODO' } },
589           'MixedContent': 1,           'MixedContent': 1,
590           'ParentTags': ('options',) },           'ParentTags': ('options',),
591             'Description': 'TODO' },
592    
593        'title': {        'title': {
594           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
# Line 414  def getXMLelements(): Line 597  def getXMLelements():
597                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
598                 'ValueSet': {                 'ValueSet': {
599                     'title': {} },                     'title': {} },
600                 'Default': 'title' },                 'Default': 'title',
601                   'Description': 'TODO' },
602              'value': {              'value': {
603                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
604                   'Description': 'TODO' } },
605           'MixedContent': 1,           'MixedContent': 1,
606           'SingleInstance': 1,           'SingleInstance': 1,
607           'Deprecated': 'Use the <form> attribute "title" instead.',           'Deprecated': 'Use the <form> attribute "title" instead.',
608           'ParentTags': ('options',) },           'ParentTags': ('options',),
609             'Description': 'TODO' },
610    
611        'name': {        'name': {
612           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
613           'Attributes': {           'Attributes': {
614              'name': {              'name': {
615                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
616                 'ValueSet': {                 'ValueSet': {
617                     'name': {} },                     'name': {} },
618                 'Default': 'name' },                 'Default': 'name',
619                   'Description': 'TODO' },
620              'value': {              'value': {
621                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
622                   'Description': 'TODO' } },
623           'MixedContent': 1,           'MixedContent': 1,
624           'SingleInstance': 1,           'SingleInstance': 1,
625           'ParentTags': ('options',) },           'ParentTags': ('options',),
626             'Description': 'TODO' },
627    
628        'height': {        'height': {
629           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
630           'Attributes': {           'Attributes': {
631              'name': {              'name': {
632                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
633                 'ValueSet': {                 'ValueSet': {
634                     'height': {} },                     'height': {} },
635                 'Default': 'height' },                 'Default': 'height',
636                   'Description': 'TODO' },
637              'value': {              'value': {
638                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
639           'MixedContent': 1,                 'Description': 'TODO' } },
640           'SingleInstance': 1,           'MixedContent': 1,
641           'Deprecated': 'Use the <form> attribute "height" instead.',           'SingleInstance': 1,
642           'ParentTags': None },           'Deprecated': 'Use the <form> attribute "height" instead.',
643             'ParentTags': None,
644             'Description': 'TODO' },
645    
646        'width': {        'width': {
647           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
# Line 464  def getXMLelements(): Line 656  def getXMLelements():
656           'MixedContent': 1,           'MixedContent': 1,
657           'SingleInstance': 1,           'SingleInstance': 1,
658           'Deprecated': 'Use the <form> attribute "width" instead.',           'Deprecated': 'Use the <form> attribute "width" instead.',
659           'ParentTags': ('options',) },           'ParentTags': ('options',),
660             'Description': 'TODO' },
661    
662        'author': {        'author': {
663           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
# Line 473  def getXMLelements(): Line 666  def getXMLelements():
666                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
667                 'ValueSet': {                 'ValueSet': {
668                     'author': {} },                     'author': {} },
669                 'Default': 'author' },                 'Default': 'author',
670                   'Description': 'TODO' },
671              'value': {              'value': {
672                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
673                   'Description': 'TODO' } },
674           'MixedContent': 1,           'MixedContent': 1,
675           'SingleInstance': 1,           'SingleInstance': 1,
676           'ParentTags': ('options',) },           'ParentTags': ('options',),
677             'Description': 'TODO' },
678    
679        'description':{        'description':{
680           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
681           'Attributes': {           'Attributes': {
682              'name': {              'name': {
683                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
684                 'ValueSet': {                 'ValueSet': {
685                     'description': {} },                     'description': {} },
686                 'Default': 'description' },                 'Default': 'description',
687                   'Description': 'TODO' },
688              'value': {              'value': {
689                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
690           'MixedContent': 1,                 'Description': 'TODO' } },
691             'MixedContent': 1,
692           'SingleInstance': 1,           'SingleInstance': 1,
693           'ParentTags': ('options',) },           'ParentTags': ('options',),
694             'Description': 'TODO' },
695    
696        'version': {        'version': {
697           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
# Line 501  def getXMLelements(): Line 700  def getXMLelements():
700                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
701                 'ValueSet': {                 'ValueSet': {
702                     'version': {} },                     'version': {} },
703                 'Default': 'version' },                 'Default': 'version',
704                   'Description': 'TODO' },
705              'value': {              'value': {
706                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
707                   'Description': 'TODO' } },
708           'MixedContent': 1,           'MixedContent': 1,
709           'SingleInstance': 1,           'SingleInstance': 1,
710           'ParentTags': ('options',) },           'ParentTags': ('options',),
711             'Description': 'TODO' },
712    
713        'tip': {        'tip': {
714           'BaseClass': GFObjects.GFOption,           'BaseClass': GFObjects.GFOption,
715           'Attributes': {           'Attributes': {
716              'name': {              'name': {
717                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
718                 'ValueSet': {                 'ValueSet': {
719                     'tip': {} },                     'tip': {} },
720                 'Default': 'tip' },                 'Default': 'tip',
721                   'Description': 'TODO' },
722              'value': {              'value': {
723                 'Typecast': GTypecast.text } },                 'Typecast': GTypecast.text,
724                   'Description': 'TODO' } },
725           'MixedContent': 1,           'MixedContent': 1,
726           'SingleInstance': 1,           'SingleInstance': 1,
727           'ParentTags': ('options',) },           'ParentTags': ('options',),
728             'Description': 'TODO' },
729        'parameter':    {        'parameter':    {
730           'BaseClass': GFObjects.GFParameter,           'BaseClass': GFObjects.GFParameter,
731           'Attributes': {           'Attributes': {
732              'name':          {              'name':          {
733                 'Required': 1,                 'Required': 1,
734                 'Unique': 1,                 'Unique': 1,
735                 'Typecast': GTypecast.name },                 'Typecast': GTypecast.name,
736                   'Description': 'TODO' },
737              'required':    {              'required':    {
738                 'Typecast': GTypecast.boolean,                 'Typecast': GTypecast.boolean,
739                 'Default': 0 },                 'Default': 0,
740                   'Description': 'TODO' },
741  ##            'limited':     {  ##            'limited':     {
742  ##               'Typecast': GTypecast.boolean,  ##               'Typecast': GTypecast.boolean,
743  ##               'Default': 0 },  ##               'Default': 0,
744    ##               'Description': 'TODO' },
745              'default':     {              'default':     {
746                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
747                   'Description': 'TODO' },
748              'description': {              'description': {
749  ##               'Required': 1,  ##               'Required': 1,
750                 'Typecast': GTypecast.text },                 'Typecast': GTypecast.text,
751                   'Description': 'TODO' },
752  ##            'source':      {  ##            'source':      {
753  ##               'Typecast': GTypecast.name },  ##               'Typecast': GTypecast.name,
754    ##               'Description': 'TODO' },
755              'type':        {              'type':        {
756                 'Typecast': GTypecast.name,                 'Typecast': GTypecast.name,
757                 'Default': "char" } },                 'Default': "char",
758           'ParentTags':  ('form',) },                 'Description': 'TODO' } },
759             'ParentTags':  ('form',),
760        'maintoolbar': {           'Description': 'TODO' },
         'BaseClass': GFForm.GFMainToolBar,  
         'Required': 0,  
         'SingleInstance': 1,  
         'Attributes': {  
           'enabled': {  
             'Typecast': GTypecast.boolean,  
             'Default': 1,  
           },  
         },  
         'ParentTags': ('form',),  
       },  
   
       'mainmenubar': {  
         'BaseClass': GFForm.GFMainMenuBar,  
         'Required': 0,  
         'SingleInstance': 1,  
         'Attributes': {  
           'enabled': {  
             'Typecast': GTypecast.boolean,  
             'Default': 1,  
           },  
         },  
         'ParentTags': ('form',),  
       },  
   
761      }      }
762    
763    
764      #      #
765        # Create the dialog alias for the forms
766        #
767        copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
768        copy._deepcopy_dispatch[types.ClassType] = copy._deepcopy_atomic
769        copy._deepcopy_dispatch[type(int)] = copy._deepcopy_atomic                            
770        dialog=copy.deepcopy(xmlElements['form'])
771        dialog['Required'] = 0
772        dialog['SingleInstance'] = 0
773        dialog['Importable'] = 1
774        dialog['Attributes']['style']['Default']='dialog'
775        dialog['ParentTags']= ('form',)
776        xmlElements.update({'dialog':dialog})
777          
778    
779        #
780      # Add DataSource elements      # Add DataSource elements
781      #      #
782      xmlElements.update(      xmlElements.update(
# Line 614  def getXMLelements(): Line 815  def getXMLelements():
815  #  #
816  entryStyles = {'text': 'Text Field',  entryStyles = {'text': 'Text Field',
817                 'dropdown': 'Drop Down Box',                 'dropdown': 'Drop Down Box',
818                   'label': 'Label-like Field',
819                 'checkbox': 'Check Box' ,                 'checkbox': 'Check Box' ,
820                 'textlookup': 'Text Lookup'}                 'textlookup': 'Text Lookup'}
821    
# Line 628  entryStyles = {'text': 'Text Field', Line 830  entryStyles = {'text': 'Text Field',
830    
831  class xmlFormsHandler (GParser.xmlHandler):  class xmlFormsHandler (GParser.xmlHandler):
832    def __init__(self):    def __init__(self):
833        
834    
835      GParser.xmlHandler.__init__(self)      GParser.xmlHandler.__init__(self)
836        
837        # This is a temp thing until we figure out
838        # how to better do layout namespaces
839        self.xmlNamespaceAttributesAsPrefixes = 1
840    
841      self.xmlElements = getXMLelements()      self.xmlElements = getXMLelements()
842    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26