|
From: Alex T. <ale...@us...> - 2004-08-16 13:17:36
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4407/tools/resourceEditor Modified Files: resourceEditor.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: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -d -r1.206 -r1.207 *** resourceEditor.py 15 Aug 2004 17:34:59 -0000 1.206 --- resourceEditor.py 16 Aug 2004 13:17:25 -0000 1.207 *************** *** 21,25 **** from modules import stackInfoDialog from modules import menuDialog ! from modules.newComponentDialog import NewComponentDialog from modules import stringDialog from modules.dialogInfoDialog import DialogInfoDialog --- 21,25 ---- from modules import stackInfoDialog from modules import menuDialog ! from modules.newComponentDialog import newComponentDialog from modules import stringDialog from modules.dialogInfoDialog import DialogInfoDialog *************** *** 1024,1038 **** def create_component(self, desc, offsets, promptString, errString): ! dlg = NewComponentDialog(self, desc, offsets, promptString) ! result = dlg.showModal() if result.accepted: ! name = dlg.components.fldName.text if name in self.components: dialog.alertDialog(self, name + " already exists", 'Error: Unable to '+errString+' widget') return ! if 'label' in desc.keys(): ! desc['label'] = dlg.components.fldLabelOrText.text ! elif 'text' in desc.keys(): ! desc['text'] = dlg.components.fldLabelOrText.text desc['name'] = name --- 1024,1039 ---- def create_component(self, desc, offsets, promptString, errString): ! optionalAttributes = registry.Registry.getInstance().components[desc['type']]._spec._optionalAttributes.keys() ! ! result = newComponentDialog(self, desc, optionalAttributes, offsets, promptString) if result.accepted: ! name = result.name if name in self.components: dialog.alertDialog(self, name + " already exists", 'Error: Unable to '+errString+' widget') return ! if 'label' in optionalAttributes: ! desc['label'] = result.labelortext ! elif 'text' in optionalAttributes: ! desc['text'] = result.labelortext desc['name'] = name *************** *** 1043,1052 **** dx, dy = self.components[name].size #rint x, y, dx, dy ! if dlg.components.chkHorizontal.checked: x += dx+30 ! if dlg.components.chkVertical.checked: y += dy+30 else: ! if dlg.components.chkVertical.checked: y += dy+30 else: --- 1044,1053 ---- dx, dy = self.components[name].size #rint x, y, dx, dy ! if result.horizontal: x += dx+30 ! if result.vertical: y += dy+30 else: ! if result.vertical: y += dy+30 else: |