From: Kevin A. <ka...@us...> - 2004-05-13 02:40:40
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14435/components Modified Files: bitmapcanvas.py button.py checkbox.py codeeditor.py grid.py htmlwindow.py iehtmlwindow.py image.py imagebutton.py multicolumnlist.py radiogroup.py staticbox.py staticline.py statictext.py textarea.py textfield.py togglebutton.py tree.py Log Message: refactored resourceEditor to query component spec for default set of attributes in on_componentAdd_command updated all components and Widget class to provide defaults Index: grid.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/grid.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** grid.py 4 May 2004 17:15:42 -0000 1.9 --- grid.py 13 May 2004 02:40:24 -0000 1.10 *************** *** 23,26 **** --- 23,27 ---- """ attributes = { + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, #'items' : { 'presence' : 'optional', 'default' : [] }, #'style' : { 'presence' : 'optional', 'default' : [], 'values' : [ 'horizontal', 'vertical' ] }, Index: staticbox.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/staticbox.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** staticbox.py 4 May 2004 17:15:42 -0000 1.11 --- staticbox.py 13 May 2004 02:40:24 -0000 1.12 *************** *** 12,16 **** def __init__(self): attributes = { ! 'label' : { 'presence' : 'optional', 'default' : '' } } widget.WidgetSpec.__init__( self, 'StaticBox', 'Widget', [], attributes ) --- 12,17 ---- def __init__(self): attributes = { ! 'label' : { 'presence' : 'optional', 'default' : '' }, ! 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__( self, 'StaticBox', 'Widget', [], attributes ) Index: staticline.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/staticline.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** staticline.py 4 May 2004 17:15:42 -0000 1.12 --- staticline.py 13 May 2004 02:40:24 -0000 1.13 *************** *** 12,16 **** def __init__(self): attributes = { ! 'layout' : { 'presence' : 'optional', 'default' : 'horizontal', 'values' : [ 'horizontal', 'vertical' ] } } widget.WidgetSpec.__init__( self, 'StaticLine', 'Widget', [], attributes ) --- 12,17 ---- def __init__(self): attributes = { ! 'layout' : { 'presence' : 'optional', 'default' : 'horizontal', 'values' : [ 'horizontal', 'vertical' ] }, ! 'size' : { 'presence' : 'optional', 'default' : [ 50, -1 ] }, } widget.WidgetSpec.__init__( self, 'StaticLine', 'Widget', [], attributes ) Index: textarea.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/textarea.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** textarea.py 2 May 2004 19:49:57 -0000 1.24 --- textarea.py 13 May 2004 02:40:24 -0000 1.25 *************** *** 10,22 **** class TextAreaSpec(textfield.TextFieldSpec): def __init__(self): ! textfield.TextFieldSpec.__init__( self ) ! self._name = 'TextArea' ! self._parent = 'TextField' ! ! # KEA 2004-04-20 ! # need to update attributes here to override size [-1, 100] ! class TextArea(textfield.TextField): --- 10,28 ---- + # KEA 2004-05-12 + # due to the way Spec inits are called, I had to duplicate the TextField spec + # just so I could add a 'size' attribute, at least I think I needed to. + class TextAreaSpec(textfield.TextFieldSpec): def __init__(self): ! events = list(textfield.TextFieldEvents) ! attributes = { ! 'text' : {'presence' : 'optional', 'default' : ''}, ! 'editable' : {'presence' : 'optional', 'default' : 1}, ! 'alignment' : {'presence' : 'optional', 'default' : 'left', 'values' :['left', 'right', 'center']}, ! 'border' : {'presence' : 'optional', 'default' : '3d', 'values' : ['3d', 'none']}, ! 'size' : { 'presence' : 'optional', 'default' : [ -1, 50 ] }, ! } ! widget.WidgetSpec.__init__( self, 'TextArea', 'TextField' , events, attributes ) class TextArea(textfield.TextField): Index: radiogroup.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/radiogroup.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** radiogroup.py 4 May 2004 17:15:42 -0000 1.24 --- radiogroup.py 13 May 2004 02:40:24 -0000 1.25 *************** *** 21,26 **** attributes = { 'label' : { 'presence' : 'optional', 'default' : '' }, ! 'items' : { 'presence' : 'optional', 'default' : [] }, ! 'stringSelection' : { 'presence' : 'optional', 'default' : None }, 'layout' : { 'presence' : 'optional', 'default' : 'vertical', 'values' : [ 'horizontal', 'vertical' ] }, 'max' : { 'presence' : 'optional', 'default' : 1 } --- 21,26 ---- attributes = { 'label' : { 'presence' : 'optional', 'default' : '' }, ! 'items' : { 'presence' : 'optional', 'default' : ['one'] }, ! 'stringSelection' : { 'presence' : 'optional', 'default' : 'one' }, 'layout' : { 'presence' : 'optional', 'default' : 'vertical', 'values' : [ 'horizontal', 'vertical' ] }, 'max' : { 'presence' : 'optional', 'default' : 1 } Index: tree.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/tree.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tree.py 3 May 2004 16:13:41 -0000 1.14 --- tree.py 13 May 2004 02:40:25 -0000 1.15 *************** *** 106,109 **** --- 106,110 ---- #'items' : { 'presence' : 'optional', 'default' : [] }, #'style' : { 'presence' : 'optional', 'default' : [], 'values' : [ 'horizontal', 'vertical' ] }, + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__( self, 'Tree', 'Widget', events, attributes ) Index: textfield.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/textfield.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** textfield.py 2 May 2004 19:56:17 -0000 1.28 --- textfield.py 13 May 2004 02:40:24 -0000 1.29 *************** *** 34,45 **** class TextFieldSpec(widget.WidgetSpec): def __init__( self ) : ! events = [ ! event.KeyPressEvent, ! event.KeyDownEvent, ! event.KeyUpEvent, ! #event.TextEnterEvent, ! event.TextUpdateEvent, ! CloseFieldEvent ! ] attributes = { 'text' : {'presence' : 'optional', 'default' : ''}, --- 34,38 ---- class TextFieldSpec(widget.WidgetSpec): def __init__( self ) : ! events = list(TextFieldEvents) attributes = { 'text' : {'presence' : 'optional', 'default' : ''}, Index: iehtmlwindow.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/iehtmlwindow.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** iehtmlwindow.py 10 May 2004 00:45:17 -0000 1.18 --- iehtmlwindow.py 13 May 2004 02:40:24 -0000 1.19 *************** *** 56,59 **** --- 56,60 ---- ## ] attributes = { + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, 'text' : { 'presence' : 'optional', 'default' : '' }, } Index: codeeditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/codeeditor.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** codeeditor.py 3 May 2004 16:12:23 -0000 1.35 --- codeeditor.py 13 May 2004 02:40:24 -0000 1.36 *************** *** 30,33 **** --- 30,34 ---- ] attributes = { + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, 'text' : { 'presence' : 'optional', 'default' : '' }, 'editable' : { 'presence' : 'optional', 'default' : 1 }, Index: htmlwindow.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/htmlwindow.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** htmlwindow.py 4 May 2004 17:15:42 -0000 1.16 --- htmlwindow.py 13 May 2004 02:40:24 -0000 1.17 *************** *** 13,16 **** --- 13,17 ---- events = [] attributes = { + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, 'text' : { 'presence' : 'optional', 'default' : '' }, } Index: togglebutton.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/togglebutton.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** togglebutton.py 6 May 2004 20:13:27 -0000 1.1 --- togglebutton.py 13 May 2004 02:40:24 -0000 1.2 *************** *** 21,25 **** events = list(ToggleButtonEvents) attributes = { ! 'label' : { 'presence' : 'mandatory' }, 'checked' : { 'presence' : 'optional', 'default' : 0 } } widget.WidgetSpec.__init__(self, 'ToggleButton', 'Widget', events, attributes ) --- 21,25 ---- events = list(ToggleButtonEvents) attributes = { ! 'label' : { 'presence' : 'optional', 'default':'ToggleButton' }, 'checked' : { 'presence' : 'optional', 'default' : 0 } } widget.WidgetSpec.__init__(self, 'ToggleButton', 'Widget', events, attributes ) Index: multicolumnlist.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/multicolumnlist.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** multicolumnlist.py 4 May 2004 04:24:09 -0000 1.25 --- multicolumnlist.py 13 May 2004 02:40:24 -0000 1.26 *************** *** 76,79 **** --- 76,80 ---- 'rules' : { 'presence' : 'optional', 'default' : 1 }, #'style' : { 'presence' : 'optional', 'default' : [], 'values' : [ 'horizontal', 'vertical' ] }, + 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__( self, 'MultiColumnList', 'Widget', events, attributes ) Index: bitmapcanvas.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/bitmapcanvas.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** bitmapcanvas.py 4 May 2004 20:49:11 -0000 1.41 --- bitmapcanvas.py 13 May 2004 02:40:24 -0000 1.42 *************** *** 25,29 **** class BitmapCanvasSpec(widget.WidgetSpec): def __init__(self): ! widget.WidgetSpec.__init__( self, 'BitmapCanvas', 'Widget', [], {} ) --- 25,32 ---- class BitmapCanvasSpec(widget.WidgetSpec): def __init__(self): ! attributes = { ! 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, ! } ! widget.WidgetSpec.__init__( self, 'BitmapCanvas', 'Widget', [], attributes ) Index: statictext.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/statictext.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** statictext.py 4 May 2004 17:15:42 -0000 1.16 --- statictext.py 13 May 2004 02:40:24 -0000 1.17 *************** *** 11,15 **** def __init__(self): attributes = { ! 'text' : { 'presence' : 'optional', 'default' : '' }, 'alignment' : { 'presence' : 'optional', 'default' : 'left', 'values' :[ 'left', 'right', 'center' ] } } --- 11,15 ---- def __init__(self): attributes = { ! 'text' : { 'presence' : 'optional', 'default' : 'StaticText' }, 'alignment' : { 'presence' : 'optional', 'default' : 'left', 'values' :[ 'left', 'right', 'center' ] } } Index: imagebutton.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/imagebutton.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** imagebutton.py 2 May 2004 23:20:40 -0000 1.16 --- imagebutton.py 13 May 2004 02:40:24 -0000 1.17 *************** *** 17,21 **** #events = [ event.MouseClickEvent ] attributes = { ! 'file' : { 'presence' : 'mandatory' }, # KEA shouldn't there be a 'file' attribute here # could call it 'image' to match background above --- 17,21 ---- #events = [ event.MouseClickEvent ] attributes = { ! 'file' : { 'presence' : 'optional', 'default':'' }, # KEA shouldn't there be a 'file' attribute here # could call it 'image' to match background above *************** *** 25,29 **** # use ImageButton if you want images with transparent border # KEA since 3d is Windows specific, make transparent the default ! 'border' : { 'presence' : 'optional', 'default' : 'transparent', 'values' : [ '3d', 'transparent', 'none' ] } } widget.WidgetSpec.__init__( self, 'ImageButton', 'Image', events, attributes ) --- 25,30 ---- # use ImageButton if you want images with transparent border # KEA since 3d is Windows specific, make transparent the default ! 'border' : { 'presence' : 'optional', 'default' : 'transparent', 'values' : [ '3d', 'transparent', 'none' ] }, ! 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__( self, 'ImageButton', 'Image', events, attributes ) Index: image.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/image.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** image.py 4 May 2004 17:15:42 -0000 1.20 --- image.py 13 May 2004 02:40:24 -0000 1.21 *************** *** 12,16 **** events = [] attributes = { ! 'file' : { 'presence' : 'mandatory' }, # KEA shouldn't there be a 'file' attribute here # could call it 'image' to match background above --- 12,16 ---- events = [] attributes = { ! 'file' : { 'presence' : 'optional', 'default':'' }, # KEA shouldn't there be a 'file' attribute here # could call it 'image' to match background above *************** *** 19,23 **** # KEA kill border for now, until variations of what is possible are worked out # use ImageButton if you want images with transparent border ! #'border' : { 'presence' : 'optional', 'default' : '3d', 'values' : [ '3d', 'transparent', 'none' ] } } widget.WidgetSpec.__init__( self, 'Image', 'Widget', events, attributes ) --- 19,24 ---- # KEA kill border for now, until variations of what is possible are worked out # use ImageButton if you want images with transparent border ! #'border' : { 'presence' : 'optional', 'default' : '3d', 'values' : [ '3d', 'transparent', 'none' ] }, ! 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__( self, 'Image', 'Widget', events, attributes ) Index: button.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/button.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** button.py 4 May 2004 17:15:41 -0000 1.30 --- button.py 13 May 2004 02:40:24 -0000 1.31 *************** *** 23,27 **** ## events = [event.MouseClickEvent] attributes = { ! 'label':{'presence':'mandatory'}, # KEA don't need style for Button unless we are going to support # Win32-specific attributes --- 23,27 ---- ## events = [event.MouseClickEvent] attributes = { ! 'label' : { 'presence' : 'optional', 'default':'Button' }, # KEA don't need style for Button unless we are going to support # Win32-specific attributes *************** *** 29,33 **** 'default':{'presence':'optional', 'default':0} } widget.WidgetSpec.__init__(self, 'Button', 'Widget', events, attributes ) ! class Button(widget.Widget, wx.Button): --- 29,42 ---- 'default':{'presence':'optional', 'default':0} } widget.WidgetSpec.__init__(self, 'Button', 'Widget', events, attributes ) ! ! # KEA 2004-05-12 ! # this is here just so I have an example of a subclass ! # using getMinimalResourceDict ! ! def getMinimalResourceDict(self, name): ! d = widget.WidgetSpec.getMinimalResourceDict(self, name) ! d['label'] = d['name'] ! return d ! class Button(widget.Widget, wx.Button): Index: checkbox.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/checkbox.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** checkbox.py 4 May 2004 17:15:42 -0000 1.18 --- checkbox.py 13 May 2004 02:40:24 -0000 1.19 *************** *** 19,23 **** events = list(CheckBoxEvents) attributes = { ! 'label' : { 'presence' : 'mandatory' }, 'checked' : { 'presence' : 'optional', 'default' : 0 } } widget.WidgetSpec.__init__(self, 'CheckBox', 'Widget', events, attributes ) --- 19,23 ---- events = list(CheckBoxEvents) attributes = { ! 'label' : { 'presence' : 'optional', 'default':'CheckBox' }, 'checked' : { 'presence' : 'optional', 'default' : 0 } } widget.WidgetSpec.__init__(self, 'CheckBox', 'Widget', events, attributes ) |