Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f28cb25
canvas: add a workaround for QTBUG-51480
ales-erjavec Feb 26, 2016
ac5f763
canvas: Using AnyQt compatibility layer for Qt5 support
ales-erjavec Mar 2, 2016
d5e2709
canvas: Change/fix a graphics object bounding rect test
ales-erjavec Mar 3, 2016
37c7959
canvas: Add textFormat to SplashScreen
ales-erjavec Mar 3, 2016
7b658f3
canvas: Remove leftover parts for old PyQt4 (on Python 2)
ales-erjavec Mar 3, 2016
6353651
canvas: Fix canvas tool dock splitter layout
ales-erjavec Mar 4, 2016
e38082e
stackedwidget: Do not force widget's resize if not visible
ales-erjavec Mar 9, 2016
8347551
gui: Remove Searcher/SearchLineEdit
ales-erjavec Mar 22, 2016
36a2f3f
Add stdpath utility module
ales-erjavec Mar 22, 2016
d62220d
widget: use super in WidgetMetaClass.__new__
ales-erjavec Mar 23, 2016
032afd2
widgets: Use AnyQt for PyQt4/PyQt5 compatibility
ales-erjavec Mar 21, 2016
b109a4a
docs: Replace full qualified Qt names in docstrings with class names …
ales-erjavec Mar 23, 2016
dea6932
widget/utils: Add a new webview utility module
ales-erjavec Mar 29, 2016
3971124
canvas/report: Use QtWebEngine if available
ales-erjavec Mar 25, 2016
5bb21d7
Install GUI requirements on travis
ales-erjavec Jun 6, 2016
f52edec
canvas/preview: Account for changed QAbstractItemView.dataChanged in Qt5
ales-erjavec Jul 22, 2016
afd7e84
Add abstracted synchronous WebviewWidget that uses WebKit or WebEngine
kernc Jul 24, 2016
bf312b0
util: inherit_docstrings() + example application
kernc Sep 1, 2016
b80b781
Handle PyQt 5.3 raising RuntimeError on incompatible orangeqt import
kernc Sep 1, 2016
696c8bf
Change imports to avoid a RuntimeError from PyQt5
ales-erjavec Oct 13, 2016
4f99d8c
Add webview's utility js files to MANIFEST.in
ales-erjavec Oct 13, 2016
3b1b267
canvas/main: Remove Qt WebEngine argument from QApplication's args
ales-erjavec Oct 21, 2016
9704c4d
error_reporting: connect a simple function to ExceptHook instead of c…
kernc Oct 21, 2016
796b0a3
WebEngine: wait for JS object channel connected before sending objects
kernc Oct 21, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis/install_orange.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ foldable pip install -U setuptools pip codecov

# Install dependencies sequentially
cat requirements-core.txt \
requirements-gui.txt \
requirements-dev.txt \
requirements-doc.txt |
while read dep; do
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ recursive-include Orange/canvas/application/workflows *.ows

recursive-include Orange/widgets *.png *.svg
recursive-include Orange/widgets/_highcharts *.js *.css *.html
recursive-include Orange/widgets/utils/_webview *.js
recursive-include Orange/widgets/utils/plot *.fs *.vs *.gs *.obj

recursive-include distribute *.svg *.desktop
Expand Down
17 changes: 12 additions & 5 deletions Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@

import pkg_resources

from PyQt4.QtGui import QFont, QColor, QDesktopServices, QMessageBox
from PyQt4.QtCore import Qt, QDir, QUrl
from AnyQt.QtGui import QFont, QColor, QDesktopServices
from AnyQt.QtWidgets import QMessageBox
from AnyQt.QtCore import Qt, QDir, QUrl, QSettings

import AnyQt.importhooks

if AnyQt.USED_API == "pyqt5":
# Use a backport shim to fake leftover PyQt4 imports
AnyQt.importhooks.install_backport_hook('pyqt4')

from Orange import canvas
from Orange.canvas.application.application import CanvasApplication
from Orange.canvas.application.canvasmain import CanvasMainWindow
from Orange.canvas.application.outputview import TextStream, ExceptHook
from Orange.canvas.application.errorreporting import ErrorReporting
from Orange.canvas.application.errorreporting import ErrorReporting, \
handle_exception

from Orange.canvas.gui.splashscreen import SplashScreen
from Orange.canvas.config import cache_dir
from Orange.canvas import config
from Orange.canvas.utils.qtcompat import QSettings

