From 9760539742c6705706837d37a9fd0e12eb121722 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 22 Feb 2013 06:20:36 +0000 Subject: [PATCH] Add declarations of the pure virtuals for the file-system handler classes so they can be instantiated, and some unittests. Update wx.tools.helpviewer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73557 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/filesys.py | 21 ++++++++++++++++++++- unittests/test_filesys.py | 10 ++++++++++ wx/tools/helpviewer.py | 7 +++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/etg/filesys.py b/etg/filesys.py index 952d1da4..218245eb 100644 --- a/etg/filesys.py +++ b/etg/filesys.py @@ -43,22 +43,41 @@ def run(): c.find('AddHandler.handler').transfer = True c.find('RemoveHandler').transferBack = True + c = module.find('wxFileSystemHandler') + c.find('GetAnchor').ignore(False) + c.find('GetLeftLocation').ignore(False) + c.find('GetProtocol').ignore(False) + c.find('GetRightLocation').ignore(False) + + + def _fixHandlerClass(klass): + klass.addItem(etgtools.WigCode("""\ + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + """)) + + c = module.find('wxArchiveFSHandler') c.addPrivateCopyCtor(); module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")') + _fixHandlerClass(c) c = module.find('wxFSFile') c.addPrivateCopyCtor(); + _fixHandlerClass(c) c = module.find('wxFilterFSHandler') c.addPrivateCopyCtor(); + _fixHandlerClass(c) c = module.find('wxInternetFSHandler') c.addPrivateCopyCtor(); + _fixHandlerClass(c) - c = module.find('wxMemoryFSHandler') c.addPrivateCopyCtor(); + _fixHandlerClass(c) + #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/unittests/test_filesys.py b/unittests/test_filesys.py index 8214b082..72689865 100644 --- a/unittests/test_filesys.py +++ b/unittests/test_filesys.py @@ -19,6 +19,16 @@ class filesys_Tests(wtc.WidgetTestCase): wx.InternetFSHandler wx.ZipFSHandler + def test_filesys02(self): + wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) + + def test_filesys03(self): + wx.FileSystem.AddHandler(wx.InternetFSHandler()) + + def test_filesys04(self): + wx.FileSystem.AddHandler(wx.MemoryFSHandler()) + + # TODO: Add more tests. #--------------------------------------------------------------------------- diff --git a/wx/tools/helpviewer.py b/wx/tools/helpviewer.py index 48fe6ef5..6f322eca 100644 --- a/wx/tools/helpviewer.py +++ b/wx/tools/helpviewer.py @@ -5,8 +5,7 @@ # Author: Robin Dunn # # Created: 11-Dec-2002 -# RCS-ID: $Id$ -# Copyright: (c) 2002 by Total Control Software +# Copyright: (c) 2013 by Total Control Software # Licence: wxWindows license #---------------------------------------------------------------------- @@ -50,7 +49,7 @@ def main(args=sys.argv): import wx import wx.html - app = wx.PySimpleApp() + app = wx.App() #wx.Log.SetActiveTarget(wx.LogStderr()) wx.Log.SetLogLevel(wx.LOG_Error) @@ -60,7 +59,7 @@ def main(args=sys.argv): cfg = wx.ConfigBase.Get() # Add the Zip filesystem - wx.FileSystem.AddHandler(wx.ZipFSHandler()) + wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) # Create the viewer helpctrl = wx.html.HtmlHelpController()