From 63d29e11767f7d0ee2e77c4bdcf24b1448c86ae6 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Fri, 23 Jun 2017 18:48:52 -0700 Subject: [PATCH 1/7] Add ImageHandler derivations to module and do some tweaking. --- etg/image.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/etg/image.py b/etg/image.py index 1895a8f4..8b50df85 100644 --- a/etg/image.py +++ b/etg/image.py @@ -22,6 +22,9 @@ DOCSTRING = "" ITEMS = [ 'wxImage', 'wxImageHistogram', 'wxImageHandler', + 'wxTIFFHandler', + 'wxGIFHandler', + "wxPNGHandler" #'wxQuantize', #'wxPalette', ] @@ -575,6 +578,21 @@ def run(): c.find('DoCanRead').ignore(False) + #------------------------------------------------------- + c = module.find('wxTIFFHandler') + c.addPrivateCopyCtor() + c.find('GetLibraryVersionInfo').ignore() + + c.find('DoGetImageCount').ignore(False) + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for GIFHandler + # need to include anidecod.h, otherwise use of forward declared class + # compilation errors will occur. + module.addHeaderCode("#include ") + module.addItem(tools.wxArrayWrapperTemplate('wxImageArray', 'wxImage', module)) + #------------------------------------------------------- module.find('wxIMAGE_ALPHA_TRANSPARENT').pyInt = True From be9f39af9d049369fd82febb33c9888fdfe518ea Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Fri, 23 Jun 2017 18:55:33 -0700 Subject: [PATCH 2/7] Remove blind-tweaking for TIFFHandler --- etg/image.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/etg/image.py b/etg/image.py index 8b50df85..36814cdf 100644 --- a/etg/image.py +++ b/etg/image.py @@ -579,12 +579,7 @@ def run(): #------------------------------------------------------- - c = module.find('wxTIFFHandler') - c.addPrivateCopyCtor() - c.find('GetLibraryVersionInfo').ignore() - - c.find('DoGetImageCount').ignore(False) - c.find('DoCanRead').ignore(False) + # tweak for TIFFHandler, presently no tweaks needed. #------------------------------------------------------- # tweak for GIFHandler From 676b781862b5f2fff05371b5a9aff84cba962d1d Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sat, 24 Jun 2017 02:44:24 -0700 Subject: [PATCH 3/7] Added remaining Image Handler classes. Ignore DoCanRead in each to allow construction at runtime. --- etg/image.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/etg/image.py b/etg/image.py index 36814cdf..e2ff3896 100644 --- a/etg/image.py +++ b/etg/image.py @@ -24,7 +24,13 @@ ITEMS = [ 'wxImage', 'wxImageHandler', 'wxTIFFHandler', 'wxGIFHandler', - "wxPNGHandler" + "wxIFFHandler", + "wxJPEGHandler", + "wxPCXHandler", + "wxPNGHandler", + "wxPNMHandler", + "wxTGAHandler", + "wxXPMHandler" #'wxQuantize', #'wxPalette', ] @@ -577,17 +583,57 @@ def run(): c.find('DoGetImageCount').ignore(False) c.find('DoCanRead').ignore(False) - - #------------------------------------------------------- - # tweak for TIFFHandler, presently no tweaks needed. - #------------------------------------------------------- # tweak for GIFHandler # need to include anidecod.h, otherwise use of forward declared class # compilation errors will occur. + c = module.find('wxGIFHandler') + c.find('DoCanRead').ignore(False) + module.addHeaderCode("#include ") module.addItem(tools.wxArrayWrapperTemplate('wxImageArray', 'wxImage', module)) + #------------------------------------------------------- + # tweak for IFFHandler + c = module.find('wxIFFHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for JPEGHandler + c = module.find('wxJPEGHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for PCXHandler + c = module.find('wxPCXHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for PNGHandler + c = module.find('wxPNGHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for PNMHandler + c = module.find('wxPNMHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for TGAHandler + c = module.find('wxTGAHandler') + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for TIFFHandler + c = module.find('wxTIFFHandler') + c.find('GetLibraryVersionInfo').ignore() + c.find('DoCanRead').ignore(False) + + #------------------------------------------------------- + # tweak for XPMHandler + c = module.find('wxXPMHandler') + c.find('DoCanRead').ignore(False) + #------------------------------------------------------- module.find('wxIMAGE_ALPHA_TRANSPARENT').pyInt = True From 18584dc645bfca94b2b6566f3fcdb07a9d0f8e6c Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sat, 24 Jun 2017 10:47:53 -0700 Subject: [PATCH 4/7] Add tests for standard wxImageHandler derivations --- unittests/test_image.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/unittests/test_image.py b/unittests/test_image.py index d18ceaef..a27f88d0 100644 --- a/unittests/test_image.py +++ b/unittests/test_image.py @@ -260,7 +260,37 @@ class image_Tests(wtc.WidgetTestCase): imghndlr = TestImageHandler() wx.Image.AddHandler(imghndlr) + def test_imageHandlerStandardDerivations(self): + # checks that all of the standard wx derivations are available. + wx.GIFHandler() + wx.IFFHandler() + wx.JPEGHandler() + wx.PCXHandler() + wx.PNGHandler() + wx.PNMHandler() + wx.TGAHandler() + wx.TIFFHandler() + wx.XPMHandler() + def test_imageHandlerStandardDerivationsDerivation(self): + for cls in (wx.GIFHandler, wx.IFFHandler, wx.JPEGHandler, + wx.PCXHandler, wx.PNGHandler, wx.PNMHandler, + wx.TGAHandler, wx.TIFFHandler,wx.XPMHandler): + + class TestImageHandler(cls): + def __init__(self): + cls.__init__(self) + self.Name = "%s File" % cls.__name__ + self.Extension = "foo" + self.MimeType = 'image/foo' + self.Type = wx.BITMAP_TYPE_JPEG + + def DoCanRead(self, stream): + return True + + imghndlr = TestImageHandler() + wx.Image.AddHandler(imghndlr) + #--------------------------------------------------------------------------- From 1347d5c6be4a63ccb801ad6031661db0fca5139c Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sat, 24 Jun 2017 10:53:23 -0700 Subject: [PATCH 5/7] Use intended bitmap type in test --- unittests/test_image.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/unittests/test_image.py b/unittests/test_image.py index a27f88d0..f06f5bac 100644 --- a/unittests/test_image.py +++ b/unittests/test_image.py @@ -280,17 +280,19 @@ class image_Tests(wtc.WidgetTestCase): class TestImageHandler(cls): def __init__(self): cls.__init__(self) - self.Name = "%s File" % cls.__name__ - self.Extension = "foo" - self.MimeType = 'image/foo' - self.Type = wx.BITMAP_TYPE_JPEG + ext = cls.__name__.replace("Handler", "") + self.Name = "%s File" % ext + self.Extension = ext + self.MimeType = 'image/ext' + + self.Type = getattr(wx, "BITMAP_TYPE_%s" % ext) def DoCanRead(self, stream): return True imghndlr = TestImageHandler() wx.Image.AddHandler(imghndlr) - + #--------------------------------------------------------------------------- From ee59e9ca70a16aba01f0d623c673987e72e804ad Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Wed, 28 Jun 2017 18:22:26 -0700 Subject: [PATCH 6/7] Add ImageHandler classes to module --- docs/sphinx/itemToModuleMap.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index 86557ce3..7cff1ae2 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -1178,6 +1178,7 @@ "GBSpan":"wx.", "GCDC":"wx.", "GDIObject":"wx.", +"GIFHandler":"wx.", "GLCanvas":"wx.glcanvas.", "GLContext":"wx.glcanvas.", "GREEN":"wx.", @@ -1665,6 +1666,7 @@ "ID_ZOOM_FIT":"wx.", "ID_ZOOM_IN":"wx.", "ID_ZOOM_OUT":"wx.", +"IFFHandler":"wx.", "IMAGELIST_DRAW_FOCUSED":"wx.", "IMAGELIST_DRAW_NORMAL":"wx.", "IMAGELIST_DRAW_SELECTED":"wx.", @@ -1791,6 +1793,7 @@ "JOY_BUTTON3":"wx.", "JOY_BUTTON4":"wx.", "JOY_BUTTON_ANY":"wx.", +"JPEGHandler":"wx.", "Joystick":"wx.adv.", "JoystickEvent":"wx.", "KILL_ACCESS_DENIED":"wx.", @@ -2531,6 +2534,7 @@ "PAPER_TABLOID_EXTRA":"wx.", "PB_SMALL":"wx.", "PB_USE_TEXTCTRL":"wx.", +"PCXHandler":"wx.", "PD_APP_MODAL":"wx.", "PD_AUTO_HIDE":"wx.", "PD_CAN_ABORT":"wx.", @@ -2736,10 +2740,12 @@ "PG_VFB_SHOW_MESSAGE_ON_STATUSBAR":"wx.propgrid.", "PG_VFB_STAY_IN_PROPERTY":"wx.propgrid.", "PG_WINDOW_STYLES":"wx.propgrid.", +"PNGHandler":"wx.", "PNG_TYPE_COLOUR":"wx.", "PNG_TYPE_GREY":"wx.", "PNG_TYPE_GREY_RED":"wx.", "PNG_TYPE_PALETTE":"wx.", +"PNMHandler":"wx.", "POPUP_WINDOW":"wx.", "PORTRAIT":"wx.", "PORT_BASE":"wx.", @@ -5741,6 +5747,8 @@ "TE_RICH2":"wx.", "TE_RIGHT":"wx.", "TE_WORDWRAP":"wx.", +"TGAHandler":"wx.", +"TIFFHandler":"wx.", "TILE":"wx.", "TIMER_CONTINUOUS":"wx.", "TIMER_ONE_SHOT":"wx.", @@ -6256,6 +6264,7 @@ "XML_PI_NODE":"wx.xml.", "XML_TEXT_NODE":"wx.xml.", "XOR":"wx.", +"XPMHandler":"wx.", "XRCCTRL":"wx.xrc.", "XRCID":"wx.xrc.", "XRC_NO_RELOADING":"wx.xrc.", From 6c9c845d8cf8aa8174435955758916cbd51731de Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Wed, 28 Jun 2017 18:22:43 -0700 Subject: [PATCH 7/7] Update ext/wxWidgets --- ext/wxWidgets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/wxWidgets b/ext/wxWidgets index 8df55d69..74605c8e 160000 --- a/ext/wxWidgets +++ b/ext/wxWidgets @@ -1 +1 @@ -Subproject commit 8df55d69ddc11f8cfda6578256afdf5ad53f08b6 +Subproject commit 74605c8e0ea01a87ba233d40e93e5a1871b5f918