From fada0e87f3faf90d6a57175338bbb65cdbd0e6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ru=C5=BEa?= Date: Tue, 16 Aug 2022 12:03:22 +0200 Subject: [PATCH] Include usage of `wxMemoryFSHandler` in webview demo --- demo/HTML2_WebView.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/demo/HTML2_WebView.py b/demo/HTML2_WebView.py index 4adb2cf6..c0817333 100644 --- a/demo/HTML2_WebView.py +++ b/demo/HTML2_WebView.py @@ -47,6 +47,12 @@ class TestPanel(wx.Panel): # Create the WebView self.wv = webview.WebView.New(self, backend=backend) + # Register a virtual FS handler for the "memory" scheme + memory = wx.MemoryFSHandler() + wx.FileSystem.AddHandler(memory) + memory.AddFileWithMimeType('hello', 'Hello!', 'text/plain') + self.wv.RegisterHandler(wx.html2.WebViewFSHandler('memory')) + self.Bind(webview.EVT_WEBVIEW_NAVIGATING, self.OnWebViewNavigating, self.wv) self.Bind(webview.EVT_WEBVIEW_LOADED, self.OnWebViewLoaded, self.wv) @@ -79,7 +85,8 @@ class TestPanel(wx.Panel): self, -1, "", style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER) self.location.AppendItems(['http://wxPython.org', 'http://wxwidgets.org', - 'http://google.com']) + 'http://google.com', + 'memory:hello']) self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location) self.location.Bind(wx.EVT_TEXT_ENTER, self.OnLocationEnter) btnSizer.Add(self.location, 1, wx.EXPAND|wx.ALL, 2)