wnd-commit Mailing List for wnd (Page 4)
Status: Alpha
Brought to you by:
jurner
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(125) |
Jun
|
Jul
(138) |
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
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[:] |
From: jürgen u. <cer...@us...> - 2005-07-23 19:25:56
|
Update of /cvsroot/wnd/wnd/wnd/custom/dirlist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30113 Modified Files: __init__.py dl_listfiles.py Log Message: bit of this and a bit of that Index: dl_listfiles.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/custom/dirlist/dl_listfiles.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dl_listfiles.py 2 Jul 2005 09:08:44 -0000 1.1 --- dl_listfiles.py 23 Jul 2005 19:25:45 -0000 1.2 *************** *** 259,262 **** --- 259,265 ---- + def GetSortType(self): + return self.sorttype, self.sortdirection + def PidlGetData(self, pIdl, attrs): *************** *** 552,556 **** def SetItems(self): ! #LVM_INSERTITEM = 4103 counter = 0 --- 555,562 ---- def SetItems(self): ! # TODO ! # custom SetItems to allow the user to set the items to the view ! ! #LVM_INSERTITEM = 4103 counter = 0 Index: __init__.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/custom/dirlist/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 2 Jul 2005 09:08:44 -0000 1.1 --- __init__.py 23 Jul 2005 19:25:45 -0000 1.2 *************** *** 106,109 **** --- 106,115 ---- + def SortBy(self, sorttype='type', direction='ascending'): + self._custom_Mainframe.FileLister.SetSortType(sorttype, direction) + + def GetSortBy(self): + return self._custom_Mainframe.FileLister.GetSortType() + def AllowNavigate(self, Bool, hideheader=False): return self._custom_Mainframe.FileLister.AllowNavigate(Bool, hideheader) |
From: jürgen u. <cer...@us...> - 2005-07-23 19:25:09
|
Update of /cvsroot/wnd/wnd/wnd/custom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29977 Modified Files: drivecombo.py splitter.py Log Message: bit of this and a bit of that Index: drivecombo.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/custom/drivecombo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** drivecombo.py 2 Jul 2005 09:05:43 -0000 1.1 --- drivecombo.py 23 Jul 2005 19:25:00 -0000 1.2 *************** *** 174,178 **** y= lp.rcItem.top + ((lp.rcItem.bottom-lp.rcItem.top- (h))/2) font.TextOutEx(dc, text, lp.rcItem.left+icoW+(font.GetAverageCharWidth(dc)), ! y, lp.rcItem, None, 'opaque') # # draw icon --- 174,178 ---- y= lp.rcItem.top + ((lp.rcItem.bottom-lp.rcItem.top- (h))/2) font.TextOutEx(dc, text, lp.rcItem.left+icoW+(font.GetAverageCharWidth(dc)), ! y, 'opaque', rect=lp.rcItem) # # draw icon Index: splitter.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/custom/splitter.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** splitter.py 2 Jul 2005 09:05:43 -0000 1.2 --- splitter.py 23 Jul 2005 19:25:00 -0000 1.3 *************** *** 143,147 **** pt.ScreenToClient(self.GetParent()) ! ## final erasing of the lest poisition brfotre actually moving if self._custom_oldpos: self._custom_DrawFeedbackBar(*self._custom_oldpos) --- 143,147 ---- pt.ScreenToClient(self.GetParent()) ! ## final erasing of the last poisition brfore actually moving if self._custom_oldpos: self._custom_DrawFeedbackBar(*self._custom_oldpos) *************** *** 151,159 **** self.DragSplitter(pt.x - self._custom_dragPoint.x) else: - pass self.DragSplitter(pt.y - self._custom_dragPoint.y) ! #self._custom_DrawFeedbackBar(*self._custom_oldpos) ! ! self._custom_fDrag=False self._custom_dragPoint=None --- 151,157 ---- self.DragSplitter(pt.x - self._custom_dragPoint.x) else: self.DragSplitter(pt.y - self._custom_dragPoint.y) ! ! # reset self._custom_fDrag=False self._custom_dragPoint=None *************** *** 161,165 **** ! ## keyboard handling elif msg==self.Msg.WM_MOUSEACTIVATE: --- 159,163 ---- ! #----------------------------------------------------------- elif msg==self.Msg.WM_MOUSEACTIVATE: *************** *** 207,211 **** pat= (WORD*8)(0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055) - hBm = gdi32.CreateBitmap(8, 8, 1, 1, byref(pat)) if hBm: --- 205,208 ---- *************** *** 223,229 **** user32.ReleaseDC(0, hDC) - - - --- 220,223 ---- *************** *** 240,250 **** self.RedrawClientArea() ! ! ! ! def _custom_MoveSplitter(self, offsX, offsY): ! # moves the splitter, taking care it is not moved beyound ! # the parent windows border. # # Return value: True if the splitter was actually moved. False otherwise --- 234,241 ---- self.RedrawClientArea() ! def _custom_MoveSplitter(self, offsX, offsY): ! # moves the splitter, taking care it is not moved outside the ! # parent windows bounds. # # Return value: True if the splitter was actually moved. False otherwise |
From: jürgen u. <cer...@us...> - 2005-07-23 19:24:32
|
Update of /cvsroot/wnd/wnd/wnd/controls/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29798 Modified Files: messagehandler.py Log Message: bit of this and a bit of that Index: messagehandler.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/treeview/messagehandler.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** messagehandler.py 2 Jul 2005 09:56:12 -0000 1.4 --- messagehandler.py 23 Jul 2005 19:24:23 -0000 1.5 *************** *** 175,177 **** elif msg==self.Msg.WM_DESTROY: self.onMSG(hwnd, "destroy", 0, 0) ! return 0 --- 175,177 ---- elif msg==self.Msg.WM_DESTROY: self.onMSG(hwnd, "destroy", 0, 0) ! \ No newline at end of file |
From: jürgen u. <cer...@us...> - 2005-07-23 19:24:11
|
Update of /cvsroot/wnd/wnd/wnd/controls/toolbar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29632 Modified Files: messagehandler.py methods.py Log Message: bit of this and a bit of that Index: methods.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/toolbar/methods.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** methods.py 29 Apr 2005 15:22:34 -0000 1.1.1.1 --- methods.py 23 Jul 2005 19:23:58 -0000 1.2 *************** *** 43,47 **** fState = 0 for i in state: ! try: fState |= states[i] except: try: fStyle |= styles[i] --- 43,48 ---- fState = 0 for i in state: ! try: ! fState |= states[i] except: try: fStyle |= styles[i] *************** *** 90,94 **** # methods ! # NEW METHOD def ResetSnapshot(self): --- 91,103 ---- # methods ! def Button(self, ID, title, *state, **kwargs): ! result = self._client_SetItem(kwargs.get('iImage', 0), ID, state, TBSTYLE_BUTTON, kwargs.get('lp', 0), title, -1) ! if result: raise RuntimeError(result) ! ! def InsertButton(self, i, ID, title, *state, **kwargs): ! result = self._client_SetItem(kwargs.get('iImage'), ID, state, TBSTYLE_BUTTON, kwargs.get('lp', 0), title, i) ! if result: raise RuntimeError(result) ! ! # NEW METHOD def ResetSnapshot(self): *************** *** 143,158 **** return self._client_GetButton(i).idCommand ! def Button(self, ID, title, iImage=0, lp=0, *state): ! result = self._client_SetItem(iImage, ID, state, TBSTYLE_BUTTON, lp, title, -1) ! if result: raise RuntimeError(result) ! def Separator(self, ID=0): result = self._client_SetItem(0, ID, 0, TBSTYLE_SEP, 0, None, -1) if result: raise RuntimeError(result ) - def InsertButton(self, i, ID, title, iImage=0, lp=0, *state): - result = self._client_SetItem(iImage, ID, state, TBSTYLE_BUTTON, lp, title, i) - if result: raise RuntimeError(result) - def InsertSeparator(self, i, ID=0): result = self._client_SetItem(0, ID, 0, TBSTYLE_SEP, 0, None, i) --- 152,160 ---- return self._client_GetButton(i).idCommand ! def Separator(self, ID=0): result = self._client_SetItem(0, ID, 0, TBSTYLE_SEP, 0, None, -1) if result: raise RuntimeError(result ) def InsertSeparator(self, i, ID=0): result = self._client_SetItem(0, ID, 0, TBSTYLE_SEP, 0, None, i) *************** *** 160,164 **** def RemoveButton(self, ID): ! i=self.IdToIndex(ID) if not self.SendMessage(self.Hwnd, self.Msg.TB_DELETEBUTTON , i, 0): raise RuntimeError("could not remove item") --- 162,166 ---- def RemoveButton(self, ID): ! i=self.IDToIndex(ID) if not self.SendMessage(self.Hwnd, self.Msg.TB_DELETEBUTTON , i, 0): raise RuntimeError("could not remove item") *************** *** 177,181 **** def GetButtonText(self, ID): ! #try: self.IdToIndex(ID) #except: raise IndexError("invalid ID") p=create_string_buffer(self._client_textMax) --- 179,183 ---- def GetButtonText(self, ID): ! #try: self.IDToIndex(ID) #except: raise IndexError("invalid ID") p=create_string_buffer(self._client_textMax) Index: messagehandler.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/toolbar/messagehandler.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** messagehandler.py 2 Jul 2005 09:55:32 -0000 1.3 --- messagehandler.py 23 Jul 2005 19:23:58 -0000 1.4 *************** *** 164,167 **** elif msg==self.Msg.WM_DESTROY: self.onMSG(hwnd, "destroy", 0, 0) ! return 0 --- 164,167 ---- elif msg==self.Msg.WM_DESTROY: self.onMSG(hwnd, "destroy", 0, 0) ! |
From: jürgen u. <cer...@us...> - 2005-07-23 19:23:52
|
Update of /cvsroot/wnd/wnd/wnd/controls/menu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29531 Modified Files: popup.py Log Message: bit of this and a bit of that Index: popup.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/menu/popup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** popup.py 2 Jul 2005 09:55:03 -0000 1.4 --- popup.py 23 Jul 2005 19:23:29 -0000 1.5 *************** *** 84,88 **** return popup ! def Separator(self, ID=0, *flags): return self.InsertSeparator(-1, ID, *flags) --- 84,88 ---- return popup ! def Separator(self, ID, *flags): return self.InsertSeparator(-1, ID, *flags) |
From: jürgen u. <cer...@us...> - 2005-07-23 19:23:08
|
Update of /cvsroot/wnd/wnd/wnd/controls/mdiframe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29431 Added Files: .CVSIGNORE __init__.py mdiclient.py Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.pyc *.pyo --- NEW FILE: mdiclient.py --- from wnd.wintypes import (user32, byref, Structure, WNDPROC, HANDLE, UINT, LOWORD, HIWORD, BOOL) from wnd import fwtypes as fw from wnd.controls.base import control from wnd.controls.base import methods from wnd.controls.windowclass import WindowClass, SZ_CONTROL_CLASS #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: N_MDICHILD= 0 WM_PARENTNOTIFY = 528 WM_NCDESTROY = 130 WM_CREATE = 1 WS_EX_MDICHILD = 64 GWL_ID = -12 WM_MDICREATE = 544 WM_MDIDESTROY = 545 WM_MDIACTIVATE = 546 WM_MDIRESTORE = 547 WM_MDINEXT = 548 WM_MDIMAXIMIZE = 549 WM_MDITILE = 550 WM_MDICASCADE = 551 WM_MDIICONARRANGE = 552 WM_MDIGETACTIVE = 553 WM_MDISETMENU = 560 WM_MDIREFRESHMENU = 564 WS_MAXIMIZE = 16777216 WS_MINIMIZE = 536870912 WS_VSCROLL = 2097152 WS_HSCROLL = 1048576 #**************************************************************************** # MDI child window #**************************************************************************** class Styles: pass Styles.__dict__.update(control.control_styles.__dict__) #Styles.prefix += [] class Msgs: pass Msgs.__dict__.update(control.control_msgs.__dict__) class MDIChild(control.ControlFromHandle, methods.ControlMethods): def __init__(self, hwnd, *styles): self.Msg= Msgs self.Style= Styles control.ControlFromHandle.__init__(self, hwnd, *styles) #**************************************************************************** # MDI client window #**************************************************************************** class MDIClient(control.ControlFromHandle, methods.ControlMethods): def __init__(self, hwndParent, hMenu, x, y, w, h, *styles): self.Msg= Msgs self.Style= Styles self.pChildProc= WNDPROC(self.ChildProc) self._client_fMessageSend= False self._client_MDIChildren= [] iStyles = self.ParseStyles(styles, style=1073741824|268435456|33554432|67108864) self._base_style = [iStyles[3], iStyles[4]] # base/clientstyle cs= CLIENTCREATESTRUCT(hMenu, fw.WND_ID_MDICHILD_MIN) # create the MDI-client ## default WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN| ## WS_CLIPSIBLINGS|WS_HSCROLL|WS_VSCROLL #iStyles= 1073741824|268435456|33554432|67108864|1048576|2097152 hwnd=user32.CreateWindowExA( iStyles[1],"mdiclient",'',iStyles[0], x,y,w,h, hwndParent,fw.ID.New(),0,byref(cs)) if not hwnd: raise "could not create MDIFrame" control.ControlFromHandle.__init__(self, hwnd, 'nosubclass') #******************************************************************* # MDI child methods #******************************************************************* def ChildProc(self, hwnd, msg, wp, lp): if msg==5: ## WM_SIZE self.onMSG(hwnd, "childsizing", hwnd, [0, 0, LOWORD(lp), HIWORD(lp)]) elif msg==WM_CREATE: self._client_MDIChildren.append(hwnd) self.onMSG(self.Hwnd, "childcreated", hwnd, 0) elif msg==WM_MDIACTIVATE: if self._client_fMessageSend==True: self._client_fMessageSend=False else: self._client_fMessageSend=True self.onMSG(self.Hwnd, "childactivated", lp, wp) elif msg==WM_NCDESTROY: self._client_MDIChildren.remove(hwnd) self.onMSG(self.Hwnd, "childdestroyed", hwnd, 0) return user32.DefMDIChildProcA(hwnd, msg, wp, lp) #---------------------------------------------------------------------------------------------- def NewChild(self, title, x, y, w, h, *styles, **kwargs): global N_MDICHILD N_MDICHILD += 1 wc = WindowClass() classname= SZ_CONTROL_CLASS % "mdichild-%s" % N_MDICHILD wc.SetClassName(classname) wc.SetCursor() Icon= kwargs.get('icon') if Icon: wc.SetIcons(Icon) wc.SetBackground('window') wc.SetWindowProc(self.pChildProc) wc.Register() ## don't need an ID here. MDI is taking care about it, including recycling. # WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS iStyle= 1073741824|268435456|33554432|67108864 if styles: st= {'maximized':WS_MAXIMIZE, 'minimized':WS_MINIMIZE, 'vscroll':WS_VSCROLL, 'hscroll':WS_HSCROLL} for i in styles: try: iStyle |= st[i] except: raise ValueError, "invalid style: %s" % i hwnd=user32.CreateWindowExA( WS_EX_MDICHILD,classname,title, iStyle,x,y,w,h, self.Hwnd,0,0,0) if not hwnd: raise RuntimeError, "could not create MDI child" return self.GetChild(hwnd) def __iter__(self): for i in self._client_MDIChildren: yield i def IsChild(self, hwnd): return hwnd in self.self._client_MDIChildren def GetChild(self, hwnd): return MDIChild(hwnd, 'nosubclass') def Activate(self, hwnd): return user32.SendMessageA(self.Hwnd, WM_MDIACTIVATE, hwnd, 0) def GetActive(self): return user32.SendMessageA(self.Hwnd, WM_MDIGETACTIVE, 0, 0) def ActivateNext(self, hwnd=None): user32.SendMessageA(self.Hwnd, WM_MDINEXT, hwnd and hwnd or 0, 0) def ActivatePrevious(self, hwnd=None): user32.SendMessageA(self.Hwnd, WM_MDINEXT, hwnd and hwnd or 0, 1) def Destroy(self, hwnd): user32.SendMessageA(self.Hwnd, WM_MDIDESTROY, hwnd, 0) def Clear(self): out= [] for i in self: out.append(i) for i in out: self.Destroy(i) def Maximize(self, hwnd): user32.SendMessageA(self.Hwnd, WM_MDIMAXIMIZE, hwnd, 0) def IsMaximized(self, hwnd): b= BOOL() user32.SendMessageA(self.Hwnd, WM_MDIGETACTIVE, 0, byref(b)) return bool(b.value) def Restore(self, hwnd): user32.SendMessageA(self.Hwnd, WM_MDIRESTORE, hwnd, 0) def Tile(self, flag='vertical'): if flag=='vertical': flag= 0 # MDITILE_VERTICAL if flag=='horizontal': flag= 1 # MDITILE_HORIZONTAL #elif flag=='zorder': flag= 4 # MDITILE_ZORDER ## ?? WM_MDITILE = 550 if not user32.SendMessageA(self.Hwnd, WM_MDITILE, flag, 0): raise "could not tile windows" def Cascade(self, skipdisabled=True): if skipdisabled: flag= 2 # MDITILE_SKIPDISABLED else: flag= 0 WM_MDICASCADE = 551 if not user32.SendMessageA(self.Hwnd, WM_MDICASCADE, flag, 0): raise "could not cascade windows" def IconArrange(self): user32.SendMessageA(self.Hwnd, WM_MDIICONARRANGE, 0, 0) def Minimize(self, hwnd): user32.ShowWindow(hwnd, 6) # SW_MINIMIZE def IsMinimized(self, hwnd): return bool(user32.IsIconic(hwnd)) ## TODO #WM_MDISETMENU #WM_MDIREFRESHMENU #**************************************************************** class CLIENTCREATESTRUCT(Structure): _fields_ = [("hWindowMenu", HANDLE), ("idFirstChild", UINT)] --- NEW FILE: __init__.py --- """ MDI-Frame For testing purposes only Main problem here is how to close the mdi-childwindows. """ from wnd.wintypes import (user32, byref, MSG, HIWORD, LOWORD) from wnd import fwtypes as fw from wnd.controls.windowclass import (WindowClass, SZ_WINDOW_CLASS) from wnd.controls.base import window from wnd.controls.base.methods import WindowMethods from wnd.controls.menu import Menu from wnd.controls.mdiframe.mdiclient import MDIClient #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class Styles: pass Styles.__dict__.update(window.window_styles.__dict__) class Msgs: WM_MDICREATE = 544 WM_MDIDESTROY = 545 WM_MDIACTIVATE = 546 WM_MDIRESTORE = 547 WM_MDINEXT = 548 WM_MDIMAXIMIZE = 549 WM_MDITILE = 550 WM_MDICASCADE = 551 WM_MDIICONARRANGE = 552 WM_MDIGETACTIVE = 553 WM_MDISETMENU = 560 Msgs.__dict__.update(window.window_msgs.__dict__) #**************************************************************************** # MDI frame #*************************************************************************** class MDIFrame(window.BaseWindow, WindowMethods): MIN_MENU_ID= fw.WND_ID_MDICHILD_MAX + 1 def __init__(self, title, x, y, w, h, *styles): self.Style= Styles self.Msg= Msgs self._client_MDIClient= None # preregister a class clss = WindowClass() clss.SetClassName(SZ_WINDOW_CLASS % "MdiFrame") clss.SetBackground('window') clss.SetCursor() # init the base window window.BaseWindow.__init__(self, clss, title, x, y, w, h, *styles) #----------------------------------------------------------------- # methods def MDIClient(self, x, y, w, h, *styles, **kwargs): if self. _client_MDIClient: raise "mdi-client already created" self. _client_MDIClient= MDIClient(self.Hwnd, kwargs.get('hMenu', 0), x,y,w,h, *styles) return self. _client_MDIClient def HasClient(self): return not self. _client_MDIClient ==None #----------------------------------------------------------------------------------- # message handler def onMESSAGE(self, hwnd, msg, wp, lp): if msg==5: # WM_SIZE ## overwrite to make resizing work if self._base_fIsopen: self.onMSG(hwnd, "size", 0, [0, 0, LOWORD(lp), HIWORD(lp)]) return user32.DefWindowProcA(hwnd, msg, wp, lp) #---------------------------------------------------------------------------------- # some adjustements for MDIFrame WindowProc # - instead of DefWindowProc an MDIFrame returns DefFrameProc # - in the message loop TranslateMDISysAccel has to intercept messages first def DefWindowProc(self, hwnd, msg, wp, lp): if self. _client_MDIClient: return user32.DefFrameProcA(hwnd, self. _client_MDIClient.Hwnd, msg, wp, lp) return user32.DefWindowProcA(hwnd, msg, wp, lp) def Run(self, show='normal'): try: show=['hidden','normal', 'minimized','maximized'].index(show) except: try: range(4)[show] except: raise "invalid flag: %s" % show # run the messageloop self._base_fIsopen= True self.onMSG(self.Hwnd, "create", 0, 0) user32.ShowWindow(self.Hwnd, show) user32.UpdateWindow(self.Hwnd) GM, TM, DM, TACC, TMDIA=(user32.GetMessageA, user32.TranslateMessage, user32.DispatchMessageA, user32.TranslateAcceleratorA, user32.TranslateMDISysAccel) msg = MSG() pMsg = byref(msg) if self.GetStyleL('basestyle') & self.Style.WS_BASE_DIALOGLIKE: IsDialogMessage=user32.IsDialogMessageA self.onMSG(self.Hwnd, "open", 0, 0) window._exit.Unregister(self.Hwnd) #ExitHandler._UnregisterGuiExitFunc() while GM(pMsg, 0, 0, 0) > 0: if self. _client_MDIClient: if not TMDIA(self. _client_MDIClient.Hwnd, pMsg): if not IsDialogMessage(self.Hwnd, pMsg): if self._base_hAccelerator: if not TACC(self.Hwnd, self._base_hAccelerator, pMsg): TM(pMsg) DM(pMsg) continue TM(pMsg) DM(pMsg) else: self.onMSG(self.Hwnd, "open", 0, 0) window._exit.Unregister(self.Hwnd) #ExitHandler._UnregisterGuiExitFunc() while GM(pMsg, 0, 0, 0) > 0: if self. _client_MDIClient: if not TMDIA(self. _client_MDIClient.Hwnd, pMsg): if self._base_hAccelerator: if not TACC(self.Hwnd, self._base_hAccelerator, pMsg): TM(pMsg) DM(pMsg) continue TM(pMsg) DM(pMsg) #************************************************************ |
From: jürgen u. <cer...@us...> - 2005-07-23 19:21:30
|
Update of /cvsroot/wnd/wnd/wnd/controls/mdiframe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28955/mdiframe Log Message: Directory /cvsroot/wnd/wnd/wnd/controls/mdiframe added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-23 19:21:08
|
Update of /cvsroot/wnd/wnd/wnd/controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28764 Modified Files: dialog.py Log Message: bit of this and a bit of that Index: dialog.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/dialog.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dialog.py 29 Apr 2005 15:21:37 -0000 1.1.1.1 --- dialog.py 23 Jul 2005 19:21:00 -0000 1.2 *************** *** 13,21 **** styles += 'visible', _dialog.BaseDialog.__init__(self, title, x, y, w, h, *styles) ! def onINITDIALOG(self, hwnd, msg, wp, lp): self.onINIT(hwnd, msg, wp, lp) def onMESSAGE(self, hwnd, msg, wp, lp): if msg==self.Msg.WM_CLOSE: --- 13,23 ---- styles += 'visible', _dialog.BaseDialog.__init__(self, title, x, y, w, h, *styles) ! ! def onINITDIALOG(self, hwnd, msg, wp, lp): self.onINIT(hwnd, msg, wp, lp) + def onMESSAGE(self, hwnd, msg, wp, lp): if msg==self.Msg.WM_CLOSE: |
From: jürgen u. <cer...@us...> - 2005-07-23 19:16:00
|
Update of /cvsroot/wnd/wnd/wnd/api/shell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27303 Modified Files: __init__.py functions.py Log Message: bit of this and a bit of that Index: functions.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/shell/functions.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions.py 2 Jul 2005 09:00:57 -0000 1.3 --- functions.py 23 Jul 2005 19:15:37 -0000 1.4 *************** *** 55,59 **** ! def FileOperation(fileaction, From, To, title='', hwnd=0, *flags): if fileaction not in FILEOPERATIONS: --- 55,59 ---- ! def FileOperation(fileaction, From, To, *flags, **kwargs): if fileaction not in FILEOPERATIONS: *************** *** 69,73 **** try: sho.fFlags=FO_FLAGS[i] except: raise "invalid flag: %s" % i ! sho.hwnd=hwnd if fileaction != 'delete': --- 69,73 ---- try: sho.fFlags=FO_FLAGS[i] except: raise "invalid flag: %s" % i ! sho.hwnd=kwargs.get('title', 0) if fileaction != 'delete': *************** *** 80,84 **** sho.pFrom='%s\x00' % '\x00'.join(From) else: sho.pFrom=From ! sho.lpszProgressTitle=title if shell32.SHFileOperation(byref(sho)): --- 80,84 ---- sho.pFrom='%s\x00' % '\x00'.join(From) else: sho.pFrom=From ! sho.lpszProgressTitle=kwargs.get('title', '') if shell32.SHFileOperation(byref(sho)): *************** *** 88,102 **** return True ! def MoveFiles(From, To, title='', hwnd=0, *flags): ! return FileOperation('move', From, To, title, hwnd, *flags) def CopyFiles(From, To, title='', hwnd=0, *flags): ! return FileOperation('copy', From, To, title, hwnd, *flags) ! def DeleteFiles(From, To, title='', hwnd=0, *flags): ! return FileOperation('delete', From, To, title, hwnd, *flags) ! def RenameFiles(From, To, title='', hwnd=0, *flags): ! return FileOperation('rename', From, To, title, hwnd, *flags) #********************************************************** --- 88,102 ---- return True ! def MoveFiles(From, To, title='', hwnd=0, *flags, **kwargs): ! return FileOperation('move', From, To, *flags, **kwargs) def CopyFiles(From, To, title='', hwnd=0, *flags): ! return FileOperation('copy', From, To, flags, kwargs) ! def DeleteFiles(From, To, title='', hwnd=0, *flags, **kwargs): ! return FileOperation('delete', From, To, flags, kwargs) ! def RenameFiles(From, To, title='', hwnd=0, *flags, **kwargs): ! return FileOperation('rename', From, To, *flags, **kwargs) #********************************************************** Index: __init__.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/shell/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 2 Jul 2005 09:00:57 -0000 1.4 --- __init__.py 23 Jul 2005 19:15:37 -0000 1.5 *************** *** 7,11 **** from wnd.api.shell.contextmenu import ShellContextMenu from wnd.api.shell.shelllink import ShellLink - from wnd.api.shell.browseforfolder import BrowseForFolder from wnd.api.shell.wintypes import Malloc, HRESULT_CODE from wnd.api.shell.consts import * --- 7,10 ---- |
From: jürgen u. <cer...@us...> - 2005-07-23 19:14:46
|
Update of /cvsroot/wnd/wnd/wnd/api/shell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27026 Modified Files: browseforfolder.py Log Message: dremoved Index: browseforfolder.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/shell/browseforfolder.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** browseforfolder.py 18 May 2005 19:29:21 -0000 1.3 --- browseforfolder.py 23 Jul 2005 19:14:38 -0000 1.4 *************** *** 1,210 **** - - - """ - - TODO - - comb over and document - - - """ - - - - from wnd.api.shell.wintypes import * - #************************************************* - BFFCALLBACK=WINFUNCTYPE(c_int, HWND, c_uint, LPARAM, LPARAM) - class BROWSEINFO(Structure): - _fields_ = [("hwndOwner", HWND), - ("pidlRoot", PIDL), - ("pszDisplayName", c_ulong), # address of return - # buffer - ("lpszTitle", LPCSTR), - ("ulFlags", UINT), - ("lpfn", BFFCALLBACK), - ("lParam", LPARAM), - ("iImage", INT)] - - - BIF_RETURNONLYFSDIRS = 0x0001 # For finding a folder to start document searching - BIF_DONTGOBELOWDOMAIN = 0x0002 # For starting the Find Computer - BIF_STATUSTEXT = 0x0004 - BIF_RETURNFSANCESTORS = 0x0008 - BIF_EDITBOX = 0x0010 - BIF_VALIDATE = 0x0020 # insist on valid result (or CANCEL) - BIF_BROWSEFORCOMPUTER = 0x1000 # Browsing for Computers. - BIF_BROWSEFORPRINTER = 0x2000 # Browsing for Printers - BIF_BROWSEINCLUDEFILES =0x4000 # Browsing for Everything - - BFFLAGS={'fsancestorssonly':BIF_RETURNFSANCESTORS, - 'donotgobbledomain':BIF_DONTGOBELOWDOMAIN, - 'statustext':BIF_STATUSTEXT, - 'fsdirsonly':BIF_RETURNONLYFSDIRS, - 'editbox':BIF_EDITBOX, - 'validate':BIF_VALIDATE, - 'browseforcomputer':BIF_BROWSEFORCOMPUTER, - 'browseforprinter':BIF_BROWSEFORPRINTER, - 'includefiles':BIF_BROWSEINCLUDEFILES,} - - - # messages send by the dialog - BFFM_INITIALIZED = 1 - BFFM_SELCHANGED = 2 - BFFM_VALIDATEFAILEDA = 3 # lParam:szPath ret:1(cont),0(EndDialog) - - # messages you can send to the dialog - WM_USER = 1024 - BFFM_SETSTATUSTEXTA = WM_USER + 100 - BFFM_ENABLEOK = WM_USER + 101 - BFFM_SETSELECTIONA = WM_USER + 102 - - class BrowseForFolder(object): - """Class wrapper around the BrowseForFolder dialog. - Overwrite the onMSG method to capture messages - send by the dialogbox. - The following messages are send to the user - message handler: - 'init' The dialog box has been initialized - wp=allways zero - lp=allways zero - 'selchanged' The user has changed seletion - wp=pIdl of the item selected (1) - lp=allways zero - (1) you should not free the pIdl, it is freed - as soon as your callback returns. - If you want to keep it make a copy of it - using PidlMethods.Copy. - 'validatefailed' The user has typed an invalid path into - the editbox and hit the OK button. - wp=the string the user typed in - lp=allways zero - Return False to dismiss the dialog - Note: version 4.71 required - - - Sample use: - - class BrowseForFolder(shell.BrowseForFolder): - def __init__(self): - shell.BrowseForFolder.__init__(self) - - def onMSG(self, hwnd, msg, wp, lp): - if msg=="init": - self.SetStatusText('foo text') - - bff=BrowseForFolder() - result=bff.Run(0, 'my title is browse for folder', 'statustext') - if result: - print shell.GetPathFromPidl(result) - shell.PidlFree(result) - """ - - def __init__(self): - self._p_BffCallBack=BFFCALLBACK(self._BffCallBack) - self.Hwnd=0 - - - def _BffCallBack(self, hwnd, msg, wp, lp): - - if msg==BFFM_INITIALIZED: - self.Hwnd=hwnd - self.onMSG(hwnd, "init", 0, 0) - elif msg==BFFM_SELCHANGED: - pIdl=PIDL.from_address(wp) - self.onMSG(hwnd, "selchanged", pIdl, 0) - Malloc.Free(pIdl) - elif msg==BFFM_VALIDATEFAILEDA: - result=self.onMSG(hwnd, - "validatefailed", c_char_p(wp).value, 0) - if result==False: return 0 - return 1 - - def SetStatusText(self, text): - """Sets the status text.""" - if not self.Hwnd: raise "dialog box is not running" - p=create_string_buffer(text) - user32.SendMessageA(self.Hwnd, BFFM_SETSTATUSTEXTA, 0, p) - - def DisableOK(self): - """Disables the OK button""" - if not self.Hwnd: raise "dialog box is not running" - user32.SendMessageA(self.Hwnd, BFFM_ENABLEOK , 0, 0) - - def EnableOK(self): - """Enables the OK button""" - if not self.Hwnd: raise "dialog box is not running" - user32.SendMessageA(self.Hwnd, BFFM_ENABLEOK , 0, 1) - - def SetSelection(self, pIdlOrPath): - """Sets the current selection in the treeview. - pIdlOrPath can be a path or a pIdl. If its a pIdl it is freed - in this operation. Use PidlMethods.Copy if you want to keep - the pIdl. - TODO: Not tested""" - if not self.Hwnd: raise "dialog box is not running" - if isinstance(pIdlOrPath, (str, unicode)): - p=create_string_buffer(pIdlOrPath) - flag=1 - else: - p=byref(pIdlOrPath) - flag=0 - user32.SendMessageA(self.Hwnd, BFFM_SETSELECTION , flag, p) - if not flag: Malloc.Free(pIdl) - - def Run(self, hwndOwner=0, title='', *flags): - """Creates the dialog box - 'hwnd' hwnd of the parent window - 'title' The title of the dialog, not really the title but a - static text beneath the title bar. - 'flags' One or more flags: - 'browseforcomputer' Return only computers. The OK - box is grayed if the user - selects anything else. - 'browseforprinter' Return only printers. The OK box is grayed if the user - selects anything else. - 'donotgobbledomain' Well... something like network - folders are not accepted - beloe domain level ?? - 'editbox' The user can type into an - editbox aswell - 'fsancestorssonly' The user can select file system - anchestors only - ?? currently dono what this is - 'fsdirsonly' Only file system objects can be - returned - 'includefiles' Include files aswell - 'statustext' For comfort some kind of status - text is included aswell - 'validate' If no valid path is typed into the - editbox the callback function - is called with the 'validatefailed' - message - - Return value is the pIdl of the selected file object - or None. The returnd pIdl has to be freed using - PidlFree.""" - shb=BROWSEINFO() - for i in flags: - try: shb.ulFlags |= BFFLAGS[i] - except: raise "invalid flag: %s" % i - shb.hwndOwner=hwndOwner - p=create_string_buffer(260) # MAX_PATH - shb.pszDisplayName=addressof(p) - shb.lpszTitle=title - shb.lpfn=self._p_BffCallBack - result=shell32.SHBrowseForFolder(byref(shb)) - self.Hwnd=0 - if result: - pIdl=PIDL.from_address(result) - return pIdl - return None - - def onMSG(self, hwnd, msg, wp, lp): - """Overwrite in derrived classes""" - - - - if __name__=='__main__': - br= BrowseForFolder() - br.Run() - - --- 0 ---- |
From: jürgen u. <cer...@us...> - 2005-07-23 19:13:02
|
Update of /cvsroot/wnd/wnd/wnd/api/privleges In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26555 Modified Files: privleges.py Log Message: bit of this and a bit of that Index: privleges.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/privleges/privleges.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** privleges.py 29 Apr 2005 15:20:02 -0000 1.1.1.1 --- privleges.py 23 Jul 2005 19:12:26 -0000 1.2 *************** *** 1,2 **** --- 1,11 ---- + """ + TODO + + - GetTokenStats is not documented + + + """ + + from wnd.api.privleges.wintypes import * *************** *** 75,83 **** #******************************************************************************** #******************************************************************************** ! def EnablePrivleges(hProcess=None, *privleges): return _AdjustPrivleges(hProcess, True, *privleges) ! def DisablePrivleges(hProcess=None, *privleges): ! return _AdjustPrivleges(hProcess, False, *privleges) --- 84,92 ---- #******************************************************************************** #******************************************************************************** ! def EnablePrivleges(hProcess, *privleges, **kwargs): return _AdjustPrivleges(hProcess, True, *privleges) ! def DisablePrivleges(*privleges, **kwargs): ! return _AdjustPrivleges(kwargs.get('hProcess'), False, *privleges) *************** *** 88,92 **** out= [] luid= LUID() ! if not advapi32.LookupPrivilegeValueA(None, privlege, byref(luid)): raise WinError(GetLastError()) --- 97,101 ---- out= [] luid= LUID() ! if not advapi32.LookupPrivilegeValueA(kwargs.get('hProcess'), privlege, byref(luid)): raise WinError(GetLastError()) *************** *** 117,120 **** --- 126,148 ---- __all__.append("EnumPrivleges") + + + ## not documented ###################################### + def GetTokenStats(hProcess): + hToken= c_ulong() + TOKEN_QUERY = 8 + + if not hProcess: hProcess= kernel32.GetCurrentProcess() + if advapi32.OpenProcessToken(hProcess, TOKEN_QUERY, byref(hToken)): + try: + result= _StatToken(hToken.value) + finally: + kernel32.CloseHandle(hToken.value) + else: + raise RuntimeError, "could not oopen token" + return result + + __all__.append("GetTokenStats") + #***************************************************************************** |
From: jürgen u. <cer...@us...> - 2005-07-23 19:12:07
|
Update of /cvsroot/wnd/wnd/wnd/api/ole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26451 Modified Files: enumformatetc.py Log Message: bit of this and a bit of that Index: enumformatetc.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/ole/enumformatetc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** enumformatetc.py 2 Jul 2005 09:15:47 -0000 1.1 --- enumformatetc.py 23 Jul 2005 19:11:50 -0000 1.2 *************** *** 1,6 **** ! """IEnumFORMATETC and PyEnumFORMATETC. Note: ! don't forgett to call OleInitialize before use. ;) """ --- 1,6 ---- ! """IEnumFORMATETC and Note: ! don't forgett to call OleInitialize before use. """ |
From: jürgen u. <cer...@us...> - 2005-07-23 19:11:28
|
Update of /cvsroot/wnd/wnd/wnd/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26340 Modified Files: resources.py win.py winos.py Added Files: copydata.py Log Message: bit of this and a bit of that --- NEW FILE: copydata.py --- from wnd.wintypes import (COPYDATASTRUCT, WNDPROC, user32, sizeof, addressof, byref, c_char, c_int, c_long, c_ulong, LOWORD, HIWORD, WINFUNCTYPE, create_string_buffer) from wnd import fwtypes as fw #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: WM_COPYDATA = 74 ENUMWINDOWSPROC = WINFUNCTYPE(c_int, c_ulong, c_long) #********************************************************************************* #********************************************************************************* class CopyData(object): def __init__(self): self._pWndProc = WNDPROC(self._WndProc) self._pOldWndProc = 0 self._pEnumWindowsProc = ENUMWINDOWSPROC(self._EnumWindowsProc) self._dwResult = c_ulong() self._tmp_result = None self._tmp_GUID = None self._tmp_hwnd = 0 # CopyData helper methods ------------------------------------------------------------- def _EnumWindowsProc(self, hwnd, lp): if self._tmp_result: return 0 # break the loop queryGUID = False if hwnd != self._tmp_hwnd: if lp == 0: # main windows ## query if the window is a framework window result = user32.SendMessageTimeoutA( hwnd, fw.WND_WM_NOTIFY, fw.WND_NM_ISFWWINDOW, self._tmp_hwnd, 2, # SMTO_ABORTIFHUNG 5, # nTimeout byref(self._dwResult)) if result: if self._dwResult.value == fw.WND_MSGRESULT_TRUE: queryGUID = True elif lp== 1: # child windows queryGUID = True if queryGUID: # query window for its GUID user32.SendMessageTimeoutA( hwnd, fw.WND_WM_NOTIFY, fw.WND_NM_GETGUID, self._tmp_hwnd, 2, # SMTO_ABORTIFHUNG 5, # nTimeout byref(self._dwResult)) if not self._tmp_result: ## not result yet... enum childwindows all the way down user32.EnumChildWindows(hwnd, self._pEnumWindowsProc, 1) return 1 def _WndProc(self, hwnd, msg, wp, lp): if msg== WM_COPYDATA: if not self._tmp_result: result= fw.HandleCopyData(hwnd, msg, wp, lp) if result: if HIWORD(result[0]): if LOWORD(result[0])==fw.WND_CD_GUID: if result[1]==self._tmp_GUID: self._tmp_result= wp return 1 return user32.CallWindowProcA(self._pOldWndProc, hwnd, msg, wp, lp) # CopyData methods ---------------------------------------------------------------- def FindGUID(self, hwnd, GUID): self._tmp_hwnd = hwnd self._tmp_GUID = GUID self._tmp_result = None ## subclass the window to catch WM_COPYDATA in response to our query self._pOldWndProc= user32.SetWindowLongA(hwnd, -4, self._pWndProc) if not self._pOldWndProc: raise RuntimeError, "could not subclass window" user32.EnumWindows(self._pEnumWindowsProc, 0) # restore old proc user32.SetWindowLongA(hwnd, -4, self._pOldWndProc) return self._tmp_result def CopyData(self, hwndSource, hwndDest, lp, data, noprefix=False): ## TODO ## what if the window is hung ?? ## can not use timeout here, noone knows how long it will take ## for the window to process the message if noprefix: p= create_string_buffer(data) else: if lp > 0xffff: raise ValueError, "lp must be <= 0xFFFF" p= create_string_buffer(fw.SZ_GUID_COPYDATA + data) ## do not include NULL byte in cbData cd= COPYDATASTRUCT(lp, sizeof(p) -1, addressof(p)) return bool(user32.SendMessageA(hwndDest, WM_COPYDATA, hwndSource, byref(cd))) Index: win.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/win.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win.py 2 Jul 2005 08:54:11 -0000 1.2 --- win.py 23 Jul 2005 19:11:19 -0000 1.3 *************** *** 27,39 **** #************************************************* def ToggleTaskBar(): ! try: ! hwnd=user32.FindWindowA('Shell_TrayWnd', 0) if user32.IsWindowVisible(hwnd): ! SW_SHOW = 0 ! user32.ShowWindow(hwnd, SW_SHOW) else: ! SW_HIDE = 5 ! user32.ShowWindow(hwnd, SW_HIDE) ! except: pass def GetText(hwnd): --- 27,41 ---- #************************************************* def ToggleTaskBar(): ! result= None ! ! hwnd= user32.FindWindowA('Shell_TrayWnd', 0) ! if hwnd: if user32.IsWindowVisible(hwnd): ! user32.ShowWindow(hwnd, 0) #SW_HIDE ! result = False else: ! user32.ShowWindow(hwnd, 5) # SW_SHOW ! result= True ! return result def GetText(hwnd): *************** *** 112,116 **** WS_POPUP = 2147483648 GetWindowLong = user32.GetWindowLongA ! GetWindowLong.restype = DWORD style = GetWindowLong(hwnd, GWL_STYLE) if style & WS_POPUP: return True --- 114,118 ---- WS_POPUP = 2147483648 GetWindowLong = user32.GetWindowLongA ! #GetWindowLong.restype = DWORD style = GetWindowLong(hwnd, GWL_STYLE) if style & WS_POPUP: return True Index: resources.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/resources.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resources.py 2 Jul 2005 08:54:11 -0000 1.3 --- resources.py 23 Jul 2005 19:11:19 -0000 1.4 *************** *** 137,141 **** # pass ! #def findresource(self, resType, name):7 # if not kernel32.FindResourceA(self.hModule, resType, name): # raise 'cold not locate resource' --- 137,141 ---- # pass ! #def findresource(self, resType, name): # if not kernel32.FindResourceA(self.hModule, resType, name): # raise 'cold not locate resource' *************** *** 149,155 **** - #r = Resources(windll.comctl32) ! #avail= r.ListTypes() #if 'cursor' in avail: --- 149,155 ---- #r = Resources(windll.comctl32) ! #avail= r.ListNames('icon') ! #if 'cursor' in avail: Index: winos.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/winos.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** winos.py 29 Apr 2005 15:19:47 -0000 1.1.1.1 --- winos.py 23 Jul 2005 19:11:19 -0000 1.2 *************** *** 137,141 **** flags = 1 # EWX_SHUTDOWN if force: flags |= 4 | 8 ! if IsNT(): privleges.EnablePrivleges(None, 'SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) --- 137,141 ---- flags = 1 # EWX_SHUTDOWN if force: flags |= 4 | 8 ! if IsNT(): privleges.EnablePrivleges('SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) *************** *** 145,149 **** flags = 2 # EWX_RBOOT if force: flags |= 4 ! if IsNT(): privleges.EnablePrivleges(None, 'SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) --- 145,149 ---- flags = 2 # EWX_RBOOT if force: flags |= 4 ! if IsNT(): privleges.EnablePrivleges('SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) *************** *** 153,157 **** flags = 8 # EWX_POWEROFF if force: flags |= 4 ! if IsNT(): privleges.EnablePrivleges(None, 'SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) --- 153,157 ---- flags = 8 # EWX_POWEROFF if force: flags |= 4 ! if IsNT(): privleges.EnablePrivleges('SeShutdownPrivilege') user32.ExitWindowsEx(flags, 0) |
From: jürgen u. <cer...@us...> - 2005-07-23 19:10:26
|
Update of /cvsroot/wnd/wnd/wnd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26125 Modified Files: __init__.py fwtypes.py wintypes.py Log Message: bit of this and a bit of that Index: fwtypes.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/fwtypes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fwtypes.py 2 Jul 2005 08:50:35 -0000 1.3 --- fwtypes.py 23 Jul 2005 19:10:17 -0000 1.4 *************** *** 1,5 **** ! """framework defined types ! ! """ --- 1,3 ---- ! """framework defined types""" *************** *** 9,12 **** --- 7,14 ---- POINTER, addressof, + byref, + sizeof, + memmove, + UINT_MAX, NMHDR, HIWORD, *************** *** 16,50 **** c_long, c_ushort, ! c_short,) import sys, atexit #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! WND_MAX_CLASSNAME = 49 ! WND_N_TIMER_IDS= 10000 # counter ! WND_ERRORLEVEL= 0 # counter ! WND_MAXERROR= 0 ! WND_SZ_TRAY_MSG = "wnd_tray_msg" # Shell_NotifyIcon message ! WND_WM_TRAY = None # RegisterWindowMessage( ! # WND_SZ_TRAY_MSG) ! # ...done by TrayIcon class ! ! WND_ID_MDICHILD_MIN= 5000 # min/max IDs for MDI childs WND_ID_MDICHILD_MAX= 5999 WND_ID_CONTROL_MIN= WND_ID_MDICHILD_MAX +1 # min ID for controls ! # WND_WM_NOTIFY ! SZ_WND_NOTIFY= "wnd_notify_msg" WND_WM_NOTIFY = user32.RegisterWindowMessageA(SZ_WND_NOTIFY) if not WND_WM_NOTIFY: raise "could not register notify message" # notification codes (passed as wParam of the message) ! WND_NM_APPCREATED= 1 # not used currently ! WND_NM_MENU= 2 # lp= WND_MENU struct ! WND_NM_APPBAR= 3 # not used currently ! WND_NM_MSGREFLECT= 4 # lp= WND_MSGREFLECT struct ! WND_NM_EXCEPTION= 5 # lp= WND_EXCEPTION struct class WND_MSGREFLECT(Structure): _fields_ = [("hwndFrom", c_ulong), # who is reflecting --- 18,81 ---- c_long, c_ushort, ! c_short, ! c_ubyte, ! c_char, ! c_void_p, ! create_string_buffer, ! MAKELONG, ! COPYDATASTRUCT) ! ! from ctypes.com import GUID import sys, atexit #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! WND_GUIMAIN = False ## main window created True/False ! WND_MSGRESULT_TRUE = 123456789 ! WND_MAX_CLASSNAME = 64 ! WND_N_TIMER_IDS = 10000 # counter ! WND_ERRORLEVEL = 0 # counter ! WND_MAXERROR = 0 ! # control id ranges ! WND_ID_MDICHILD_MIN= 5000 # min/max IDs for MDI child windows WND_ID_MDICHILD_MAX= 5999 WND_ID_CONTROL_MIN= WND_ID_MDICHILD_MAX +1 # min ID for controls ! # Shell_NotifyIcon message ! WND_SZ_TRAY_MSG = "wnd_tray_msg{D1A29F00-F917-11D9-B552-00112FF53A26}" ! WND_WM_TRAY = None # RegisterWindowMessage( ! # WND_SZ_TRAY_MSG) ! # ...done by TrayIcon class ! # copy data ! SZ_GUID_COPYDATA= "{88077500-F881-11D9-B552-00112FF53A26}" # cookie ! WND_COPYDATA_MAXDATA = 10000000 # arbitrary ! # message ids for WM_COPYDATA ! WND_CD_GUID = 1 ! ! ! # wnd notify ! SZ_WND_NOTIFY= "wnd_notify_msg{E4FB9FC0-F917-11D9-B552-00112FF53A26}" WND_WM_NOTIFY = user32.RegisterWindowMessageA(SZ_WND_NOTIFY) if not WND_WM_NOTIFY: raise "could not register notify message" # notification codes (passed as wParam of the message) ! WND_NM_APPCREATED = 1 # not used currently ! WND_NM_MENU = 2 # lp= struct WND_MENU ! WND_NM_APPBAR = 3 # not used currently ! WND_NM_MSGREFLECT = 4 # lp= struct WND_MSGREFLECT ! WND_NM_EXCEPTION = 5 # lp= struct WND_EXCEPTION ! WND_NM_DLGDISPATCH = 6 # lp= hwnd or 0 to clear ! # modeless dialogboxes should set and clear this ! # on creatinon/destruction to enable keyboard handling ! ! WND_NM_ISMAINWINDOW = 7 # lp= 0. Returns WND_MSGRESULT_TRUE for ! # mainwindows ! WND_NM_ISFWWINDOW = 8 # lp= 0. Returns WND_MSGRESULT_TRUE for framework ! # windows or childwindows ! WND_NM_GETGUID = 9 # lp= hwndReceiver. Will respond with a WM_COPYDATA ! # to the receiver passing the GUID ! class WND_MSGREFLECT(Structure): _fields_ = [("hwndFrom", c_ulong), # who is reflecting *************** *** 54,59 **** ("fReturn", c_ushort)] # filled in by receiver --> # ...True/False ! # True return the return value, ! # False continue processing MNUT_MENU= 1 --- 85,90 ---- ("fReturn", c_ushort)] # filled in by receiver --> # ...True/False ! # True: return the return value, ! # False: continue processing MNUT_MENU= 1 *************** *** 74,83 **** ! # stuff framwork defined messages and styles in a class ! # so base classes update their styles from them WS_BASE_DEBUG = 1 WS_BASE_DEBUGALL = 2 WND_DEBUGMASK= WS_BASE_DEBUG | WS_BASE_DEBUGALL class wnd_window_styles: prefix = ['WS_', 'WS_EX_', 'WS_BASE_', 'WS_CLIENT_'] --- 105,126 ---- ! # <- end wnd notify ! ! ! # framwork defined messages and styles ! # so base classes should update their styles and messages from the classes below WS_BASE_DEBUG = 1 WS_BASE_DEBUGALL = 2 WND_DEBUGMASK= WS_BASE_DEBUG | WS_BASE_DEBUGALL + + class wnd_control_styles: + prefix = ['WS_', 'WS_EX_', 'WS_BASE_', 'WS_CLIENT_'] + WS_BASE_DEBUG = WS_BASE_DEBUG + WS_BASE_DEBUGALL = WS_BASE_DEBUGALL + + WS_BASE_SUBCLASS = 64 # used for controls only + + class wnd_window_styles: prefix = ['WS_', 'WS_EX_', 'WS_BASE_', 'WS_CLIENT_'] *************** *** 90,95 **** # handling. Can not be set # at runtime. - WS_BASE_SUBCLASS = 64 # used for controls only - class wnd_window_msgs: --- 133,136 ---- *************** *** 109,121 **** class _ID(object): def __init__(self): ! # self.stack= [] self.n= WND_ID_CONTROL_MIN ! #def Recycle(self, ID): ! # if ID not in self.stack: ! # self.stack.append(ID) ! # else: raise "could not recycle ID: %s" % ID def New(self): ! #if self.stack: ! # return self.stack.pop() self.n += 1 return self.n --- 150,164 ---- class _ID(object): def __init__(self): ! self.stack= [] self.n= WND_ID_CONTROL_MIN ! ! def Recycle(self, ID): ! if ID not in self.stack: ! self.stack.append(ID) ! else: raise "could not recycle ID: %s" % ID ! def New(self): ! if self.stack: ! return self.stack.pop() self.n += 1 return self.n *************** *** 124,128 **** - class Handles(object): def __init__(self, initval=0): --- 167,170 ---- *************** *** 226,248 **** elif msg==WND_WM_NOTIFY: ! ## expand reflected messages ! mr= WND_MSGREFLECT.from_address(lp) ! if mr.msg== 78: # WM_NOTIFY ! msgOut= mr.msg ! name, code= self.GetNm(mr.lParam) ! s= self.remsg % (name, ! code, ! hwnd, ! mr.wParam, ! mr.lParam, ! mr.hwndFrom) else: ! msgOut= mr.msg ! s= self.remsg % (self.MsgName(mr.msg), ! mr.msg, ! hwnd, ! mr.wParam, ! mr.lParam, ! mr.hwndFrom) else: s= self.msg % (self.MsgName(msg), msg, hwnd, wp, lp) --- 268,294 ---- elif msg==WND_WM_NOTIFY: ! ! if wp== WND_NM_MSGREFLECT: ! ## expand reflected messages ! mr= WND_MSGREFLECT.from_address(lp) ! if mr.msg== 78: # WM_NOTIFY ! msgOut= mr.msg ! name, code= self.GetNm(mr.lParam) ! s= self.remsg % (name, ! code, ! hwnd, ! mr.wParam, ! mr.lParam, ! mr.hwndFrom) ! else: ! msgOut= mr.msg ! s= self.remsg % (self.MsgName(mr.msg), ! mr.msg, ! hwnd, ! mr.wParam, ! mr.lParam, ! mr.hwndFrom) else: ! s= self.msg % (self.MsgName(msg), msg, hwnd, wp, lp) else: s= self.msg % (self.MsgName(msg), msg, hwnd, wp, lp) *************** *** 326,329 **** --- 372,376 ---- window._base_fMsgReflect= Bool and 1 or 0 + """******************************************************************** handlers for reflecting messages *************** *** 364,368 **** def ReflectMessage(hwnd, hwndTo, msg, wp, lp): - fReturn = c_ushort() msgr= WND_MSGREFLECT(hwnd, msg, wp, lp) result =user32.SendMessageA(hwndTo, --- 411,414 ---- *************** *** 410,426 **** ! def IsDialogReflectMessage(hwnd, msg, wp, lp): ! ## TODO: test ## filter WM_COMMAND for dialog boxes if msg==273: # WM_COMMAND if lp: if lp !=1: # IDOK if lp != 2: # IDCANCEL #DM_GETDEFID = WM_USER + 0 result= user32.SendMessageA(hwnd, 1024, 0, 0) if HIWORD(result) == 21323: # DC_HASDEFID defID= user32.GetDlgItem(hwnd, LOWORD(result)) if defID != lp: return ReflectMessage(hwnd, lp, msg, wp, lp) --- 456,479 ---- ! def IsDialogReflectMessage(hwnd, msg, wp, lp, dlgmode): ! #print dlgmode ## TODO: test ## filter WM_COMMAND for dialog boxes if msg==273: # WM_COMMAND + + #print wp, lp if lp: + if dlgmode=='modeless': + return ReflectMessage(hwnd, lp, msg, wp, lp) + if lp !=1: # IDOK if lp != 2: # IDCANCEL #DM_GETDEFID = WM_USER + 0 result= user32.SendMessageA(hwnd, 1024, 0, 0) + if HIWORD(result) == 21323: # DC_HASDEFID defID= user32.GetDlgItem(hwnd, LOWORD(result)) + if defID != lp: return ReflectMessage(hwnd, lp, msg, wp, lp) *************** *** 452,454 **** return ReflectMessage(hwnd, user32.GetDlgItem(hwnd, wp),msg, wp, lp) ! return None \ No newline at end of file --- 505,559 ---- return ReflectMessage(hwnd, user32.GetDlgItem(hwnd, wp),msg, wp, lp) ! return None ! ! ! """***************************************************************************************** ! Copy Data handlers ! ! CopyData(hwndSource, hwndDest, lp, data, reserved = 0) ! Copies data to another window ! ! hwndSource = the source window for the data ! hwndDest = the destination window ! lp = user defined parameter (range 0-65535) ! data = data to send (may be any string) ! reserved = if 1 the message is handled internally, setting a var _base_copyDataResult ! not notifying the user, if 0 the user will receive a 'copydata' message in ! the handler of its window ! ! Return value: True if the receiver returned True, False otherwise ! ! ! HandleCopyData(hwnd, msg, wp, lp) ! ! Handles WM_COPYDATA in a messageloop ! ! Return value: the data being copied (as string) or None if the message ! does not conform framework rules ! ! ! For the framework to recognize a WM_COPYDATA as 'friendly' the data is ! prefixed internally with the GUID SZ_GUID_COPYDATA. ! ! *****************************************************************************************""" ! WM_COPYDATA = 74 ! ! def CopyData(hwndSource, hwndDest, lp, data, reserved = 0): ! p= create_string_buffer(SZ_GUID_COPYDATA + data) ! ## do not include NULL byte in cbData ! cd= COPYDATASTRUCT(MAKELONG(lp, reserved), sizeof(p) -1, addressof(p)) ! return bool(user32.SendMessageA(hwndDest, WM_COPYDATA, hwndSource, byref(cd))) ! ! def HandleCopyData(hwnd, msg, wp, lp): ! cd = COPYDATASTRUCT.from_address(lp) ! ! # make shure only trustable data gets in here ! if WND_COPYDATA_MAXDATA >= cd.cbData >= len(SZ_GUID_COPYDATA): ! data= (c_char*cd.cbData).from_address(cd.lpData) ! if data[:len(SZ_GUID_COPYDATA)] == SZ_GUID_COPYDATA: ! return (cd.dwData, ''.join(data[len(SZ_GUID_COPYDATA):])) ! ! ! ! ! Index: wintypes.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/wintypes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wintypes.py 2 Jul 2005 08:50:35 -0000 1.3 --- wintypes.py 23 Jul 2005 19:10:17 -0000 1.4 *************** *** 26,30 **** #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! UINT_MAX = 1<<32 INT_MIN = -2147483647 - 1 INT_MAX = 2147483647 --- 26,30 ---- #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! UINT_MAX = 1 << 32 INT_MIN = -2147483647 - 1 INT_MAX = 2147483647 *************** *** 68,79 **** def MAKEWORD(byte1, byte2): return byte1 | (byte2 << 8) def MAKELONG(word1, word2): return word1 | (word2 << 16) - def MAKEINTRESOURCE(i): - p= create_string_buffer(4) - memmove(p, addressof(c_int(i)), 4) - return p - - - #return LPSTR(addressof(c_ulong(i))) - def RGB(r, g, b): return r | (g<<8) | (b<<16) def GETRGB(colorref): return colorref & 255,colorref >> 8 & 255,colorref >> 16 & 255 --- 68,71 ---- *************** *** 86,91 **** class NMHDR(Structure): _fields_=[("hwndFrom", HWND), ! ("idFrom", UINT), ! ("code", UINT)] --- 78,83 ---- class NMHDR(Structure): _fields_=[("hwndFrom", HWND), ! ("idFrom", UINT), ! ("code", UINT)] *************** *** 167,176 **** - #r0 = RECT(10, 10, 20, 20) - #r1 = RECT(15, 15, 30, 30) - - #r3 = r0.offset(10, 3) - - #************************************************ class POINT(POINT): --- 159,162 ---- *************** *** 187,196 **** raise "could not convert coordinates" - #rc= RECT(0, 0, 30, 30) - #pt=POINT(3, 4) - #************************************************************************************* class MEASUREITEMSTRUCT(Structure): _fields_ = [("CtlType", UINT), --- 173,184 ---- raise "could not convert coordinates" #************************************************************************************* + class COPYDATASTRUCT(Structure): + _fields_ = [("dwData", c_ulong), + ("cbData", c_ulong), + ("lpData", c_void_p)] + class MEASUREITEMSTRUCT(Structure): _fields_ = [("CtlType", UINT), *************** *** 314,324 **** # ...and the test if it works ! # some message box would be nice here ! result=DllGetVersion(comctl32) ! VER_COMCTL =result.dwMajorVersion, result.dwMinorVersion if VER_COMCTL < (4, 71): from wnd.api.msgbox import Msg ! msg= '''Sorry, at least comctl32.dll version 4.71 is required. ! Found version %s.%s'''.replace('\t', '') Msg(0, msg % VER_COMCTL, 'wnd-module', 'ok', 'systemmodal') --- 302,312 ---- # ...and the test if it works ! result = DllGetVersion(comctl32) ! VER_COMCTL = result.dwMajorVersion, result.dwMinorVersion if VER_COMCTL < (4, 71): from wnd.api.msgbox import Msg ! msg= '''Sorry ! At least comctl32.dll ver 4.71 is required ! Found ver %s.%s on your system'''.replace('\t', '') Msg(0, msg % VER_COMCTL, 'wnd-module', 'ok', 'systemmodal') Index: __init__.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 2 Jul 2005 08:50:35 -0000 1.4 --- __init__.py 23 Jul 2005 19:10:17 -0000 1.5 *************** *** 1,5 **** """Framework entry... """ ! __version__= "0.1.12" --- 1,5 ---- """Framework entry... """ ! __version__= "0.1.20" |
From: jürgen u. <cer...@us...> - 2005-07-02 09:56:21
|
Update of /cvsroot/wnd/wnd/wnd/controls/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24985 Modified Files: header.py messagehandler.py methods.py Log Message: bit of this and a bit of that Index: methods.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/treeview/methods.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methods.py 15 May 2005 09:38:30 -0000 1.2 --- methods.py 2 Jul 2005 09:56:12 -0000 1.3 *************** *** 461,465 **** self.Msg.TVM_GETEDITCONTROL, 0, 0) if not hwndEdit: raise RuntimeError("could not retrieve edit control") ! return TextinFromHandle(hwndEdit, 'nosubclass') def EditLabel(self, handle): --- 461,468 ---- self.Msg.TVM_GETEDITCONTROL, 0, 0) if not hwndEdit: raise RuntimeError("could not retrieve edit control") ! txt= TextinFromHandle(hwndEdit) ! fw.SetFlagMsgReflect(txt, False) ! return txt ! def EditLabel(self, handle): *************** *** 467,476 **** raise RuntimeError("could not edit label") def ItemHittest(self, x, y): hi=TVHITTESTINFO() ! hi.pt.x, hi.pt.y=x, y result= self.SendMessage(self.Hwnd, self.Msg.TVM_HITTEST, 0, byref(hi)) ! TVHT_NOWHERE = 1 ! out=[] if hi.flags& 1: out.append('nowhere') if hi.flags& 2: out.append('onitemicon') --- 470,484 ---- raise RuntimeError("could not edit label") + def EndEditLabel(self, cancel=False): + return bool(self.SendMessage(self.Hwnd, self.Msg.TVM_ENDEDITLABELNOW, save and 1 or 0, 0)) + def ItemHittest(self, x, y): hi=TVHITTESTINFO() ! pt = POINT(x, y) ! user32.ScreenToClient(self.Hwnd, byref(pt)) ! hi.pt= pt result= self.SendMessage(self.Hwnd, self.Msg.TVM_HITTEST, 0, byref(hi)) ! #TVHT_NOWHERE = 1 ! out=[hi.hItem, ] if hi.flags& 1: out.append('nowhere') if hi.flags& 2: out.append('onitemicon') *************** *** 485,489 **** if hi.flags& 2048: out.append('toleft') if hi.flags& (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON): out.append('onitem') ! return (hi.hItem, out) --- 493,498 ---- if hi.flags& 2048: out.append('toleft') if hi.flags& (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON): out.append('onitem') ! return out ! Index: header.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/treeview/header.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** header.py 29 Apr 2005 15:22:52 -0000 1.1.1.1 --- header.py 2 Jul 2005 09:56:12 -0000 1.2 *************** *** 2,6 **** ! from wnd.wintypes import (Structure, WINFUNCTYPE, sizeof, --- 2,7 ---- ! from wnd.wintypes import (user32, ! Structure, WINFUNCTYPE, sizeof, *************** *** 143,148 **** TVS_NOHSCROLL = 32768 # TVS_NOSCROLL overrides this ! WS_CLIENT_CUSTOMDRAW = 1 ! Styles.__dict__.update(control.control_styles.__dict__) Styles.prefix += ['TVS_', ] --- 144,148 ---- TVS_NOHSCROLL = 32768 # TVS_NOSCROLL overrides this ! Styles.__dict__.update(control.control_styles.__dict__) Styles.prefix += ['TVS_', ] Index: messagehandler.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/treeview/messagehandler.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** messagehandler.py 17 May 2005 20:14:12 -0000 1.3 --- messagehandler.py 2 Jul 2005 09:56:12 -0000 1.4 *************** *** 27,31 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 nm=NMTREEVIEW.from_address(msgr.lParam) --- 27,31 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect nm=NMTREEVIEW.from_address(msgr.lParam) |
From: jürgen u. <cer...@us...> - 2005-07-02 09:55:41
|
Update of /cvsroot/wnd/wnd/wnd/controls/toolbar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24685 Modified Files: __init__.py messagehandler.py Log Message: bit of this and a bit of that Index: __init__.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/toolbar/__init__.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** __init__.py 29 Apr 2005 15:22:23 -0000 1.1.1.1 --- __init__.py 2 Jul 2005 09:55:32 -0000 1.2 *************** *** 47,51 **** def AddBitmap(self, ID, hInst=None): # not complete yet. Second member is the resource identifier as UINT. - # I could not get MAKEINTRESOURCE to work if not hInst: hInst=4294967295 # HINST_COMMCTRL --- 47,50 ---- Index: messagehandler.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/toolbar/messagehandler.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** messagehandler.py 15 May 2005 09:36:43 -0000 1.2 --- messagehandler.py 2 Jul 2005 09:55:32 -0000 1.3 *************** *** 23,27 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_COMMAND: --- 23,27 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_COMMAND: |
From: jürgen u. <cer...@us...> - 2005-07-02 09:55:16
|
Update of /cvsroot/wnd/wnd/wnd/controls/menu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24490 Modified Files: __init__.py header.py methods.py popup.py Log Message: bit of this and a bit of that Index: header.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/menu/header.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** header.py 29 Apr 2005 15:22:18 -0000 1.1.1.1 --- header.py 2 Jul 2005 09:55:03 -0000 1.2 *************** *** 110,119 **** TPM_RETURNCMD = 256 - MF_BYPOSITION = 1024 MF_UNCHECKED = 0 MF_CHECKED = 8 ! ! --- 110,118 ---- TPM_RETURNCMD = 256 MF_UNCHECKED = 0 MF_CHECKED = 8 ! MF_BYCOMMAND = 0 ! MF_BYPOSITION = 1024 Index: methods.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/menu/methods.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methods.py 17 May 2005 20:13:39 -0000 1.2 --- methods.py 2 Jul 2005 09:55:03 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- from wnd.controls.menu.header import * + from wnd.controls.menu.popup import Popup #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: *************** *** 165,170 **** #------------------------------------------------------------------ ! # menu iterators ! def Walk(self, hMenu=None): if not hMenu: --- 166,178 ---- #------------------------------------------------------------------ ! ! def Clear(self, hMenu=None): ! if not hMenu: ! hMenu= self.handle ! n = user32.GetMenuItemCount(hMenu) ! for i in range(n): ! user32.DeleteMenu(hMenu, 0, MF_BYPOSITION) ! ! def Walk(self, hMenu=None): if not hMenu: Index: popup.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/menu/popup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** popup.py 17 May 2005 20:13:39 -0000 1.3 --- popup.py 2 Jul 2005 09:55:03 -0000 1.4 *************** *** 5,11 **** - - - class Popup(object): """Popup class returned by the Menu methods --- 5,8 ---- *************** *** 49,53 **** #'menubarbreak': 32,'menubreak':64, state_flags={'disabled' : 3,'checked' : 8,'default':4096} ! type_flags = {'menubarbreak': 32,'menubreak':64} for i in flags: try: itemState |= state_flags[i] --- 46,50 ---- #'menubarbreak': 32,'menubreak':64, state_flags={'disabled' : 3,'checked' : 8,'default':4096} ! type_flags = {'menubarbreak': 32,'menubreak':64, 'ownerdraw':256} for i in flags: try: itemState |= state_flags[i] Index: __init__.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/menu/__init__.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** __init__.py 29 Apr 2005 15:22:15 -0000 1.1.1.1 --- __init__.py 2 Jul 2005 09:55:03 -0000 1.2 *************** *** 96,99 **** --- 96,101 ---- if msg==278: # WM_INITMENU self.onMSG(hwnd, "menu open", wp, 0) + return 1 + elif msg==279: # WM_INITMENUPOPUP *************** *** 102,105 **** --- 104,108 ---- else: # menu self.onMSG(hwnd, "menu popup", wp, 0) + return 1 |
From: jürgen u. <cer...@us...> - 2005-07-02 09:54:59
|
Update of /cvsroot/wnd/wnd/wnd/controls/listview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24130 Modified Files: messagehandler.py methods.py Log Message: bit of this and a bit of that Index: methods.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/listview/methods.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methods.py 17 May 2005 20:08:04 -0000 1.3 --- methods.py 2 Jul 2005 09:54:34 -0000 1.4 *************** *** 46,50 **** style |= lv_styles.index(i) flag=True ! else: out.append(i) if flag: ControlMethods.SetStyleL(self, 'style', style) if out: ControlMethods.SetStyle(self, *out) --- 46,50 ---- style |= lv_styles.index(i) flag=True ! else: out.append(i) if flag: ControlMethods.SetStyleL(self, 'style', style) if out: ControlMethods.SetStyle(self, *out) *************** *** 310,314 **** lvi.iItem = lineno if not self.SendMessage(self.Hwnd,self.Msg.LVM_GETITEM, lineno, byref(lvi)): ! raise RuntimeError("could not retrieve item image") return lvi.lParam --- 310,314 ---- lvi.iItem = lineno if not self.SendMessage(self.Hwnd,self.Msg.LVM_GETITEM, lineno, byref(lvi)): ! raise RuntimeError("could not retrieve item lParam") return lvi.lParam *************** *** 342,345 **** --- 342,363 ---- return (result >> 12) + def SetItemOverlayImage(self, i, iOverlImage): + LVIS_OVERLAYMASK = 0x0F00 + lvi =LV_ITEM() + lvi.mask = lvi.LVIF_STATE + lvi.stateMask = LVIS_OVERLAYMASK + lvi.state = INDEXTOOVERLAYMASK(iOverlayImage) + if not self.SendMessage(self.Hwnd, self.Msg.LVM_SETITEMSTATE, i, byref(lvi)): + raise RuntimeError("could not set state image") + + def GetItemOverlayImage(self, i): + LVIS_OVERLAYMASK = 0x0F00 + + result= self.SendMessage(self.Hwnd, self.Msg.LVM_GETITEMSTATE, i, LVIS_OVERLAYMASK) + return (result >> 8) + + + + def GetItemRect(self, lineno, columno): rc = RECT() # LVIR_BOUNDS *************** *** 435,438 **** --- 453,457 ---- lfi.vkDirection =VK_DOWN result = self.SendMessage(self.Hwnd, self.Msg.LVM_FINDITEM, start, byref(lfi)) + if result > -1: return result *************** *** 615,619 **** if not hwndHd: raise RuntimeError("could not retrieve header control") ## do not sublass ! return HeaderFromHandle(hwndHd, 'nosubclass') def GetEditControl(self): --- 634,641 ---- if not hwndHd: raise RuntimeError("could not retrieve header control") ## do not sublass ! ! hd= HeaderFromHandle(hwndHd) ! fw.SetFlagMsgReflect(hd, False) ! return hd def GetEditControl(self): *************** *** 621,626 **** self.Msg.LVM_GETEDITCONTROL, 0, 0) if not hwndEdit: raise RuntimeError("could not retrieve edit control") ! ## do not sublass ! return TextinFromHandle(hwndEdit, 'nosubclass') def EditLabel(self, lineno): --- 643,651 ---- self.Msg.LVM_GETEDITCONTROL, 0, 0) if not hwndEdit: raise RuntimeError("could not retrieve edit control") ! ! txt= TextinFromHandle(hwndEdit) ! fw.SetFlagMsgReflect(txt, False) ! return txt ! def EditLabel(self, lineno): *************** *** 699,702 **** --- 724,735 ---- # listview 'icon' methods + def SetTooltips(self, tooltip): + return self.SendMessage(self.Hwnd, self.Msg.LVM_SETTOOLTIPS, 0, tooltip.Hwnd) + + def GetTooltips(self): + result= self.SendMessage(self.Hwnd, self.Msg.LVM_GETTOOLTIPS, 0, 0) + if result: return result + + def Arrange(self, flag=0): """For listview 'icon' style.""" *************** *** 728,741 **** # return (HIWORD(result), LOWORD(result)) ! #def GetItemSpacing(self): ! # """Retrieves horizontal and vertical icon spacing ! # for 'icon' and 'smallicon' listviews as tuple(w, h). For all others return value is allways none.""" ! # style = self.GetStyleL('style') ! # if style & 3 == 0: # LVS_ICON ! # flag=0 ! # elif style & 3 == 2: # LVS_SMALLICON: ! # flag=1 ! # else: return None ! # result=self.SendMessage(self.Hwnd, self.Msg.LVM_GETITEMSPACING , flag, 0) ! # return (HIWORD(result), LOWORD(result)) --- 761,779 ---- # return (HIWORD(result), LOWORD(result)) ! # def GetItemSpacing(self): ! # """Retrieves horizontal and vertical icon spacing ! # for 'icon' and 'smallicon' listviews as tuple(w, h). For all others return value is allways none.""" ! # style = self.GetStyleL('style') ! # #if style & 3 == 0: # LVS_ICON ! # # flag=0 ! # if style & 3 == 2: # LVS_SMALLICON: ! # flag=1 ! # else: ! # flag= 0 ! # ! # #else: return None ! # result=self.SendMessage(self.Hwnd, self.Msg.LVM_GETITEMSPACING , flag, 0) ! # print 'xxx', result ! # return (HIWORD(result), LOWORD(result)) ! Index: messagehandler.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/listview/messagehandler.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** messagehandler.py 15 May 2005 09:34:40 -0000 1.2 --- messagehandler.py 2 Jul 2005 09:54:34 -0000 1.3 *************** *** 12,16 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 --- 12,16 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect |
From: jürgen u. <cer...@us...> - 2005-07-02 09:53:55
|
Update of /cvsroot/wnd/wnd/wnd/controls/base In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23805 Modified Files: control.py methods.py window.py Log Message: bit of this and a bit of that Index: control.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/base/control.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** control.py 15 May 2005 09:31:16 -0000 1.2 --- control.py 2 Jul 2005 09:53:42 -0000 1.3 *************** *** 25,28 **** --- 25,30 ---- self._base_timers= [] self._base_debugger= None + self._base_fMsgReflect= 1 + # ...all the style parsing *************** *** 153,157 **** self.onMSG(hwnd, "timer", wp, lp) ## do not return 0; pass it to DefWindowProc to enshure default processing ! ## Treeview header, for example, user timer messages elif msg==self.Msg.WM_MOUSELEAVE: --- 155,161 ---- self.onMSG(hwnd, "timer", wp, lp) ## do not return 0; pass it to DefWindowProc to enshure default processing ! ## Listview header, for example, user timer messages ! if self.IsOwnTimer(wp): ! return 0 elif msg==self.Msg.WM_MOUSELEAVE: *************** *** 228,231 **** --- 232,236 ---- self._base_timers= [] self._base_debugger= None + self._base_fMsgReflect= 1 # set the windowproc Index: window.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/base/window.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** window.py 15 May 2005 09:32:45 -0000 1.2 --- window.py 2 Jul 2005 09:53:42 -0000 1.3 *************** *** 135,140 **** #------------------------------------------------------------------- ! if msg==2: # WM_DESTROY self.onMSG(hwnd, "close", 0, 0) # catch errors ?? --- 135,150 ---- #------------------------------------------------------------------- + if msg==43: # WM_DRAWITEM + ## ownerdraw menus + self.onMSG(hwnd, "drawitem", 0, DRAWITEMSTRUCT.from_address(lp)) + return 1 + + elif msg==44: # WM_MEASUREITEN + ## ownerdraw menus + self.onMSG(hwnd, "measureitem", 0, MEASUREITEMSTRUCT.from_address(lp)) + return 1 ! ! elif msg==2: # WM_DESTROY self.onMSG(hwnd, "close", 0, 0) # catch errors ?? *************** *** 226,229 **** --- 236,241 ---- elif msg==self.Msg.WM_TIMER: self.onMSG(hwnd, "timer", wp, lp) + if self.IsOwnTimer(wp): + return 0 elif msg==278: # WM_INITMENU *************** *** 475,478 **** --- 487,493 ---- WS_MINIMIZEBOX = 131072 WS_MAXIMIZEBOX = 65536 + WS_THICKFRAME = 262144 ## not documented + WS_OVERLAPPEDWINDOW= WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX + WS_EX_DLGMODALFRAME = 1 Index: methods.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/base/methods.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methods.py 15 May 2005 09:31:54 -0000 1.2 --- methods.py 2 Jul 2005 09:53:42 -0000 1.3 *************** *** 128,131 **** --- 128,132 ---- def DeferWindows(self, *windows): + handle= user32.BeginDeferWindowPos(len(windows)) if handle: *************** *** 149,152 **** --- 150,154 ---- else: raise RuntimeError, d + if user32.EndDeferWindowPos(handle): return raise WinError(GetLastError()) *************** *** 275,278 **** --- 277,285 ---- def GetTimers(self): return self._base_timers + + def IsOwnTimer(self, ID): + return ID in self._base_timers + + def SetTimer(self, ID, nTimeout): # TODO: find out about timer ID's used by the system *************** *** 289,295 **** # would ne nice to dump all open timers to TrackHandler # when the window is closed for a status report ! if not user32.KillTimer(self.Hwnd, ID): raise WinError(GetLastError()) try: self._base_timers.remove(ID) except: raise IndexError, "no such timer registered: %s" % ID def HandleMessage(self, Const): --- 296,305 ---- # would ne nice to dump all open timers to TrackHandler # when the window is closed for a status report ! result= user32.KillTimer(self.Hwnd, ID) try: self._base_timers.remove(ID) except: raise IndexError, "no such timer registered: %s" % ID + if not result: + raise WinError(GetLastError()) + def HandleMessage(self, Const): *************** *** 407,410 **** --- 417,421 ---- offset = 0 prefix = prefix.split('_', 2) + if prefix[0]=='WS': if prefix[1]=='EX': *************** *** 484,488 **** def SetFont(self, Font): ! self.SendMessage(self.Hwnd, self.Msg.WM_SETFONT, Font.handle, 1) def SetRedraw(self, Bool): --- 495,502 ---- def SetFont(self, Font): ! if isinstance(Font, (int, long)): ! self.SendMessage(self.Hwnd, self.Msg.WM_SETFONT, Font, 1) ! else: ! self.SendMessage(self.Hwnd, self.Msg.WM_SETFONT, Font.handle, 1) def SetRedraw(self, Bool): *************** *** 578,582 **** def GetFocus(self): return user32.GetFocus() def HasFocus(self): return user32.GetFocus()==self.Hwnd ! def HasMouseCapture(self):user32.GetCapture()==self.Hwnd def GetMouseCapture(self): return user32.GetCapture() def SetMouseCapture(self): return user32.SetCapture(self.Hwnd) --- 592,596 ---- def GetFocus(self): return user32.GetFocus() def HasFocus(self): return user32.GetFocus()==self.Hwnd ! def HasMouseCapture(self): return user32.GetCapture()==self.Hwnd def GetMouseCapture(self): return user32.GetCapture() def SetMouseCapture(self): return user32.SetCapture(self.Hwnd) |
From: jürgen u. <cer...@us...> - 2005-07-02 09:52:12
|
Update of /cvsroot/wnd/wnd/wnd/res/autogen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23075 Modified Files: icons1.py Log Message: bit of this and a bit of that Index: icons1.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/res/autogen/icons1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icons1.py 15 May 2005 09:40:32 -0000 1.2 --- icons1.py 2 Jul 2005 09:52:03 -0000 1.3 *************** *** 5,8 **** --- 5,9 ---- comctl32= windll.comctl32 + shell32= windll.shell32 #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: *************** *** 28,32 **** 32, 32), ! ] } --- 29,39 ---- 32, 32), ! ('ico_link_overlay', ! 'link overlay icon', ! gdi.IconFromFile(r'D:\download\res\icons\197.ico', 32, 32), ! 1, ! 32, ! 32), ! ] } |
From: jürgen u. <cer...@us...> - 2005-07-02 09:51:23
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/Structures, types and makros/RECT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22670 Modified Files: rect.dtpl Log Message: bit of this and a bit of that Index: rect.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/Structures, types and makros/RECT/rect.dtpl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** rect.dtpl 29 Apr 2005 15:16:11 -0000 1.1.1.1 --- rect.dtpl 2 Jul 2005 09:51:14 -0000 1.2 *************** *** 73,79 **** ::item:: Subtract <code>Subtract(Rect)</code><br> ! <P>Returns a new rectangle wich is the result of the subtracktion ! of the the given rectangle. The two rectangles have to intersect completely in x ! or y direction to make this method work. </P> --- 73,79 ---- ::item:: Subtract <code>Subtract(Rect)</code><br> ! <P>Returns a new rectangle wich is the result of the subtraction ! of the the given rectangle. If the two rectangles do not intersect ! completely in the rect is left unchanged </P> |
From: jürgen u. <cer...@us...> - 2005-07-02 09:50:58
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/Structures, types and makros In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22399 Modified Files: structures and types and makros.dtpl Log Message: bit of this and a bit of that Index: structures and types and makros.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/Structures, types and makros/structures and types and makros.dtpl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** structures and types and makros.dtpl 29 Apr 2005 15:16:09 -0000 1.1.1.1 --- structures and types and makros.dtpl 2 Jul 2005 09:50:35 -0000 1.2 *************** *** 399,403 **** <DT>wDay <DD>day of month ! <DT><wHour <DD>the hour <DT>wMinute --- 399,403 ---- <DT>wDay <DD>day of month ! <DT>wHour <DD>the hour <DT>wMinute |
From: jürgen u. <cer...@us...> - 2005-07-02 09:50:21
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/gdi/icon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21937 Modified Files: icon.dtpl Log Message: bit of this and a bit of that Index: icon.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/gdi/icon/icon.dtpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icon.dtpl 15 May 2005 10:12:08 -0000 1.2 --- icon.dtpl 2 Jul 2005 09:49:45 -0000 1.3 *************** *** 33,49 **** </P> - ::site:: class DummyIcon - <code class=import>defined in: wnd.gdi</code><br><br> - <code>class DummyIcon(w=0, h=0)</code><br> - <P> - Creates an empty icon. - <br><br> - Seems pretty useless at first sight, but listviews for example set item heights - according to the size of the assigned imagelist and this imagelist needs one icon at last. So here it is. - <br><br> - These icons are not shared resources. So you have to close them when done with them.By default the frameworks TrackHandler keeps track of these icons - and closes them when the process exits. - </P> - ::site:: class SystemIcon --- 33,36 ---- *************** *** 79,83 **** ::site:: class IconFromInstance <code class=import>defined in: wnd.gdi</code><br><br> ! <code>IconFromFile(instance, resname, w=0, h=0)</code><br> <P> Loads an icon from a dll. --- 66,70 ---- ::site:: class IconFromInstance <code class=import>defined in: wnd.gdi</code><br><br> ! <code>IconFromInstance(instance, resname, w=0, h=0)</code><br> <P> Loads an icon from a dll. *************** *** 109,115 **** the desired height of the icon to load. If both are zero the default size is loaded. - <br><br> - These icons are loaded as shared resources so you do not have to close them, - but best is if you do so. </P> --- 96,99 ---- *************** *** 320,324 **** --- 304,358 ---- Draws an icon at the specified position in the dc. </P> + + + + ::item:: DrawEx + <code>DrawEx(dc, x, y, w, h, flag)</code><br> + <P> + Draws an icon at the specified position in the dc. + <br><br> + <DL> + <DT>dc + <DD>the dc to draw to + <DT>x + <DD>the x-position to draw at + <DT>y + <DD>the y-position to draw at + <DT>w + <DD>the desired width of the icon + <DT>h + <DD>the desired height of the icon + <DT>flag + <DD>one of the following flags: + <br><br> + <TABLE class="table1" BORDER="1"> + <TR> + <TD>'compat'</TD> + <TD>??</TD> + </TR> + <TR> + <TD>'defaultsize'</TD> + <TD>ignores w and h parameters and uses the icons default size</TD> + </TR> + <TR> + <TD>'image'</TD> + <TD>draws the image of the icon</TD> + </TR> + <TR> + <TD>'mask'</TD> + <TD>draws the mask of the icon</TD> + </TR> + <TR> + <TD>'nomirror'</TD> + <TD>??</TD> + </TR> + <TR> + <TD>'normal'</TD> + <TD>draws both, the mask and the image of the icon</TD> + </TR> + </TABLE> + </DL> + </P> ::item:: Release |
From: jürgen u. <cer...@us...> - 2005-07-02 09:49:24
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/controls/window classes/window In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21597 Modified Files: window.dtpl Log Message: bit of this and a bit of that Index: window.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/controls/window classes/window/window.dtpl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** window.dtpl 29 Apr 2005 15:19:27 -0000 1.1.1.1 --- window.dtpl 2 Jul 2005 09:49:12 -0000 1.2 *************** *** 74,79 **** </TR> <TR> ! <TD></TD> ! <TD></TD> </TR> </TABLE> --- 74,79 ---- </TR> <TR> ! <TD>'thickframe'</TD> ! <TD>draws a thick frame around the window and enables resizing</TD> </TR> </TABLE> *************** *** 506,510 **** ::item:: SetIcon ! <code>SetIcon(Icon')</code><br> <P>Sets the icon to be displayed in the title bar of the window <br><br> --- 506,510 ---- ::item:: SetIcon ! <code>SetIcon(Icon)</code><br> <P>Sets the icon to be displayed in the title bar of the window <br><br> |