diff --git a/TODO.txt b/TODO.txt index 81b6524b..037409ec 100644 --- a/TODO.txt +++ b/TODO.txt @@ -131,7 +131,6 @@ other dev stuff * taskbar * print (as in print framework classes) - * dragimag * datectrl * hyperlink * pickerbase, clrpicker, filepicker, fontpicker diff --git a/docs/MigrationGuide.txt b/docs/MigrationGuide.txt index ff417bb9..941f85af 100644 --- a/docs/MigrationGuide.txt +++ b/docs/MigrationGuide.txt @@ -236,6 +236,8 @@ wx.ListCtrl public. Instead use the associated getter/setter methods or the auto-generated properties that are using them. + + wx.TreeCtrl ----------- @@ -250,3 +252,14 @@ wx.TreeCtrl [G|S]etItemPyData members still exist, but are now deprecated aliases for [G|S]etItemData. + + +wx.DragImage +------------ + +Phoenix is providing both wx.DragImage and wx.GenericDragImage classes. +Classic wxPython only provided wx.DragImage, but it was actually using +wx.GenericDragImage internally for all platforms. wx.DragImage will now be a +native implementation on Windows, and will still be the generic version +elsewhere. If you would rather use the generic implementation on Window to +then switch to using the wx.GenericDragImage class name. diff --git a/etg/_core.py b/etg/_core.py index 622ffb8f..70910b95 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -181,6 +181,7 @@ INCLUDES = [ # core 'settings', 'sysopt', 'artprov', + 'dragimag', ] diff --git a/etg/dragimag.py b/etg/dragimag.py new file mode 100644 index 00000000..deaf1d41 --- /dev/null +++ b/etg/dragimag.py @@ -0,0 +1,65 @@ +#--------------------------------------------------------------------------- +# Name: etg/dragimag.py +# Author: Robin Dunn +# +# Created: 09-Apr-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools +import copy + +PACKAGE = "wx" +MODULE = "_core" +NAME = "dragimag" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ "wxDragImage", + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + di = module.find('wxDragImage') + assert isinstance(di, etgtools.ClassDef) + + # make a copy and rename it to 'wxGenericDragImage' + gdi = copy.deepcopy(di) + assert isinstance(gdi, etgtools.ClassDef) + gdi.name = 'wxGenericDragImage' + for ctor in gdi.find('wxDragImage').all(): + ctor.name = 'wxGenericDragImage' + module.insertItemAfter(di, gdi) + + # now add some tweaks for wxDragImage + di.find('DoDrawImage').ignore() + di.find('GetImageRect').ignore() + di.find('UpdateBackingFromWindow').ignore() + di.addPrivateCopyCtor() + + # and for wxGenericDragImage + gdi.addPrivateCopyCtor() + + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/unittests/test_dragimag.py b/unittests/test_dragimag.py new file mode 100644 index 00000000..b451b675 --- /dev/null +++ b/unittests/test_dragimag.py @@ -0,0 +1,63 @@ +import imp_unittest, unittest +import wtc +import wx +import os + +pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') +icoFile = os.path.join(os.path.dirname(__file__), 'mondrian.ico') + +#--------------------------------------------------------------------------- + +class dragimag_Tests(wtc.WidgetTestCase): + + def test_dragimag1(self): + di = wx.DragImage() + + def test_dragimag2(self): + di = wx.DragImage(wx.Bitmap(pngFile)) + + def test_dragimag3(self): + di = wx.DragImage(wx.Icon(icoFile)) + + def test_dragimag4(self): + di = wx.DragImage("Some draggable text") + + def test_dragimag5(self): + ctrl = wx.TreeCtrl(self.frame) + root = ctrl.AddRoot('root item') + di = wx.DragImage(ctrl, root) + + def test_dragimag6(self): + ctrl = wx.ListCtrl(self.frame, style=wx.LC_REPORT) + ctrl.AppendColumn('hello') + idx = ctrl.InsertItem(0, "a list item") + di = wx.DragImage(ctrl, idx) + + + def test_genericdragimag1(self): + di = wx.GenericDragImage() + + def test_genericdragimag2(self): + di = wx.GenericDragImage(wx.Bitmap(pngFile)) + + def test_genericdragimag3(self): + di = wx.GenericDragImage(wx.Icon(icoFile)) + + def test_genericdragimag4(self): + di = wx.GenericDragImage("Some draggable text") + + def test_genericdragimag5(self): + ctrl = wx.TreeCtrl(self.frame) + root = ctrl.AddRoot('root item') + di = wx.GenericDragImage(ctrl, root) + + def test_genericdragimag6(self): + ctrl = wx.ListCtrl(self.frame, style=wx.LC_REPORT) + ctrl.AppendColumn('hello') + idx = ctrl.InsertItem(0, "a list item") + di = wx.GenericDragImage(ctrl, idx) + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()