Drop Webkit from 1.3.X

This commit is contained in:
Julien Duponchelle
2015-12-08 11:44:21 +01:00
parent 8983e6c5a9
commit e736fbbb87
17 changed files with 1 additions and 551 deletions

View File

@@ -1,81 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from ..qt import QtCore, QtGui, QtWebKit
from ..ui.getting_started_dialog_ui import Ui_GettingStartedDialog
from ..utils.get_resource import get_resource
from ..local_config import LocalConfig
class GettingStartedDialog(QtGui.QDialog, Ui_GettingStartedDialog):
"""
GettingStarted dialog.
"""
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.uiWebView.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
self.uiWebView.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self.adjustSize()
self.uiWebView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
self.uiWebView.linkClicked.connect(self._urlClickedSlot)
self._local_config = LocalConfig.instance()
gui_settings = self._local_config.loadSectionSettings("GUI", {"hide_getting_started_dialog": False})
self.uiCheckBox.setChecked(gui_settings["hide_getting_started_dialog"])
getting_started = get_resource(os.path.join("static", "getting_started.html"))
if getting_started and not (sys.platform.startswith("win") and not sys.maxsize > 2 ** 32):
# do not show the page on Windows 32-bit (crash when no Internet connection)
self.uiWebView.load(QtCore.QUrl.fromLocalFile(getting_started))
else:
self.uiCheckBox.setChecked(True)
self.accept()
def showit(self):
"""
Either this dialog should be automatically showed at startup.
:returns: boolean
"""
return not self.uiCheckBox.isChecked()
def done(self, result):
"""
This dialog is closed.
:param result: ignored
"""
self._local_config.saveSectionSettings("GUI", {"hide_getting_started_dialog": self.uiCheckBox.isChecked()})
QtGui.QDialog.done(self, result)
def _urlClickedSlot(self, url):
"""
Opens a clicked URL using user's default browser.
:param url: URL to open
"""
if QtGui.QDesktopServices.openUrl(url) is False:
QtGui.QMessageBox.critical(self, "Getting started", "Failed to open the URL: {}".format(url))

View File

