[Wnd-commit] wnd/wnd/dlgs/templates choosecolor.py,NONE,1.1 findtext.py,NONE,1.1 opensavefile.py,NON
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 19:29:02
|
Update of /cvsroot/wnd/wnd/wnd/dlgs/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30832 Modified Files: choosefont.py Added Files: choosecolor.py findtext.py opensavefile.py replacetext.py Log Message: bit of this and a bit of that --- NEW FILE: findtext.py --- """default template for FindText dialog using dlgeditor""" from wnd.consts import dlgs from wnd.tools.dlgeditor.dlgeditor import DlgEditor #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: p= DlgEditor() p.BeginTemplate(None, 'Find', 30, 73, 236, 62, ('Ms Sans Serif', 8, 0, 0), 'modalframe', 'popup', 'caption', 'sysmenu', 'border', '3dlook', 'contexthelp') # find editvox p.Item('static', 0xFFFFFFFF, 'Fi&nd what:', 4, 8, 42, 8, 'left', 'visible') p.Item('edit', dlgs.edt1, '', 47, 7, 128, 12, 'group', 'tabstop', 'autohscroll', 'visible', 'clientedge') # whole word and match case checkbox p.Item('button', dlgs.chx1, 'Match &whole word only', 4, 26, 100, 12, 'group','autocheckbox', 'visible', 'tabstop') p.Item('button', dlgs.chx2, 'Match &case', 4, 42, 64, 12, 'autocheckbox', 'visible') # direcion radiobox p.Item('button', dlgs.grp1, 'Direction', 107, 26, 68, 28, 'groupbox', 'group', 'visible') p.Item('button', dlgs.rad1, '&Up', 111, 38, 25, 12, 'group','autoradiobutton', 'visible') p.Item('button', dlgs.rad2, '&Down', 138, 38, 35, 12, 'autoradiobutton', 'visible') # default buttons p.Item('button', dlgs.IDOK, '&Find Next', 182, 5, 50, 14, 'group', 'visible', 'tabstop') p.Item('button', dlgs.IDCANCEL, 'Cancel', 182, 23, 50, 14, 'visible') p.Item('button', dlgs.pshHelp, '&Help', 182, 45, 50, 14, 'visible') #*********************************************************************** #*********************************************************************** if __name__=='__main__': import wnd from wnd.dlgs import findtext class Window(wnd.Window): def __init__(self): wnd.Window.__init__(self, 'findtext_test', 'findtext_test', None, None, None, None, 'sysmenu', 'sizebox', 'dialoglike') self.fr = findtext.FindTextFromTemplate(p.ToBuffer()) self.fr.onMSG = self.on_fr def on_fr(self, hwnd, msg, wp, lp): if msg.startswith('fr_'): print hwnd, msg, wp, lp def onMSG(self, hwnd, msg, wp, lp): if msg == 'open': self.fr.Run(self.Hwnd, 'foo', 'hook', 'showhelp') w= Window() w.Run() --- NEW FILE: opensavefile.py --- """default template for OpenSaveFile dialog using dlgeditor""" from wnd.consts import dlgs from wnd.tools.dlgeditor.dlgeditor import DlgEditor #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: """ NOTES - the toolbar used by the dialog is not documented - the dialog ignores all attempts to change the font - the listview used to display the files is created at runtime as a child of a parent window 'SHELLDLL_DefView' """ p= DlgEditor() p.BeginTemplate(None, 'Open', 0, 0, 280, 164, ('Ms Sans Serif', 8, 0, 0), 'modalframe', 'popup', 'caption', 'contexthelp', '3dlook', 'sysmenu', 'clipchildren') # dir combo p.Item('static', dlgs.stc4, 'Look &in:', 7, 6, 27, 8, 'left', 'notify', 'visible') p.Item('combobox', dlgs.cmb2, '', 36, 3, 138, 300, 'dropdownlist', 'ownerdrawfixed', 'hasstrings', 'vscroll','tabstop', 'visible') # some listbox p.Item('static', dlgs.stc1, '', 172, 2, 102, 17) # not visiblre p.Item('listbox', dlgs.lst1, '', 4, 20, 272, 85, 'sort', 'nointegralheight', 'multicolumn', 'hscroll') # not visible # filename editbox p.Item('static', dlgs.stc3, 'File &name:', 5, 112, 48, 8, 'notify', 'left', 'visible') p.Item('edit', dlgs.edt1, '', 54, 111, 155, 12, 'autohscroll', 'visible') # filter combobox p.Item('static', dlgs.stc2, 'Files of &type:', 5, 131, 48, 8, 'notify', 'left', 'visible') p.Item('combobox', dlgs.cmb1, '', 54, 129, 155, 100, 'dropdownlist', 'vscroll','tabstop', 'visible') # redonly checkbox p.Item('button', dlgs.chx1, 'Open as &read-only', 54, 148, 74, 10, 'autocheckbox', 'tabstop', 'visible') # buttons p.Item('button', dlgs.IDOK, '&Open', 222, 110, 50, 14, 'defpushbutton', 'visible', 'tabstop') p.Item('button', dlgs.IDCANCEL, 'Cancel', 222, 128, 50, 14, 'visible') p.Item('button', dlgs.pshHelp, '&Help', 222, 145, 50, 14, 'visible') #********************************************************************************* #********************************************************************************* if __name__=='__main__': from wnd.dlgs import opensavefile def callback(hwnd, msg, wp, lp): pass #if msg=="debug": print lp o=opensavefile.OpenSaveFileFromTemplate(p.ToBuffer(), 'debug') o.onMSG= callback r= o.RunOpenFile(0, 'createprompt', 'hook', 'report', defaultfilter=0, initialdir='c:\\') #r= o.RunSaveFile(0, 'createprompt', 'overwriteprompt', 'hook', 'hidereadonly', defaultfilter=0, initialdir='c:\\') print r Index: choosefont.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/dlgs/templates/choosefont.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** choosefont.py 29 Apr 2005 15:24:00 -0000 1.1.1.1 --- choosefont.py 23 Jul 2005 19:28:49 -0000 1.2 *************** *** 1,3 **** ! """default template for ChooseFont dialog using dlgeditor""" from wnd.consts import dlgs --- 1,3 ---- ! """default template for ChooseFont dialog using dlgeditor""" from wnd.consts import dlgs *************** *** 6,40 **** p= DlgEditor() ! p.BeginTemplate(None, 'Font', 13, 54, 263, 196, None, 'modalframe', 'popup', 'caption', 'contexthelp', '3dlook', 'sysmenu') ! # FONT COMBOS p.Item('static', dlgs.stc1, '&Font:', 7, 7, 40, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb1, '', 7, 16, 98, 76, 'simple', 'sort', 'vscroll', 'tabstop', 'disablenoscroll', 'hasstrings', 'ownerdrawfixed', 'visible') p.Item('static', dlgs.stc2, 'Font st&yle:', 110, 7, 44, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb2, '', 110, 16, 62, 76, 'simple', 'vscroll', 'disablenoscroll', 'tabstop', 'visible') p.Item('static', dlgs.stc3, '&Size:',177, 7, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb3, '', 177, 16, 27, 76, 'simple', 'tabstop', 'sort', 'disablenoscroll', 'hasstrings', 'ownerdrawfixed', 'visible') ! # DEFAULT BUTTONS ! p.Item('button', dlgs.IDOK, 'OK', 210, 16, 45, 14, 'pushbutton', 'defpushbutton', 'group', 'visible') ! p.Item('button', dlgs.IDCANCEL, 'Cancel', 210, 32, 45, 14, 'pushbutton', 'group', 'visible') ! p.Item('button', dlgs.psh3, '&Apply', 210, 48, 45, 14, 'pushbutton', 'defpushbutton', 'group', 'visible') ! p.Item('button', dlgs.pshHelp, '&Help', 210, 64, 45, 14, 'pushbutton', 'group', 'visible') ! # EFFECTS ! p.Item('button', dlgs.grp1, 'Effects', 7, 97, 98, 72, 'groupbox', 'group', 'visible') p.Item('button', dlgs.chx1, 'Stri&keout', 13, 110, 49, 10, 'autocheckbox', 'tabstop', 'visible') p.Item('button', dlgs.chx2, '&Underline', 13, 123, 51, 10, 'autocheckbox', 'tabstop', 'visible') ! # COLOR p.Item('static', dlgs.stc4, '&Color:', 13, 136, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb4, '', 13, 146, 82, 100, 'dropdownlist', 'autohscroll', 'border', 'vscroll', 'tabstop', 'hasstrings', 'ownerdrawfixed', 'visible') ! # SAMPLE p.Item('button', dlgs.grp2, 'Sample', 110, 97, 94, 43, 'groupbox', 'group', 'visible') p.Item('static', dlgs.stc5, 'AaBbYyZz', 118, 111, 77, 23, 'noprefix') # not visible p.Item('static', dlgs.stc6, '', 7, 176, 196, 20, 'left', 'noprefix', 'visible') ! # SCRIPT p.Item('static', dlgs.stc7, 'Sc&ript:', 110, 147, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb5, '', 110, 157, 94, 30, 'dropdownlist', 'autohscroll', 'border', 'vscroll', 'tabstop', 'hasstrings', 'ownerdrawfixed', 'visible') --- 6,42 ---- p= DlgEditor() ! p.BeginTemplate(None, 'Font', 13, 54, 263, 196, ('Ms Sans Serif', 8, 0, 0), 'modalframe', 'popup', 'caption', 'contexthelp', '3dlook', 'sysmenu') ! # font combos p.Item('static', dlgs.stc1, '&Font:', 7, 7, 40, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb1, '', 7, 16, 98, 76, 'simple', 'sort', 'vscroll', 'tabstop', 'disablenoscroll', 'hasstrings', 'ownerdrawfixed', 'visible') + p.Item('static', dlgs.stc2, 'Font st&yle:', 110, 7, 44, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb2, '', 110, 16, 62, 76, 'simple', 'vscroll', 'disablenoscroll', 'tabstop', 'visible') + p.Item('static', dlgs.stc3, '&Size:',177, 7, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb3, '', 177, 16, 27, 76, 'simple', 'tabstop', 'sort', 'disablenoscroll', 'hasstrings', 'ownerdrawfixed', 'visible') ! # default buttons ! p.Item('button', dlgs.IDOK, 'OK', 210, 16, 45, 14, 'pushbutton', 'defpushbutton', 'group', 'visible', 'tabstop') ! p.Item('button', dlgs.IDCANCEL, 'Cancel', 210, 32, 45, 14, 'pushbutton', 'visible') ! p.Item('button', dlgs.psh3, '&Apply', 210, 48, 45, 14, 'pushbutton', 'defpushbutton', 'visible') ! p.Item('button', dlgs.pshHelp, '&Help', 210, 64, 45, 14, 'pushbutton', 'visible') ! # effects ! p.Item('button', dlgs.grp1, 'Effects', 7, 97, 98, 72, 'groupbox', 'visible') p.Item('button', dlgs.chx1, 'Stri&keout', 13, 110, 49, 10, 'autocheckbox', 'tabstop', 'visible') p.Item('button', dlgs.chx2, '&Underline', 13, 123, 51, 10, 'autocheckbox', 'tabstop', 'visible') ! # color p.Item('static', dlgs.stc4, '&Color:', 13, 136, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb4, '', 13, 146, 82, 100, 'dropdownlist', 'autohscroll', 'border', 'vscroll', 'tabstop', 'hasstrings', 'ownerdrawfixed', 'visible') ! # sample p.Item('button', dlgs.grp2, 'Sample', 110, 97, 94, 43, 'groupbox', 'group', 'visible') p.Item('static', dlgs.stc5, 'AaBbYyZz', 118, 111, 77, 23, 'noprefix') # not visible p.Item('static', dlgs.stc6, '', 7, 176, 196, 20, 'left', 'noprefix', 'visible') ! # script p.Item('static', dlgs.stc7, 'Sc&ript:', 110, 147, 30, 9, 'left', 'visible') p.Item('combobox', dlgs.cmb5, '', 110, 157, 94, 30, 'dropdownlist', 'autohscroll', 'border', 'vscroll', 'tabstop', 'hasstrings', 'ownerdrawfixed', 'visible') *************** *** 45,47 **** if __name__=='__main__': ! p.RunModal() \ No newline at end of file --- 47,62 ---- if __name__=='__main__': ! from wnd.dlgs import choosefont ! ! def callback(hwnd, msg, wp, lp): ! pass ! #if msg=="debug": print lp ! ! lf=choosefont.LOGFONT() ! lf.lfFaceName='verdana' ! c=choosefont.ChooseFontFromTemplate(p.ToBuffer(), 'debug') ! c.onMSG= callback ! r=c.Run(None, 'hook', 'screenfonts', 'apply', 'effects', 'showhelp', 'selectscript', logfont=lf) ! #print r ! ! \ No newline at end of file --- NEW FILE: replacetext.py --- from wnd.consts import dlgs from wnd.tools.dlgeditor.dlgeditor import DlgEditor #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: p= DlgEditor() p.BeginTemplate(None, 'Find', 36, 44, 230, 94, ('arial', 8, 0, 0), 'modalframe', 'popup', 'caption', 'sysmenu', 'border', '3dlook', 'contexthelp') # find editvox p.Item('static', 0xFFFFFFFF, 'Fi&nd what:', 4, 9, 48, 8, 'left', 'visible') p.Item('edit', dlgs.edt1, '', 54, 7, 114, 12, 'group', 'tabstop', 'autohscroll', 'visible', 'clientedge') # replace editbox p.Item('static', 0xFFFFFFFF, 'Fi&nd what:', 4, 26, 48, 8, 'left', 'visible') p.Item('edit', dlgs.edt2, '', 54, 24, 114, 12, 'group', 'tabstop', 'autohscroll', 'visible', 'clientedge') # whole word and match case checkbox p.Item('button', dlgs.chx1, 'Match &whole word only', 5, 46, 104, 12, 'group','autocheckbox', 'visible', 'tabstop') p.Item('button', dlgs.chx2, 'Match &case', 5, 62, 59, 12, 'autocheckbox', 'visible') # default buttons p.Item('button', dlgs.IDOK, '&Find Next', 174, 4, 50, 14, 'group', 'visible', 'tabstop') p.Item('button', dlgs.psh1, '&Find Next', 174, 21, 50, 14, 'visible') p.Item('button', dlgs.psh2, '&Find Next', 174, 38, 50, 14, 'visible') p.Item('button', dlgs.IDCANCEL, 'Cancel', 174, 55, 50, 14, 'visible') p.Item('button', dlgs.pshHelp, '&Help', 174, 75, 50, 14, 'visible') #*********************************************************************** #*********************************************************************** if __name__=='__main__': import wnd from wnd.dlgs import replacetext class Window(wnd.Window): def __init__(self): wnd.Window.__init__(self, 'findtext_test', 'findtext_test', None, None, None, None, 'sysmenu', 'sizebox', 'dialoglike') self.fr = replacetext.ReplaceTextFromTemplate(p.ToBuffer()) self.fr.onMSG = self.on_fr def on_fr(self, hwnd, msg, wp, lp): if msg.startswith('fr_'): print hwnd, msg, wp, lp def onMSG(self, hwnd, msg, wp, lp): if msg == 'open': self.fr.Run(self.Hwnd, 'foo', '', 'hook', 'showhelp') w= Window() w.Run() --- NEW FILE: choosecolor.py --- """default template for OpenSaveFile dialog using dlgeditor""" from wnd.consts import dlgs from wnd.tools.dlgeditor.dlgeditor import DlgEditor #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: DLG_COLOR = 10 COLOR_HUESCROLL = 700 COLOR_SATSCROLL = 701 COLOR_LUMSCROLL = 702 COLOR_HUE = 703 COLOR_SAT = 704 COLOR_LUM = 705 COLOR_RED = 706 COLOR_GREEN = 707 COLOR_BLUE = 708 COLOR_CURRENT = 709 COLOR_RAINBOW = 710 COLOR_SAVE = 711 COLOR_ADD = 712 COLOR_SOLID = 713 COLOR_TUNE = 714 COLOR_SCHEMES = 715 COLOR_ELEMENT = 716 COLOR_SAMPLES = 717 COLOR_PALETTE = 718 COLOR_MIX = 719 COLOR_BOX1 = 720 COLOR_CUSTOM1 = 721 COLOR_HUEACCEL = 723 COLOR_SATACCEL = 724 COLOR_LUMACCEL = 725 COLOR_REDACCEL = 726 COLOR_GREENACCEL = 727 COLOR_BLUEACCEL = 728 COLOR_SOLID_LEFT = 730 COLOR_SOLID_RIGHT = 731 NUM_BASIC_COLORS = 48 NUM_CUSTOM_COLORS = 16 #***************************************************************************** #***************************************************************************** p= DlgEditor() p.BeginTemplate(None, 'Color', 2, 0, 298, 184, ('Ms Sans Serif', 8, 0, 0), 'modalframe', 'popup', 'caption', 'contexthelp', '3dlook', 'sysmenu') ## color selectors p.Item('static', 0xFFFFFFFF, '&Basic colors:', 4, 4, 140, 9, 'left', 'visible') p.Item('static', COLOR_BOX1, '', 4, 14, 140, 86, 'simple', 'visible', 'tabstop', 'group') p.Item('static', 0xFFFFFFFF, '&Custom colors:', 4, 106, 140, 9, 'left', 'visible') p.Item('static', COLOR_CUSTOM1, '', 4, 116, 140, 28, 'simple', 'visible', 'tabstop', 'group') p.Item('button', COLOR_MIX, '&Define Custom Colors >>', 4, 150, 140, 14, 'tabstop', 'visible', 'group') ## default buttons p.Item('button', dlgs.IDOK, 'OK', 4, 166, 44, 14, 'tabstop', 'visible', 'group') p.Item('button', dlgs.IDCANCEL, 'Cancel', 52, 166, 44, 14, 'tabstop', 'visible', 'group') p.Item('button', dlgs.pshHelp, '&Help', 100, 166, 44, 14, 'tabstop', 'visible', 'group') ## custom colors --------------------------------------------------------------------------------- ## color selector p.Item('static', COLOR_RAINBOW, '', 152, 4, 118, 116, 'simple', 'sunken', 'visible') p.Item('static', COLOR_LUMSCROLL, '', 280, 4, 8, 116, 'simple', 'sunken', 'visible') p.Item('static', COLOR_CURRENT, '', 152, 124, 40, 26, 'simple', 'sunken', 'visible') ## hidden group p.Item('button', COLOR_SOLID, '&o', 300, 200, 4, 14, 'group', 'visible') p.Item('static', COLOR_SOLID_LEFT, 'Color', 152, 4, 118, 116, 'right') p.Item('static', COLOR_SOLID_RIGHT, '|S&olid', 172, 151, 20, 9, 'left') ## Hue/Sat/Lum editboxes p.Item('static', COLOR_HUEACCEL, 'Hu&e:', 194, 126, 20, 9, 'right', 'visible') p.Item('edit', COLOR_HUE, '', 216, 124, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') p.Item('static', COLOR_SATACCEL, '&Sat:', 194, 140, 20, 9, 'right', 'visible') p.Item('edit', COLOR_SAT, '', 216, 138, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') p.Item('static', COLOR_LUMACCEL, '&Sat:', 194, 154, 20, 9, 'right', 'visible') p.Item('edit', COLOR_LUM, '', 216, 152, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') ## RGB editboxes p.Item('static', COLOR_REDACCEL, '&Red:', 243, 126, 24, 9, 'right', 'visible') p.Item('edit',COLOR_RED, '', 269, 124, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') p.Item('static', COLOR_GREENACCEL, '&Green:', 243, 140, 24, 9, 'right', 'visible') p.Item('edit',COLOR_GREEN, '', 269, 138, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') p.Item('static', COLOR_BLUEACCEL, 'Bl&ue:', 243, 154, 24, 9, 'right', 'visible') p.Item('edit',COLOR_BLUE, '', 269, 152, 18, 12, 'group', 'tabstop', 'visible', 'clientedge') p.Item('button', COLOR_ADD, '&Add to Custom Colors', 152, 166, 142, 14, 'group', 'tabstop', 'visible') #*********************************************************************************** if __name__=='__main__': from wnd.dlgs import choosecolor def callback(hwnd, msg, wp, lp): pass #if msg=="debug": print lp cc=choosecolor.ChooseColorFromTemplate(p.ToBuffer(), 'debug') cc[:]= (0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF) cc.onMSG= callback r= cc.Run(0, 'anycolor','hook', initcolor=0xFF) print r print cc[:] |