From 49ea7ed8ddffd2beb41ad01b0e32a48873f2079f Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 7 Sep 2020 14:33:04 +0200 Subject: [PATCH] Web: [skip ci] allow to directly load local (X)HTML files with file browser --- src/Mod/Web/Gui/AppWebGui.cpp | 8 ++++++++ src/Mod/Web/InitGui.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/Mod/Web/Gui/AppWebGui.cpp b/src/Mod/Web/Gui/AppWebGui.cpp index 8901e04957..016abf531e 100644 --- a/src/Mod/Web/Gui/AppWebGui.cpp +++ b/src/Mod/Web/Gui/AppWebGui.cpp @@ -62,6 +62,14 @@ public: ); add_varargs_method("openBrowserWindow",&Module::openBrowserWindow ); + add_varargs_method("open",&Module::openBrowser, + "open(string)\n" + "Load a local (X)HTML file." + ); + add_varargs_method("insert",&Module::openBrowser, + "insert(string)\n" + "Load a local (X)HTML file." + ); initialize("This module is the WebGui module."); // register with Python } diff --git a/src/Mod/Web/InitGui.py b/src/Mod/Web/InitGui.py index 87dd9575a3..a3daa1455f 100644 --- a/src/Mod/Web/InitGui.py +++ b/src/Mod/Web/InitGui.py @@ -47,4 +47,7 @@ class WebWorkbench ( Workbench ): Gui.addWorkbench(WebWorkbench()) +# Append the open handler +FreeCAD.addImportType("Web Page (*.html *.xhtml)", "WebGui") + FreeCAD.__unit_test__ += [ "TestWebGui" ]