|
From: Alex T. <ale...@us...> - 2004-08-16 13:17:37
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4407/tools/resourceEditor/modules Modified Files: newComponentDialog.py Log Message: Add a function wrapper for newCOmponentDialog, and use it from resourceEditor Use attributespec to identify whether label or text attributes apply to each component type. Index: newComponentDialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/newComponentDialog.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** newComponentDialog.py 12 Aug 2004 23:55:49 -0000 1.1 --- newComponentDialog.py 16 Aug 2004 13:17:27 -0000 1.2 *************** *** 8,12 **** class NewComponentDialog(model.CustomDialog): ! def __init__(self, aBg, original, offsets, title): model.CustomDialog.__init__(self, aBg) --- 8,12 ---- class NewComponentDialog(model.CustomDialog): ! def __init__(self, aBg, original, attributes, offsets, title): model.CustomDialog.__init__(self, aBg) *************** *** 19,31 **** add = "Copy" self.components.fldName.text = original['name']+add ! if "label" in original.keys(): self.components.lblLabelOrText.text = "Label" self.components.lblLabelOrText.visible = True ! self.components.fldLabelOrText.text = original['label']+add self.components.fldLabelOrText.visible = True ! elif "text" in original.keys(): self.components.lblLabelOrText.text = "Text" self.components.lblLabelOrText.visible = True ! self.components.fldLabelOrText.text = original['text']+add self.components.fldLabelOrText.visible = True else: --- 19,37 ---- add = "Copy" self.components.fldName.text = original['name']+add ! if "label" in attributes: self.components.lblLabelOrText.text = "Label" self.components.lblLabelOrText.visible = True ! if "label" in original.keys(): ! self.components.fldLabelOrText.text = original['label']+add ! else: ! self.components.fldLabelOrText.text = original['name']+add self.components.fldLabelOrText.visible = True ! elif "text" in attributes: self.components.lblLabelOrText.text = "Text" self.components.lblLabelOrText.visible = True ! if "text" in original.keys(): ! self.components.fldLabelOrText.text = original['text']+add ! else: ! self.components.fldLabelOrText.text = original['name']+add self.components.fldLabelOrText.visible = True else: *************** *** 41,42 **** --- 47,59 ---- self.components.chkVertical.visible = False + def newComponentDialog(aBg, original, attributes, offsets, title): + dlg = NewComponentDialog(aBg, original, attributes, offsets, title) + result = dlg.showModal() + if result.accepted: + result.name = dlg.components.fldName.text + result.labelortext = dlg.components.fldLabelOrText.text + result.horizontal = dlg.components.chkHorizontal.checked + result.vertical = dlg.components.chkVertical.checked + dlg.destroy() + return result + |