from Orange.canvas.registry import qt
from Orange.canvas.registry import WidgetRegistry, set_global_registry
Expand Down Expand Up @@ -369,7 +376,7 @@ def handle_response(result):
try:
with patch('sys.excepthook',
ExceptHook(stream=stderr, canvas=canvas_window,
handledException=ErrorReporting.handle_exception)),\
handledException=handle_exception)),\
patch('sys.stderr', stderr),\
patch('sys.stdout', stdout):
status = app.exec_()
Expand Down
4 changes: 2 additions & 2 deletions Orange/canvas/application/aboutdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import sys
import pkg_resources

from PyQt4.QtGui import QDialog, QDialogButtonBox, QVBoxLayout, QLabel
from PyQt4.QtCore import Qt
from AnyQt.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel
from AnyQt.QtCore import Qt

from .. import config

Expand Down
24 changes: 14 additions & 10 deletions Orange/canvas/application/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@
except ImportError:
docutils = None

from PyQt4.QtGui import (
from AnyQt.QtWidgets import (
QWidget, QDialog, QLabel, QLineEdit, QTreeView, QHeaderView,
QTextBrowser, QTextOption, QDialogButtonBox, QProgressDialog,
QVBoxLayout, QPalette, QStandardItemModel, QStandardItem,
QSortFilterProxyModel, QItemSelectionModel, QStyle, QStyledItemDelegate,
QStyleOptionViewItemV4, QApplication, QHBoxLayout
QTextBrowser, QDialogButtonBox, QProgressDialog,
QVBoxLayout, QStyle, QStyledItemDelegate, QStyleOptionViewItem,
QApplication, QHBoxLayout
)

from PyQt4.QtCore import (
from AnyQt.QtGui import (
QStandardItemModel, QStandardItem, QPalette, QTextOption
)

from AnyQt.QtCore import (
QSortFilterProxyModel, QItemSelectionModel,
Qt, QObject, QMetaObject, QEvent, QSize, QTimer, QThread, Q_ARG
)
from PyQt4.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
from AnyQt.QtCore import pyqtSignal as Signal, pyqtSlot as Slot

from ..config import ADDON_KEYWORD
from ..gui.utils import message_warning, message_information, \
Expand Down Expand Up @@ -125,7 +129,7 @@ def editorEvent(self, event, model, option, index):
if event.type() in {QEvent.MouseButtonPress, QEvent.MouseButtonRelease,
QEvent.MouseButtonDblClick}:
pos = event.pos()
opt = QStyleOptionViewItemV4(option)
opt = QStyleOptionViewItem(option)
self.initStyleOption(opt, index)
rect = style.subElementRect(
QStyle.SE_ItemViewItemCheckIndicator, opt, widget)
Expand Down Expand Up @@ -222,8 +226,8 @@ def __init__(self, parent=None, **kwargs):
self.__update_details
)
header = self.__view.header()
header.setResizeMode(0, QHeaderView.Fixed)
header.setResizeMode(2, QHeaderView.ResizeToContents)
header.setSectionResizeMode(0, QHeaderView.Fixed)
header.setSectionResizeMode(2, QHeaderView.ResizeToContents)

self.__details = QTextBrowser(
frameShape=QTextBrowser.NoFrame,
Expand Down
4 changes: 2 additions & 2 deletions Orange/canvas/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

"""

from PyQt4.QtGui import QApplication
from AnyQt.QtWidgets import QApplication

from PyQt4.QtCore import Qt, QUrl, QEvent, pyqtSignal as Signal
from AnyQt.QtCore import Qt, QUrl, QEvent, pyqtSignal as Signal


class CanvasApplication(QApplication):
Expand Down
82 changes: 47 additions & 35 deletions Orange/canvas/application/canvasmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,37 @@

import pkg_resources

from PyQt4.QtGui import (
from AnyQt.QtWidgets import (
QMainWindow, QWidget, QAction, QActionGroup, QMenu, QMenuBar, QDialog,
QFileDialog, QMessageBox, QVBoxLayout, QSizePolicy, QColor, QKeySequence,
QIcon, QToolBar, QToolButton, QDockWidget, QDesktopServices, QApplication,
QShortcut
QFileDialog, QMessageBox, QVBoxLayout, QSizePolicy, QToolBar, QToolButton,
QDockWidget, QApplication, QShortcut
)
from AnyQt.QtGui import QColor, QIcon, QDesktopServices, QKeySequence

from PyQt4.QtCore import (
Qt, QEvent, QSize, QUrl, QTimer, QFile, QByteArray
from AnyQt.QtCore import (
Qt, QEvent, QSize, QUrl, QTimer, QFile, QByteArray, QSettings, QT_VERSION
)

from PyQt4.QtNetwork import QNetworkDiskCache

from PyQt4.QtWebKit import QWebView

from PyQt4.QtCore import pyqtProperty as Property

# Compatibility with PyQt < v4.8.3
from ..utils.qtcompat import QSettings
if QT_VERSION < 0x50500:
from AnyQt.QtWebKitWidgets import QWebView
from AnyQt.QtNetwork import QNetworkDiskCache
USE_WEB_ENGINE = False
else:
from PyQt5.QtWebEngineWidgets import QWebEngineView
USE_WEB_ENGINE = True

from AnyQt.QtCore import pyqtProperty as Property

if QT_VERSION >= 0x50000:
from AnyQt.QtCore import QStandardPaths
def user_documents_path():
"""Return the users 'Documents' folder path."""
return QStandardPaths.writableLocation(
QStandardPaths.DocumentsLocation)
else:
def user_documents_path():
return QDesktopServices.storageLocation(
QDesktopServices.DocumentsLocation)

from ..gui.dropshadow import DropShadowFrame
from ..gui.dock import CollapsibleDockWidget
Expand Down Expand Up @@ -155,9 +167,7 @@ def __init__(self, *args):

self.widget_registry = None

self.last_scheme_dir = QDesktopServices.StandardLocation(
QDesktopServices.DocumentsLocation
)
self.last_scheme_dir = user_documents_path()
try:
self.recent_schemes = config.recent_schemes()
except Exception:
Expand Down Expand Up @@ -334,13 +344,17 @@ def setup_ui(self):
objectName="help-dock",
allowedAreas=Qt.RightDockWidgetArea |
Qt.BottomDockWidgetArea)
self.help_view = QWebView()
manager = self.help_view.page().networkAccessManager()
cache = QNetworkDiskCache()
cache.setCacheDirectory(
os.path.join(config.cache_dir(), "help", "help-view-cache")
)
manager.setCache(cache)
self.help_dock.setAllowedAreas(Qt.NoDockWidgetArea)
if USE_WEB_ENGINE:
self.help_view = QWebEngineView()
else:
self.help_view = QWebView()
manager = self.help_view.page().networkAccessManager()
cache = QNetworkDiskCache()
cache.setCacheDirectory(
os.path.join(config.cache_dir(), "help", "help-view-cache")
)
manager.setCache(cache)
self.help_dock.setWidget(self.help_view)
self.addDockWidget(
QSettings().value('help-dock/area', Qt.RightDockWidgetArea, type=int),
Expand Down Expand Up @@ -567,7 +581,10 @@ def setup_actions(self):
triggered=self.reset_widget_settings)

def setup_menu(self):
menu_bar = QMenuBar()
if sys.platform == "darwin" and QT_VERSION >= 0x50000:
self.__menu_glob = QMenuBar(None)

menu_bar = QMenuBar(self)

# File menu
file_menu = QMenu(self.tr("&File"), menu_bar)
Expand Down Expand Up @@ -691,9 +708,7 @@ def restore(self):
self.show_log_action.setChecked(
settings.value("output-dock/is-visible", False, type=bool))

default_dir = QDesktopServices.storageLocation(
QDesktopServices.DocumentsLocation
)
default_dir = user_documents_path()

self.last_scheme_dir = settings.value("last-scheme-dir", default_dir,
type=str)
Expand Down Expand Up @@ -872,15 +887,14 @@ def open_scheme(self):

if self.last_scheme_dir is None:
# Get user 'Documents' folder
start_dir = QDesktopServices.storageLocation(
QDesktopServices.DocumentsLocation)
start_dir = user_documents_path()
else:
start_dir = self.last_scheme_dir

# TODO: Use a dialog instance and use 'addSidebarUrls' to
# set one or more extra sidebar locations where Schemes are stored.
# Also use setHistory
filename = QFileDialog.getOpenFileName(
filename, _ = QFileDialog.getOpenFileName(
self, self.tr("Open Orange Workflow File"),
start_dir, self.tr("Orange Workflow (*.ows)"),
)
Expand Down Expand Up @@ -1179,13 +1193,11 @@ def save_scheme_as(self):
if self.last_scheme_dir is not None:
start_dir = self.last_scheme_dir
else:
start_dir = QDesktopServices.storageLocation(
QDesktopServices.DocumentsLocation
)
start_dir = user_documents_path()

start_dir = os.path.join(str(start_dir), title + ".ows")

filename = QFileDialog.getSaveFileName(
filename, _ = QFileDialog.getSaveFileName(
self, self.tr("Save Orange Workflow File"),
start_dir, self.tr("Orange Workflow (*.ows)")
)
Expand Down
Loading