wnd-commit Mailing List for wnd (Page 6)
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-02 09:28:37
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/ole/dragdrop In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10853/dragdrop Log Message: Directory /cvsroot/wnd/wnd/wnd_doc/doc/api/ole/dragdrop added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:28:05
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/ole/dataobject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10652/dataobject Log Message: Directory /cvsroot/wnd/wnd/wnd_doc/doc/api/ole/dataobject added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:27:40
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/handles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10474 Added Files: handles.dtpl Log Message: bit of this and a bit of that --- NEW FILE: handles.dtpl --- ::site:: class Handles <code class=import>defined in: wnd.api.handles</code><br><br> <code>Handles(initval=0)</code><br> <P> This class wraps methods to create and recycle unique handles. <br><br> The win32 api throws around handles every now and then, this class lets you join the concert with your own unique handles. <br><br> the class defines three methods: <br><br> <code>New()</code><br> <P> Returns a new unique handle </P> <br><br> <code>Close(handle)</code><br> <P> Recycles a handle returned in a call to 'New' so so it can be reused </P> <br><br> <code>GetHandles()</code><br> <P> Returns a copy of the list of all currently open handles kept by the class </P> <br><br> Access to 'New' and 'Close' is synchronized so it should be thread safe. <br><br> The first handle returned is always 'initval' +1 </P> |
From: jürgen u. <cer...@us...> - 2005-07-02 09:27:06
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/display In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10019 Modified Files: display.dtpl Log Message: bit of this and a bit of that Index: display.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/api/display/display.dtpl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** display.dtpl 29 Apr 2005 15:16:01 -0000 1.1.1.1 --- display.dtpl 2 Jul 2005 09:26:43 -0000 1.2 *************** *** 100,104 **** <code>GetMonitorXY(x, y, flag='nearest')</code><br> <P> ! Returns tuple(display-name, is-primary-monitor), RECT-size, RECT-work-size, monitor-name), (...)) of the monitor at the specified point. <br><br> <DL> --- 100,104 ---- <code>GetMonitorXY(x, y, flag='nearest')</code><br> <P> ! Returns tuple(display-name, is-primary-monitor, RECT-size, RECT-work-size) of the monitor at the specified point. <br><br> <DL> |
From: jürgen u. <cer...@us...> - 2005-07-02 09:26:42
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/clipboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9663 Added Files: clipboard.dtpl Log Message: bit of this and a bit of that --- NEW FILE: clipboard.dtpl --- ::site:: clipboard this module contains several clipboard related functions and datatypes <br> <code class=import>defined in: wnd.api</code><br><br> <br><br> Sample code. Set/Get clipboard the ole way. The data will be set to the clipboard, provifing three different aspects of a string: plain text, unicode text and oem text. This gives any application the oportuenty to retrieve the data in the format suiting its needs best. <pre> from wnd.api import clipboard \# set the text you want to have on the clipboard to the wrappers \# and use them to init a DataObject myText= 'abcdefg' text= clipboard.cf.text(myText) utext= clipboard.cf.unicodetext(unicode(myText)) otext= clipboard.cf.oemtext(myText) do= clipboard.DataObject(text, utext, otext) clipboard.SetDataObject(do) \# to check if it worked, print the formats now available on the clipboard for i in ListFormats(): print i \#>> <wnd.cf.null at 10f4fd0 {format=text} {aspect=content} {tymed=hglobal}> \#>> <wnd.cf.null at 10fa090 {format=unicodetext} {aspect=content} {tymed=hglobal}> \#>> <wnd.cf.null at 10fa0d0 {format=oemtext} {aspect=content} {tymed=hglobal}> clipboard.Flush() do.Close() \# retrieve thei data from clipboard again do= clipboard.GetDataObject() if do: if do.HasFormat(text): if do.GetData(text): print text.value text.Close() if do.HasFormat(utext): if do.GetData(utext): print untext.value utext.Close() if do.HasFormat(otext): if do.GetData(otext): print ontext.value otext.Close() \#>> abcdefg \#>> u'abcdefg' \#>> abcdefg </pre> <br><br> The required DataObject (and DataObjectFromPointer) are imported by the clipboard module <code class="import">from wnd.api.ole.dataobject</code> and are intended too be used from this module. ::folder:: clipboard functions the clipboard module defines the following functions ::item:: GetDataObject <code>GetDataObject()</code><br> <P>Returns a pointer to the data object that is currently on the clipboard <br><br> <b>Return value</b><br> a DataObjectFromPointer instance </P> ::item:: SetDataObject <code>SetDataObject(dataobject)</code><br> <P>Sets the data object to the clipboard </P> ::item:: Clear <code>Clear()</code><br> <P>Empties the clipboard <br><br> <b>Return value</b><br> True if successfull, False otherwise </P> ::item:: IsFormatAvailable <code>IsFormatAvailable(format)</code><br> <P>returns True if the format is available on the clipboard, False otherwise. <br><br> format can be a format class or a format instance <br><br> See <a HREF="../clipboard format wrappers/contents.html">clipboard format wrappers</a> for dtails </P> ::item:: Flush <code>Flush()</code><br> <P>Flushes the contents of a data object to the clipboard. <br><br> When you set a DataObject to the clipboard, its contents are not rendered unless calling Flush. After caling Flush the clipboard has taken over ownership of the data of the DataObject. As long as Flush is not called all changes in the dataObject are reflected directly by the dataObject. <pre> MyFormat= text('blah here') do= DataObject(MyFormat) SetDataObject(do) MyFormat.value= None do2= GetDataObject() format= do2.GetData(MyFormat) print myFormat.value \#>> None </pre> <pre> MyFormat= text('blah here') do= DataObject(MyFormat) SetDataObject(do) Flush() MyFormat.value= None do2= GetDataObject() format= do2.GetData(MyFormat) print myFormat.value \#>> 'blah here' </pre> <b>Return value</b><br> True if successfull, False otherwise </P> ::item:: GetFormatName <code>GetFormatName(format)</code><br> <P>returns the name of a (registered) format or None <br><br> See <a HREF="../clipboard format wrappers/contents.html">clipboard format wrappers</a> for dtails </P> ::item:: GetFrameworkName <code>GetFrameworkName(format)</code><br> <P>returns the framework name of a format wich may or may not differ from the name returned by <a HREF="GetFormatName.html">GetFormatName</a> <br><br> If no name could be found return value is None </P> ::item:: GetFormatNameN <code>GetFormatNameN(nFormat)</code><br> <P>same as <a HREF="GetFormatName.html">GetFormatName</a>, but format should be an integer value </P> ::item:: GetFrameworkNameN <code>GetFrameworkName(nFormat)</code><br> <P>same as <a HREF="GetFrameworkName.html">GetFrameworkName</a>, but format should be an integer value </P> ::item:: RegisterClipboardFormat <code>RegisterClipboardFormat(name)</code><br> <P>Registers a clipboard format by name. <br><br> Subsequent registeing of the same name will allways return the same value, throughout the system. <br><br> <b>Return value</b><br> An integer representing the clipboard format </P> ::item:: cf <code>cf</code><br> <P>Stub class, returning a format wrapper class to handle the specified clipboard format <br><br> <pre> text= cf.text html= cf.htmlraw('html here') </pre> </P> ::folder:: clipboard datatypes the clipboard module defines the following datatypes ::item:: FORMATETC <code>FORMATETC</code><br> <P>the FORMATETC structure used to as format descriptor </P> ::item:: STGMEDIUM <code>STGMEDIUM</code><br> <P>the STGMEDIUM structure used to store data for a format </P> ::folder:: clipboard format wrappers <b>Note</b><br> All these wrappers are not heavily tested, so handle with care and report any bugs. <br><br> The clipboard uses wrapper classes to handle clipboard data. <br><br> The classes should know how to pack a certain data type, so that it can be handled by ole, and how to unpack it that it can be easily retrieved by a user. <br><br> All wrapper classes define an attribute 'value', wich is used to set and get the data contained in the wrapper class. If no data is available 'value' will always be None. <br><br> These classes are not defined in this module, they are imported at runtime. Use the <a HREF="../clipboard functions/cf.html">cf</a> function to import the desired format. <br><br> All wrapper classes define the following attributes and methods: <DL> <DT>value (attribute) <DD>used to get or set data from the underlaying global memory handle in the STGMEDIUM. You can set value to None to clear the value and free memory handle, just the same as calling <b>Close</b> <br><br> <DT>fmt (attribute) <DD>the format descriptor of the format (ctypes.structure FORMATETC) <br><br> <DT>stg (attribute) <DD>the storage medium of the format (ctypes.structure STGMEDIUM) <br><br> <DT>Close() (method) <DD>closes the format. This should free any memory allocated by for the storage of data <br><br> <DT>AsParam() (method) <DD>returns a tuple(pointer(fmt), pointer(stg)) you can pass to a method expecting pointers to the underlaying FORMATETC and FORMATETC structures of the format <br><br> <DT>__eq__() (method) <DD>compares the format to another </DL> <br><br> each format can be compared for equality to any other format on the class or on the instance. <pre> text= cf.text() print text==text==cf.text >> True </pre> <br><br> The following wrapper classes are currently avaiable to set or retrive clipboard data or to be used in drag and drop operations: <br><br> ::item:: null <code>null( fmt=None, stg=None)</code><br> <P>wrapper for an empty format. <br><br> This wrapper contains no valid clipboard format. You can use it for example to retrieve data in an unknown format, by adjusting its fmt and stg attribures as required. getattr(value) will always return the hMem attribute of the stg structure. If you want you can pass custom FORMATETC and STGMEDIUM structures. If not, default onse are used with clipboard format set to 0 </P> ::item:: text <code>text(text=None)</code><br> <P>wrapper for plain ANSI text format (CF_TEXT) </P> ::item:: unicodetext <code>unicodetext(text=None)</code><br> <P>wrapper for unicode text format </P> ::item:: oemtext <code>oemtext(text=None)</code><br> <P>wrapper for oem text format </P> ::item:: htmlraw <code>htmlraw(html=None)</code><br> <P>wrapper for html Format. <br><br> This wrapper handles setting and retrieving Html Format as raw text string </P> ::item:: filename <code>filename(path=None)</code><br> <P>wrapper for filename format ("FileName"). <br><br> Format to place and retrieve a file path from/to clipboard. path should be an absolute filepath </P> ::item:: hdropfiles <code>hdropfiles(paths=None)</code><br> <P>wrapper for hdrop format (CF_HDROP). <br><br> Use this to place a list of files on the clipboard. paths should be a list or tuple of (ANSI) file paths ::item:: hdropex <code>hdropex(dropdata=None)</code><br> <P>extended wrapper for hdrop format (CF_HDROP). <br><br> Same format as <a HREF"HDROP.html">hdrop</a>, but setting and retrieving the complete data used by this format. <br><br> dropdata should be a tuple(x, y, fClientarea, fUnicode, (paths, )) containing the data of the drop <DL> <DT>x <DD>x-position where the drop took place (screen coordinates) <br><br> <DT>y <DD>y-position where the drop took place (screen coordinates) <br><br> <DT>fClientarea <DD>True if the drop took place in the client area of the window, False otherwise. (not like in the windows api the other way round) <br><br> <DT>fUnicode <DD>True if the filepaths are in unicode format, False otherwise <br><br> <DT>(paths, ) <DD>the list or tuple of filepaths dropped <br><br> </DL> </P> ::item:: filenamemap <code>filenamemap(paths=None)</code><br> <P>wrapper for filemap format ("FileNameMap"). <br><br> Use this to place a list of files on the clipboard. paths should be a list or tuple of (ANSI) file paths ::item:: dropeffect_prefered <code>dropeffect_prefered(value)</code><br> <P>wrapper for dropeffect_prefered format ("Preferred DropEffect"). <br><br> Use this to place a information regarding the prefered drop effect of your drop source. value should be one or a combination of the following constants: <br><br> DROPEFFECT_COPY = 1<br> DROPEFFECT_MOVE = 2<br> DROPEFFECT_LINK = 4<br> </P> ::item:: dropeffect_performed <code>dropeffect_performed(value=None)</code><br> <P>wrapper for dropeffect_performed format ("Performed DropEffect"). <br><br> Use this to place a information regarding the actually performed drop effect of your drop target. value should be one or a combination of the following constants: <br><br> DROPEFFECT_COPY = 1<br> DROPEFFECT_MOVE = 2<br> DROPEFFECT_LINK = 4<br> </P> ::item:: idlistarray <code>idlistarray(pIdls=None)</code><br> <P>wrapper for idlarray format ("shell idlist array"). <br><br> Use this to place or retrieve pIdls from the clipboard. <br><br> pIdls should be a list of pIdls,where the first item in the list has to be the absolute pIdl of the parent folder, followed by the relative pIdls of items in that folder Some sample code might help here <br><br> <pre> from wnd.api.shell import clipboard from wnd.api import shell \# get some nice and friendly pIdls sh= shell.ShellNamespace() pIdls= [] sh.OpenSpecialFolder(shell.CLSIDL_DRIVES) pIdls.append(sh.GetCwd()) for i in sh: pIdls.append(i) \# free the pIdls and set the format to clipboard il= clipboard.cf.idlistarray(pIdls) for i in pIdls: shell.PidlFree(i) do= clipboard.DataObject(il) clipboard.SetDataObject(do) clipboard.Flush() do.Close() \# test if it worked do= clipboard.GetDataObject() if do.HasFormat(il): if do.GetData(il): pIdls= il.value il.value= None for i in pIdls: shell.PidlFree(i) if pIdls: print '... got something in return' </pre> <br><br> </P> ::site:: defining own format wrappers Some step through example on this. <br><br> <pre> from wnd.api.shell.oledata.clipformats import * cfName= 'my_format_name' myClipformat= RegisterClipboardFormat() CF_RNAMES.append([cfName, cfName, myClipformat]) class MYFORMAT(object): fmt= FORMATETC() fmt.cfFormat = myClipformat fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_NULL def __init__(self, data=None): self.stg= clipboard.STGMEDIUM() self.stg.tymed = self.fmt.tymed if text: self._set_value(data) def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = MyDataToHGlobal(data) def _get_value(self): if self.stg.hGlobal: value= MyDataFromHGlobal(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) </pre> <br><br> First it could be quite handy to import all the required datatypes and functions. The clipformat module defines these. Its a shamefully cluttered, so dir() is not to much of a help in here. <pre> from wnd.api.shell.oledata.clipformats import * cfName= 'my_format_name' myClipformat= RegisterClipboardFormat() CF_RNAMES.append([cfName, cfName, myClipformat]) </pre> The RegisterClipboardFormat funtion can be found here to register a format. To let the framework know about the new format, append it to the CF_RNAMES list. <br><br> First it could be quite handy to import all the required datatypes and functions. The clipformat module defines these. Its a shamefully cluttered, so dir() is not to much of a help here. <pre> class MYFORMAT(object): fmt= FORMATETC() fmt.cfFormat = myClipformat fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_NULL </pre> This will define the format your medium is in. The classname should corrospond to to the format registered (all upper case). <br><br> The FORMATETC structure should be filled in to give anyone an idea what kind of data to expect ehen requesting it. <br><br> cfFormat should be self explanatory, its the clipboard format you registered or one of the predefined clipboard formats. <br><br> cfAspect is the view aspect of your data. can be DVASPECT_CONTENT its embedable, DVASPECT_THUMBNAIL its athumbnail image ( SDK docs claim 120 by 120 pixel, 16-color is recommended), DVASPECT_ICON its an icon or DVASPECT_DOCPRINT, to be hnest I didn' t check this up to now. <br><br> lindex is some value describing how to act if the data has to be split across page boundaries. INDEX_ALL seems to be a sufficient choice here. <br><br> tymed is importand. It states what your data actually is. <br> TYMED_HGLOBAL = global memory handle.<br> TYMED_FILE = a path to a file<br> TYMED_ISTREAM = a stream (IStrem)<br> TYMED_ISTORAGE = a storage (IStorage)<br> TYMED_GDI = a gdi handle (bitmap)<br> TYMED_MFPICT = a metafile<br> TYMED_ENHMF = an enhanced metafile<br> TYMED_NULL = no data <br><br> <pre> def __init__(self, data=None): self.stg= clipboard.STGMEDIUM() self.stg.tymed = self.fmt.tymed if text: self._set_value(data) </pre> Next up is __init__. Here you set up you storage medium. <br><br> Like the FORMATETC it has a tymed member corrosponding to the FORMATETC's one. <br><br> <pre> def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = MyDataToHGlobal(data) def _get_value(self): if self.stg.hGlobal: value= MyDataFromHGlobal(self.stg.hGlobal) return value </pre> The heart of this thinggy are the two descriptors. hey get called everytime the user accesses the value attribute of the format wrapper. <br> When the user wants to set a value, _set_value gets called you should transfer it into a global handle or stream or storage and put it in the hGlobal member ot the STGMEDIUM structure. STGMEDIUM accepts only DWORD values. If data id None youshould free the allocated memory by setting stg.hGlobal to 0 <br><br> When the user wants to retrieve data from the value attribute _get_value will be called and its up to you how to convert from a hGlobal back into a human readable if stg.hGlobal contains a memory handle. <br><br> <pre> def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) </pre> Last comb overs is on Close to set hGlobal to 0. STGMEDIUM comes equipped with its own property and setting it to 0 will trigger ole32.ReleaseStgMedium to free the memory. <br><br> IsSameFormat is a funtion defined in the module to handle format comparisons, <pre> is a pretty print function for better looks of the printable representation of the format. |
From: jürgen u. <cer...@us...> - 2005-07-02 09:25:41
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/ole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9192/ole Log Message: Directory /cvsroot/wnd/wnd/wnd_doc/doc/api/ole added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:25:24
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/handles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9121/handles Log Message: Directory /cvsroot/wnd/wnd/wnd_doc/doc/api/handles added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:25:01
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/api/clipboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9057/clipboard Log Message: Directory /cvsroot/wnd/wnd/wnd_doc/doc/api/clipboard added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:24:32
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/1. Whats new In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8772 Modified Files: whats new.dtpl Log Message: bit of this and a bit of that Index: whats new.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/1. Whats new/whats new.dtpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** whats new.dtpl 18 May 2005 19:32:05 -0000 1.3 --- whats new.dtpl 2 Jul 2005 09:24:12 -0000 1.4 *************** *** 2,11 **** ! ::defaultpage:: whats new in 0.1.11 ::contents-header1:: news ::contents-header2:: version history ! ::site:: whats new in 0.1.11 <H3><a NAME="contents">changes in wnd 0.1.11</a></H3> release 0.1.1 18.05.05 --- 2,349 ---- ! ::defaultpage:: whats new in 0.1.12 ::contents-header1:: news ::contents-header2:: version history ! ::site:: whats new in 0.1.12 ! ! ! <H3><a NAME="contents">changes in wnd 0.1.12</a></H3> ! release 0.1.1 3.06.05 ! <br><br> ! ! <UL> ! <LI><a HREF="#samples">changes sample guis</a> ! <LI><a HREF="#controls">changes controls</a> ! <LI><a HREF="#api">changes api</a> ! <LI><a HREF="#gdi">changes api</a> ! <LI><a HREF="#misc">miscelaneous changes</a> ! </UL> ! ! <strong>NOTE:</strong> ! Everything in the framework is still highly experimental. ! Guess up to version 0.2 everything in the framework may change ! without warning. I see no way in this state of developement to care about ! backwards compatibility. Sorry for this. ! <br><br> ! ! With the recent changes in shell and ole, drag and drop features are now implemented in ! the framework. ! <br><br> ! ! ! <HR> ! <H3><a NAME="samples" HREF="#contents">-sample guis</a></H3> ! ! <OL> ! <br> ! <OL><b>gui_dobjview</b> ! <br> ! <LI>new sample gui to view the contents of a DataObject ! either from clipboard or by draging data upon ! <br> ! See <code class=import>wnd.sample guis.gui_dobjview.py</code> ! </OL> ! ! <br> ! <OL><b>explorer</b> ! <br> ! <LI>new sample gui to demonstrate shell and dragdrop capabilities of the framework ! <br> ! See <code class=import>wnd.sample guis.explorer/expl.py</code> ! </OL> ! ! <br> ! <OL><b>gui_shellnotify</b> ! <br> ! <LI>updated the gui to handle the new ShellChangeNotification class ! <br> ! See <code class=import>wnd.sample guis.explorer/expl.py</code> ! </OL> ! ! </OL> ! ! ! ! <HR> ! <H3><a NAME="controls" HREF="#contents">-controls- bugs fixed and other changes</a></H3> ! ! <OL> ! ! <br> ! <OL><b>DriveCombo</b> ! <br> ! <LI>new control <b>DriveCombo</b> to view drives ! <br> ! See <code class=import>wnd.custom.dirlist</code> ! </OL> ! ! <br> ! <OL><b>DirList</b> ! <br> ! <LI> new control <b>DirList</b> to handle lists of files and folders ! <br> ! See <code class=import>wnd.custom.dirlist</code> ! </OL> ! ! ! <br> ! <OL><b>Combobox</b> ! <br> ! <LI> fixed bug in <b>GetEditControl</b>. The combobox was not fully functional ! when the editcontrol was subclassed. This is fixed now. Same goes for Treeview ! and Listview ! <br> ! See <code class=import>wnd.controls.treeview</code> ! </OL> ! ! ! <br> ! <OL><b>Treeview</b> ! <br> ! <LI> new method <b>EndEditLabel</b> to end label editing ! <br> ! See <code class=import>wnd.controls.treeview</code> ! </OL> ! ! ! <br> ! <OL><b>Listview</b> ! <br> ! <LI> new method <b>SetOverlayImage</b> + <b>GetOverlayImage</b> to set or retrieve the overlay image of an item ! <br> ! See <code class=import>wnd.controls.listview</code> ! </OL> ! ! ! <br> ! <OL><b>menu</b> ! <br> ! <LI> new method <b>>Clear</b> to remove all items from a menu ! ! <LI> fixed bug in <b>>GetPopup</b>. Should work now as expected ! ! ! ! <br> ! See <code class=import>wnd.controls.listview</code> ! </OL> ! ! ! <br> ! <OL><b>imagelist</b> ! <br> ! <LI> <b>SetbkColor</b> is now implemeted for SystemImagelist ! <br> ! See <code class=import>wnd.controls.listview</code> ! </OL> ! ! <br> ! <OL><b>splitter</b> ! <br> ! <LI> Splitter controls support a new flag: 'feedbackbar'. ! <br> ! Draws a feeedbackbar instead of moving the splitter dynmically ! along with the mouse. ! ! <br> ! See <code class=import>wnd.coustom.splitter</code> ! </OL> ! ! </OL> ! ! ! ! <HR> ! <H3><a NAME="api" HREF="#contents"> -api- bugs fixed and other changes</a></H3> ! ! ! <OL> ! <OL><b>clipboard</b> ! <br> ! <LI>new module <b>clipboard</b> to provide clipboard support. ! <br>This module introduces a package 'clipformats' to provide wrapper classes ! for clipboard formats ! ! <br> ! See <code class=import>wnd.api</code> ! </OL> ! ! ! <OL><b>ole</b> ! <br> ! <LI>new module <b>ole</b>. ! <br> ! highlights here are the <b>dataobject</b> module ! and the <b>dragdrop</b> module ! ! <br> ! See <code class=import>wnd.api.ole</code> ! </OL> ! ! ! <OL><b>shell</b> ! <br> ! ! <LI>- new class <b>ShellContextMenu</b>. ! This class handles the messy details of invoking a ! context menu for a shell namespace item ! ! <LI>new method <b>GetSpecialFolderPath</b> ! ! <LI>implemented ms-anti-trust <b>pIdl methods</b> ! <br> ! <blockquote> ! <b> ! PidlRemoveLast<br> ! PidlFromPath<br> ! PidlGetNext<br> ! PidlGetChild<br> ! PidlGetLast<br> ! PidlCopyFirst<br> ! PidlAppend<br> ! PidlIsEqual<br> ! PidlIsParent<br> ! ILIsZero<br> ! </b> ! </blockquote> ! <br> ! ! <LI> new method <b>GetIShellFolder</b>, ! returns the pointer to the IShelFolder given an absolute pIdl ! ! <LI>fixed a bug in <b>GetPathFromPidl</b>, should return ! the right thing now ! ! <LI><b>FileOperation</b> and friends where not working as expected, ! should be fixed now ! ! ! <LI><b>GetContextMenu</b> now accepts an array of pIdls to query the context menu for ! ! <LI>new method <b>GetDataObject</b> to retrieve the DataObject for one or more items in a folder ! ! <LI><b>GetAttributes</b> lost its nItems parameter and takes ! an array of pIdls now aswell as a single pIdl as argument. Same goes for all other attribute requesting ! methods. ! ! ! <br> ! See <code class=import>wnd.api.shell</code> ! </OL> ! ! ! ! ! <OL><b>ShellNamespace</b> ! <br> ! ! <LI>new method <b>GetDataObject</b> to retrieve the DataObject ! for one or more items in a folder ! ! <LI>new method <b>GetDropTarget</b> to retrieve the ! DropTarget inertface of a shell item ! ! ! <LI><b>GetAttributes</b> lost its nItems parameter and takes an ! array of pIdls now aswell as a single pIdl as argument. ! Same goes for all other attribute requesting methods. ! ! ! <LI>Reworked <b>GetContextMenu</b>. Changes are not ! backwards compatible !! Returns now tuple(IContextMenu, ! version) or None if something goes wrong + Version parameter ! is now supported + an array of pIdls is accepted to query the ! common contextmenu for multiple items. ! ! <LI>fixed a memory leak in <b>SetCwd</b> ! ! <br> ! See <code class=import>wnd.api.shell</code> ! ! </OL> ! ! ! <br><br> ! ! ! <OL><b>ShellNew</b> ! <br> ! ! <LI>new class <b>ShellNew</b>. This class mimics Explorers 'ShellNew' ! menu ! ! <br> ! See <code class=import>wnd.api.shell.shellnew</code> ! </OL> ! ! ! <OL><b>ShellChangeNotification</b> ! <br> ! ! <LI>new class <b>ShellChangeNotification</b>. This class is an alternative to ! the <b>ShellNotify<br> class. ! ! <br> ! See <code class=import>wnd.api.shell</code> ! </OL> ! ! ! </OL> ! ! ! ! <br><br> ! ! <HR> ! <H3><a NAME="gdi" HREF="#contents"> -gdi- bugs fixed and other changes</a></H3> ! ! ! <OL> ! <OL><b>icon</b> ! <br> ! <LI> new method <b>DrawEx</b> ! ! <LI>- fixed bug in <b>GetSize</b>. Retrieving size for monochrome ! icons failed. Should work now ! ! <br> ! See <code class=import>wnd.api.gdi</code> ! </OL> ! ! </OL> ! ! ! <HR> ! <H3><a NAME="misc" HREF="#contents"> -miscelaneous- bugs fixed and other changes</a></H3> ! ! ! <OL> ! <OL><b>RECT</b> ! <br> ! ! <LI>Changed the the <b>Subtract</b> method slightly. ! <br>previous versions raised an error if the the two rects did ! not intersect completely. This case is ignored now and the ! rect is left unchanged ! ! <br> ! See <code class=import>wnd.wintypes</code> ! </OL> ! ! </OL> ! ! ! <br><br><br><br><br><br><br> ! ! ! ! ! ! ::folder:: version history ! ! ! ::item:: what was new in 0.1.11 <H3><a NAME="contents">changes in wnd 0.1.11</a></H3> release 0.1.1 18.05.05 *************** *** 88,99 **** <br><br><br><br><br><br><br> ! ! ! ! ! ! ::folder:: version history ! ! ::item:: whats new in 0.1.1 <H3><a NAME="contents">changes in wnd 0.1.1</a></H3> --- 426,434 ---- <br><br><br><br><br><br><br> ! ! ! ! ! ::item:: what was new in 0.1.1 <H3><a NAME="contents">changes in wnd 0.1.1</a></H3> *************** *** 343,346 **** ! ::item:: whats new in release 0.1 initial release 29.04.05 --- 678,681 ---- ! ::item:: what was new in release 0.1 initial release 29.04.05 |
From: jürgen u. <cer...@us...> - 2005-07-02 09:22:51
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7919 Modified Files: wnd.dtpl Log Message: bit of this and a bit of that Index: wnd.dtpl =================================================================== RCS file: /cvsroot/wnd/wnd/wnd_doc/doc/wnd.dtpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wnd.dtpl 15 May 2005 09:55:11 -0000 1.3 --- wnd.dtpl 2 Jul 2005 09:22:40 -0000 1.4 *************** *** 90,94 **** ::def:: ||type-POINT|| ! <a HREF="::root::Structures, types and makros/poin/POINT.html">POINT</a> ::def:: ||type-RECT|| --- 90,94 ---- ::def:: ||type-POINT|| ! <a HREF="::root::Structures, types and makros/point/POINT.html">POINT</a> ::def:: ||type-RECT|| *************** *** 383,386 **** --- 383,390 ---- same message-name will allways return the same message value, no matter wich process calls this method. + <br><br> + You should not use message names prefixed with 'wnd_'. These names + are considered reserved for the framework + </P> |
From: jürgen u. <cer...@us...> - 2005-07-02 09:21:39
|
Update of /cvsroot/wnd/wnd/wnd/sample-guis/explorer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7310 Added Files: .CVSIGNORE expl.ini expl.py expl_dircombo.py expl_ini.py expl_menu.py expl_statusbar.py Log Message: bit of this and a bit of that --- NEW FILE: expl_ini.py --- import os, ConfigParser from wnd.api import winpath #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: INIPATH= os.path.join(os.path.split(__file__)[0], 'expl.ini') class Ini(ConfigParser.RawConfigParser): def __init__(self, mainframe): self.ini_sections= { 'mainwindow': ('size', ), 'dircombo': ('n_mru_items', ), 'mru_dircombo': None, 'panes': None, 'pane1': ('dir', ), 'pane2': ('dir', ), } ConfigParser.RawConfigParser.__init__(self) self.Main= mainframe try: self.read((INIPATH, )) except: pass ## remove the stupid defaults. ## Sorry, but this is a nonsense feature... if hasattr(self, '_defaults'): self._defaults= {} def GetMRU(self, section): if self.has_section(section): items= dict(self.items(section)) out= [] for i in range(len(items)): try: out.append(items[str(i)]) except: pass return out self.add_section(section) def SetMRU(self, section, values): if self.has_section(section): self.remove_section(section) self.add_section(section) for n, i in enumerate(values): self.set(section, str(n), i) def GetValue(self, section, name, default=None): if self.has_section(section): if self.has_option(section, name): return self.get(section, name) else: self.add_section(section) return default def SetValue(self, section, name, value): if not self.has_section(section): self.add_section(section) self.set(section, name, value) def GetInt(self, section, name, default=None): if not self.has_section(section): self.add_section(section) try: return self.getint(section, name) except: return default def Save(self): ## keep ini clean sections= self.sections() for section in sections: if section not in self.ini_sections: self.remove_section(section) else: names= self.ini_sections[section] options= self.options(section) if names: for option in options: if option not in names: self.remove_option(section, option) if 1: ## store cwds of the DirLists path= self.Main.DirList1.GetCwd(path=True) if not path: path= self.Main.DirList1.GetCLSIDL() if path: path= path[1] else: path= 'desktop' self.SetValue('pane1', 'dir', path) path= self.Main.DirList2.GetCwd(path=True) if not path: path= self.Main.DirList2.GetCLSIDL() if path: path= path[1] else: path= 'desktop' self.SetValue('pane2', 'dir', path) fp= open(INIPATH, 'w') try: self.write(fp) finally: fp.close() --- NEW FILE: expl.py --- """The very start of a file manager... """ import sys import wnd from wnd import gdi from wnd.wintypes import RECT from wnd.api import winpath, display from wnd.wintypes import RGB, GETRGB from wnd.controls.statusbar import Statusbar from wnd.custom.dirlist import DirList from wnd.custom.splitter import Splitter import expl_menu import expl_dircombo import expl_statusbar import expl_ini PATHICO= '%s\\py.ico' % sys.prefix #****************************************************************** #****************************************************************** class Window(wnd.Window): def __init__(self): self.activePane= None self.DirCombo= None self.title= 'wnd_explorer 01 -- %s' self.Ini= expl_ini.Ini(self) size= self.Ini.GetValue('mainwindow', 'size', default= None) if size: ## make shure window is visible on monitor try: x, y, w, h= map(int, size.split(',')) rc= display.GetMonitorXY(x, y)[3] ## working rect rc2= RECT(x, y, x+gdi.GetSystemMetric('cxmin'), y+gdi.GetSystemMetric('cymin')) if not rc2.InRect(rc): x= rc.left y= rc.top except: x= y= w= h= None else: x= y= w= h= None wnd.Window.__init__(self, 'wnd_explorer', self.title % '', x, y, w, h, 'overlappedwindow', 'clipchildren', 'dialoglike') ## set python icon try: ico= gdi.IconFromFile(PATHICO) self.SetIcon(ico) except: pass ## init combobox andstatusbar self.DirCombo= expl_dircombo.ExplDircombo(self) self.Statusbar= expl_statusbar.ExplStatusbar(self) ## init menu self.Menu= expl_menu.ExplMenu(self) self.Menu.Set(self) ## init dirlists self.DirList1= DirList(self, 0, 0, 0, 0, 'border', 'editlabels', 'showselalways', 'report', 'clientedge', 'tabstop') self.DirList2= DirList(self, 0, 0, 0, 0, 'largeicon', 'clientedge', 'editlabels', 'showselalways', 'report', 'tabstop') self.DirList1.onMSG= self.DirList2.onMSG= self.on_dirlist def init_dirlist(dirlist, inisection): flag= False dirr= self.Ini.GetValue(inisection, 'dir') if winpath.GetRoot(dirr): if winpath.Exists(dirr): if winpath.IsDir(dirr): dirlist.ListDir(dirr) flag= True else: flag= dirlist.ListDir(dirr) if not flag: dirlist.ListDir('desktop') init_dirlist(self.DirList1, 'pane1') init_dirlist(self.DirList2, 'pane2') ## init splitter w= self.GetClientRect().ToSize()[2] self.SplitteritterW= 5 self.Splitter= Splitter(self, (w/2)-(self.SplitteritterW/2), 0, self.SplitteritterW, 0, 'feedbackbar', 'vert') colorBk= gdi.GetSysColor('msgbox') self.Splitter.SetPageSize(30) #colorHi= gdi.GetSysColor('highlight') rgb= GETRGB(colorBk) colorHi= RGB(rgb[0]+30, rgb[1]+30, rgb[2]+30) self.Splitter.SetColors(colorBk, colorHi) self.Splitter.onMSG= self.on_splitter def on_dirlist(self, hwnd, msg, wp, lp): if msg=='itemchanged': if 'selected' in lp[0] and not 'selected' in lp[1]: ## an item has been deselected self.Statusbar.Expl_SetItemsSelected( self.activePane.GetSelectedCount()) if 'selected' not in lp[0] and 'selected' in lp[1]: ## an item has been selected size= 0 for i in self.activePane.IterSelected(): n= self.activePane.GetSize(i, asstring=False) if n != None: size += n self.Statusbar.Expl_SetItemsSelected( self.activePane.GetSelectedCount(), self.activePane.FormatInt(size)) elif msg=='shell_contextmenu': if wp=='open': self.Statusbar.SetSimple() elif wp=='helpstring': self.Statusbar.SetText(lp) elif wp=='close': self.Statusbar.SetText('') self.Statusbar.SetMultiple() elif msg in ('setfocus', 'dirchanged'): if hwnd== self.DirList1.Hwnd: self.cur_sel_pane1= [] self.activePane= self.DirList1 else: self.cur_sel_pane2= [] self.activePane= self.DirList2 path= self.activePane.GetCwd(path=True) self.SetText(self.title % path) self.DirCombo.SetText( path, self.activePane.GetFilespec()[0] ) size= 0 for i in self.activePane.IterSelected(): n= self.activePane.GetSize(i, asstring=False) if n != None: size += n self.Statusbar.Expl_SetItemsSelected( self.activePane.GetSelectedCount(), self.activePane.FormatInt(size)) def size_controls(self, ): x, y, w, h= self.GetClientRect().ToSize() paneOffsY= 4 stH= self.Statusbar.GetWindowRect().ToSize()[3] cmbH= self.DirCombo.GetWindowRect().ToSize()[3] #cmbH= self.DirCombo.GetItemHeight(-1) rcSpl= self.Splitter.GetWindowRect() rcSpl.ScreenToClient(self.Hwnd) #self.DirList2.SetRedraw(False) self.DeferWindows( (self.DirCombo, None, None, (w/10)*6, cmbH), (self.Splitter, rcSpl.left, cmbH+paneOffsY, self.SplitteritterW, h-stH-cmbH-paneOffsY), (self.DirList1, 0, 0+cmbH+paneOffsY, rcSpl.left-1, h-stH-cmbH-paneOffsY), (self.DirList2, rcSpl.right+1, 0+cmbH+paneOffsY, (w-rcSpl.right)-1, h-stH-cmbH-paneOffsY), (self.Statusbar, 0, h-stH, w, stH), ) w= w/10 self.Statusbar.SetParts(w, w*8, -1) def on_splitter(self, hwnd, msg, wp, lp): if msg=="moved": self.size_controls() def onMSG(self, hwnd, msg, wp, lp): if msg=="size": self.size_controls() elif msg in ('menu open', 'menu popup', 'menu choice'): self.Menu.handle_menu_msg(hwnd, msg, wp, lp) elif msg=="open": self.DirList1.SetFocus() self.activePane= self.DirList1 elif msg=="close": if self.DirCombo != None: ## combos have a __len_ attr !! self.DirCombo.Expl_SaveState() self.Ini.SetValue('mainwindow', 'size', '%s,%s,%s,%s' % self.GetWindowRect().ToSize()) self.Ini.Save() #********************************************************************* if __name__=='__main__': w = Window() w.Run() --- NEW FILE: expl_menu.py --- from wnd.controls import menu #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class ExplMenu(menu.Menu): def __init__(self, main): menu.Menu.__init__(self) self.Main= main p= self.Popup('&File', IDM_FILE) p.Item('Quit', IDM_FILE_QUIT) p= self.Popup('&Mark', IDM_MARK) p.Item('&Select Group...', IDM_MARK_SELECTGROUP, 'disabled') # not impl p= self.Popup('&panes', IDM_PANES) p.Item('Pane1 Allow navigate', IDM_PANES_ALLOWNAVIGATE_1) p.Item(' Show Folders', IDM_PANES_SHOWFOLDERS_1) p.Separator(0) p.Item('Pane 2 Allow navigate', IDM_PANES_ALLOWNAVIGATE_2) p.Item(' Show Folders', IDM_PANES_SHOWFOLDERS_2) def handle_menu_msg(self, hwnd, msg, wp, lp): if msg=='menu popup': panes= self.GetPopup(IDM_PANES) if wp== panes.handle: ## if self.Main.DirList1.IsNavigateAllowed(): self.Check(IDM_PANES_ALLOWNAVIGATE_1) else: self.Uncheck(IDM_PANES_ALLOWNAVIGATE_1) if self.Main.DirList1.AreFoldersVisible(): self.Check(IDM_PANES_SHOWFOLDERS_1) else: self.Uncheck(IDM_PANES_SHOWFOLDERS_1) ## if self.Main.DirList2.IsNavigateAllowed(): self.Check(IDM_PANES_ALLOWNAVIGATE_2) else: self.Uncheck(IDM_PANES_ALLOWNAVIGATE_2) if self.Main.DirList2.AreFoldersVisible(): self.Check(IDM_PANES_SHOWFOLDERS_2) else: self.Uncheck(IDM_PANES_SHOWFOLDERS_2) elif msg=='menu choice': if lp[0]== IDM_FILE_QUIT: self.Main.Close() elif lp[0]==IDM_PANES_ALLOWNAVIGATE_1: self.CheckUncheck(lp[0]) self.Main.DirList1.AllowNavigate(self.IsChecked(lp[0])) elif lp[0]==IDM_PANES_ALLOWNAVIGATE_2: self.CheckUncheck(lp[0]) self.Main.DirList2.AllowNavigate(self.IsChecked(lp[0])) elif lp[0]==IDM_PANES_SHOWFOLDERS_1: self.CheckUncheck(lp[0]) self.Main.DirList1.ShowFolders(self.IsChecked(lp[0])) elif lp[0]==IDM_PANES_SHOWFOLDERS_2: self.CheckUncheck(lp[0]) self.Main.DirList2.ShowFolders(self.IsChecked(lp[0])) IDM_FILE= 1000 IDM_FILE_QUIT= IDM_FILE +1 IDM_MARK= 2000 IDM_MARK_SELECTGROUP= IDM_MARK +1 IDM_VIEW= 3000 IDM_PANES= 4000 IDM_PANES_ALLOWNAVIGATE_1= IDM_PANES +1 IDM_PANES_ALLOWNAVIGATE_2= IDM_PANES +2 IDM_PANES_SHOWFOLDERS_1= IDM_PANES +3 IDM_PANES_SHOWFOLDERS_2= IDM_PANES +4 #**************************************************************************** #**************************************************************************** --- NEW FILE: expl_statusbar.py --- from wnd.controls.statusbar import Statusbar #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class ExplStatusbar(Statusbar): def __init__(self, mainframe): self.Main= mainframe Statusbar.__init__(self, mainframe) def Expl_SetItemsSelected(self, n, size=''): if len(self) > 1: if not n: self.SetText('' , 1) elif n==1: self.SetText(' 1 Item Selected %s bytes total' % size, 1) else: self.SetText(' %s Items Selected %s bytes total' % (n, size), 1) --- NEW FILE: expl_dircombo.py --- from wnd.api import winpath from wnd.controls.combobox import Combobox #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class ExplDircombo(Combobox): def __init__(self, mainframe): self.Main= mainframe self.n_mru_items= self.Main.Ini.GetInt('dircombo', 'n_mru_items', default=10) self.maxW= 0 ## TODO ## calculate combobox height for nItems Combobox.__init__(self, mainframe, 0, 0, 0, 150, 'dropdown', 'vscroll', 'hscroll') self.SetExtendedUI(True) ## restore MRU list mru= self.Main.Ini.GetMRU('mru_dircombo') if mru: for n, i in enumerate(mru): if n >= self.n_mru_items: break if winpath.Exists(i): self.maxW= max(self.GetTextExtend(i)[0], self.maxW) self.Item(i) self.maxW += self.GetTextExtend('W')[0] Combobox.SetScrollWidth(self, self.maxW) #self.SetScrollWidth() self.ed= self.GetEditControl() self.ed.onMSG= self.onMSG def SetScrollWidth(self): self.maxW= 0 for i in self: text= self.GetItemText(i) self.maxW= max(self.GetTextExtend(text)[0], self.maxW) self.maxW += self.GetTextExtend('W')[0] Combobox.SetScrollWidth(self, self.maxW) def onMSG(self, hwnd, msg, wp, lp): if msg=='getdlgcode': lp.append('wantallkeys') return lp if msg=='return': refresh= False path= self.GetText() spec= winpath.GetFileName(path) if self.IsDroppedDown(): self.CloseDropdown() if spec: if spec.startswith('*'): path= winpath.RemoveFileSpec(path) self.Main.activePane.SetFilespec(spec) if len(path)==2 and path[1]==':': path= '%s\\' % path else: ## path may be spec if path.startswith('*'): self.Main.activePane.SetFilespec(path) refresh= True if refresh: self.Main.activePane.Refresh() else: if self.Main.activePane.ListDir(path): self.SetText(path, self.Main.activePane.GetFilespec()[0]) else: self.Beep('asterisk') def Expl_SaveState(self): self.Main.Ini.SetValue('dircombo', 'n_mru_items', self.n_mru_items) out= [] for i in self: out.append(self.GetItemText(i)) self.Main.Ini.SetMRU('mru_dircombo', out) def SetText(self, path, filespec): if path: out= [] for i in self: if self.GetItemText(i).lower()== path.lower(): out.append(i) if out: for i in reversed(out): self.RemoveItem(i) if path.endswith('\\'): Combobox.SetText(self, '%s%s' % (path, filespec)) else: Combobox.SetText(self, '%s\\%s' % (path, filespec)) self.InsertItem(0, path) if len(self) > self.n_mru_items: self.RemoveItem(self.n_mru_items) else: Combobox.SetText(self, filespec) self.SetScrollWidth() --- NEW FILE: .CVSIGNORE --- *.pyc *.pyo --- NEW FILE: expl.ini --- [mru_dircombo] 1 = D:\z 0 = D:\ 3 = C:\ 2 = D:\z\Neuer Ordner 5 = D:\_txt_ 4 = D:\_pyCvs 7 = C:\WINDOWS\DRWATSON\Desktop\py_tools 6 = D:\bookmarks 9 = C:\Eigene Dateien\My eBooks 8 = C:\Eigene Dateien [pane2] dir = D:\z\Neuer Ordner [pane1] dir = drives [dircombo] n_mru_items = 10 [mainwindow] size = 96,219,894,617 |
From: jürgen u. <cer...@us...> - 2005-07-02 09:20:49
|
Update of /cvsroot/wnd/wnd/wnd/sample-guis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6768 Modified Files: gui_shellnotify.py gui_splitter.py Added Files: gui_dobjview.py Log Message: bit of this and a bit of that --- NEW FILE: gui_dobjview.py --- """simple DataObject viewer Displays information for either the DataObject currently on th eclipboard or for the DataObject dropped. """ import wnd from wnd.controls.listview import Listview from wnd.controls.menu import Menu from wnd.api import clipboard, msgbox from wnd.api.ole import dragdrop #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ## GUI class window(wnd.Window): def __init__(self): self.title= 'DataObject viewer [drop data or get clipboard]' wnd.Window.__init__(self, 'wnd_dobjview', self.title, None, None, None, None, 'sysmenu', 'sizebox') # setup a listview self.lv = Listview(self, 0, 0, 0, 0, 'report', 'border', 'fullrowselect', 'showselalways', 'gridlines') self.lv.Column('get/set') self.lv.Column('name') self.lv.Column('aspect') self.lv.Column('tymed') self.lv.Column('index') # setup drag drop stuff self.drag= dragdrop.DragDrop(self.lv.Hwnd) self.drag.onMSG= self.on_dragdrop dragdrop.Register(self.lv.Hwnd, self.drag) # setup a menu self.m= Menu() p1= self.m.Popup('&File', 1000) p1.Item('E&xit', 1001) p2= self.m.Popup('&Clipboard', 2000) p2.Item('&Get DataObject', 2001) p2.Item('&Clear Clipboard', 2002) p3= self.m.Popup('&View', 3000) p3.Item('&Clar View', 3001) self.m.Set(self) ## helper method to print clipformats of a DataObject to the listview def lv_PrintDataObject(self, dataobject): def tmp_setdata(fmt, get=True): s= str(fmt).split('{') if get: n= self.lv.Item('(get)') else: n= self.lv.Item('(set)') self.lv.SetItemText(n, 1, s[1][s[1].index('=')+1:-2]) self.lv.SetItemText(n, 2, '{%s' % s[2]) self.lv.SetItemText(n, 3, '{%s' % s[3]) self.lv.SetItemText(n, 4, '{%s' % s[4][:-1]) self.lv.Clear() try: n= 0 for i in dataobject.ListFormats(): tmp_setdata(i, get=True) n += 1 self.lv.Item('') except: pass try: for i in dataobject.ListFormats(get=False): n += 1 tmp_setdata(i, get=False) except: pass self.SetText('%s --%s formats found--' % (self.title, n)) def error(self, msg): msgbox.Msg(self.Hwnd, msg, 'DataObject viewer', 'ok', 'systemmodal') # menu message handler def menu_HandleMessage(self, hwnd, msg, wp, lp): if msg=="menu choice": if lp[0]==1001: self.Close() elif lp[0]==2001: try: self.lv_PrintDataObject(clipboard.GetDataObject()) except: self.error('error! \n failed to retrieve DataObject') elif lp[0]==2002: clipboard.Clear() elif lp[0]==3001: self.lv.Clear() # drag and drop message handler def on_dragdrop(self, hwnd, msg, wp, lp): if msg=="dragdrop": if wp=="drop": try: self.lv_PrintDataObject(lp[0]) except: self.error('error! \n failed to retrieve DataObject') return False ## reject DataObject # GUI message handler def onMSG(self, hwnd, msg, wp, lp): if msg=="size": self.lv.SetWindowPosAndSize(*lp) w= lp[2]/5 self.lv.SetColumnWidth(0, w/2) self.lv.SetColumnWidth(1, w) self.lv.SetColumnWidth(2, w) self.lv.SetColumnWidth(3, w + (w/2)) self.lv.SetColumnWidth(4, w) elif msg in ("menu choice", "menu open", "menu popup"): self.menu_HandleMessage(hwnd, msg, wp, lp) elif msg=="destroy": try: dragdrop.Revoke(self.lv.Hwnd) except: pass #************************************ w = window() w.Run() Index: gui_shellnotify.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/sample-guis/gui_shellnotify.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gui_shellnotify.py 15 May 2005 10:16:50 -0000 1.1 --- gui_shellnotify.py 2 Jul 2005 09:20:38 -0000 1.2 *************** *** 1,12 **** """Sample GUI, monitoring file sytem related changes. ! (creating, deleting of files and folders and other related stuff)""" ! import wnd from wnd.api import shell from wnd.controls.listview import Listview ! import os #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class window(wnd.Window): --- 1,41 ---- """Sample GUI, monitoring file sytem related changes. ! (creating, deleting of files and folders and other related stuff) ! You may drop a folder on either the ShellNotify or the ShellChangeNotification ! pane to start monitoring the folder for changes. ! ! The ShellChangeNotification pane accepts only filesystem folders, while ! the ShellNotify pane accepts non filesystem folders aswell. Only one pane ! may be active and monitoring at a time. ! ! ! REMARKS ! ShellChangeNotification is quite inacurate here. Its nomore then giving ! an idea of how it works. To tell notifications for related events apart ! one handler has to be registered per event to be monitored. ! So you may get file related changes in the 'dirname' handler and vice versa. ! Have to test this more in detail rather then blaming it to soon on the crappy ! FindFirstChangeNotification api ;) ! ! """ ! ! ! import os, wnd ! from wnd.wintypes import RGB from wnd.api import shell + from wnd.api.ole import dragdrop from wnd.controls.listview import Listview ! from wnd.controls import menu ! #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + IDM_FILE= 100 + IDM_EXIT= 101 + + IDM_VIEW= 200 + IDM_CLEARSHN= 201 + IDM_CLEARSHC= 202 + class window(wnd.Window): *************** *** 16,37 **** self.sh= None self.shn= None ! self.shn_msg= wnd.RegisterWindowMessage("myMsg") wnd.Window.__init__(self, 'SHNotify sample', self.title % 'drop folder to monitor changes', None, None, None, None, 'sysmenu', 'sizebox') ! # setup a listview ! self.lv = Listview(self, 0, 0, 0, 0, 'report', 'border', 'fullrowselect', 'showselalways', 'gridlines') ! self.lv.Column('action') self.lv.Column('param1') self.lv.Column('param2') ! self.lv.onMSG=self.on_lv ! self.lv.DragAcceptFiles(True) self.lv.HandleMessage(self.shn_msg) # setup shell namespace and shell notify self.sh= shell.ShellNamespace() self.shn= shell.ShellNotify(self.lv, self.shn_msg, self.on_shellnotify) # callback for shell notify def on_shellnotify(self, hwnd, msg, wp, lp): --- 45,250 ---- self.sh= None self.shn= None ! self.shc= None ! self.colorhi= RGB(255, 255, 255) ! self.colorlo= RGB(208, 208, 255) ! ! ! self.shn_msg= wnd.RegisterWindowMessage("sh_notify_msg") wnd.Window.__init__(self, 'SHNotify sample', self.title % 'drop folder to monitor changes', None, None, None, None, 'sysmenu', 'sizebox') ! # setup menu ! m= menu.Menu() ! pop= m.Popup('&File', IDM_FILE) ! pop.Item('&Exit', IDM_EXIT) ! ! pop= m.Popup('&View', IDM_VIEW) ! pop.Item('Clear SH&Notify', IDM_CLEARSHN) ! pop.Item('Clear SH&Change', IDM_CLEARSHC) ! self.menu= m ! self.menu.Set(self) ! ! ! # setup the two listviews ! self.lv = Listview(self, 0, 0, 0, 0, 'report', 'clientedge', 'fullrowselect', 'showselalways', 'gridlines') ! self.lv.onMSG=self.on_lv ! self.lv.Column('ShellNotify action') self.lv.Column('param1') self.lv.Column('param2') ! #self.lv.DragAcceptFiles(True) self.lv.HandleMessage(self.shn_msg) + self.lv2 = Listview(self, 0, 0, 0, 0, 'report', 'clientedge', 'fullrowselect', 'showselalways', 'gridlines') + self.lv2.onMSG=self.on_lv + #self.lv2.DragAcceptFiles(True) + self.lv2.Column('ShellChangeNotification action') + + self.set_colors(self.lv, hilight=False) + self.set_colors(self.lv2, hilight=False) + + + ## register listviews as drop targets + self.drop1= dragdrop.DragDrop(self.lv.Hwnd) + self.drop2= dragdrop.DragDrop(self.lv2.Hwnd) + self.drop1.onMSG= self.drop2.onMSG= self.on_drop + dragdrop.Register(self.lv.Hwnd, self.drop1) + dragdrop.Register(self.lv2.Hwnd, self.drop2) + + + # setup shell change notify + self.shc_flags= ('filename','dirname','attributes','size','lastwrite', + 'lastaccess','creation','security') + + self.shc_flags= ('filename','dirname') + self.shc= [] + for n, i in enumerate(self.shc_flags): + shc= shell.ShellChangeNotification() + shc.onMSG= self.on_lv + self.shc.append(shc) + + # setup shell namespace and shell notify self.sh= shell.ShellNamespace() self.shn= shell.ShellNotify(self.lv, self.shn_msg, self.on_shellnotify) + + + + #-------------------------------------------------------------------------------- + + def error(self, msg): + from wnd.api import msgbox + msgbox.Msg(self.Hwnd, msg, 'gui shellnotify', 'ok', 'systemmodal') + + + def set_colors(self, lv, hilight=False): + if hilight: + lv.SetBkColor(self.colorhi) + lv.SetTextBkColor(self.colorhi) + else: + lv.SetBkColor(self.colorlo) + lv.SetTextBkColor(self.colorlo) + + + def close_notifiers(self): + ## closes (resets) SHNotify and ShellChangeNotification handlers + try: + self.set_colors(self.lv, hilight=False) + except:pass + try: + self.set_colors(self.lv2, hilight=False) + except: pass + try: + if self.shn: self.shn.Close() + except: pass + try: + if self.shc: self.shc_close() + except: pass + + + def dataobject_get_pIdl(self, dataobject, idlarray=False): + ## returns the pIdl (abs) of the first folder in the DataObject or None + ## if idlarray is True the DataObject is queried preferably for IDLISTARRAY + ## format, else HDROP is queried + + pIdlAbs= None + if idlarray: + il= dragdrop.cf.idlistarray() + if dataobject.HasFormat(il): + dataobject.GetData(il) + arr= il.value + il.value= None + self.sh.SetCwd(arr[0]) + + for i in arr[1:]: + if self.sh.IsFolder(i): + pIdlAbs= shell.PidlJoin(arr[0], i) + break + + for i in arr: + shell.PidlFree(i) + + if pIdlAbs: return pIdlAbs + + ## query for hdrop format + hd= dragdrop.cf.hdropfiles() + if dataobject.HasFormat(hd): + dataobject.GetData(hd) + arr= hd.value + hd.value= None + for i in arr: + if os.path.isdir(i): + pIdlAbs= self.sh.ParseDisplayName(i) + break + return pIdlAbs + + + + ## drop target handler + def on_drop(self, hwnd, msg,wp, lp): + + if hwnd==self.lv.Hwnd: + ## accepts IDLISTARRAY and HDROP + + if wp=='dragenter': + if lp[0].HasFormat(dragdrop.cf.idlistarray) or lp[0].HasFormat(dragdrop.cf.hdropfiles): + return True + + elif wp=='drop': + self.close_notifiers() + + error= True + try: + pIdl= self.dataobject_get_pIdl(lp[0], idlarray=True) + if pIdl: + self.sh.SetCwd(pIdl) ## shell is taking care now + self.shn.Register(pIdl) + self.SetText(str(self.title % self.sh.GetParseName())) + self.set_colors(self.lv, hilight=True) + error= False + except: + pass + + if error: + self.error("no or invalid folder found in drop") + + return False + + elif hwnd==self.lv2.Hwnd: + ## accepts HDROP only + + if wp=='dragenter': + if lp[0].HasFormat(dragdrop.cf.hdropfiles): + return True + + elif wp=='drop': + self.close_notifiers() + + error= True + try: + pIdl= self.dataobject_get_pIdl(lp[0], idlarray=False) + if pIdl: + try: + path= shell.GetPathFromPidl(pIdl) + self.shc_register(path) + self.SetText(str(self.title % path)) + self.set_colors(self.lv2, hilight=True) + shell.PidlFree(pIdl) + error= False + except: + shell.PidlFree(pIdl) + raise '' + except: + pass + if error: + self.error("no or invalid folder found in drop") + + return False + + + + ## methods for SHNotify ------------------------ + # callback for shell notify def on_shellnotify(self, hwnd, msg, wp, lp): *************** *** 40,81 **** if lp: if wp in ("rename", "renamefolder", "delete", "rmdir"): ! if lp[0]: self.lv.SetItemText(n, 1, self.sh.GetParseName(lp[0])) ! if lp[1]: self.lv.SetItemText(n, 2, self.sh.GetParseName(lp[1])) else: ! if lp[0]: self.lv.SetItemText(n, 1, self.sh.GetParseName(lp)) ! self.lv.EnshureVisible(n) # listview message handler def on_lv(self, hwnd, msg, wp, lp): if msg== self.shn_msg: self.shn.HandleMessage(hwnd, msg, wp, lp) ! elif msg=="droppedfiles": ! for i in lp: ! if os.path.isdir(i): ! pIdl= self.sh.ParseDisplayName(i) ! self.shn.Register(pIdl) ! self.SetText(str(self.title % self.sh.GetParseName(pIdl))) ! shell.PidlFree(pIdl) ! break # GUI message handler def onMSG(self, hwnd, msg, wp, lp): if msg=="size": ! self.lv.SetWindowPosAndSize(*lp) w= lp[2]/5 self.lv.SetColumnWidth(0, w) self.lv.SetColumnWidth(1, w*2) ! self.lv.SetColumnWidth(2, w*2) elif msg=="destroy": try: ! if self.shn: self.shn.Close() except: pass try: if self.sh: self.sh.Close() except: pass ! - w = window() w.Run() --- 253,378 ---- if lp: if wp in ("rename", "renamefolder", "delete", "rmdir"): ! ! if lp[0]: ! pIdl= shell.PidlCopy(lp[0]) ! pIdlChild= shell.PidlSplit(pIdl) ! self.sh.SetCwd(pIdl) ! try: ! self.lv.SetItemText(n, 1, self.sh.GetParseName(pIdlChild)) ! finally: ! shell.PidlFree(pIdl) ! shell.PidlFree(pIdlChild) ! ! if lp[1]: ! pIdl= shell.PidlCopy(lp[1]) ! pIdlChild= shell.PidlSplit(pIdl) ! self.sh.SetCwd(pIdl) ! try: ! self.lv.SetItemText(n, 2, self.sh.GetParseName(pIdlChild)) ! finally: ! shell.PidlFree(pIdl) ! shell.PidlFree(pIdlChild) ! else: ! if lp[0]: ! pIdl= shell.PidlCopy(lp) ! pIdlChild= shell.PidlSplit(pIdl) ! self.sh.SetCwd(pIdl) ! try: ! self.lv.SetItemText(n, 1, self.sh.GetParseName(pIdlChild)) ! finally: ! shell.PidlFree(pIdl) ! shell.PidlFree(pIdlChild) ! ! self.lv.EnshureVisible(n) ! ! ! ! ! ## methods for ShellChangeNotification ------------------------ ! ! def shc_register(self, path): ! ## registers all ShellChangeNotifications ! for n, i in enumerate(self.shc): ! try: ! i.Register(path, self.shc_flags[n], hwnd=n) ! except: ! ## can not register all classes on win98 ! ## 'lastaccess','creation','security' will fail ! pass ! ! ! def shc_close(self): ! ## closes all ShellChangeNotifications ! for i in self.shc: ! try: ! i.Close() ! except: pass ! ! def shc_handlemessage(self, hwnd, msg, wp, lp): ! if msg=="shellchange": ! try: ! evt= self.shc_flags[hwnd] ! n= self.lv2.Item(evt) ! self.lv2.EnshureVisible(n) ! except: pass + # message handlers ------------------------------------------------------------ + + ## menu message handler + def handle_menu_msg(self, hwnd, msg, wp, lp): + if msg=='menu choice': + if lp[0]== IDM_EXIT: + self.Close() + elif lp[0]== IDM_CLEARSHN: + self.lv.Clear() + elif lp[0]== IDM_CLEARSHC: + self.lv2.Clear() + + # listview message handler def on_lv(self, hwnd, msg, wp, lp): if msg== self.shn_msg: self.shn.HandleMessage(hwnd, msg, wp, lp) ! ! elif msg=="shellchange": ! self.shc_handlemessage(hwnd, msg, wp, lp) ! # GUI message handler def onMSG(self, hwnd, msg, wp, lp): + if msg in ('menu open', 'menu popup', 'menu choice'): + self.handle_menu_msg(hwnd, msg, wp, lp) + if msg=="size": ! x, y, w, h= lp ! ! self.DeferWindows( ! (self.lv, x, y, w, h/2), ! (self.lv2, x, y+(h/2), w, h/2), ! ) ! self.lv2.SetColumnWidth(0, w-1) w= lp[2]/5 self.lv.SetColumnWidth(0, w) self.lv.SetColumnWidth(1, w*2) ! self.lv.SetColumnWidth(2, w*2-1) ! ! elif msg=="destroy": try: ! dragdrop.Revoke(self.lv.Hwnd) except: pass try: + dragdrop.Revoke(self.lv2.Hwnd) + except: pass + try: if self.sh: self.sh.Close() except: pass ! self.close_notifiers() ! ! ! #--------------------------------------------------- w = window() w.Run() Index: gui_splitter.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/sample-guis/gui_splitter.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gui_splitter.py 29 Apr 2005 15:24:56 -0000 1.1.1.1 --- gui_splitter.py 2 Jul 2005 09:20:38 -0000 1.2 *************** *** 15,20 **** x,y,w,h= self.GetClientRect().ToSize() ! self.sp1=Splitter(self, w/2-(self.spW/2), 0, self.spW, h, 'clientedge','vert', 'tabstop') ! self.sp2=Splitter(self, 0, h/2-(self.spW/2), w/2-(self.spW/2)-1, self.spW, 'clientedge', 'tabstop') self.sp3=Splitter(self, w/2+(self.spW/2)+1, h/2-(self.spW/2), w/2-self.spW/2-1, self.spW, 'clientedge', 'tabstop') self.sp1.onMSG= self.sp2.onMSG=self.sp3.onMSG= self.on_splitter --- 15,21 ---- x,y,w,h= self.GetClientRect().ToSize() ! ## 'feedbackbar' will leave some stains behind on sp3 ! self.sp1=Splitter(self, w/2-(self.spW/2), 0, self.spW, h, 'clientedge','vert', 'tabstop', 'feedbackbar') ! self.sp2=Splitter(self, 0, h/2-(self.spW/2), w/2-(self.spW/2)-1, self.spW, 'clientedge', 'tabstop', 'feedbackbar') self.sp3=Splitter(self, w/2+(self.spW/2)+1, h/2-(self.spW/2), w/2-self.spW/2-1, self.spW, 'clientedge', 'tabstop') self.sp1.onMSG= self.sp2.onMSG=self.sp3.onMSG= self.on_splitter |
From: jürgen u. <cer...@us...> - 2005-07-02 09:20:31
|
Update of /cvsroot/wnd/wnd/wnd/sample-guis/explorer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6598/explorer Log Message: Directory /cvsroot/wnd/wnd/wnd/sample-guis/explorer added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:19:10
|
Update of /cvsroot/wnd/wnd/wnd/res/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6056 Modified Files: icons1.py Added Files: lnk.ico Log Message: bit of this and a bit of that Index: icons1.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/res/icons/icons1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icons1.py 15 May 2005 09:43:51 -0000 1.2 --- icons1.py 2 Jul 2005 09:19:02 -0000 1.3 *************** *** 37,38 **** --- 37,47 ---- return IconFromBytes(MASK, COLOR, BITS, W, H) + + def ico_link_overlay(): + """link overlay icon""" + + BITS, W, H= 1, 32, 32 + MASK= '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff\x00\x1f\xff\xff' + COLOR= '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x00\x00p\xc0\x00\x00x\xc0\x00\x00p\xc0\x00\x00b\xc0\x00\x00g\xc0\x00\x00o\xc0\x00\x00w\xc0\x00\x00\x7f\xc0\x00\x00\x00\x00\x00\x00' + return IconFromBytes(MASK, COLOR, BITS, W, H) + --- NEW FILE: lnk.ico --- (This appears to be a binary file; contents omitted.) |
From: jürgen u. <cer...@us...> - 2005-07-02 09:16:37
|
Update of /cvsroot/wnd/wnd/wnd/gdi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4773 Modified Files: brush.py icon.py Log Message: bit of this and a bit of that Index: icon.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/gdi/icon.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icon.py 15 May 2005 09:39:35 -0000 1.2 --- icon.py 2 Jul 2005 09:16:28 -0000 1.3 *************** *** 1,7 **** ! """Bitmaps. ! The module defines a list SYSTEM_ICONS with the string identifiers all available predefined system icons to be used with the 'systemicon' class. """ --- 1,7 ---- ! """ The module defines a list SYSTEM_ICONS with the string identifiers all available predefined system icons to be used with the 'systemicon' class. + """ *************** *** 17,21 **** ! __all__= ("GetShellIconSize", "GetShellSmallIconSize", "SYSTEM_ICONS", "IconFromHandle", "DisposableIcon", "IconFromFile", "FileIcon", "SystemIcon", "IconFromBytes", "GetSysIconIndex") --- 17,21 ---- ! __all__= ("GetShellIconSize", "GetShellSmallIconSize", "SYSTEM_ICONS", "IconFromHandle", "DisposableIcon", "IconFromFile", "FileIcon", "SystemIcon", "IconFromBytes", "IconFromInstance", "GetSysIconIndex") *************** *** 38,41 **** --- 38,51 ---- 'shelliconsize' : 4} #'sysiconindex' : 4096 + DI_FLAGS= { + 'mask':1, + 'image':2, + 'normal':3, + 'compat':4, + 'defaultsize':8, + 'nomirror':16, + } + + #********************************************* *************** *** 212,220 **** raise RuntimeError("could not retrieve icon info") bm=BITMAP() ! if not gdi32.GetObjectA(ii.hbmColor, sizeof(BITMAP), byref(bm)): raise RuntimeError("could not retrieve bitmap info") ! gdi32.DeleteObject(ii.hbmMask) ! gdi32.DeleteObject(ii.hbmColor) ! return bm.bmWidth, bm.bmHeight --- 222,233 ---- raise RuntimeError("could not retrieve icon info") bm=BITMAP() ! if not gdi32.GetObjectA(ii.hbmMask, sizeof(BITMAP), byref(bm)): raise RuntimeError("could not retrieve bitmap info") ! if ii.hbmMask: ! gdi32.DeleteObject(ii.hbmMask) ! if ii.hbmColor: ! gdi32.DeleteObject(ii.hbmColor) ! return bm.bmWidth, bm.bmHeight ! return bm.bmWidth, bm.bmHeight/2 *************** *** 230,233 **** --- 243,255 ---- + + def DrawEx(self, dc, x, y, w, h, flag): + try: flag= DI_FLAGS[flag] + except: raise ValueError, "invalid flag: %s" % flag + if not user32.DrawIconEx(dc.handle, x, y, self.handle, w, h, 0, None, flag): + raise "could not draw icon" + + + def Draw(self, dc, x, y): if not user32.DrawIcon(dc.handle, x, y, self.handle): *************** *** 302,306 **** self.handle = user32.LoadImageA(hInstance, resname, IMAGE_ICON, w, h, 0) if not self.handle: raise RuntimeError("could not load icon: %s" % path) ! DisposableIcon.__init__(self, handle) #************************************************** --- 324,328 ---- self.handle = user32.LoadImageA(hInstance, resname, IMAGE_ICON, w, h, 0) if not self.handle: raise RuntimeError("could not load icon: %s" % path) ! DisposableIcon.__init__(self, self.handle) #************************************************** Index: brush.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/gdi/brush.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** brush.py 15 May 2005 09:39:13 -0000 1.2 --- brush.py 2 Jul 2005 09:16:28 -0000 1.3 *************** *** 106,110 **** try: color = SYSTEM_COLORS[colorname] ! except: raise ValueError("invalid color: %s" % color) handle = user32.GetSysColorBrush(color) if not handle: raise RuntimeError("could not create sys color brush") --- 106,110 ---- try: color = SYSTEM_COLORS[colorname] ! except: raise ValueError("invalid color: %s" % colorname) handle = user32.GetSysColorBrush(color) if not handle: raise RuntimeError("could not create sys color brush") |
From: jürgen u. <cer...@us...> - 2005-07-02 09:16:08
|
Update of /cvsroot/wnd/wnd/wnd/api/ole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4337 Added Files: .CVSIGNORE __init__.py dataobject.py dragdrop.py enumformatetc.py enumstatdata.py wintypes.py Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.pyc *.pyo --- NEW FILE: wintypes.py --- from wnd.wintypes import * from ctypes.com import IUnknown, ole32 from ctypes.com.ole import IAdviseSink #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: DVASPECT_CONTENT = 1 DVASPECT_THUMBNAIL = 2 DVASPECT_ICON = 4 DVASPECT_DOCPRINT = 8 # medium types TYMED_HGLOBAL = 1 TYMED_FILE = 2 TYMED_ISTREAM = 4 TYMED_ISTORAGE = 8 TYMED_GDI = 16 TYMED_MFPICT = 32 TYMED_ENHMF = 64 TYMED_NULL = 0 INDEX_ALL = -1 class STGMEDIUM(Structure): _fields_ = [("tymed", DWORD), ("_hGlobal", HANDLE), ("pUnkForRelease", POINTER(IUnknown))] def _get_hGlobal(self): return self._hGlobal def _set_hGlobal(self, value, release=ole32.ReleaseStgMedium): if self._hGlobal: release(byref(self)) self._hGlobal= value hGlobal= property(_get_hGlobal, _set_hGlobal) class DVTARGETDEVICE(Structure): _fields_ = [("tdSize", DWORD), ("tdDriverNameOffset", WORD), ("tdDeviceNameOffset", WORD), ("tdPortNameOffset", WORD), ("tdExtDevmodeOffset", WORD), ("tdData", BYTE)] class FORMATETC(Structure): _fields_ = [("cfFormat", CLIPFORMAT), ("ptd", POINTER(DVTARGETDEVICE)), ("dwAspect", DWORD), ("lindex", LONG), ("tymed", DWORD)] class STATDATA(Structure): _fields_ = [("formatetc", FORMATETC), ("grfAdvf", DWORD), ("pAdvSink", POINTER(IAdviseSink)), ("dwConnection", DWORD)] --- NEW FILE: dragdrop.py --- from ctypes.com import IUnknown, GUID, STDMETHOD, HRESULT, COMObject, ole32 from wnd.api.ole.dataobject import IDataObject, DataObjectFromPointer from wnd.api.clipformats import cf from wnd.wintypes import (BOOL, DWORD, POINT, POINTER, byref, windll ) from ctypes.com import (REFIID) ole32= windll.ole32 import traceback #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::. class IDropSource(IUnknown): _iid_ = GUID("{00000121-0000-0000-C000-000000000046}") IDropSource._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "QueryContinueDrag", BOOL, DWORD), STDMETHOD(HRESULT, "GiveFeedback", DWORD)] class IDropTarget(IUnknown): _iid_ = GUID("{00000122-0000-0000-C000-000000000046}") IDropTarget._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "DragEnter", POINTER(IDataObject), DWORD, POINT, POINTER(DWORD)), STDMETHOD(HRESULT, "DragOver", DWORD, POINT, POINTER(DWORD)), STDMETHOD(HRESULT, "DragLeave"), STDMETHOD(HRESULT, "Drop", POINTER(IDataObject), DWORD, POINT, POINTER(DWORD))] S_OK = 0 E_UNEXPECTED = 0x8000FFFFL E_INVALIDARG = 0x80070057L DROPEFFECT_NONE = 0 DROPEFFECT_COPY = 1 DROPEFFECT_MOVE = 2 DROPEFFECT_LINK = 4 DROPEFFECT_SCROLL = -2147483648 D_EFFECTS= {'none':0,'copy':1,'move':2,'link':4} MK_LBUTTON = 1 MK_RBUTTON = 2 MK_SHIFT = 4 MK_CONTROL = 8 MK_MBUTTON = 16 MK_ALT = 32 DRAGDROP_S_CANCEL = 262401 DRAGDROP_S_DROP = 262400 DRAGDROP_S_USEDEFAULTCURSORS = 262402 E_OUTOFMEMORY = 0x8007000L E_UNEXPECTED = 0x8000FFFFL #*********************************************************** # drag drop class #*********************************************************** class DragDropFactory(object): def LockServer(self, arg, arg2): pass #*********************************************************** class DragDrop(COMObject): _com_interfaces_ = [IDropTarget, IDropSource] _factory = DragDropFactory() def __init__(self, hwnd): COMObject.__init__(self) self.allow_drop = False self.Hwnd= hwnd self.dropeffect= DROPEFFECT_MOVE | DROPEFFECT_COPY | DROPEFFECT_LINK def GetDropTargetPointer(self): return byref(self._com_pointers_[0][1]) def GetDropSourcePointer(self): return byref(self._com_pointers_[2][1]) def SetDropEffect(self, *effects): self.dropeffect= 0 for i in effects: try: self.dropeffect |=D_EFFECTS[i] except: raise ValueError, "invalid drop effect: %s" % i def GetDropEffect(self): out= [] if self.dropeffect & DROPEFFECT_MOVE: out.append('move') if self.dropeffect & DROPEFFECT_COPY: out.append('copy') if self.dropeffect & DROPEFFECT_LINK: out.append('link') if out: return out return ['none', ] def _get_dropeffect(self, keystate, point, allowed): # 1. check "point" -> do we allow a drop at the specified coordinates? effect = 0 test= keystate & (MK_CONTROL|MK_SHIFT) if test==MK_CONTROL: effect = allowed & (self.dropeffect & DROPEFFECT_COPY) elif test==MK_SHIFT: effect = allowed & (self.dropeffect & DROPEFFECT_MOVE) elif test==MK_CONTROL|MK_SHIFT: effect = allowed & (self.dropeffect & DROPEFFECT_LINK) if effect == 0: if allowed & DROPEFFECT_MOVE: effect = self.dropeffect & DROPEFFECT_MOVE if effect: return effect if allowed & DROPEFFECT_COPY: effect = self.dropeffect & DROPEFFECT_COPY if effect: return effect if allowed & DROPEFFECT_LINK: effect = self.dropeffect & DROPEFFECT_LINK return effect ## drop target methods def DragEnter(self, this, pDataObject, keystate, point, pEffect): if pEffect: try: result= self.onMSG(self.Hwnd, "dragdrop", "dragenter", ( DataObjectFromPointer(pDataObject), keystate, point, pEffect)) except: traceback.print_exc() return E_UNEXPECTED if result==False: pEffect[0] = DROPEFFECT_NONE self.allow_drop = False else: pEffect[0] = self._get_dropeffect(keystate, point, pEffect[0]) self.allow_drop = True return S_OK else: return E_INVALIDARG def DragOver(self, this, keystate, point, pEffect): if pEffect: if self.allow_drop: try: result= self.onMSG(self.Hwnd, "dragdrop", "dragover", (keystate, point, pEffect)) if result !=False: pEffect[0] = self._get_dropeffect(keystate, point, pEffect[0]) return S_OK except: traceback.print_exc() return E_UNEXPECTED pEffect[0] = DROPEFFECT_NONE return S_OK def DragLeave(self, this): try: self.onMSG(self.Hwnd, "dragdrop", "dragleave", 0) except: traceback.print_exc() return S_OK def Drop(self, this, pDataObject, keystate, point, pEffect): if self.allow_drop: try: result= self.onMSG(self.Hwnd, "dragdrop", "drop", (DataObjectFromPointer(pDataObject), keystate, point, pEffect)) if result != False: pEffect[0] = self._get_dropeffect(keystate, point, pEffect[0]) return S_OK except: traceback.print_exc() pEffect[0] = DROPEFFECT_NONE return S_OK ## drop source methods def QueryContinueDrag(self, this, fEscapePressed, grfKeyState): if fEscapePressed: return DRAGDROP_S_CANCEL if not (grfKeyState & (MK_LBUTTON|MK_RBUTTON)): return DRAGDROP_S_DROP return S_OK def GiveFeedback(self, this, dwEffect): try: result= self.onMSG(self.Hwnd, "dragdrop", "feedback", dwEffect) if result==False: return S_OK except: traceback.print_exc() return DRAGDROP_S_USEDEFAULTCURSORS def onMSG(self, hwnd, msg, wp, lp): pass #******************************************************** # #******************************************************** # TODO: document class DropTargetPointer(object): def __init__(self): self._DropTarget= POINTER(IDropTarget)() self.refiid= REFIID(IDropTarget._iid_) self.ptr= byref(self._DropTarget) def AddRef(self): return self._DropTarget.AddRef() def Release(self): return self._DropTarget.Release() def DragEnter(self, DataObject, KeyState, Point, pEffect): try: self._DropTarget.DragEnter(DataObject.GetComPointer(), KeyState, Point, pEffect) return True except: return False def DragLeave(self): try: self._DropTarget.DragLeave() return True except: return False def DragOver(self, KeyState, Point, pEffect): try: self._DropTarget.DragOver(KeyState, Point, pEffect) return True except: return False def Drop(self, DataObject, KeyState, Point, pEffect): try: self._DropTarget.Drop(DataObject.GetComPointer(), KeyState, Point, pEffect) return True except: return False #******************************************************** # drag drop functions #******************************************************** def Register(hwnd, DropTarget): return ole32.RegisterDragDrop(hwnd, DropTarget.GetDropTargetPointer()) Revoke = ole32.RevokeDragDrop def DoDragDrop(DataObject, DropSource, *effects): effect= 0 for i in effects: try: effect |= D_EFFECTS[i] except: raise ValueError, "invalid drop effect: %s" % i effectOut= DWORD() result = ole32.DoDragDrop(DataObject.GetComPointer(), DropSource.GetDropSourcePointer(), effect, byref(effectOut) ) if result==DRAGDROP_S_CANCEL: result= 'cancel' elif result==DRAGDROP_S_DROP: result= 'drop' elif result==E_OUTOFMEMORY: result= 'outofmemory' elif result==E_UNEXPECTED: result= 'unexpected' else: result= 'unknown error' if effectOut.value==DROPEFFECT_NONE: effect= 'none' elif effectOut.value==DROPEFFECT_COPY: effect= 'copy' elif effectOut.value==DROPEFFECT_MOVE: effect= 'move' elif effectOut.value==DROPEFFECT_LINK: effect= 'link' else: effect= 'unknown' return result, effect --- NEW FILE: enumstatdata.py --- from ctypes.com import IUnknown, GUID, STDMETHOD, HRESULT from wnd.api.ole.wintypes import (STATDATA, POINTER, c_ulong) #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class IEnumSTATDATA(IUnknown): _iid_ = GUID("{00000105-0000-0000-C000-000000000046}") IEnumSTATDATA. _methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "Next", c_ulong, POINTER(STATDATA), POINTER(c_ulong)), STDMETHOD(HRESULT, "Skip", c_ulong), STDMETHOD(HRESULT, "Reset"), STDMETHOD(HRESULT, "Clone", POINTER(POINTER(IEnumSTATDATA))), ] --- NEW FILE: dataobject.py --- """IDataObject and PyDataObject Note: don't forgett to call OleInitialize before use. ;) (I bet nobody's gonna read this.......) """ from ctypes.com import (ole32, GUID, IUnknown, STDMETHOD, HRESULT, COMObject, REFIID) from wnd.api.ole.wintypes import * from wnd.api.ole.enumformatetc import (SHCreateStdEnumFmtEtc, IEnumFORMATETC, FORMATETC) from ctypes.com.ole import IAdviseSink from wnd.api.ole.enumstatdata import IEnumSTATDATA from wnd.api.clipformats import cf TYMED_HGLOBAL = 1 DATADIR_GET = 1 DATADIR_SET = 2 # error codes S_OK = 0 S_FALSE = 1 DV_E_FORMATETC = -2147221404 STG_E_MEDIUMFULL = 2147680368 E_NOTIMPL = -2147467263 OLE_E_ADVISENOTSUPPORTED = -2147221501 DATA_E_FORMATETC = 0x80040064L DV_E_TYMED = 0x80040069L E_OUTOFMEMORY = 0x8007000L E_INVALIDARG = 0x80070057L E_UNEXPECTED = 0x8000FFFFL GMEM_FIXED = 0 #*************************************************** class IDataObject(IUnknown): _iid_ = GUID("{0000010E-0000-0000-C000-000000000046}") IDataObject._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "GetData", POINTER(FORMATETC), POINTER(STGMEDIUM)), STDMETHOD(HRESULT, "GetDataHere", POINTER(FORMATETC), POINTER(STGMEDIUM)), STDMETHOD(HRESULT, "QueryGetData", POINTER(FORMATETC)), STDMETHOD(HRESULT, "GetCanonicalFormatEtc", POINTER(FORMATETC), POINTER(FORMATETC)), STDMETHOD(HRESULT, "SetData", POINTER(FORMATETC), POINTER(STGMEDIUM), BOOL), STDMETHOD(HRESULT, "EnumFormatEtc", DWORD, POINTER(POINTER(IEnumFORMATETC))), STDMETHOD(HRESULT, "DAdvise", POINTER(FORMATETC), DWORD, POINTER(IAdviseSink), POINTER(DWORD)), STDMETHOD(HRESULT, "DUnadvise", DWORD), STDMETHOD(HRESULT, "EnumDAdvise", POINTER(POINTER(IEnumSTATDATA)))] class IDataAdviseHolder(IUnknown): _iid_ = GUID("{00000110-0000-0000-C000-000000000046}") IDataAdviseHolder._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "Advise", POINTER(IDataObject), POINTER(FORMATETC), DWORD, POINTER(IAdviseSink), POINTER(DWORD)), STDMETHOD(HRESULT, "Unadvise", DWORD), STDMETHOD(HRESULT, "EnumAdvise", POINTER(IEnumSTATDATA)), STDMETHOD(HRESULT, "SendOnDataChange", POINTER(IDataObject), DWORD, DWORD), ] class IDataObject2(IUnknown): _iid_ = GUID("{0000010E-0000-0000-C000-000000000046}") IDataObject2._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "GetData", POINTER(FORMATETC), POINTER(STGMEDIUM)), STDMETHOD(HRESULT, "GetDataHere", POINTER(FORMATETC), POINTER(STGMEDIUM)), STDMETHOD(HRESULT, "QueryGetData", POINTER(FORMATETC)), STDMETHOD(HRESULT, "GetCanonicalFormatEtc", POINTER(FORMATETC), POINTER(FORMATETC)), STDMETHOD(HRESULT, "SetData", POINTER(FORMATETC), POINTER(STGMEDIUM), BOOL), STDMETHOD(HRESULT, "EnumFormatEtc", DWORD, POINTER(POINTER(IEnumFORMATETC))), STDMETHOD(HRESULT, "DAdvise", POINTER(FORMATETC), DWORD, POINTER(IAdviseSink), POINTER(DWORD)), STDMETHOD(HRESULT, "DUnadvise", DWORD), STDMETHOD(HRESULT, "EnumDAdvise", POINTER(POINTER(IEnumSTATDATA)))] #************************************************** class DataObjectFactory(object): def LockServer(self, arg, arg2): pass #************************************************** #************************************************** class DataObjectImpl(COMObject): _com_interfaces_ = [IDataObject] _factory = DataObjectFactory() def __init__(self, *formats, **kwargs): COMObject.__init__(self) self.IDataObject = self._com_pointers_[0][1] self.formats= list(formats) ## list of cf.FORMATS self.allowset= list(kwargs.get('allowset', [])) def _lookup_formatetc_set(self, pFormatetc): """Helper method. Returns the index of the requested FORMATEC type or -1 if none of our FORMATEC types matches the given FORMATEC.""" if pFormatetc: for n, i in enumerate(self.allowset): if i.fmt.tymed & pFormatetc[0].tymed \ and i.fmt.cfFormat == pFormatetc[0].cfFormat \ and i.fmt.dwAspect == pFormatetc[0].dwAspect: return n return -1 # error format not found def _lookup_formatetc(self, pFormatetc): """Helper method. Returns the index of the requested FORMATEC type or -1 if none of our FORMATEC types matches the given FORMATEC.""" if pFormatetc: for n, i in enumerate(self.formats): if i.fmt.tymed & pFormatetc[0].tymed \ and i.fmt.cfFormat == pFormatetc[0].cfFormat \ and i.fmt.dwAspect == pFormatetc[0].dwAspect: return n return -1 # error format not found #-------------------------------------------------------------------------- # default DataObject methods def QueryGetData(self, this, pFormatetc): if pFormatetc: if self._lookup_formatetc(pFormatetc) != -1: return S_OK return DV_E_FORMATETC def GetData(self, this, pFormatetc, pStgmedium): # get the corrosponding format from our list # stuff the data into the supplied STGMEDIUM # pUnkForRelease dhould be NULL here, so the caller # is responsible for freeing the memory handle if pFormatetc and pStgmedium: n = self._lookup_formatetc(pFormatetc) if n == -1: return DV_E_FORMATETC # sorry format not supported format= self.formats[n] pStgmedium[0].tymed =format.stg.tymed pStgmedium[0].pUnkForRelease = format.stg.pUnkForRelease if format.fmt.tymed == TYMED_HGLOBAL: hMem= ole32.OleDuplicateData(format.stg.hGlobal, format.fmt.cfFormat, None) if hMem: pStgmedium[0].hGlobal = hMem return S_OK else: return STG_E_MEDIUMFULL else: ## other then hGlobal (...) pass return DV_E_FORMATETC def EnumFormatEtc(self, this, direction, ppEnumFormatetc): ## create a FORMATETC array on the fly from available formats arr= None if direction == DATADIR_GET: if self.formats: arr= (FORMATETC*len(self.formats))() for n, i in enumerate(self.formats): arr[n]= i.fmt elif direction==DATADIR_SET: if self.allowset: arr= (FORMATETC*len(self.allowset))() for n, i in enumerate(self.allowset): arr[n]= i.fmt if arr: if not SHCreateStdEnumFmtEtc(len(arr), addressof(arr[0]), ppEnumFormatetc): return S_OK return E_NOTIMPL ## not tested def SetData(self, this, pFormatetc, pStgmedium, release): if self.allowset== None: return E_NOTIMPL if not pFormatetc or not pStgmedium: return E_INVALIDARG if self._lookup_formatetc_set(pFormatetc) == -1: return DV_E_FORMATETC n = self._lookup_formatetc(pFormatetc) if n == -1: ## add format format= cf.null() memmove(byref(format.fmt), pFormatetc, sizeof(FORMATETC)) format.stg.tymed= format.fmt.tymed self.formats.append(format) else: ## replace format format= self.formats[n] if release: ## we own the medium format.stg.hGlobal= pStgmedium[0].hGlobal return S_OK else: ## copy the medium if pFormatetc[0].tymed == TYMED_HGLOBAL: if pStgmedium[0].hGlobal: format.stg.hGlobal= ole32.OleDuplicateData(pStgmedium[0].hGlobal, format.fmt.cfFormat, None) if not format.stg.hGlobal: ## something went wrong return STG_E_MEDIUMFULL return S_OK else: ## other then hGlobal (...) return DV_E_TYMED return E_UNEXPECTED # not tested implemented currently def GetDataHere(self, this, pFormatetc, pStgmedium): return DATA_E_FORMATETC def GetCanonicalFormatEtc(self, this, pFormatetc, pFormatetcout): pFormatetcout[0].ptd = 0 # Tutorial says we have to NULL it return E_NOTIMPL def DAdvise(self, this, pFormatetc, advf, pAdvisesink, connection): return OLE_E_ADVISENOTSUPPORTED def DUnAdvise(self, this, connection): return OLE_E_ADVISENOTSUPPORTED def EnumDAdvise(self, this, ppEnumadvise): return OLE_E_ADVISENOTSUPPORTED ## def GetComPointer(self): return byref(self._com_pointers_[0][1]) def Close(self): for i in self.formats: i.value= None for i in self.allowset: i.value= None self.formats= [] self.allowset= [] def GetComPointer(self): return byref(self._com_pointers_[0][1]) #************************************************************ #************************************************************ class DataObjectFromPointer(object): def __init__(self, pDataObject): self._DataObject= pDataObject def GetComPointer(self): return self._DataObject def __nonzero__(self): return bool(self._DataObject) def ListFormats(self, get=True): enum = POINTER(IEnumFORMATETC)() result= self._DataObject.EnumFormatEtc(get and DATADIR_GET or DATADIR_SET, byref(enum)) if result: raise WinError(result) n = pointer(ULONG()) enum.Reset() out= [] while 1: fmtNull= cf.null() result = enum.Next(1, byref(fmtNull.fmt), n) if result: break out.append(fmtNull) del enum return out def GetData(self, format): try: self._DataObject.GetData(byref(format.fmt), byref(format.stg)) return True except: return False def HasFormat(self, format): try: self._DataObject.QueryGetData(byref(format.fmt)) return True except: return False def CanSet(self, format): try: if formst in ListFormats(self, get=False): return True except: pass return False def SetData(self, format, release=True): try: self._DataObject.SetData(byref(format.fmt), byref(format.stg), release and 1 or 0) return True except: return False #************************************************************ #************************************************************ class DataObjectPointer(DataObjectFromPointer): def __init__(self): self._DataObject= POINTER(IDataObject)() self.refiid= REFIID(IDataObject._iid_) self.ptr= byref(self._DataObject) #************************************************************ #************************************************************ class DataObject(object): def __init__(self, *formats, **kwargs): self._DataObject= DataObjectImpl(*formats, **kwargs) def GetComPointer(self): return byref(self._DataObject._com_pointers_[0][1]) def ListFormats(self, get=True): enum = POINTER(IEnumFORMATETC)() if self._DataObject.EnumFormatEtc(0, get and DATADIR_GET or DATADIR_SET, byref(enum)): raise WinError(result) enum.AddRef() n = pointer(ULONG()) enum.Reset() out= [] while 1: fmtNull= cf.null() result = enum.Next(1, byref(fmtNull.fmt), n) if result: break out.append(fmtNull) enum.Release() return out def GetData(self, format): try: self._DataObject.GetData(0, pointer(format.fmt), pointer(format.stg)) return True except: return False def HasFormat(self, format): try: self._DataObject.QueryGetData(0, pointer(format.fmt)) return True except: return False def CanSet(self, format): return format in self.ListFormats(get=False) def SetData(self, format, release=True): try: self._DataObject.SetData(0, pointer(format.fmt), pointer(format.stg), release and 1 or 0) return True except: return False def Close(self): return self._DataObject.Close() --- NEW FILE: __init__.py --- from ctypes.com import ole32 ole32.OleInitialize(None) class _Cleaner(object): def __del__(self, func=ole32.OleUninitialize): try: func() except WindowsError: pass __cleaner = _Cleaner() del _Cleaner --- NEW FILE: enumformatetc.py --- """IEnumFORMATETC and PyEnumFORMATETC. Note: don't forgett to call OleInitialize before use. ;) """ from wnd.api.ole.wintypes import * from ctypes.com import (GUID, IUnknown, STDMETHOD, HRESULT, COMObject) #************************************************* class IEnumFORMATETC(IUnknown): _iid_ = GUID("{00000103-0000-0000-C000-000000000046}") IEnumFORMATETC._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "Next", ULONG, POINTER(FORMATETC), POINTER(ULONG)), STDMETHOD(HRESULT, "Skip", ULONG), STDMETHOD(HRESULT, "Reset"), STDMETHOD(HRESULT, "Clone", POINTER(IEnumFORMATETC))] ## documented for anti-trust-case reasons and exported by ordinal GPA= kernel32.GetProcAddress GPA.restype= WINFUNCTYPE( HRESULT, c_uint, c_ulong, ## addr FORMATETC*1 POINTER(POINTER(IEnumFORMATETC))) #GPA.restype= WINFUNCTYPE(HRESULT, c_uint, FORMATETC*1, POINTER(POINTER(IEnumFORMATETC))) SHCreateStdEnumFmtEtc= GPA(shell32._handle, 74) #SHCreateStdEnumFmtEtc (74) #HRESULT SHCreateStdEnumFmtEtc( # UINT cfmt, # const FORMATETC afmt[], # IEnumFORMATETC **ppenumFormatEtc # |
From: jürgen u. <cer...@us...> - 2005-07-02 09:15:03
|
Update of /cvsroot/wnd/wnd/wnd/custom/dirlist/dl_lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3951 Added Files: .CVSIGNORE __init__.py de.py en.py Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.pyc *.pyo --- NEW FILE: en.py --- LANG= 'en' COL_NAME= 'Name' COL_SIZE= 'Size' COL_MODIFIED= 'Modified' NEWFILE= 'New File' NEWFOLDER= 'New Folder' PASTE= 'Paste' PASTE_LINK= 'Paste Link' SORT= 'Sort' SORT_DATE= 'Date' SORT_NAME= 'Name' SORT_SIZE= 'Size' SORT_TYPE= 'Type' SORT_ASC= 'Sort Ascending' SORT_DESC= 'Sort Descending' VIEW= 'View' VIEW_DETAILS= 'Details' VIEW_LIST= 'List' VIEW_ICON= 'Icon View' VIEW_ICONLARGE= 'Large Icons' VIEW_ICONSMALL= 'Small Icons' SHELL_NEW= 'Shell New' ERR_MSGBOX_TITLE= 'dirlist error' --- NEW FILE: __init__.py --- """language support for the view""" import imp, os _PATH= os.path.split(__file__)[0] #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: def get_lang(lang_code): try: return imp.load_source('dl_lang_%s' % lang_code, os.path.join(_PATH, '%s.py' % lang_code)) except: return imp.load_source('lang_en', os.path.join(_PATH, 'en.py')) --- NEW FILE: de.py --- # -*- coding: iso8859_15 -*- LANG= 'de' COL_NAME= 'Name' COL_SIZE= 'Grösse' COL_MODIFIED= 'Geändert' NEWFILE= 'Neue Datei' NEWFOLDER= 'Neuer Ordner' PASTE= 'Einfügen' PASTE_LINK= 'Link Einfügen' SORT= 'Sortieren' SORT_DATE= 'Datum' SORT_NAME= 'Name' SORT_SIZE= 'Grösse' SORT_TYPE= 'Typ' SORT_ASC= 'Sort. Aufsteigend' SORT_DESC= 'Sort. Absteigend' VIEW= 'Ansicht' VIEW_DETAILS= 'Details' VIEW_LIST= 'Liste' VIEW_ICON= 'Icon Ansicht' VIEW_ICONLARGE= 'Grosse Icons' VIEW_ICONSMALL= 'Kleine Icons' SHELL_NEW= 'Neu' ERR_MSGBOX_TITLE= 'dirlist fehler' |
From: jürgen u. <cer...@us...> - 2005-07-02 09:07:15
|
Update of /cvsroot/wnd/wnd/wnd/custom/dirlist/dl_lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31852/dl_lang Log Message: Directory /cvsroot/wnd/wnd/wnd/custom/dirlist/dl_lang added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:06:40
|
Update of /cvsroot/wnd/wnd/wnd/custom/dirlist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31726/dirlist Log Message: Directory /cvsroot/wnd/wnd/wnd/custom/dirlist added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 09:05:56
|
Update of /cvsroot/wnd/wnd/wnd/custom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31354 Modified Files: splitter.py Added Files: drivecombo.py Log Message: bit of this and a bit of that --- NEW FILE: drivecombo.py --- """ TODO - winos.GetDriveList fails sometimes - limit dropdown height if style 'adjusth' is used. (dono if 26 drives listed cause trouble. Anyone here for testing ??) - implement flags to exclude drive types ?? NOTES - comboboxes do not send any reliable notification when being enabled or disabled, so no special drawing is done here - SetFont/GetFont not implemented; If the user sets a non-default font this control will mess up. - item offets are calculated as follows: icon -> text = font.GetAverageCharWidth item -> nextItem = font.GetAverageCharWidth/2 """ from wnd import gdi from wnd.api import shell from wnd.api import winos from wnd.controls.imagelist import Imagelist from wnd.controls.helpers import ParseStylesSZ from wnd.custom.odcombobox import ODCombobox from wnd.wintypes import user32 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SZ_MSG_SHELLNOTIFY= "wnd_DriveCombo_notify" STYLES= ('adjusth', 'largeicon', 'monitorchanges', 'showdetails', 'smallicon', ) #********************************************************************************** #********************************************************************************** class Data(object): __slots__= ('Combobox', 'Imagelist', 'Shell', 'ShellNotify', 'msgNotify', 'styles', 'isNotifyRegistered') def __init__(self): self.Combobox= None self.Imagelist= None self.Shell= None self.ShellNotify= None self.msgNotify= None self.isNotifyRegistered= False self.styles= [] def Close(self): try: self.Shell.Close() except: pass try: self.ShellNotify.Close() except: pass try: self.Imagelist.Close() except: pass def SHN_StartMonitor(self): if not self.isNotifyRegistered: self.Shell.OpenSpecialFolder(shell.CLSIDL_DRIVES) pIdl= self.Shell.GetCwd() self.ShellNotify.Register(pIdl, 'mediainserted', 'mediaremoved', 'driveremoved', 'driveadd') shell.PidlFree(pIdl) self.Shell.SetCwd(None) self.isNotifyRegistered= True def SHN_StopMonitor(self): if self.isNotifyRegistered: self.ShellNotify.Close() self.isNotifyRegistered= False def _printPidls(self, msg, wp, lp): ## helper for 'shellnotify' message if lp==None: return out= [] if isinstance(lp, tuple): if lp[0]: out.append(self.Shell.GetParseName(lp[0])) else: out.append(None) if lp[1]: out.append(self.Shell.GetParseName(lp[1])) else: out.append(None) else: if lp: out.append(self.Shell.GetParseName(lp)) else: out.append(None) print msg, wp, out #********************************************************************************** #********************************************************************************** class DriveCombo(object): def __init__(self, parent, x, y, w, h, *styles): self._custom_Data= Data() for i in styles: if i not in STYLES: raise ValueError, "invalid style: %s" % i self._custom_Data.styles= styles self.Hwnd= 0 self._custom_Data.Combobox=ODCombobox(parent) self._custom_Data.Combobox.onMSG= self.onMESSAGECombobox self._custom_Data.Combobox.InitCombobox(x, y, w, h, 'ownerdrawvariable', 'hasstrings', 'dropdownlist') self.Hwnd= self._custom_Data.Combobox.GetContainer().Hwnd self._custom_Data.Shell= shell.ShellNamespace() self._custom_Data.msgNotify= user32.RegisterWindowMessageA(SZ_MSG_SHELLNOTIFY) self._custom_Data.ShellNotify= shell.ShellNotify( self._custom_Data.Combobox, self._custom_Data.msgNotify, self.onMESSAGECombobox) self._custom_Data.Combobox.HandleMessage(self._custom_Data.msgNotify) if 'monitorchanges' in self._custom_Data.styles: self._custom_Data.SHN_StartMonitor() self.Refresh() #-------------------------------------------------------------------------------------------- # message handler def onMESSAGECombobox(self, hwnd, msg, wp, lp): if msg=="measureitem": #if lp.itemID==0xFFFFFFFF: return if 'largeicon' in self._custom_Data.styles: icoH=gdi.GetSystemMetric('cyicon') else: icoH=gdi.GetSystemMetric('cysmicon') dc=gdi.ClientDC(self._custom_Data.Combobox.Hwnd) font= dc.GetFont() lp.itemHeight = max(icoH, font.GetMaxHeight(dc))+ \ (font.GetAverageCharWidth(dc)/2) font.Close() dc.Close() elif msg=="drawitem": # do not process combobox selection field if lp.itemID==0xFFFFFFFF: return dc=gdi.DCFromHandle(lp.hDC) font= dc.GetFont() if lp.itemAction == lp.FOCUSCHANGE: if not lp.itemState & lp.FOCUS: dc.DrawFocusRect(lp.rcItem) elif lp.itemAction == lp.SELECTCHANGE or lp.itemAction == lp.DRAWENTIRE: if lp.itemState & lp.SELECTED: dc.SetTextColor(gdi.GetSysColor('highlighttext')) dc.SetBkColor(gdi.GetSysColor('highlight')) else: dc.SetTextColor(gdi.GetSysColor('windowtext')) dc.SetBkColor(gdi.GetSysColor('window')) # # draw text text= self._custom_Data.Combobox.GetItemText(lp.itemID) w, h= font.GetTextExtend(dc, text) icoW, icoH = self._custom_Data.Imagelist.GetIconSize() 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 y= lp.rcItem.top + ((lp.rcItem.bottom-lp.rcItem.top- (icoH))/2) self._custom_Data.Imagelist.Draw(dc, lp.itemID, lp.rcItem.left, y) # # draw focus rect if lp.itemState & lp.FOCUS: dc.DrawFocusRect(lp.rcItem) dc.Close() font.Close() elif msg==self._custom_Data.msgNotify: self._custom_Data.ShellNotify.HandleMessage(hwnd, msg, wp, lp) return 0 elif msg=="shellnotify": #self._custom_Data._printPidls(msg, wp, lp) if wp=="mediainserted": self.Refresh() if lp: self.onMSG(hwnd, "shellnotify", "mediainserted", self._custom_Data.Shell.GetParseName(lp)) elif wp=="mediaremoved": self.Refresh() if lp: self.onMSG(hwnd, "shellnotify", "mediaremoved", self._custom_Data.Shell.GetParseName(lp)) elif wp=="driveadd": self.Refresh() if lp: self.onMSG(hwnd, "shellnotify", "driveadd", self._custom_Data.Shell.GetParseName(lp)) elif wp=="driveremoved": self.Refresh() if lp: self.onMSG(hwnd, "shellnotify", "driveremoved", self._custom_Data.Shell.GetParseName(lp)) elif msg=="select": data= self._custom_Data.Combobox.GetText() self.onMSG(hwnd, "driveselected", 0, data[:data.find(':')+1]) else: if msg=="destroy": self._custom_Data.Close() ## default self.onMSG(hwnd, msg, wp, lp) def onMSG(self, hwnd, msg, wp, lp): # overwrite pass #------------------------------------------------------------------------------------------ # DriveCombo methods def Refresh(self): if self._custom_Data.Imagelist: self._custom_Data.Imagelist.Close() self._custom_Data.Combobox.Clear() drives= winos.GetDriveList() ## if drives: if "largeicon" in self._custom_Data.styles: iconSize= 'largeicon' else: iconSize= 'smallicon' ico=gdi.FileIcon(drives[0], iconSize) icoW, icoH=ico.GetSize() self._custom_Data.Imagelist= Imagelist(icoW, icoH, len(drives), 0, 'color16', 'mask') self._custom_Data.Imagelist.AddIcons(ico) for i in drives[1:]: self._custom_Data.Imagelist.AddIcons(gdi.FileIcon(i, iconSize)) if "showdetails" in self._custom_Data.styles: for i in drives: if i == 'a:\\' or i== 'b:\\': self._custom_Data.Combobox.Item('%s [3\xBD floppy]' % i.rstrip('\\')) else: try: name= winos.GetVolumeInfo(i)[0] self._custom_Data.Combobox.Item('%s [%s -%s-]' % (i.rstrip('\\'),name, winos.GetDriveInfo(i).lower())) except: self._custom_Data.Combobox.Item('%s [%s]' % (i.rstrip('\\'), winos.GetDriveInfo(i).lower())) else: for i in drives: self._custom_Data.Combobox.Item(i.rstrip('\\')) # # adjust selection field height of the hosted combobox # ...set some limit here ?? dc= gdi.ClientDC(self._custom_Data.Combobox.Hwnd) font= dc.GetFont() baseOffset= font.GetAverageCharWidth(dc) / 2 self._custom_Data.Combobox.SetItemHeight(icoH + baseOffset, -1) if "adjusth" in self._custom_Data.styles: n= len(self._custom_Data.Combobox) if n: rc=self._custom_Data.Combobox.GetWindowRect() h= n* self._custom_Data.Combobox.GetItemHeight(1) + (rc.bottom-rc.top) self._custom_Data.Combobox.SetWindowSize(rc.right-rc.left, h) dc.Close() font.Close() # finally: make shure there is a selection try: self._custom_Data.Combobox.Select(0) except: pass def GetDrive(self): drv= self._custom_Data.Combobox.GetText() if drv: try: return drv[:drv.find(':')+1] except: pass def SelectDrive(self, drive): if isinstance(drive, (str, unicode)): return self._custom_Data.Combobox.SelectItemText(drive, -1) elif isinstance(drive, (int, long)): return self._custom_Data.Combobox.Select(drive) def SetSelectionFieldHeight(self, h): self._custom_Data.Combobox.SetItemHeight(h, -1) rc= self._custom_Data.Combobox.GetWindowRect() self._custom_Data.Combobox.SetWindowSize(rc.right-rc.left, h) def GetSelectionFieldHeight(self): return self._custom_Data.Combobox.GetItemHeight(-1) def GetMinSelectionFieldSize(self): dc=gdi.ClientDC(self._custom_Data.Combobox.Hwnd) font= dc.GetFont() maxW= 0 for i in self._custom_Data.Combobox: w, h= font.GetTextExtend(dc, self._custom_Data.Combobox.GetItemText(i)) maxW = max(maxW, w) font.Close() dc.Close() icoW, icoH = self._custom_Data.Imagelist.GetIconSize() maxH = max(icoH, h) return maxW + icoW + (icoW/2) + \ gdi.GetSystemMetric('cyhscroll') + \ (gdi.GetSystemMetric('cyedge') * 2) +1, maxH #----------------------------------------------------------------------------------- def GetStyle(self): return self._custom_Data.styles def SetStyle(self, *styles): self._custom_Data.styles= ParseStylesSZ(STYLES, self._custom_Data.styles, styles) if 'largeicon' in self._custom_Data.styles: if (gdi.GetSystemMetric('cxicon'), gdi.GetSystemMetric('cyicon')) != \ self._custom_Data.Imagelist.GetIconSize(): self._custom_Data.Imagelist= SystemImagelist('large') refresh= True else: if (gdi.GetSystemMetric('cxsmicon'), gdi.GetSystemMetric('cysmicon')) != \ self._custom_Data.Imagelist.GetIconSize(): self._custom_Data.Imagelist= SystemImagelist('small') refresh= True if 'monitorchanges' in self._custom_Data.styles: self._custom_Data.SHN_StartMonitor() else: self._custom_Data.SHN_StopMonitor() if refresh: self.Refresh() def SetWindowPosAndSize(self, x, y, w, h): rc= self._custom_Data.Combobox.GetWindowRect() self._custom_Data.Combobox.SetWindowSize(rc.right-rc.left, h) rc= self._custom_Data.Combobox.GetContainer().GetWindowRect() self._custom_Data.Combobox.GetContainer().SetWindowPosAndSize(x, y, w, rc.bottom-rc.top) def SetWindowSize(self, w, h): rc= self._custom_Data.Combobox.GetWindowRect() self._custom_Data.Combobox.SetWindowSize(rc.right-rc.left, h) rc= self._custom_Data.Combobox.GetContainer().GetWindowRect() self._custom_Data.Combobox.GetContainer().SetWindowSize(w, rc.bottom-rc.top) def OffsetWindowSize(self, offsW, offsH): self._custom_Data.Combobox.OffsetWindowSize(0, offsH) self._custom_Data.Combobox.GetContainer().OffsetWindowSize(offsW, 0) def OffsetWindowPos(self, offsX, offsY): return self._custom_Data.Combobox.GetContainer().OffsetWindowPos(offsX, offsY) def SetWindowPos(self, x, y): return self._custom_Data.Combobox.GetContainer().OffsetWindowPos(x, y) def GetItemHeight(self, i): return self._custom_Data.Combobox.GetItemHeight() def GetDropdownRect(self): return self._custom_Data.Combobox.GetDropdownRect() def GetWindowRect(self): return self._custom_Data.Combobox.GetContainer().GetWindowRect() def GetClientRect(self): return self._custom_Data.Combobox.GetContainer().GetClientRect() def GetCombobox(self): return self._custom_Data.Combobox def GetContainer(self): return self._custom_Data.Combobox.GetContainer() def Enable(self): return self._custom_Data.Combobox.Enable() def Disable(self): return self._custom_Data.Combobox.Disable() def IsEnabled(self): return self._custom_Data.Combobox.IsEnabled() def Show(self): return self._custom_Data.Combobox.GetContainer().Show() def Hide(self): return self._custom_Data.Combobox.GetContainer().Hide() def IsVisible(self): return self._custom_Data.Combobox.GetContainer().IsVisible() def HasExtendedUI(self): return self._custom_Data.Combobox.HasExtendedUI() def SetExtendedUI(self, Bool): return self._custom_Data.Combobox.SetExtendedUI(Bool) Index: splitter.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/custom/splitter.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** splitter.py 29 Apr 2005 15:23:54 -0000 1.1.1.1 --- splitter.py 2 Jul 2005 09:05:43 -0000 1.2 *************** *** 7,13 **** - focus rect got messed up in heavier resizing actions. Switched ro background an hilight color setting instead. - """ from wnd.wintypes import (user32, comctl32, --- 7,17 ---- - focus rect got messed up in heavier resizing actions. Switched ro background an hilight color setting instead. + TODO + - 'feedbackbar' may not get erased completely under certain circumstances + + """ + from wnd.wintypes import (user32, comctl32, *************** *** 19,23 **** LOWORD, HIWORD, ! c_short,) from wnd.controls import blank from wnd.controls import windowclass --- 23,29 ---- LOWORD, HIWORD, ! c_short, ! WORD) ! from wnd.controls import blank from wnd.controls import windowclass *************** *** 31,34 **** --- 37,41 ---- WS_CLIENT_HORZ= 0 WS_CLIENT_VERT= 1 + WS_CLIENT_FEEDBACKBAR= 2 #class Msgs: pass *************** *** 46,50 **** self._custom_colors = None # [colorbk, colorhi] self._custom_pageSize = None ! # preregister a class --- 53,59 ---- self._custom_colors = None # [colorbk, colorhi] self._custom_pageSize = None ! self._custom_oldpos= None ! ! # preregister a class *************** *** 79,83 **** if self._custom_fDrag: if self._custom_dragPoint: ! if self.GetStyleL('clientstyle') & self.Style.WS_CLIENT_VERT: self._custom_MoveSplitter(c_short(pt.x).value -self._custom_dragPoint.x, 0) else: --- 88,123 ---- if self._custom_fDrag: if self._custom_dragPoint: ! style= self.GetStyleL('clientstyle') ! ! if style & self.Style.WS_CLIENT_FEEDBACKBAR: ! ## move later on LMBUP ! ! rc= self.GetWindowRect() ! rcNew= rc.Copy() ! rcParent= RECT() ! user32.GetClientRect(self.GetParent(), byref(rcParent)) ! rcParent.ClientToScreen(self.GetParent()) ! ! if style & self.Style.WS_CLIENT_VERT: ! ## +2 ?? ! rcNew.Offset(c_short(pt.x).value - self._custom_dragPoint.x, 0) ! else: ! rcNew.Offset(0, c_short(pt.y).value - self._custom_dragPoint.y) ! ! if rcNew.InRect(rcParent): ! if self._custom_oldpos: ! self._custom_DrawFeedbackBar(*self._custom_oldpos) ! ! rcInters= rcNew.Intersect(rc) ! if not rcInters.IsEmpty(): ! rcNew= rcNew.Subtract(rcInters) ! ! x, y, w, h= rcNew.ToSize() ! self._custom_DrawFeedbackBar(x, y, w, h) ! self._custom_oldpos= x, y, w, h ! ! ! ! elif style & self.Style.WS_CLIENT_VERT: self._custom_MoveSplitter(c_short(pt.x).value -self._custom_dragPoint.x, 0) else: *************** *** 95,100 **** --- 135,162 ---- elif msg==self.Msg.WM_LBUTTONUP: self.ReleaseMouseCapture() + + ## move 'feedbackbar' splitter + style= self.GetStyleL('clientstyle') + if style & self.Style.WS_CLIENT_FEEDBACKBAR: + if self._custom_dragPoint: + pt= POINT(*self.GetCursorPos()) + pt.ScreenToClient(self.GetParent()) + + ## final erasing of the lest poisition brfotre actually moving + if self._custom_oldpos: + self._custom_DrawFeedbackBar(*self._custom_oldpos) + + if style & self.Style.WS_CLIENT_VERT: + + 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 + self._custom_oldpos= None *************** *** 135,138 **** --- 197,231 ---- # helper methods + def _custom_DrawFeedbackBar(self, x, y, w, h): + + + hDC= user32.GetDC(0) + hBr= None + hBm= None + + if hDC: + pat= (WORD*8)(0x00aa, 0x0055, 0x00aa, 0x0055, + 0x00aa, 0x0055, 0x00aa, 0x0055) + + hBm = gdi32.CreateBitmap(8, 8, 1, 1, byref(pat)) + if hBm: + hBr = gdi32.CreatePatternBrush(hBm) + if hBr: + hbrushOld = gdi32.SelectObject(hDC, hBr) + gdi32.PatBlt(hDC, x, y, w, h, 5898313) # PATINVERT = 5898313 + gdi32.SelectObject(hDC, hbrushOld) + + if hBm: + gdi32.DeleteObject(hBm) + if hBr: + gdi32.DeleteObject(hBr) + if hDC: + user32.ReleaseDC(0, hDC) + + + + + + def _custom_SetHilight(self, Bool): if self._custom_colors: *************** *** 148,151 **** --- 241,247 ---- + + + def _custom_MoveSplitter(self, offsX, offsY): # moves the splitter, taking care it is not moved beyound |
From: jürgen u. <cer...@us...> - 2005-07-02 09:03:47
|
Update of /cvsroot/wnd/wnd/wnd/controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29169 Modified Files: button.py checkbox.py combobox.py header.py imagelist.py ipcontrol.py listbox.py pager.py radiobox.py scrollbar.py statusbar.py tab.py textin.py tooltip.py updown.py Log Message: bit of this and a bit of that Index: ipcontrol.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/ipcontrol.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ipcontrol.py 15 May 2005 09:24:07 -0000 1.2 --- ipcontrol.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 40,44 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: --- 40,44 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: Index: header.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/header.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** header.py 15 May 2005 09:22:49 -0000 1.2 --- header.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 61,65 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) --- 61,65 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) Index: scrollbar.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/scrollbar.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scrollbar.py 15 May 2005 09:27:25 -0000 1.2 --- scrollbar.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 153,157 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_HSCROLL: return self._base_HandleScroll(hwnd, msgr.msg, msgr.wParam, msgr.lParam) --- 153,157 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_HSCROLL: return self._base_HandleScroll(hwnd, msgr.msg, msgr.wParam, msgr.lParam) Index: imagelist.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/imagelist.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** imagelist.py 15 May 2005 09:23:38 -0000 1.2 --- imagelist.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 78,82 **** def Seek(self, this, move, origin, pNewPos):return E_NOTIMPL ! def SetSize(self, this, newsize): return STG_E_MEDIUMFULL # not quite def CopyTo(self, this, pDest, cb, pRead, pWritten): return E_NOTIMPL def Commit(self, this, flags): return E_NOTIMPL --- 78,82 ---- def Seek(self, this, move, origin, pNewPos):return E_NOTIMPL ! def SetSize(self, this, newsize): return STG_E_MEDIUMFULL def CopyTo(self, this, pDest, cb, pRead, pWritten): return E_NOTIMPL def Commit(self, this, flags): return E_NOTIMPL *************** *** 393,397 **** ! def GetIconIndex(self, path, *flags): flag = 16384 # SHGFI_SYSICONINDEX --- 393,413 ---- ! def AddIcons(self, *Icons): ! for n, i in enumerate(Icons): ! result = comctl32.ImageList_ReplaceIcon(self.handle, -1, i.handle) ! i.Close() ! if result < 0: raise RuntimeError("could not add icon: (%s)" % n) ! return result - n ! ! ! def SetBkColor(self, colorref): ! CLR_NONE = 4294967295 ! if colorref==None: ! colorref = CLR_NONE ! result = comctl32.ImageList_SetBkColor(self.handle, colorref) ! if result == CLR_NONE: ! raise RuntimeError("could not set background color") ! return result ! def GetIconIndex(self, path, *flags): flag = 16384 # SHGFI_SYSICONINDEX Index: pager.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/pager.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pager.py 15 May 2005 09:25:51 -0000 1.2 --- pager.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 37,41 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: --- 37,41 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: Index: statusbar.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/statusbar.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** statusbar.py 15 May 2005 09:28:06 -0000 1.2 --- statusbar.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 52,56 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) --- 52,56 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) Index: textin.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/textin.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** textin.py 15 May 2005 09:28:55 -0000 1.2 --- textin.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 25,32 **** def onMESSAGE(self, hwnd, msg, wp, lp): if msg==fw.WND_WM_NOTIFY: if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_COMMAND: notify = HIWORD(msgr.wParam) --- 25,33 ---- def onMESSAGE(self, hwnd, msg, wp, lp): + if msg==fw.WND_WM_NOTIFY: 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: notify = HIWORD(msgr.wParam) Index: listbox.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/listbox.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** listbox.py 15 May 2005 09:25:28 -0000 1.2 --- listbox.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 53,57 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_COMMAND: notify = HIWORD(msgr.wParam) --- 53,57 ---- 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: notify = HIWORD(msgr.wParam) Index: tab.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/tab.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tab.py 15 May 2005 09:28:29 -0000 1.2 --- tab.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 58,62 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) --- 58,62 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: nm = NMHDR.from_address(msgr.lParam) Index: combobox.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/combobox.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** combobox.py 15 May 2005 09:22:22 -0000 1.2 --- combobox.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 74,78 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_COMMAND: notify=HIWORD(msgr.wParam) --- 74,78 ---- 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: notify=HIWORD(msgr.wParam) *************** *** 271,279 **** flag= True break ! if flag: return TextinFromHandle(i, *flags) raise RuntimeError("could not retrieve edit control") - - #*********************************************************************** --- 271,281 ---- flag= True break ! if flag: ! txt= TextinFromHandle(i, *flags) ! fw.SetFlagMsgReflect(txt, False) ! return txt ! raise RuntimeError("could not retrieve edit control") #*********************************************************************** Index: radiobox.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/radiobox.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** radiobox.py 15 May 2005 09:27:00 -0000 1.2 --- radiobox.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 14,18 **** if wp==fwtypes.WND_NM_MSGREFLECT: msgr= fwtypes.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_COMMAND: if self.IsGrouped(): --- 14,18 ---- if wp==fwtypes.WND_NM_MSGREFLECT: msgr= fwtypes.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_COMMAND: if self.IsGrouped(): Index: button.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/button.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** button.py 15 May 2005 09:21:23 -0000 1.2 --- button.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 35,39 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_DRAWITEM: di=DRAWITEMSTRUCT.from_address(msgr.lParam) --- 35,39 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_DRAWITEM: di=DRAWITEMSTRUCT.from_address(msgr.lParam) Index: updown.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/updown.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** updown.py 15 May 2005 09:30:00 -0000 1.2 --- updown.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 34,38 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_NOTIFY: nm=NMHDR.from_address(msgr.lParam) --- 34,38 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_NOTIFY: nm=NMHDR.from_address(msgr.lParam) Index: tooltip.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/tooltip.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tooltip.py 15 May 2005 09:29:23 -0000 1.2 --- tooltip.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 84,88 **** # - #************************************************* class TooltipMethods: --- 84,87 ---- *************** *** 100,107 **** def onMESSAGE(self, hwnd, msg, wp, lp): if msg==fw.WND_WM_NOTIFY: if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 nm=NMHDR.from_address(msgr.lParam) if nm.code==self.Msg.TTN_POP: --- 99,107 ---- def onMESSAGE(self, hwnd, msg, wp, lp): + if msg==fw.WND_WM_NOTIFY: if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect nm=NMHDR.from_address(msgr.lParam) if nm.code==self.Msg.TTN_POP: Index: checkbox.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/controls/checkbox.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** checkbox.py 15 May 2005 09:21:48 -0000 1.2 --- checkbox.py 2 Jul 2005 09:03:38 -0000 1.3 *************** *** 28,32 **** if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= 1 if msgr.msg==self.Msg.WM_DRAWITEM: --- 28,32 ---- if wp==fw.WND_NM_MSGREFLECT: msgr= fw.WND_MSGREFLECT.from_address(lp) ! msgr.fReturn= self._base_fMsgReflect if msgr.msg==self.Msg.WM_DRAWITEM: |
From: jürgen u. <cer...@us...> - 2005-07-02 08:56:14
|
Update of /cvsroot/wnd/wnd/wnd/api/clipformats In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25263 Added Files: .CVSIGNORE __init__.py dropeffect_performed.py dropeffect_prefered.py filename.py filenamemap.py hdropex.py hdropfiles.py htmlraw.py idlistarray.py null.py oemtext.py text.py unicodetext.py Log Message: bit of this and a bit of that --- NEW FILE: filenamemap.py --- from wnd.api.clipformats import * from ctypes import c_char_p, windll shell32= windll.shell32 #************************************************************* # dropped files format ("FileNameMap") #************************************************************* def ValueToHandle(paths): hMem= None ## unicode version ## #isunicode= False #if isunicode: # paths= '%s\x00\x00' % '\x00'.join(paths) # n= len(paths)*2 #else: paths= '%s\x00\x00' % '\x00'.join(paths) n= len(paths) hMem= kernel32.GlobalAlloc(GMEM_FIXED, n) if hMem: memmove(hMem, paths, n) return hMem def HandleToValue(hMem): paths= [] n= kernel32.GlobalSize(hMem) if n: p= create_string_buffer(n) mem= kernel32.GlobalLock(hMem) if mem: memmove(p, mem, n) x= 0 for n, i in enumerate(p): if i=='\x00': paths.append(p[x:n]) x= n +1 try: if p[n+1]=='\x00': break except: paths= [] break kernel32.GlobalUnlock(hMem) return paths #************************************************************* #************************************************************* class filenamemap(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("FileNameMap") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, data=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if data: self._set_value(data) def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = ValueToHandle(data) def _get_value(self): if self.stg.hGlobal: return HandleToValue(self.stg.hGlobal) def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(filenamemap, ['c:\\p', 'c:\\klmnopwqw','c:\\ssst']) if __name__=='__main__': test() --- NEW FILE: .CVSIGNORE --- *.pyc *.pyo --- NEW FILE: oemtext.py --- from wnd.api.clipformats import * from ctypes import c_char_p #************************************************************* # oem text format (CF_OEMTEXT) #************************************************************* CF_OEMTEXT = 7 class oemtext(object): fmt= FORMATETC() fmt.cfFormat = CF_OEMTEXT fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, text=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if text: self._set_value(text) def _set_value(self, text): if text==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = StringToHandle(text) def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= c_char_p value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #***************************************************************** def test(): testformat(oemtext, 'aaa\n bbb ccc\n ddd\n') if __name__=='__main__': test() --- NEW FILE: dropeffect_performed.py --- from wnd.api.clipformats import * from ctypes import c_ulong #************************************************************* # performed drop effect ("Performed DropEffect") #************************************************************* class Ddropeffect_performed(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("Performed DropEffect") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, value=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if value: self._set_value(value) def _set_value(self, value): if value==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 hMem = kernel32.GlobalAlloc(GMEM_FIXED, sizeof(c_ulong)) memmove(hMem, buffer(c_ulong(value))[:], sizeof(c_ulong)) self.stg.hGlobal= hMem def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= POINTER(c_ulong) value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) if value: return value[0] def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): DROPEFFECT_COPY = 1 testformat(dropeffect_performed, DROPEFFECT_COPY) if __name__=='__main__': test() --- NEW FILE: idlistarray.py --- from wnd.api.clipformats import * from wnd.api.shell import Malloc, PidlGetSize, PIDL, ITEMIDLIST #************************************************************* # idlist array "Shell IDList Array" #************************************************************* class CIDA(Structure): _fields_ = [("cidl", UINT), # n-offsets in offset array ("aoffset", UINT*1)] # var length offset array # the structure is followed by an array of IDLISTs, 1st the absolute of the folder, # then the relative of the items. aoffset is the offset of the next item from the # beginning of the structure. def HandleToValue(hMem): if hMem: n= kernel32.GlobalSize(hMem) if n >= sizeof(CIDA): kernel32.GlobalLock.restype= POINTER(CIDA) pCida= kernel32.GlobalLock(hMem) if pCida: ## get the offset array ## cidl seems to be +1 -- aoffset[1], is not counted addr= addressof(pCida[0]) offs= (UINT*(pCida[0].cidl+1)).from_address(addr + \ sizeof(UINT)) # copy ITEMIDLISTs from global mem to shell allocated mem out= [] for i in offs: error= True if addr +i <= addr + n: il= ITEMIDLIST.from_address(int(addr +i)) size= PidlGetSize(byref(il)) pMem= Malloc.Alloc(size) if pMem: if memmove(pMem, byref(il), size): out.append(PIDL(ITEMIDLIST.from_address(pMem))) error= False if error: for i in out: shell.PidlFree(i) return None return out def ValueToHandle(data): if data: ## prep the CIDA struct and fill in the offset members ## have to work with two arrays here cida= CIDA(len(data)-1) arrOffs= (UINT*(len(data)-1))() offs= sizeof(cida) + sizeof(arrOffs) for n, i in enumerate(data): if n==0: cida.aoffset[0]= offs else: arrOffs[n-1]= offs # append later offs += PidlGetSize(i) hMem= kernel32.GlobalAlloc(GMEM_FIXED, offs) if hMem: ## move the CIDA structure + array to global mem p= hMem memmove(hMem, byref(cida), sizeof(cida)) p += sizeof(cida) memmove(p, byref(arrOffs), sizeof(arrOffs)) p += sizeof(arrOffs) ## move the pIdls to global mem n= PidlGetSize(data[0]) memmove(p, data[0], n) p += n for n, i in enumerate(data[1:]): n= PidlGetSize(i) memmove(p, i, n) p += n return hMem return 0 #************************************************************* #************************************************************* class idlistarray(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("Shell IDList Array") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, data=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if data: self._set_value(data) def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = ValueToHandle(data) def _get_value(self): if self.stg.hGlobal: return HandleToValue(self.stg.hGlobal) def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): from wnd.api import shell from wnd.api import clipboard from wnd.api.ole import dataobject print '** test clipformatIDLISTARRAY*************************************' ## get some friendly pIdls ## pass them to our format and set it to clipboard pIdls, paths= [], [] sh= shell.ShellNamespace() sh.OpenSpecialFolder(shell.CLSIDL_DRIVES) pIdls.append(sh.GetCwd()) paths.append(sh.GetParseName()) for i in sh: pIdls.append(i) paths.append(sh.GetParseName(i)) il=idlistarray(pIdls) for i in pIdls: shell.PidlFree(i) pIdls= [] print 'set clipboard=%s' % paths[0] for i in paths[1:]: print ' %s' % i do= dataobject.DataObject(il) clipboard.SetDataObject(do) clipboard.Flush() il.value= None ## retrive the format from clipboard do2= clipboard.GetDataObject() if do2.HasFormat(il): do2.GetData(il) pIdls= il.value il.value= None paths2= [] if pIdls: sh.SetCwd(pIdls[0]) paths2.append(sh.GetParseName()) for i in pIdls[1:]: paths2.append(sh.GetParseName(i)) for i in pIdls: shell.PidlFree(i) print 'get clipboard=%s' % paths2[0] for i in paths2[1:]: print ' %s' % i else: print 'get clipboard=' if paths==paths2: print '<success>' else: print '<error>' print if __name__=='__main__': test() --- NEW FILE: null.py --- from wnd.api.clipformats import * #************************************************************************** # null format # # empty format or used to retrieve data or to setup a custom format # # return value of getattr('value') is allways the memory handle # of the storage medium # # fmt is defined at compile time, too, to make the test for # IsSameFormat(NULL, other) work. #************************************************************************ class null(object): fmt= FORMATETC() ## makes __eq__ work on the class and on the instance ## cos the instance may change in format fmt.cfFormat = 0 fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_NULL def __init__(self, fmt=None, stg=None): if fmt: self.fmt= fmt else: self.fmt= FORMATETC() self.fmt.cfFormat = 0 self.fmt.dwAspect = DVASPECT_CONTENT self.fmt.lindex = INDEX_ALL self.fmt.tymed = TYMED_NULL if stg: self.stg= stg else: self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed def _set_value(self, hMem): if hMem==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = hMem def _get_value(self): if self.stg.hGlobal: return self.stg.hGlobal def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) --- NEW FILE: filename.py --- from wnd.api.clipformats import * from ctypes import c_char_p #************************************************************* # filename format ("FileName") #************************************************************* class filename(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("FileName") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, path=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if path: self._set_value(path) def _set_value(self, path): if path==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = StringToHandle(path) def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= c_char_p value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(filename, 'c:\\klmnopwqw.ddd') if __name__=='__main__': test() --- NEW FILE: dropeffect_prefered.py --- from wnd.api.clipformats import * from ctypes import c_ulong #************************************************************* # prefered drop effect ("Preferred DropEffect") #************************************************************* class dropeffect_prefered(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("Preferred DropEffect") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, value=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if value: self._set_value(value) def _set_value(self, value): if value==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 hMem = kernel32.GlobalAlloc(GMEM_FIXED, sizeof(c_ulong)) memmove(hMem, buffer(c_ulong(value))[:], sizeof(c_ulong)) self.stg.hGlobal= hMem def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= POINTER(c_ulong) value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) if value: return value[0] def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): DROPEFFECT_COPY = 1 testformat(dropeffect_prefered, DROPEFFECT_COPY) if __name__=='__main__': test() --- NEW FILE: htmlraw.py --- from wnd.api.clipformats import * from ctypes import c_char_p #************************************************************* # raw html format (CF_HDROP) #************************************************************* class htmlraw(object): fmt= FORMATETC() fmt.cfFormat = RegisterClipboardFormat("HTML Format") fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, html=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if html: self._set_value(html) def _set_value(self, html): if html==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = StringToHandle(html) def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= c_char_p value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #****************************************************************************** ## just a simple test, not a test of the format def test(): testformat(htmlraw, 'aaa\n bbb ccc\n ddd\n') if __name__=='__main__': test() --- NEW FILE: __init__.py --- """helpers and data for clipboard and clipformats""" import imp, os from ctypes import windll from wnd.api.ole.wintypes import * kernel32= windll.kernel32 user32= windll.user32 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: _PATH= os.path.split(__file__)[0] #************************************************************************** #************************************************************************** CF_ASPECT = { DVASPECT_CONTENT:'content', DVASPECT_THUMBNAIL:'thumbnail', DVASPECT_ICON:'icon', DVASPECT_DOCPRINT:'docprint' } CF_TYMED = { TYMED_NULL:'null', TYMED_HGLOBAL:'hglobal', TYMED_FILE:'file', TYMED_ISTREAM:'stream', TYMED_ISTORAGE:'storage', TYMED_GDI:'gdi', TYMED_MFPICT:'mfpict', TYMED_ENHMF:'enhmf' } CF_INDEX= { INDEX_ALL:'all', } RegisterClipboardFormat= user32.RegisterClipboardFormatA CF_NAMES= ['null', 'text', 'bitmap', 'metafilepict', 'sylk', 'dif', 'tiff', 'oemtext', 'dib', 'palette', 'pendata', 'riff', 'wave', 'unicodetext', 'enhmetafile', 'hdrop', 'locale', 'dibv5',] FW_NAMES= { "html format": 'html', "shell idlist array": 'idlarray', "shell object offsets": 'objoffset', "net resource": 'netres', "filegroupdescriptor": 'filegroup', "filecontents": 'filecotents', "filename": 'filename', "printerfriendlyname": 'printername', "filenamemap": 'filenamemap', "uniformresourcelocator": 'url', "preferred dropeffect": 'dropeffect_prefered', "performed dropeffect": 'dropeffect_performed', "paste succeeded": 'pastesuceeded', "inshelldragloop": 'dragloop', } def GetFormatName(format, nBuffer=56): if format.fmt.cfFormat < 18: return CF_NAMES[format.fmt.cfFormat] p= create_string_buffer(nBuffer) user32.GetClipboardFormatNameA(format.fmt.cfFormat, p, nBuffer) if p.value: return p.value def GetFrameworkName(format): if format.fmt.cfFormat < 18: return CF_NAMES[format.fmt.cfFormat] try: return FW_NAMES[GetFormatName(format).lower()] except: pass def GetFormatNameN(nFormat, nBuffer=56): if nFormat < 18: return CF_NAMES[nFormat] p= create_string_buffer(nBuffer) user32.GetClipboardFormatNameA(nFormat) if p.value: return p.value def GetFrameworkNameN(nFormat): if nFormat < 18: return CF_NAMES[nFormat] try: return FW_NAMES[GetFormatNameN(nFormat).lower()] except: pass ## import format wrappers dynamically class _cf(object): def __getattribute__(self, name): try: mod= globals()[name] return getattr(mod, name) except: try: mod= imp.load_source(name, os.path.join(_PATH, '%s.py' % name)) globals()[name]= mod return getattr(mod, name) except IOError: raise ValueError, "no matching clipformat found: %s" % name except Exception, d: raise d cf= _cf() #******************************************************************* # helper methods for clipformat wrapper classes #******************************************************************* def IsSameFormat(fmt1, fmt2): if fmt1.fmt.cfFormat== fmt2.fmt.cfFormat: if fmt1.fmt.dwAspect==fmt2.fmt.dwAspect: if (fmt1.fmt.tymed == fmt2.fmt.tymed == 0) or \ (fmt1.fmt.tymed & fmt2.fmt.tymed): return True return False def Repr(format): name= GetFormatName(format) if name==None: name= 'unknown' if format.fmt.tymed== 0: tymed= CF_TYMED[0] else: out= [] for value, medname in CF_TYMED.items(): if format.fmt.tymed & value: out.append(medname) tymed= '/'.join(out) return "<wnd.cf.%s at %x {format=%s} {aspect=%s} {tymed=%s} {index=%s}>" % \ (format.__class__.__name__, id(format), name, CF_ASPECT[format.fmt.dwAspect], tymed, format.fmt.lindex ) GMEM_FIXED = 0 ## returns a chunk of global memory containing the passed string ## use GlobaFree to free it def StringToHandle(text): if isinstance(text, str): n= len(text) +1 elif isinstance(text, unicode): n= (len(text)*2) +2 else: raise ValueError, "string or unicode expected found: %s" % type(text) # no GlobalLock/unlock needed for GMEM_FIXED hMem = kernel32.GlobalAlloc(GMEM_FIXED, n) if hMem: if not memmove(hMem, text, n): raise MemoryError, "could not memmove text" else: raise MemoryError, "could alloc memory" return hMem ## test helper def testformat(FMT, data): from wnd.api import clipboard from wnd.api.ole import dataobject print '** test clipformat %s*************************************' % FMT.__name__ print 'set clipboard=%s' % repr(data) fmt= FMT(data) try: do= dataobject.DataObject(fmt) clipboard.SetDataObject(do) clipboard.Flush() fmt.value= None do2= clipboard.GetDataObject() if do2.HasFormat(fmt): print fmt.value do2.GetData(fmt) print 'get clipboard=%s' % repr(fmt.value) if fmt.value==data: print '<success>' else: print '<error>' finally: fmt.Close() print --- NEW FILE: hdropfiles.py --- from wnd.api.clipformats import * from ctypes import c_char_p, windll shell32= windll.shell32 #************************************************************* # dropped files format CF_HDROP #************************************************************* class DROPFILES(Structure): _fields_ = [("pFiles", DWORD), ("pt", POINT), ("fNC", BOOL), ("fWide", BOOL)] def ValueToHandle(paths): szeof= sizeof(DROPFILES) df= DROPFILES(szeof) hMem= None ## unicode version ## #isunicode= False #if isunicode: # paths= '%s\x00\x00' % '\x00'.join(paths) # n= len(paths)*2 #else: paths= '%s\x00\x00' % '\x00'.join(paths) n= len(paths) hMem= kernel32.GlobalAlloc(GMEM_FIXED, szeof + n) if hMem: memmove(hMem, byref(df), szeof) memmove(hMem+szeof, paths, n) return hMem def HandleToValue(hMem): out= [] result= shell32.DragQueryFileA(hMem, 0xFFFFFFFF, None, 0) p= create_string_buffer(260) for i in range(result): shell32.DragQueryFile(hMem, i, p, 260) out.append(p.value) return out ## seems to be quite some discussion about wether if zo pull in DropFinish ## for closing the mem handle or not. Noone knows and so do I. #************************************************************* #************************************************************* CF_HDROP = 15 class hdropfiles(object): fmt= FORMATETC() fmt.cfFormat = CF_HDROP fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, data=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if data: self._set_value(data) def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = ValueToHandle(data) def _get_value(self): if self.stg.hGlobal: return HandleToValue(self.stg.hGlobal) def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(hdropfiles, ['c:\\p', 'c:\\klmnopwqw','c:\\ssst']) if __name__=='__main__': test() --- NEW FILE: text.py --- from wnd.api.clipformats import * from ctypes import c_char_p #************************************************************* # ansi text format (CF_TEXT) #************************************************************* class CIDA(Structure): _fields_ = [("cidl", UINT), ("aoffset", UINT*1)] CF_TEXT= 1 class text(object): fmt= FORMATETC() fmt.cfFormat = CF_TEXT fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, text=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if text: self._set_value(text) def _set_value(self, text): if text==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = StringToHandle(text) def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= c_char_p value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(text,'aaa\n bbb ccc\n ddd\n') if __name__=='__main__': test() --- NEW FILE: unicodetext.py --- from wnd.api.clipformats import * from ctypes import c_wchar_p import locale LOCALE= locale.getdefaultlocale()[1] #************************************************************* # unicode text format (CF_UBICODETEXT) #************************************************************* CF_UNICODETEXT = 13 class unicodetext(object): fmt= FORMATETC() fmt.cfFormat = CF_UNICODETEXT fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, text=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if text: self._set_value(text) def _set_value(self, text): if text==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = StringToHandle(text) def _get_value(self): if self.stg.hGlobal: kernel32.GlobalLock.restype= c_wchar_p value= kernel32.GlobalLock(self.stg.hGlobal) kernel32.GlobalUnlock(self.stg.hGlobal) return value def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(unicodetext, u'aaa\n bbb ccc\n ddd\n') if __name__=='__main__': test() --- NEW FILE: hdropex.py --- from wnd.api.clipformats import * from ctypes import c_char_p, windll #************************************************************* # extended dropped files format CF_HDROP #************************************************************* class DROPFILES(Structure): _fields_ = [("pFiles", DWORD), ("pt", POINT), ("fNC", BOOL), ("fWide", BOOL)] def ValueToHandle(x, y, fClientarea, isunicode, paths): szeof= sizeof(DROPFILES) df= DROPFILES(szeof, (x, y), fClientarea and [0][0] or 1, isunicode and 1 or 0) hMem= None if isunicode: paths= '%s\x00\x00' % '\x00'.join(paths) n= len(paths)*2 else: paths= '%s\x00\x00' % '\x00'.join(paths) n= len(paths) hMem= kernel32.GlobalAlloc(GMEM_FIXED, szeof + n) if hMem: memmove(hMem, byref(df), szeof) memmove(hMem+szeof, paths, n) return hMem def HandleToValue(hMem): n= kernel32.GlobalSize(hMem) szeof= sizeof(DROPFILES) if n >= szeof: pdf= POINTER(DROPFILES).from_address(int(hMem)) ## int(hMem) ?? ## ctypes loves to raise here.. ## <int expected> df= pdf[0] paths= [] if df.pFiles >= szeof: if df.fWide: p= create_unicode_buffer(n-szeof) else: p= create_string_buffer(n-szeof) memmove(p, addressof(df)+szeof, n-szeof) x= 0 for n, i in enumerate(p): if i=='\x00': paths.append(p[x:n]) x= n +1 try: if p[n+1]=='\x00': break except: paths= [] break return (df.pt.x, df.pt.y, df.fNC, df.fWide, paths) #************************************************************* #************************************************************* CF_HDROP = 15 class hdropex(object): fmt= FORMATETC() fmt.cfFormat = CF_HDROP fmt.dwAspect = DVASPECT_CONTENT fmt.lindex = INDEX_ALL fmt.tymed = TYMED_HGLOBAL def __init__(self, data=None): self.stg= STGMEDIUM() self.stg.tymed = self.fmt.tymed if data: self._set_value(data) def _set_value(self, data): if data==None: self.stg.hGlobal= 0 else: if self.stg.hGlobal: self.stg.hGlobal= 0 self.stg.hGlobal = ValueToHandle(*data) def _get_value(self): if self.stg.hGlobal: return HandleToValue(self.stg.hGlobal) def Close(self): self.stg.hGlobal= 0 def __eq__(self, other): return IsSameFormat(self, other) def __repr__(self): return Repr(self) value= property(_get_value, _set_value) #**************************************************************************** def test(): testformat(hdropex, (12, 44, 1, 0, ['c:\\p', 'c:\\klmnopwqw','c:\\ssst'])) if __name__=='__main__': test() |
From: jürgen u. <cer...@us...> - 2005-07-02 08:54:19
|
Update of /cvsroot/wnd/wnd/wnd/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24691 Modified Files: resources.py win.py winpath.py Added Files: clipboard.py handles.py Log Message: bit of this and a bit of that Index: winpath.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/winpath.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** winpath.py 17 May 2005 20:05:33 -0000 1.2 --- winpath.py 2 Jul 2005 08:54:11 -0000 1.3 *************** *** 33,37 **** """ ! from ctypes import windll, create_string_buffer, string_at shlwapi= windll.shlwapi --- 33,39 ---- """ ! from ctypes import (windll, ! create_string_buffer, ! string_at) shlwapi= windll.shlwapi *************** *** 39,43 **** #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - def AddBackslash(path): p= create_string_buffer(path, size=len(path)+1) --- 41,44 ---- --- NEW FILE: handles.py --- import thread #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: class Handles(object): def __init__(self, initval=0): self.handles= [initval, ] self.lock= thread.allocate_lock() def GetHandles(self): #self.lock.acquire() handles= self.handles[:] #self.lock.release() return handles def Close(self, handle): #self.lock.acquire() try: self.handles.remove(handle) except: self.lock.release() raise ValueError, "no handle found to close" #self.lock.release() def New(self): #self.lock.acquire() result= None tmp_h= self.GetHandles() s= len(self.handles) for n, i in enumerate(tmp_h): if n+1 < s: if self.handles[n+1] > i+1: self.handles.insert(n+1, i+1) result= i+1 break else: self.handles.append(i+1) result= i+1 #self.lock.release() return result --- NEW FILE: clipboard.py --- """clipboard the ole way TODO SetClipboardViewer """ from wnd.api.ole.wintypes import (ole32, user32, byref, POINTER, pointer) from wnd.api.ole.dataobject import (DataObject, DataObjectPointer, IDataObject) from wnd.api.clipformats import (cf, GetFormatName, GetFrameworkName, GetFormatNameN, GetFrameworkNameN, RegisterClipboardFormat,) #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: def Clear(): result= False if user32.OpenClipboard(None): if user32.EmptyClipboard(): result= True user32.CloseClipboard() return result def IsFormatAvailable(format): return bool(user32.IsClipboardFormatAvailable(format.fmt.cfFormat)) def GetDataObject(): dataobject = DataObjectPointer() ole32.OleGetClipboard(dataobject.ptr) return dataobject def SetDataObject(dataobject): ole32.OleSetClipboard(0) result = ole32.OleSetClipboard(dataobject.GetComPointer()) def Flush(): return not ole32.OleFlushClipboard() def IsClipboard(dataobject): return not ole32.OleIsCurrentClipboard(dataobject.GetComPointer()) Index: resources.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/resources.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resources.py 15 May 2005 09:17:35 -0000 1.2 --- resources.py 2 Jul 2005 08:54:11 -0000 1.3 *************** *** 6,15 **** EnumResNames returns the identifyers of resources not their names for default resources so you can not use it in calls to functions - like this '#resid'. Even worse, I never made it to get the damn - MAKEINTRESOURCE makro to work. Could anyone enlighten me ?? - MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i))) - def MAKEINTRESOURCE(i): - """ --- 6,10 ---- Index: win.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/api/win.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** win.py 29 Apr 2005 15:19:57 -0000 1.1.1.1 --- win.py 2 Jul 2005 08:54:11 -0000 1.2 *************** *** 41,45 **** if n: p = create_string_buffer(n+ 1) ! caption = user32.GetWindowTextA(hwnd, p, n) return p.value --- 41,45 ---- if n: p = create_string_buffer(n+ 1) ! caption = user32.GetWindowTextA(hwnd, p, n+1) return p.value |
From: jürgen u. <cer...@us...> - 2005-07-02 08:51:41
|
Update of /cvsroot/wnd/wnd/wnd/api/clipformats In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23167/clipformats Log Message: Directory /cvsroot/wnd/wnd/wnd/api/clipformats added to the repository |
From: jürgen u. <cer...@us...> - 2005-07-02 08:51:15
|
Update of /cvsroot/wnd/wnd/wnd/api/ole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23039/ole Log Message: Directory /cvsroot/wnd/wnd/wnd/api/ole added to the repository |