Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30211/modules
Modified Files:
propertyEditor.py
Log Message:
added stringItems and other code to avoid eval() on strings
Index: propertyEditor.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/propertyEditor.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** propertyEditor.py 3 Oct 2004 19:21:34 -0000 1.56
--- propertyEditor.py 15 Sep 2006 23:54:07 -0000 1.57
***************
*** 34,37 ****
--- 34,38 ----
self.cantModify = ['id', 'name', 'alignment', 'layout', 'style', 'border', \
'horizontalScrollbar', 'min', 'max', 'columns', 'rules', 'labels', 'ticks']
+ self.stringItems = self.popItems + ['alignment', 'command', 'file', 'label', 'name', 'text', 'toolTip', 'userdata']
self.editItems = [self.components.wField, self.components.wColor,
***************
*** 196,210 ****
elif propName in self.popItems:
value = self.components.wPop.stringSelection
! elif propName in ('items', 'userdata') or (wClass == 'TextArea' and propName == 'text'):
value = self.components.wTextArea.text
! else:
! #value = self.components.wField.GetValue()
! value = self.components.wField.text
!
! if propName not in ['label', 'stringSelection', 'text', 'toolTip', 'userdata']:
try:
value = eval(value)
except:
pass
# KEA 2004-05-10
--- 197,220 ----
elif propName in self.popItems:
value = self.components.wPop.stringSelection
! elif propName == 'items':
value = self.components.wTextArea.text
! # KEA 2006-09-15
! # need better error handling
try:
value = eval(value)
except:
pass
+ elif propName == 'userdata' or (wClass == 'TextArea' and propName == 'text'):
+ value = self.components.wTextArea.text
+ else:
+ value = self.components.wField.text
+
+ if propName not in self.stringItems:
+ # KEA 2006-09-15
+ # need better error handling
+ try:
+ value = eval(value)
+ except:
+ pass
# KEA 2004-05-10
***************
*** 358,362 ****
##widget = self.components[wName]
widget = self._comp[wName]
! if propName in ['label', 'stringSelection', 'text', 'toolTip'] or propName in self.checkItems:
value = getattr(widget, propName)
else:
--- 368,372 ----
##widget = self.components[wName]
widget = self._comp[wName]
! if propName in self.stringItems or propName in self.checkItems:
value = getattr(widget, propName)
else:
***************
*** 411,415 ****
value = str(size)
! self.components.wField.text = value
# this should only display if the attribute is settable
# so name, alignment, and others are read-only
--- 421,428 ----
value = str(size)
! if value == None:
! self.components.wField.text = ''
! else:
! self.components.wField.text = value
# this should only display if the attribute is settable
# so name, alignment, and others are read-only
|