Support tabs in the runtime browser.

Added functionality to open different website link and load the
website data to different tab. To achieve this, new customized
QTabWidget and QWebView are added to render the data to WebView
widget. All the widgets (New Tab, WebViewWinodw, and QToolButton)
are added dynamically. QToolButton is used to traverse back and
forward to web document opened in WebViewWindow.

Introduced the New class called WebViewWindow which is derived
from QWebView. Each tab of the QTabWidget contains the instance
of WebViewWindow class. WebViewWindow class is useful to display
the web document.

Introduced New class called TabWindow which is derived from
QTabWidget. This class is useful to achieve following functionality:
  - Customize the close button of tabbar so that it can only be
    visible other then main pgAdmin 4 window.
  - Enable/Disable the toolbutton added left side of tabbar
    depending on the web history traversed by the user in WebViewWindow.
  - Set the tooltip text of the tabbar depending on the title change
    event of WebViewWindow class.

Modified the Qt project file to support the both the version
of python 2 and python 3.

Qt5 is recommended to test pgAdmin4 in dektop mode.
This commit is contained in:
Neel Patel
2016-01-18 14:33:28 +00:00
committed by Dave Page
parent 94bed721bd
commit 8f146ebb4c
11 changed files with 639 additions and 42 deletions

View File

@@ -2,7 +2,7 @@
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013, The pgAdmin Development Team
// Copyright (C) 2013 - 2016, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// Server.cpp - Thread in which the web server will run.
@@ -26,9 +26,22 @@ Server::Server(quint16 port)
{
// Appserver port
m_port = port;
m_wcAppName = NULL;
// Initialise Python
Py_NoSiteFlag=1;
// Python3 requires conversion of char * to wchar_t *, so...
#ifdef PYTHON2
Py_SetProgramName(PGA_APP_NAME.toUtf8().data());
#else
char *appName = PGA_APP_NAME.toUtf8().data();
const size_t cSize = strlen(appName)+1;
m_wcAppName = new wchar_t[cSize];
mbstowcs (m_wcAppName, appName, cSize);
Py_SetProgramName(m_wcAppName);
#endif
Py_Initialize();
// Setup the search path
@@ -44,13 +57,22 @@ Server::Server(quint16 port)
PyObject* sysPath = PySys_GetObject((char*)"path");
// Add new additional path elements
for (int i = 0; i < path_list.size(); ++i)
for (int i = path_list.size() - 1; i >= 0 ; --i)
{
#ifdef PYTHON2
PyList_Append(sysPath, PyString_FromString(path_list.at(i).toUtf8().data()));
#else
PyList_Append(sysPath, PyBytes_FromString(path_list.at(i).toUtf8().data()));
#endif
}
}
}
Server::~Server()
{
if (m_wcAppName)
delete m_wcAppName;
// Shutdown Python
Py_Finalize();
}