From: Alex T. <ale...@us...> - 2005-11-02 12:14:43
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13330 Modified Files: backgroundInfoDialog.py backgroundInfoDialog.rsrc.py Log Message: Added support for custom window styles. Index: backgroundInfoDialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/backgroundInfoDialog.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** backgroundInfoDialog.py 24 Aug 2004 19:01:37 -0000 1.16 --- backgroundInfoDialog.py 2 Nov 2005 12:14:33 -0000 1.17 *************** *** 5,11 **** """ ! from PythonCard import dialog, model, util import os class BackgroundInfoDialog(model.CustomDialog): def __init__(self, aBg, rsrc): --- 5,25 ---- """ ! from PythonCard import dialog, model, util, helpful import os + import wx + + ### map wxWindowStyle constants to nice strings + styleNames = [ ('wx.MINIMIZE_BOX', 'Include Minimize box'), + ('wx.CAPTION', 'Include Caption'), + ('wx.MAXIMIZE_BOX', 'Include Maximize box'), + ('wx.CLOSE_BOX', 'Include Close box'), + ('wx.STAY_ON_TOP', 'Stay on top'), + ('wx.SYSTEM_MENU', 'Include System Menu'), + ('wx.RESIZE_BORDER', 'Include resize border'), + ('wx.FRAME_TOOL_WINDOW', 'Toolbar size frame'), + ('wx.FRAME_SHAPED', 'Frame can be shaped') ] + + class BackgroundInfoDialog(model.CustomDialog): def __init__(self, aBg, rsrc): *************** *** 30,38 **** self.components.chkTiled.checked = rsrc.tiled self.components.chkVisible.checked = rsrc.visible ! self.components.chkResizeable.checked = (rsrc.style != []) ! if rsrc.icon is not None: self.components.fldIcon.text = rsrc.icon def on_btnForegroundColor_mouseClick(self, event): result = dialog.colorDialog(self, color=util.colorFromString(self.components.fldForegroundColor.text)) --- 44,82 ---- self.components.chkTiled.checked = rsrc.tiled self.components.chkVisible.checked = rsrc.visible ! self.components.btnCustomize.visible = False ! self.components.btnCustomize.enabled = False ! if rsrc.style == []: ! self.components.windowStyle.stringSelection = 'Static' ! elif rsrc.style == ['resizeable']: ! self.components.windowStyle.stringSelection = 'Resizeable' ! else: ! self.components.windowStyle.stringSelection = 'Custom' ! self.components.btnCustomize.visible = True ! self.components.btnCustomize.enabled = True ! self.style = rsrc.style ! if rsrc.icon is not None: self.components.fldIcon.text = rsrc.icon + def on_windowStyle_select(self, event): + if self.components.windowStyle.stringSelection <> 'Custom': + self.components.btnCustomize.visible = False + self.components.btnCustomize.enabled = False + return + self.components.btnCustomize.visible = True + self.components.btnCustomize.enabled = True + self.on_btnCustomize_mouseClick(event) + + def on_btnCustomize_mouseClick(self, event): + styleBoxes = [] + for s,text in styleNames: + styleBoxes.append( (s, s in self.style, text) ) + + result = helpful.multiCheckBoxDialog(self, styleBoxes, "Define Custom Window Styles") + if result.accepted: + self.style = [] + for s,val in result.boxes.iteritems(): + if val: self.style.append( s ) + def on_btnForegroundColor_mouseClick(self, event): result = dialog.colorDialog(self, color=util.colorFromString(self.components.fldForegroundColor.text)) *************** *** 78,85 **** result.tiled = dlg.components.chkTiled.checked result.visible = dlg.components.chkVisible.checked ! if dlg.components.chkResizeable.checked: result.style = ['resizeable'] else: ! result.style = [] if dlg.components.fldIcon.text != '': result.icon = dlg.components.fldIcon.text --- 122,131 ---- result.tiled = dlg.components.chkTiled.checked result.visible = dlg.components.chkVisible.checked ! if dlg.components.windowStyle.stringSelection == 'Static': ! result.style = [] ! elif dlg.components.windowStyle.stringSelection == 'Resizeable': result.style = ['resizeable'] else: ! result.style = dlg.style if dlg.components.fldIcon.text != '': result.icon = dlg.components.fldIcon.text Index: backgroundInfoDialog.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/backgroundInfoDialog.rsrc.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** backgroundInfoDialog.rsrc.py 9 Aug 2004 23:04:19 -0000 1.2 --- backgroundInfoDialog.rsrc.py 2 Nov 2005 12:14:33 -0000 1.3 *************** *** 1,7 **** {'type':'CustomDialog', ! 'name':'backgroundInfo', ! 'title':'Background Info', ! 'size':(370, 380), ! 'components': [ {'type':'StaticText', --- 1,25 ---- {'type':'CustomDialog', ! 'name':'backgroundInfo', ! 'title':'Background Info', ! 'position':(53, 94), ! 'size':(370, 563), ! 'components': [ ! ! {'type':'Button', ! 'name':'btnCustomize', ! 'position':(247, 333), ! 'label':'Customize', ! }, ! ! {'type':'RadioGroup', ! 'name':'windowStyle', ! 'position':(76, 279), ! 'size':(281, -1), ! 'items':['Static', 'Resizeable', 'Custom'], ! 'label':'Window Style', ! 'layout':'horizontal', ! 'max':1, ! 'stringSelection':'Static', ! }, {'type':'StaticText', *************** *** 38,42 **** 'name':'stcBackgroundColor', 'position':(10, 135), - #'size':(90, -1), 'text':'Background color:', }, --- 56,59 ---- *************** *** 80,84 **** 'name':'fldForegroundColor', 'position':(130, 110), - 'size':(100, -1), }, --- 97,100 ---- *************** *** 86,90 **** 'name':'btnForegroundColor', 'position':(250, 110), ! 'label':'Color...', }, --- 102,106 ---- 'name':'btnForegroundColor', 'position':(250, 110), ! 'label':'Color...', }, *************** *** 92,96 **** 'name':'fldBackgroundColor', 'position':(130, 135), - 'size':(100, -1), }, --- 108,111 ---- *************** *** 98,102 **** 'name':'btnBackgroundColor', 'position':(250, 135), ! 'label':'Color...', }, --- 113,117 ---- 'name':'btnBackgroundColor', 'position':(250, 135), ! 'label':'Color...', }, *************** *** 104,108 **** 'name':'fldImage', 'position':(130, 160), - 'size':(100, -1), }, --- 119,122 ---- *************** *** 110,114 **** 'name':'btnFile', 'position':(250, 160), ! 'label':'File...', }, --- 124,128 ---- 'name':'btnFile', 'position':(250, 160), ! 'label':'File...', }, *************** *** 117,121 **** 'position':(130, 185), 'size':(135, -1), - 'checked':0, 'label':'Tile image', }, --- 131,134 ---- *************** *** 124,128 **** 'name':'fldIcon', 'position':(130, 210), - 'size':(100, -1), }, --- 137,140 ---- *************** *** 130,134 **** 'name':'btnIconFile', 'position':(250, 210), ! 'label':'File...', }, --- 142,146 ---- 'name':'btnIconFile', 'position':(250, 210), ! 'label':'File...', }, *************** *** 136,140 **** 'name':'chkStatusBar', 'position':(130, 235), - 'checked':0, 'label':'Status bar on window', }, --- 148,151 ---- *************** *** 144,172 **** 'position':(130, 260), 'size':(135, -1), ! 'checked':1, 'label':'Visible at startup', }, - {'type':'CheckBox', - 'name':'chkResizeable', - 'position':(130, 285), - 'size':(135, -1), - 'checked':0, - 'label':'Resizeable', - }, - {'type':'Button', 'name':'btnOK', ! 'position':(10, 320), ! 'label':'OK', ! 'default':1, ! 'id':5100, }, {'type':'Button', 'name':'btnCancel', ! 'position':(115, 320), ! 'label':'Cancel', ! 'id':5101, }, --- 155,175 ---- 'position':(130, 260), 'size':(135, -1), ! 'checked':True, 'label':'Visible at startup', }, {'type':'Button', + 'id':5100, 'name':'btnOK', ! 'position':(9, 405), ! 'default':1, ! 'label':'OK', }, {'type':'Button', + 'id':5101, 'name':'btnCancel', ! 'position':(114, 405), ! 'label':'Cancel', }, |