Added Gui.showDownloads() py function to show the download manager, and allow to click https links in webgui browser

This commit is contained in:
Yorik van Havre
2014-08-31 16:51:51 -03:00
parent 4d58575ddf
commit 7f6a22c787
3 changed files with 15 additions and 1 deletions

View File

@@ -236,6 +236,8 @@ public:
PYFUNCDEF_S(sDoCommand);
PYFUNCDEF_S(sDoCommandGui);
PYFUNCDEF_S(sAddModule);
PYFUNCDEF_S(sShowDownloads);
static PyMethodDef Methods[];

View File

@@ -44,6 +44,7 @@
#include "Workbench.h"
#include "WorkbenchManager.h"
#include "Language/Translator.h"
#include "DownloadManager.h"
#include <App/DocumentObjectPy.h>
#include <App/PropertyFile.h>
#include <Base/Interpreter.h>
@@ -142,6 +143,9 @@ PyMethodDef Application::Methods[] = {
{"addModule", (PyCFunction) Application::sAddModule, 1,
"addModule(string) -> None\n\n"
"Prints the given module import only once in the macro recording"},
{"showDownloads", (PyCFunction) Application::sShowDownloads,1,
"showDownloads() -> None\n\n"
"Shows the downloads manager window"},
{NULL, NULL} /* Sentinel */
};
@@ -865,3 +869,11 @@ PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject *
Command::addModule(Command::Doc,pstr);
return Py_None;
}
PyObject* Application::sShowDownloads(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Gui::Dialog::DownloadManager::getInstance();
return Py_None;
}

View File

@@ -145,7 +145,7 @@ void BrowserView::onLinkClicked (const QUrl & url)
//QString fragment = url. fragment();
if (scheme==QString::fromLatin1("http")) {
if (scheme==QString::fromLatin1("http") || scheme==QString::fromLatin1("https")) {
load(url);
}
// Small trick to force opening a link in an external browser: use exthttp or exthttp