From: Alex T. <ale...@us...> - 2004-08-12 23:55:58
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3227/modules Added Files: newComponentDialog.py newComponentDialog.rsrc.py Log Message: Add a dialog to give new name and, if appropriate, label/text when creating a component via (Edit/Duplicate, Copy/Paste or Component/<comp>). Provide offset checkboxes to allow easy default positioning. --- NEW FILE: newComponentDialog.py --- """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/08/12 23:55:49 $" """ from PythonCard import model class NewComponentDialog(model.CustomDialog): def __init__(self, aBg, original, offsets, title): model.CustomDialog.__init__(self, aBg) self.parent = aBg self.title = title if title.startswith("New"): add = "" else: 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: self.components.lblLabelOrText.visible = False self.components.fldLabelOrText.visible = False self.components.fldLabelOrText.enabled = False if offsets: self.components.chkHorizontal.visible = True self.components.chkVertical.visible = True else: self.components.chkHorizontal.visible = False self.components.chkVertical.visible = False --- NEW FILE: newComponentDialog.rsrc.py --- {'type':'CustomDialog', 'name':'Template', 'title':'Dialog Template', 'position':(519, 120), 'size':(300, 199), 'components': [ {'type':'TextField', 'name':'fldName', 'position':(49, 9), 'size':(180, -1), }, {'type':'TextField', 'name':'fldLabelOrText', 'position':(50, 40), 'size':(180, -1), }, {'type':'CheckBox', 'name':'chkHorizontal', 'position':(10, 80), 'size':(114, -1), 'label':'Offest Horizontally', }, {'type':'CheckBox', 'name':'chkVertical', 'position':(150, 80), 'size':(94, -1), 'label':'Offest Vertically', }, {'type':'Button', 'id':5100, 'name':'btnOK', 'position':(30, 110), 'label':'OK', }, {'type':'Button', 'id':5101, 'name':'btnCancel', 'position':(130, 110), 'label':'Cancel', }, {'type':'StaticText', 'name':'lblLabelOrText', 'position':(10, 40), 'size':(25, -1), 'alignment':'right', 'text':'Label', }, {'type':'StaticText', 'name':'lblName', 'position':(10, 10), 'size':(35, -1), 'alignment':'right', 'text':'Name ', }, ] # end components } # end CustomDialog |