From: Schollnick, B. <Ben...@xe...> - 2005-07-14 16:27:10
|
Folks, I'm working on a custom dialog, that I need to revise depending on the type of data being edited. The following code works fine, except for the Choice Dialog. class Edit_Window(model.CustomDialog): def static_and_area (self, x, y, label, default): #self.static_and_area (10, 20, "xyz", "testing") #self.static_and_area (10, 20, "xyz", "testing") self.components[label+'text'] =3D {'type':'StaticText', 'name':label+'text', 'position':(x, y), 'text':label.replace("_", " "),} self.components[label+'field'] =3D {'type':'TextArea', 'name':label+'field', 'position':(x+110, y-10), 'size':(280, 40), 'text':default.replace("_", " "),} def static_and_pulldown ( self, x, y, label, data=3D[]): self.components[label+'text'] =3D {'type':'StaticText', 'name':label+'text', 'position':(x, y), 'text':label.replace("_", " "),} ## self.components[label+'field'] =3D {'type':'Choice',=20 ## 'name':'Choice1',=20 ## 'position':(10, 10),=20 ## 'items':[],=20 ## 'labelSpecified':0,=20 ## 'nameSpecified':0,=20 ## } ## self.components[label+'field'] =3D {'type':'Choice',=20 ## 'name':'popChoice',=20 ## 'position':(100, 360),=20 ## 'items':{'one':1, 'two':2, 'three':3},=20 ## 'stringSelection':'two',=20 ## }, ## self.components[label+'field'] =3D {'type':'Choice', ## 'name':label+'field', ## 'position':(x+125, y), ## 'items':['abc', 'def','ghi'], ## 'stringSelection': 'def',}, Any ideas? C:\develope\security>software_licensing_report2.py Traceback (most recent call last): File "C:\develope\Python24\lib\site-packages\PythonCard\widget.py", line 439,in _dispatch handler(background, aWxEvent) File "C:\develope\security\browser.py", line 62, in on_btnEdit_mouseClick results =3D self.edit (self, data) File "C:\develope\security\editting_dialog.py", line 109, in edit_software_catalog result.Software_Classification =3D dlg.components.Software_Classificationfield.text File "C:\develope\Python24\lib\site-packages\PythonCard\model.py", line 77, in __getattr__ return self.data[key] KeyError: 'Software_Classificationfield' {'returnedString': 'Close', 'accepted': True, 'returned': 5100} - Ben |