diff --git a/samples/html2/simpleweb.zip b/samples/html2/simpleweb.zip new file mode 100644 index 00000000..ce537d37 Binary files /dev/null and b/samples/html2/simpleweb.zip differ diff --git a/samples/html2/webview_sample.html b/samples/html2/webview_sample.html index 3652d3be..30bb034f 100644 --- a/samples/html2/webview_sample.html +++ b/samples/html2/webview_sample.html @@ -20,8 +20,12 @@

Resources can also be loaded from custom file systems:

diff --git a/samples/html2/webview_sample.py b/samples/html2/webview_sample.py index bcf51fc1..22b6489c 100644 --- a/samples/html2/webview_sample.py +++ b/samples/html2/webview_sample.py @@ -10,7 +10,9 @@ BASE = 'file://{}/'.format(HERE.replace('\\', '/')) URL = BASE + 'webview_sample.html' LOGO = os.path.join(HERE, 'logo.png') -#print(wx.version()) +# We need to be in the HERE folder for the archive link to work since the sample +# page does not use a full path +os.chdir(HERE) #-------------------------------------------------------------------------- @@ -58,7 +60,10 @@ class WebViewPanel(wx.Panel): # Register a handler for the memory: file system self.wv.RegisterHandler(webview.WebViewFSHandler("memory")) - # And also one for the custom: file system implemented by the + # This handler takes care of links that are in zip files + self.wv.RegisterHandler(webview.WebViewArchiveHandler("wxzip")) + + # And this one is for the custom: file system implemented by the # CustomWebViewHandler class below self.wv.RegisterHandler(CustomWebViewHandler()) @@ -191,20 +196,21 @@ def SetupMemoryFiles(): # loaded into the webview just like network or local file sources. # These "files" can be access using a protocol specifier of "memory:" wx.FileSystem.AddHandler(wx.MemoryFSHandler()) + wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) wx.MemoryFSHandler.AddFile( - "page1.htm", + "page1.html", "File System Example" "" "

Page 1

" "

" "

This file was loaded directly from a virtual in-memory filesystem.

" - "

Here's another page: Page 2.

") + "

Here's another page: Page 2.

") wx.MemoryFSHandler.AddFile( - "page2.htm", + "page2.html", "File System Example" "" "

Page 2

" - "

Page 1 was better.

") + "

Page 1 was better.

") wx.MemoryFSHandler.AddFile( "test.css", "h1 {color: red;}")