@@ -108,15 +108,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self._analytics_client = AnalyticsClient()
self.loading_cloud_project = False
self._uiNewsDockWidget = None
if not self._settings["hide_news_dock_widget"]:
try:
from .news_dock_widget import NewsDockWidget
self._uiNewsDockWidget = NewsDockWidget(self)
self.addDockWidget(QtCore.Qt.DockWidgetArea(QtCore.Qt.BottomDockWidgetArea), self._uiNewsDockWidget)
except ImportError:
pass
# restore the geometry and state of the main window.
local_config = LocalConfig.instance()
gui_settings = local_config.loadSectionSettings("GUI", {"geometry": "",
@@ -297,7 +288,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# help menu connections
self.uiOnlineHelpAction.triggered.connect(self._onlineHelpActionSlot)
self.uiCheckForUpdateAction.triggered.connect(self._checkForUpdateActionSlot)
self.uiGettingStartedAction.triggered.connect(self._gettingStartedActionSlot)
self.uiLabInstructionsAction.triggered.connect(self._labInstructionsActionSlot)
self.uiAboutQtAction.triggered.connect(self._aboutQtActionSlot)
self.uiAboutAction.triggered.connect(self._aboutActionSlot)
@@ -902,24 +892,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
network_reply.deleteLater()
def _gettingStartedActionSlot(self, auto=False):
"""
Slot to open the news dialog.
"""
try:
# QtWebKit which is used by GettingStartedDialog is not installed
# by default on FreeBSD, Solaris and possibly other systems.
from .dialogs.getting_started_dialog import GettingStartedDialog
except ImportError:
return
dialog = GettingStartedDialog(self)
if auto is True and dialog.showit() is False:
return
dialog.show()
dialog.exec_()
def _labInstructionsActionSlot(self, silent=False):
"""
Slot to open lab instructions.
@@ -1139,13 +1111,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
root = logging.getLogger()
root.addHandler(logging.StreamHandler(sys.stdout))
if self._uiNewsDockWidget and not self._uiNewsDockWidget.isVisible():
self.addDockWidget(QtCore.Qt.DockWidgetArea(QtCore.Qt.BottomDockWidgetArea), self._uiNewsDockWidget)
local_config = LocalConfig.instance()
gui_settings = local_config.loadSectionSettings("GUI", {"hide_getting_started_dialog": False})
if gui_settings["hide_getting_started_dialog"] is not True:
self._gettingStartedActionSlot(auto=True)
gui_settings = local_config.loadSectionSettings("GUI", {})
# connect to the local server
servers = Servers.instance()

View File

@@ -1,115 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from .qt import QtGui, QtCore, QtWebKit
from .ui.news_dock_widget_ui import Ui_NewsDockWidget
from .utils.get_resource import get_resource
import logging
log = logging.getLogger(__name__)
class NewsDockWidget(QtGui.QDockWidget, Ui_NewsDockWidget):
"""
:param parent: parent widget
"""
def __init__(self, parent):
QtGui.QDockWidget.__init__(self, parent)
self.setupUi(self)
self._visible = True
self.visibilityChanged.connect(self._visibilityChangedSlot)
self.uiWebView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
self.uiWebView.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self.uiWebView.linkClicked.connect(self._urlClickedSlot)
self.uiWebView.loadFinished.connect(self._loadFinishedSlot)
self._refresh_timer = QtCore.QTimer(self)
self._refresh_timer.timeout.connect(self._refreshSlot)
self._refresh_timer.start(300000)
self._timer = QtCore.QTimer(self)
self._timer.timeout.connect(self._loadFinishedSlot)
self._timer.setSingleShot(True)
self._timer.start(5000)
if parent.settings()["default_local_news"]:
self._loadFinishedSlot()
else:
self.uiWebView.load(QtCore.QUrl("http://as.gns3.com/software/docked_200x200.html"))
def _visibilityChangedSlot(self, visible):
"""
Slot for visibility changed signal.
:param visible: either the dock is visible or not
"""
self._visible = visible
def isVisible(self):
return self._visible
def closeEvent(self, event):
"""
You really cannot close that dock (using ATL+F4...)
:param event: closeEvent instance.
"""
event.ignore()
def _refreshSlot(self):
"""
Refeshes the page.
"""
self.uiWebView.reload()
def _urlClickedSlot(self, url):
"""
Opens a clicked URL using user's default browser.
:param url: URL to open
"""
if QtGui.QDesktopServices.openUrl(url) is False:
QtGui.QMessageBox.critical(self, "Getting started", "Failed to open the URL: {}".format(url))
def _loadFinishedSlot(self, result=False):
"""
Slot called when the web page has been loaded.
:param result: boolean
"""
self.uiWebView.loadFinished.disconnect(self._loadFinishedSlot)
self._timer.stop()
self._timer.timeout.disconnect()
if result is False:
self._refresh_timer.stop()
# load a local resource if the page is not available
gns3_jungle = get_resource(os.path.join("static", "gns3_jungle.html"))
if gns3_jungle and not (sys.platform.startswith("win") and not sys.maxsize > 2 ** 32):
# do not show the page on Windows 32-bit (crash when no Internet connection)
self.uiWebView.load(QtCore.QUrl.fromLocalFile(gns3_jungle))
else:
self.hide()

View File

@@ -46,12 +46,6 @@ if DEFAULT_BINDING == 'PyQt':
sys.modules[__name__ + '.QtNetwork'] = QtNetwork
sys.modules[__name__ + '.QtSvg'] = QtSvg
try:
from PyQt4 import QtWebKit
sys.modules[__name__ + '.QtWebKit'] = QtWebKit
except ImportError:
pass
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
@@ -65,12 +59,6 @@ elif DEFAULT_BINDING == 'PySide':
sys.modules[__name__ + '.QtNetwork'] = QtNetwork
sys.modules[__name__ + '.QtSvg'] = QtSvg
try:
from PySide import QtWebKit
sys.modules[__name__ + '.QtWebKit'] = QtWebKit
except ImportError:
pass
QtCore.QT_VERSION_STR = QtCore.__version__
QtCore.BINDING_VERSION_STR = __version__

View File

@@ -214,8 +214,6 @@ GENERAL_SETTINGS = {
"auto_close_console": True,
"bring_console_to_front": True,
"delay_console_all": 500,
"default_local_news": False,
"hide_news_dock_widget": False,
"debug_level": 0,
}
@@ -234,8 +232,6 @@ GENERAL_SETTING_TYPES = {
"auto_close_console": bool,
"bring_console_to_front": bool,
"delay_console_all": int,
"default_local_news": bool,
"hide_news_dock_widget": bool,
"debug_level": int,
}

0
gns3/static/.keep Normal file
View File

View File

@@ -1,94 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#startScreen {
font-family: 'Myriad Pro', Arial, Gadget, sans-serif;
font-size: 14px;
color: #000;
width: 706px;
padding: 20px;
}
#startScreen h1 {
font-family: 'Myriad Pro', Arial, Gadget, sans-serif;
text-transform: uppercase;
font-size: 42px;
line-height: 42px;
margin: 0;
}
#startScreen h2 {
font-family: 'Myriad Pro', Arial, Gadget, sans-serif;
text-transform: uppercase;
font-size: 18px;
line-height: 18px;
margin-top: 0;
padding-bottom: 10px;
}
#startScreen p {
padding: 20px 0;
}
#startScreen .clear {
clear: both;
}
#startScreen a {
border: 0;
width: 221px;
height: 192px;
margin-bottom: 21px;
float: left;
}
#startScreen a.gettingStarted {
background: url("images/gettingStarted.jpg") no-repeat;
margin-right: 21px;
}
#startScreen a.documentation {
background: url("images/documentation.jpg") no-repeat;
margin-right: 21px;
}
#startScreen a.userGroups {
background: url("images/userGroups.jpg") no-repeat;
}
#startScreen a.instantSupport {
background: url("images/instantSupport.jpg") no-repeat;
margin-right: 21px;
}
#startScreen a.gns3Jungle {
background: url("images/gns3Jungle.jpg") no-repeat;
width: 464px;
}
#startScreen a.networkingBlog {
background: url("images/networkingBlog.jpg") no-repeat;
margin-right: 21px;
}
#startScreen a.reportABug {
background: url("images/reportABug.jpg") no-repeat;
margin-right: 21px;
}
</style>
</head>
<body>
<div id="startScreen">
<h1>WELCOME TO GNS3</h1>
<h2>NOT SURE WHERE TO START? MIND IF WE GIVE YOU A HAND?</h2>
<a class="networkingBlog" href="https://community.gns3.com/community/connect/community-blog"></a>
<a class="documentation" href="https://community.gns3.com/community/software/documentation"></a>
<a class="userGroups" href="https://community.gns3.com/community/connect/groups"></a>
<a class="reportABug" href="https://community.gns3.com/community/software/bug"></a>
<a class="gns3Jungle" href="https://community.gns3.com/"></a>
<div class="clear"></div>
</div>
</body>
</html>

View File

@@ -1,9 +0,0 @@
<html>
<head>
<title>GNS3 Jungle</title>
</head>
<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>
<a href="https://community.gns3.com"><img width="200" height="200" src="images/gns3_jungle.png"></a>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,67 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/getting_started_dialog.ui'
#
# Created: Thu Oct 16 19:58:05 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_GettingStartedDialog(object):
def setupUi(self, GettingStartedDialog):
GettingStartedDialog.setObjectName(_fromUtf8("GettingStartedDialog"))
GettingStartedDialog.resize(778, 593)
GettingStartedDialog.setModal(True)
self.gridLayout = QtGui.QGridLayout(GettingStartedDialog)
self.gridLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.uiWebView = QtWebKit.QWebView(GettingStartedDialog)
self.uiWebView.setMinimumSize(QtCore.QSize(760, 540))
self.uiWebView.setMaximumSize(QtCore.QSize(760, 540))
self.uiWebView.setProperty("url", QtCore.QUrl(_fromUtf8("about:blank")))
self.uiWebView.setObjectName(_fromUtf8("uiWebView"))
self.gridLayout.addWidget(self.uiWebView, 0, 0, 1, 1)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.uiCheckBox = QtGui.QCheckBox(GettingStartedDialog)
self.uiCheckBox.setChecked(True)
self.uiCheckBox.setObjectName(_fromUtf8("uiCheckBox"))
self.horizontalLayout.addWidget(self.uiCheckBox)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.buttonBox = QtGui.QDialogButtonBox(GettingStartedDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.horizontalLayout.addWidget(self.buttonBox)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
self.retranslateUi(GettingStartedDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), GettingStartedDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), GettingStartedDialog.reject)
QtCore.QMetaObject.connectSlotsByName(GettingStartedDialog)
def retranslateUi(self, GettingStartedDialog):
GettingStartedDialog.setWindowTitle(_translate("GettingStartedDialog", "Getting started", None))
self.uiCheckBox.setText(_translate("GettingStartedDialog", "Don\'t show this again", None))
from PyQt4 import QtWebKit

View File

@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewsDockWidget</class>
<widget class="QDockWidget" name="NewsDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>203</width>
<height>225</height>
</rect>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::AllDockWidgetAreas</set>
</property>
<property name="windowTitle">
<string>Jungle Newsfeed</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="uiWebView" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="url" stdset="0">
<url>
<string/>
</url>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -1,57 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/news_dock_widget.ui'
#
# Created: Tue Nov 11 15:47:57 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_NewsDockWidget(object):
def setupUi(self, NewsDockWidget):
NewsDockWidget.setObjectName(_fromUtf8("NewsDockWidget"))
NewsDockWidget.resize(203, 225)
NewsDockWidget.setFloating(False)
NewsDockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetMovable)
NewsDockWidget.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self.dockWidgetContents = QtGui.QWidget()
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
self.horizontalLayout = QtGui.QHBoxLayout(self.dockWidgetContents)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
self.horizontalLayout.setContentsMargins(1, 0, 2, 0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.uiWebView = QtWebKit.QWebView(self.dockWidgetContents)
self.uiWebView.setMinimumSize(QtCore.QSize(200, 200))
self.uiWebView.setMaximumSize(QtCore.QSize(200, 200))
self.uiWebView.setProperty("url", QtCore.QUrl(None))
self.uiWebView.setObjectName(_fromUtf8("uiWebView"))
self.horizontalLayout.addWidget(self.uiWebView)
NewsDockWidget.setWidget(self.dockWidgetContents)
self.retranslateUi(NewsDockWidget)
QtCore.QMetaObject.connectSlotsByName(NewsDockWidget)
def retranslateUi(self, NewsDockWidget):
NewsDockWidget.setWindowTitle(_translate("NewsDockWidget", "Jungle Newsfeed", None))
from PyQt4 import QtWebKit