[Wnd-commit] wnd/wnd/tools/dlgeditor dlgeditor.py,1.1.1.1,1.2 dlgtemplate.py,1.1.1.1,1.2 res_dlg.py,
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 19:34:55
|
Update of /cvsroot/wnd/wnd/wnd/tools/dlgeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32308 Modified Files: dlgeditor.py dlgtemplate.py res_dlg.py Log Message: bit of this and a bit of that Index: res_dlg.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/tools/dlgeditor/res_dlg.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** res_dlg.py 29 Apr 2005 15:25:06 -0000 1.1.1.1 --- res_dlg.py 23 Jul 2005 19:34:46 -0000 1.2 *************** *** 1 **** ! DLG_RES= '\x01\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x08\x10\x02\x00\x00\x00\n\x00P\x00U\x00\x00\x00\x00\x00t\x00e\x00s\x00t\x00 \x00d\x00i\x00a\x00l\x00o\x00g\x00\x00\x00\x0c\x00d\x00\x01\x00a\x00r\x00i\x00a\x00l\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x08\x002\x00\x19\x00\x0c\x00\x01\x00\x00\x00b\x00u\x00t\x00t\x00o\x00n\x00\x00\x00O\x00K\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P-\x002\x00\x19\x00\x0c\x00\x02\x00\x00\x00b\x00u\x00t\x00t\x00o\x00n\x00\x00\x00c\x00a\x00n\x00c\x00e\x00l\x00\x00\x00\x00\x00\x00\x00' \ No newline at end of file --- 1 ---- ! DLG_RES= '\x01\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x08\x10\x02\x00\x00\x00\n\x00P\x00U\x00\x00\x00\x00\x00t\x00e\x00s\x00t\x00 \x00d\x00i\x00a\x00l\x00o\x00g\x00s\x00\x00\x00\x0c\x00d\x00\x01\x00a\x00r\x00i\x00a\x00l\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x08\x002\x00\x19\x00\x0c\x00\x01\x00\x00\x00b\x00u\x00t\x00t\x00o\x00n\x00\x00\x00O\x00K\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P-\x002\x00\x19\x00\x0c\x00\x02\x00\x00\x00b\x00u\x00t\x00t\x00o\x00n\x00\x00\x00c\x00a\x00n\x00c\x00e\x00l\x00\x00\x00\x00\x00\x00\x00' \ No newline at end of file Index: dlgtemplate.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/tools/dlgeditor/dlgtemplate.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dlgtemplate.py 29 Apr 2005 15:25:04 -0000 1.1.1.1 --- dlgtemplate.py 23 Jul 2005 19:34:46 -0000 1.2 *************** *** 70,74 **** #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! #************************************************** class DlgTemplate(object): --- 70,77 ---- #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ! ! #************************************************************************ ! # based on DLGTEMPLATEEX ++ DLGITEMTEMPLATEEX ! #************************************************************************ class DlgTemplate(object): *************** *** 109,113 **** def Item(self, classname, ID, title, style, exstyle, x, y, w, h): ! if not self: raise "nop template started" self._nItems += 1 style |= WS_CHILD --- 112,116 ---- def Item(self, classname, ID, title, style, exstyle, x, y, w, h): ! if not self: raise "no template started" self._nItems += 1 style |= WS_CHILD *************** *** 130,134 **** def RunModal(self, hwnd=0, lp=0): ! if not self: raise "nop template started" self._template = self.ToBuffer() #self._template = self.ToString() --- 133,137 ---- def RunModal(self, hwnd=0, lp=0): ! if not self: raise "no template started" self._template = self.ToBuffer() #self._template = self.ToString() *************** *** 139,143 **** def RunModeless(self, hwnd=0, lp=0): ! if not self: raise "nop template started" self._template = self.ToBuffer() self._pDlgProc = DIALOGPROC(self.DlgProc) --- 142,146 ---- def RunModeless(self, hwnd=0, lp=0): ! if not self: raise "no template started" self._template = self.ToBuffer() self._pDlgProc = DIALOGPROC(self.DlgProc) *************** *** 164,168 **** #************************************************ - #************************************************ --- 167,170 ---- *************** *** 177,181 **** tpl.Item('button', IDOK, 'OK', WS_VISIBLE, 0, 8, 50, 25, 12) tpl.Item('button', IDCANCEL, 'cancel', WS_VISIBLE, 0, 45, 50, 25, 12) ! #print repr(tpl.ToBuffer().raw) print tpl.RunModal() --- 179,183 ---- tpl.Item('button', IDOK, 'OK', WS_VISIBLE, 0, 8, 50, 25, 12) tpl.Item('button', IDCANCEL, 'cancel', WS_VISIBLE, 0, 45, 50, 25, 12) ! print repr(tpl.ToBuffer()) print tpl.RunModal() *************** *** 188,189 **** --- 190,288 ---- #test() + + """ + #******************************************************************************** + # based on DLGTEMPLATE ++ DLGITEMTEMPLATE + #******************************************************************************** + + #class DlgTemplateSimple(DlgTemplate): + + def __init__(self): + DlgTemplate.__init__(self) + + + def BeginTemplate(self, classname, title, style, exstyle, x, y, w, h, font): + + style |= WS_VISIBLE + if font: style |= DS_SETFONT + p= [] + p += DWORD_TOBYTES(style) # style + p += DWORD_TOBYTES(exstyle) # exstyle + p += WORD_TOBYTES(0) # nItems bit 8/19 + p += WORD_TOBYTES(x) # x + p += WORD_TOBYTES(y) # y + p += WORD_TOBYTES(w) # w + p += WORD_TOBYTES(h) # h + p += [0, 0] # menu # not yet + if classname: p += SZ_TOWBYTES(classname) + else: p += [0, 0] + p += SZ_TOWBYTES(title) + if font: + ## does not support weight and italic + p += WORD_TOBYTES(font[1]) # size + p += SZ_TOWBYTES(font[0]) # face name + # align + if len(p) % 4: p += (0, 0) + self._p = p + self._nItems = 0 + + def Item(self, classname, ID, title, style, exstyle, x, y, w, h): + if not self: raise "no template started" + self._nItems += 1 + style |= WS_CHILD + p= [] + p += DWORD_TOBYTES(style) # style + p += DWORD_TOBYTES(exstyle) # extended style + p += WORD_TOBYTES(x) # x + p += WORD_TOBYTES(y) # y + p += WORD_TOBYTES(w) # w + p += WORD_TOBYTES(h) # h + p += WORD_TOBYTES(ID) # ID (WORD in DLGTEMOPLATE) + p += SZ_TOWBYTES(classname) + p += SZ_TOWBYTES(title) + # dword align + if len(p) % 4: p += (0, 0) + else: p += (0, 0, 0, 0) + self._p += p + + + def ToBuffer(self): + if not self: raise "no template started" + self._p[8], self._p[9]= WORD_TOBYTES(self._nItems) + return buffer(''.join(map(chr, self._p)))[:] + + + + def test(): + WS_VISIBLE = 268435456 + WS_SYSMENU = 524288 + WS_SIZEBOX = 262144 + IDOK = 1 + IDCANCEL = 2 + font=('arial', 12, 100) + tpl = DlgTemplateSimple() + tpl.BeginTemplate(None, 'test dialog', WS_SYSMENU|WS_SIZEBOX, 0, 0, 100, 80, 185, font) + tpl.Item('button', IDOK, 'OK', WS_VISIBLE, 0, 8, 50, 25, 12) + tpl.Item('button', IDCANCEL, 'cancel', WS_VISIBLE, 0, 45, 50, 25, 12) + #print repr(tpl.ToBuffer()) + tpl.RunModal() + + import os + fp= open('%s\\test.dlg' % os.path.split(__file__)[0], 'w') + try: + fp.write(repr(tpl.ToBuffer())) + finally: fp.close() + + #test() + + + """ + + #************************************************ + + #************************************************ + + + + + Index: dlgeditor.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/tools/dlgeditor/dlgeditor.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dlgeditor.py 29 Apr 2005 15:25:01 -0000 1.1.1.1 --- dlgeditor.py 23 Jul 2005 19:34:46 -0000 1.2 *************** *** 81,85 **** if name[2] in styles: exstyle |= value ! styles.remove(name) elif len(name)==2: if name[1] in styles: --- 81,85 ---- if name[2] in styles: exstyle |= value ! styles.remove(name[2]) elif len(name)==2: if name[1] in styles: *************** *** 91,95 **** return style, exstyle ! #************************************************** class DlgEditor(DlgTemplate): --- 91,96 ---- return style, exstyle ! #************************************************************************************ ! #************************************************************************************ class DlgEditor(DlgTemplate): *************** *** 113,122 **** # return DlgTemplate.DlgProc(self, hwnd, msg, wp, lp) ! ! ! ! #************************************************ ! ! #************************************************ def test(): --- 114,119 ---- # return DlgTemplate.DlgProc(self, hwnd, msg, wp, lp) ! #***************************************************************************************** ! #***************************************************************************************** def test(): *************** *** 128,132 **** tpl.Item('button', IDOK, 'OK', 8, 50, 25, 12, 'visible') tpl.Item('button', IDCANCEL, 'cancel', 45, 50, 25, 12, 'visible') ! #print repr(tpl.ToBuffer().raw) print tpl.RunModal() import os --- 125,129 ---- tpl.Item('button', IDOK, 'OK', 8, 50, 25, 12, 'visible') tpl.Item('button', IDCANCEL, 'cancel', 45, 50, 25, 12, 'visible') ! #print repr(tpl.ToBuffer()) print tpl.RunModal() import os |