Example #1
0
static PyObject * 
openBrowserHTML(PyObject *self, PyObject *args) 
{
    const char* HtmlCode;
    const char* BaseUrl;
    const char* TabName = "Browser";
    if (! PyArg_ParseTuple(args, "ss|s",&HtmlCode,&BaseUrl,&TabName))
        return NULL; 
    
    PY_TRY {
        QMdiSubWindow* browserView = 0;
        QMdiArea* mdiArea = Gui::getMainWindow()->findChild<QMdiArea*>();
        QList<QMdiSubWindow *> mdiViews = mdiArea->subWindowList();
        for (QList<QMdiSubWindow *>::iterator it = mdiViews.begin(); it != mdiViews.end(); ++it) {
            if (qobject_cast<WebGui::BrowserView*>((*it)->widget())) {
                browserView = *it;
                break;
            }
        }

        if (!browserView) {
            WebGui::BrowserView* pcBrowserView = 0;
            pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
            pcBrowserView->resize(400, 300);
            pcBrowserView->setHtml(QString::fromUtf8(HtmlCode),QUrl(QString::fromLatin1(BaseUrl)),QString::fromUtf8(TabName));
            Gui::getMainWindow()->addWindow(pcBrowserView);
        }
        else {
            mdiArea->setActiveSubWindow(browserView);
        }
    } PY_CATCH;

    Py_Return; 
}
Example #2
0
    Py::Object openBrowserHTML(const Py::Tuple& args)
    {
        const char* HtmlCode;
        const char* BaseUrl;
        char* TabName = nullptr;
        if (! PyArg_ParseTuple(args.ptr(), "ss|et", &HtmlCode, &BaseUrl, "utf-8", &TabName))
            throw Py::Exception();

        std::string EncodedName = "Browser";
        if (TabName) {
            EncodedName = std::string(TabName);
            PyMem_Free(TabName);
        }

        WebGui::BrowserView* pcBrowserView = 0;
        pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
        pcBrowserView->resize(400, 300);
        pcBrowserView->setHtml(QString::fromUtf8(HtmlCode),QUrl(QString::fromLatin1(BaseUrl)));
        pcBrowserView->setWindowTitle(QString::fromUtf8(EncodedName.c_str()));
        Gui::getMainWindow()->addWindow(pcBrowserView);
        if (!Gui::getMainWindow()->activeWindow())
            Gui::getMainWindow()->setActiveWindow(pcBrowserView);

        return Py::None();
    }
Example #3
0
    Py::Object openBrowserHTML(const Py::Tuple& args)
    {
        const char* HtmlCode;
        const char* BaseUrl;
        const char* TabName = "Browser";
        if (! PyArg_ParseTuple(args.ptr(), "ss|s",&HtmlCode,&BaseUrl,&TabName))
            throw Py::Exception();

        WebGui::BrowserView* pcBrowserView = 0;
        pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
        pcBrowserView->resize(400, 300);
        pcBrowserView->setHtml(QString::fromUtf8(HtmlCode),QUrl(QString::fromLatin1(BaseUrl)),QString::fromUtf8(TabName));
        Gui::getMainWindow()->addWindow(pcBrowserView);

        return Py::None();
    }
Example #4
0
    Py::Object openBrowser(const Py::Tuple& args)
    {
        const char* url;
        if (!PyArg_ParseTuple(args.ptr(), "s",&url))
            throw Py::Exception();

        WebGui::BrowserView* pcBrowserView;

        pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
        pcBrowserView->setWindowTitle(QObject::tr("Browser"));
        pcBrowserView->resize(400, 300);
        pcBrowserView->load(url);
        Gui::getMainWindow()->addWindow(pcBrowserView);

        return Py::None();
    }
Example #5
0
/* module functions */
static PyObject * 
openBrowser(PyObject *self, PyObject *args) 
{
    const char* Url;
    if (! PyArg_ParseTuple(args, "s",&Url))
        return NULL; 
    
    PY_TRY {

        WebGui::BrowserView* pcBrowserView;

        pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());   
        pcBrowserView->setWindowTitle(QObject::tr("Browser"));
        pcBrowserView->resize(400, 300);
        pcBrowserView->load(Url);
        Gui::getMainWindow()->addWindow(pcBrowserView);

    } PY_CATCH;

    Py_Return; 
}
Example #6
0
    Py::Object openBrowserWindow(const Py::Tuple& args)
    {
        char* TabName = nullptr;
        if (!PyArg_ParseTuple(args.ptr(), "|et", "utf-8", &TabName))
            throw Py::Exception();

        std::string EncodedName = "Browser";
        if (TabName) {
            EncodedName = std::string(TabName);
            PyMem_Free(TabName);
        }

        WebGui::BrowserView* pcBrowserView = 0;
        pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
        pcBrowserView->resize(400, 300);
        pcBrowserView->setWindowTitle(QString::fromUtf8(EncodedName.c_str()));
        Gui::getMainWindow()->addWindow(pcBrowserView);
        if (!Gui::getMainWindow()->activeWindow())
            Gui::getMainWindow()->setActiveWindow(pcBrowserView);

        return Py::asObject(pcBrowserView->getPyObject());
    }