[pyzo] 44/68: Adjust for PyQt5 approach
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Sep 28 09:47:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository pyzo.
commit 14d5c51d226eca86a40b6bc165e9e61f625427f5
Author: Almar Klein <almar.klein at gmail.com>
Date: Mon Sep 19 13:47:59 2016 +0200
Adjust for PyQt5 approach
---
pyzo/__init__.py | 14 ++---
pyzo/codeeditor/_test.py | 28 +++++-----
pyzo/codeeditor/base.py | 10 ++--
pyzo/codeeditor/extensions/appearance.py | 16 +++---
pyzo/codeeditor/extensions/autocompletion.py | 14 ++---
pyzo/codeeditor/extensions/calltip.py | 6 +-
pyzo/codeeditor/manager.py | 4 +-
pyzo/codeeditor/misc.py | 4 +-
pyzo/codeeditor/qt.py | 2 +-
pyzo/core/about.py | 20 +++----
pyzo/core/assistant.py | 54 +++++++++---------
pyzo/core/baseTextCtrl.py | 4 +-
pyzo/core/compactTabWidget.py | 46 +++++++--------
pyzo/core/editor.py | 28 +++++-----
pyzo/core/editorTabs.py | 74 ++++++++++++------------
pyzo/core/icons.py | 32 +++++------
pyzo/core/main.py | 46 +++++++--------
pyzo/core/menu.py | 84 ++++++++++++++--------------
pyzo/core/shell.py | 4 +-
pyzo/core/shellInfoDialog.py | 76 ++++++++++++-------------
pyzo/core/shellStack.py | 38 ++++++-------
pyzo/core/splash.py | 20 +++----
pyzo/pyzokernel/guiintegration.py | 28 +++++-----
pyzo/pyzokernel/guisupport.py | 6 +-
pyzo/tools/__init__.py | 18 +++---
pyzo/tools/pyzoFileBrowser/__init__.py | 10 ++--
pyzo/tools/pyzoFileBrowser/browser.py | 50 ++++++++---------
pyzo/tools/pyzoFileBrowser/importwizard.py | 80 +++++++++++++-------------
pyzo/tools/pyzoFileBrowser/tree.py | 54 +++++++++---------
pyzo/tools/pyzoHistoryViewer.py | 10 ++--
pyzo/tools/pyzoInteractiveHelp.py | 20 +++----
pyzo/tools/pyzoSourceStructure.py | 28 +++++-----
pyzo/tools/pyzoWebBrowser.py | 34 +++++------
pyzo/tools/pyzoWorkspace.py | 30 +++++-----
pyzo/util/_locale.py | 6 +-
pyzo/util/bootstrapconda.py | 46 +++++++--------
pyzo/util/pyzowizard.py | 30 +++++-----
37 files changed, 537 insertions(+), 537 deletions(-)
diff --git a/pyzo/__init__.py b/pyzo/__init__.py
index d1cefc3..1f84215 100644
--- a/pyzo/__init__.py
+++ b/pyzo/__init__.py
@@ -73,7 +73,7 @@ else:
from pyzo.util import zon as ssdf # zon is ssdf-light
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
# Import language/translation tools
from pyzo.util._locale import translate, setLanguage
@@ -84,7 +84,7 @@ _is_pyqt4 = hasattr(QtCore, 'PYQT_VERSION_STR')
os.environ['PYZO_QTLIB'] = 'PyQt4' if _is_pyqt4 else 'PySide'
-class MyApp(QtGui.QApplication):
+class MyApp(QtWidgets.QApplication):
""" So we an open .py files on OSX.
OSX is smart enough to call this on the existing process.
"""
@@ -98,10 +98,10 @@ class MyApp(QtGui.QApplication):
if not commandline.is_our_server_running():
print(res)
sys.exit()
- return QtGui.QApplication.event(self, event)
+ return QtWidgets.QApplication.event(self, event)
if not sys.platform.startswith('darwin'):
- MyApp = QtGui.QApplication
+ MyApp = QtWidgets.QApplication
## Define some functions
@@ -224,10 +224,10 @@ def start():
pass
# Set to be aware of the systems native colors, fonts, etc.
- QtGui.QApplication.setDesktopSettingsAware(True)
+ QtWidgets.QApplication.setDesktopSettingsAware(True)
# Instantiate the application
- QtGui.qApp = MyApp(sys.argv) # QtGui.QApplication([])
+ QtWidgets.qApp = MyApp(sys.argv) # QtWidgets.QApplication([])
# Choose language, get locale
appLocale = setLanguage(config.settings.language)
@@ -236,7 +236,7 @@ def start():
frame = MainWindow(None, appLocale)
# Enter the main loop
- QtGui.qApp.exec_()
+ QtWidgets.qApp.exec_()
## Init
diff --git a/pyzo/codeeditor/_test.py b/pyzo/codeeditor/_test.py
index 6294f45..fbb423e 100644
--- a/pyzo/codeeditor/_test.py
+++ b/pyzo/codeeditor/_test.py
@@ -5,7 +5,7 @@
"""
import os, sys
-from qt import QtGui, QtCore
+from qt import QtGui, QtCore, QtWidgets
Qt = QtCore.Qt
## Go up one directory and then import the codeeditor package
@@ -19,7 +19,7 @@ from codeeditor import *
if __name__=='__main__':
- app = QtGui.QApplication([])
+ app = QtWidgets.QApplication([])
# Create editor instance
@@ -27,19 +27,19 @@ if __name__=='__main__':
showIndentationGuides = True, showWhitespace = True,
showLineEndings = True, wrap = True, showLineNumbers = True)
- QtGui.QShortcut(QtGui.QKeySequence("F1"), e).activated.connect(e.autocompleteShow)
- QtGui.QShortcut(QtGui.QKeySequence("F2"), e).activated.connect(e.autocompleteCancel)
- QtGui.QShortcut(QtGui.QKeySequence("F3"), e).activated.connect(lambda: e.calltipShow(0, 'test(foo, bar)'))
- QtGui.QShortcut(QtGui.QKeySequence("Shift+Tab"), e).activated.connect(e.dedentSelection) # Shift + Tab
+ QtWidgets.QShortcut(QtGui.QKeySequence("F1"), e).activated.connect(e.autocompleteShow)
+ QtWidgets.QShortcut(QtGui.QKeySequence("F2"), e).activated.connect(e.autocompleteCancel)
+ QtWidgets.QShortcut(QtGui.QKeySequence("F3"), e).activated.connect(lambda: e.calltipShow(0, 'test(foo, bar)'))
+ QtWidgets.QShortcut(QtGui.QKeySequence("Shift+Tab"), e).activated.connect(e.dedentSelection) # Shift + Tab
#TODO: somehow these shortcuts don't work in this test-app, but they do in
# pyzo. May have something to do with overriding slots of Qt-native objects?
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"), e).activated.connect(e.copy)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+X"), e).activated.connect(e.cut)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+V"), e).activated.connect(e.paste)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Shift+V"), e).activated.connect(e.pasteAndSelect)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Z"), e).activated.connect(e.undo)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Y"), e).activated.connect(e.redo)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+C"), e).activated.connect(e.copy)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+X"), e).activated.connect(e.cut)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+V"), e).activated.connect(e.paste)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Shift+V"), e).activated.connect(e.pasteAndSelect)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Z"), e).activated.connect(e.undo)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Y"), e).activated.connect(e.redo)
e.setPlainText("foo(bar)\nfor bar in range(5):\n print bar\n" +
"\nclass aap:\n def monkey(self):\n pass\n\n")
@@ -47,8 +47,8 @@ if __name__=='__main__':
# Run application
e.show()
- s=QtGui.QSplitter()
+ s=QtWidgets.QSplitter()
s.addWidget(e)
- s.addWidget(QtGui.QLabel('test'))
+ s.addWidget(QtWidgets.QLabel('test'))
s.show()
app.exec_()
diff --git a/pyzo/codeeditor/base.py b/pyzo/codeeditor/base.py
index 6d581a0..6702d6b 100644
--- a/pyzo/codeeditor/base.py
+++ b/pyzo/codeeditor/base.py
@@ -100,7 +100,7 @@ into account:
"""
import sys
-from .qt import QtGui,QtCore
+from .qt import QtGui,QtCore, QtWidgets
Qt = QtCore.Qt
from .misc import DEFAULT_OPTION_NAME, DEFAULT_OPTION_NONE, ce_option
@@ -110,7 +110,7 @@ from .highlighter import Highlighter
from .style import StyleFormat, StyleElementDescription
-class CodeEditorBase(QtGui.QPlainTextEdit):
+class CodeEditorBase(QtWidgets.QPlainTextEdit):
""" The base code editor class. Implements some basic features required
by the extensions.
@@ -265,7 +265,7 @@ class CodeEditorBase(QtGui.QPlainTextEdit):
# Get all names that can be options
allNames = set(dir(self))
- nativeNames = set(dir(QtGui.QPlainTextEdit))
+ nativeNames = set(dir(QtWidgets.QPlainTextEdit))
names = allNames.difference(nativeNames)
# Init dict of setter members
@@ -421,7 +421,7 @@ class CodeEditorBase(QtGui.QPlainTextEdit):
font = QtGui.QFont(family, size)
# Set, emit and return
- QtGui.QPlainTextEdit.setFont(self, font)
+ QtWidgets.QPlainTextEdit.setFont(self, font)
self.fontChanged.emit()
return font
@@ -462,7 +462,7 @@ class CodeEditorBase(QtGui.QPlainTextEdit):
elements = []
def collectElements(cls, iter=1):
# Valid class?
- if cls is object or cls is QtGui.QPlainTextEdit:
+ if cls is object or cls is QtWidgets.QPlainTextEdit:
return
# Check members
if hasattr(cls, '_styleElements'):
diff --git a/pyzo/codeeditor/extensions/appearance.py b/pyzo/codeeditor/extensions/appearance.py
index 3a695ea..0cdbfd8 100644
--- a/pyzo/codeeditor/extensions/appearance.py
+++ b/pyzo/codeeditor/extensions/appearance.py
@@ -8,7 +8,7 @@
Code editor extensions that change its appearance
"""
-from ..qt import QtGui,QtCore
+from ..qt import QtGui,QtCore, QtWidgets
Qt = QtCore.Qt
from ..misc import ce_option
@@ -711,12 +711,12 @@ class LineNumbers(object):
'fore:#222,back:#DDD',
) ]
- class __LineNumberArea(QtGui.QWidget):
+ class __LineNumberArea(QtWidgets.QWidget):
""" This is the widget reponsible for drawing the line numbers.
"""
def __init__(self, codeEditor):
- QtGui.QWidget.__init__(self, codeEditor)
+ QtWidgets.QWidget.__init__(self, codeEditor)
self.setCursor(QtCore.Qt.PointingHandCursor)
self._pressedY = None
self._lineNrChoser = None
@@ -842,9 +842,9 @@ class LineNumbers(object):
# Done
painter.end()
- class LineNumberChoser(QtGui.QSpinBox):
+ class LineNumberChoser(QtWidgets.QSpinBox):
def __init__(self, parent):
- QtGui.QSpinBox.__init__(self, parent)
+ QtWidgets.QSpinBox.__init__(self, parent)
self._editor = parent
@@ -879,7 +879,7 @@ class LineNumbers(object):
if event.key() in [QtCore.Qt.Key_Escape, QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return]:
self._editor.setFocus() # Moves focus away, thus hiding self
else:
- QtGui.QSpinBox.keyPressEvent(self, event)
+ QtWidgets.QSpinBox.keyPressEvent(self, event)
def onValueChanged(self, nr):
if self._ignoreSignalOnceFlag:
@@ -971,12 +971,12 @@ class BreakPoints(object):
'fore:#F66,back:#dfdfe1',
) ]
- class __BreakPointArea(QtGui.QWidget):
+ class __BreakPointArea(QtWidgets.QWidget):
""" This is the widget reponsible for drawing the break points.
"""
def __init__(self, codeEditor):
- QtGui.QWidget.__init__(self, codeEditor)
+ QtWidgets.QWidget.__init__(self, codeEditor)
self.setCursor(QtCore.Qt.PointingHandCursor)
self.setMouseTracking(True)
self._virtualBreakpoint = 0
diff --git a/pyzo/codeeditor/extensions/autocompletion.py b/pyzo/codeeditor/extensions/autocompletion.py
index 2c5278b..37881a4 100644
--- a/pyzo/codeeditor/extensions/autocompletion.py
+++ b/pyzo/codeeditor/extensions/autocompletion.py
@@ -9,28 +9,28 @@ Code editor extensions that provides autocompleter functionality
"""
-from ..qt import QtGui,QtCore
+from ..qt import QtGui,QtCore, QtWidgets
Qt = QtCore.Qt
import keyword
#TODO: use this CompletionListModel to style the completion suggestions (class names, method names, keywords etc)
-class CompletionListModel(QtGui.QStringListModel):
+class CompletionListModel(QtWidgets.QStringListModel):
def data(self, index, role):
if role == Qt.ForegroundRole:
- # data = str(QtGui.QStringListModel.data(self, index, QtCore.Qt.DisplayRole))
+ # data = str(QtWidgets.QStringListModel.data(self, index, QtCore.Qt.DisplayRole))
# return QtGui.QBrush(Qt.red)
return None
else:
- return QtGui.QStringListModel.data(self, index, role)
+ return QtWidgets.QStringListModel.data(self, index, role)
# todo: use keywords from the parser
class AutoCompletion(object):
def __init__(self,*args, **kwds):
super(AutoCompletion, self).__init__(*args, **kwds)
# Autocompleter
- self.__completerModel = QtGui.QStringListModel(keyword.kwlist)
- self.__completer = QtGui.QCompleter(self)
+ self.__completerModel = QtWidgets.QStringListModel(keyword.kwlist)
+ self.__completer = QtWidgets.QCompleter(self)
self.__completer.setModel(self.__completerModel)
self.__completer.setCaseSensitivity(Qt.CaseInsensitive)
self.__completer.setWidget(self)
@@ -169,7 +169,7 @@ class AutoCompletion(object):
position = self.cursorRect(cur).bottomLeft() + self.viewport().pos()
# Check if the completer is going to go off the screen
- desktop_geometry = QtGui.qApp.desktop().geometry()
+ desktop_geometry = QtWidgets.qApp.desktop().geometry()
global_position = self.mapToGlobal(position)
if global_position.y() + geometry.height() > desktop_geometry.height():
# Move the completer to above the current line
diff --git a/pyzo/codeeditor/extensions/calltip.py b/pyzo/codeeditor/extensions/calltip.py
index 3e0669d..7340286 100644
--- a/pyzo/codeeditor/extensions/calltip.py
+++ b/pyzo/codeeditor/extensions/calltip.py
@@ -4,16 +4,16 @@
# Pyzo is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
-from ..qt import QtCore, QtGui
+from ..qt import QtCore, QtGui, QtWidgets
Qt = QtCore.Qt
class Calltip(object):
_styleElements = [('Editor.calltip', 'The style of the calltip. ',
'fore:#555, back:#ff9, border:1')]
- class __CalltipLabel(QtGui.QLabel):
+ class __CalltipLabel(QtWidgets.QLabel):
def __init__(self):
- QtGui.QLabel.__init__(self)
+ QtWidgets.QLabel.__init__(self)
# Start hidden
self.hide()
diff --git a/pyzo/codeeditor/manager.py b/pyzo/codeeditor/manager.py
index bbb7e9e..ee8a50d 100644
--- a/pyzo/codeeditor/manager.py
+++ b/pyzo/codeeditor/manager.py
@@ -13,7 +13,7 @@ management tasks.
import os, sys
-from .qt import QtGui, QtCore
+from .qt import QtGui, QtCore, QtWidgets
Qt = QtCore.Qt
from . import parsers
@@ -245,7 +245,7 @@ class Manager:
"""
db = QtGui.QFontDatabase()
- QFont, QFontInfo = QtGui.QFont, QtGui.QFontInfo
+ QFont, QFontInfo = QtWidgets.QFont, QtGui.QFontInfo
# fn = font_name (str)
return [fn for fn in db.families() if QFontInfo(QFont(fn)).fixedPitch()]
diff --git a/pyzo/codeeditor/misc.py b/pyzo/codeeditor/misc.py
index eb3990d..d2c1848 100644
--- a/pyzo/codeeditor/misc.py
+++ b/pyzo/codeeditor/misc.py
@@ -11,7 +11,7 @@ Defined ustr (Unicode string) class and the option property decorator.
"""
import sys
-from .qt import QtGui, QtCore
+from .qt import QtGui, QtCore, QtWidgets
# Set Python version and get some names
@@ -86,7 +86,7 @@ class _CallbackEventHandler(QtCore.QObject):
def postEventWithCallback(self, callback, *args):
self.queue.put((callback, args))
- QtGui.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
+ QtWidgets.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
def callLater(callback, *args):
diff --git a/pyzo/codeeditor/qt.py b/pyzo/codeeditor/qt.py
index 91e6a12..77131ba 100644
--- a/pyzo/codeeditor/qt.py
+++ b/pyzo/codeeditor/qt.py
@@ -1,2 +1,2 @@
# This is the one place where codeeditor depends on Pyzo itself
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
diff --git a/pyzo/core/about.py b/pyzo/core/about.py
index f1a1549..0aa0ddc 100644
--- a/pyzo/core/about.py
+++ b/pyzo/core/about.py
@@ -2,43 +2,43 @@
import os
import sys
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
from pyzo.util import paths
-class AboutDialog(QtGui.QDialog):
+class AboutDialog(QtWidgets.QDialog):
def __init__(self, parent):
- QtGui.QDialog.__init__(self, parent)
+ QtWidgets.QDialog.__init__(self, parent)
self.setWindowTitle(pyzo.translate("menu dialog", "About Pyzo"))
self.resize(600,500)
# Layout
- layout = QtGui.QVBoxLayout(self)
+ layout = QtWidgets.QVBoxLayout(self)
self.setLayout(layout)
# Create image and title
im = QtGui.QPixmap( os.path.join(pyzo.pyzoDir,
'resources', 'appicons', 'pyzologo64.png') )
- imlabel = QtGui.QLabel(self)
+ imlabel = QtWidgets.QLabel(self)
imlabel.setPixmap(im)
- textlabel = QtGui.QLabel(self)
+ textlabel = QtWidgets.QLabel(self)
textlabel.setText('<h3>Pyzo: the Interactive Editor for Python</h3>')
#
- titleLayout = QtGui.QHBoxLayout()
+ titleLayout = QtWidgets.QHBoxLayout()
titleLayout.addWidget(imlabel, 0)
titleLayout.addWidget(textlabel, 1)
#
layout.addLayout(titleLayout, 0)
# Create tab bar
- self._tabs = QtGui.QTabWidget(self)
+ self._tabs = QtWidgets.QTabWidget(self)
self._tabs.setDocumentMode(True)
layout.addWidget(self._tabs, 1)
# Create button box
- self._butBox = QtGui.QDialogButtonBox(self)
+ self._butBox = QtWidgets.QDialogButtonBox(self)
self._butBox.setOrientation(QtCore.Qt.Horizontal)
self._butBox.setStandardButtons(self._butBox.Close)
layout.addWidget(self._butBox, 0)
@@ -53,7 +53,7 @@ class AboutDialog(QtGui.QDialog):
def addTab(self, title, text, rich=True):
# Create label to show info
- label = QtGui.QTextEdit(self)
+ label = QtWidgets.QTextEdit(self)
label.setLineWrapMode(label.WidgetWidth)
label.setReadOnly(True)
# Set text
diff --git a/pyzo/core/assistant.py b/pyzo/core/assistant.py
index 5b5ccfa..8a339ec 100644
--- a/pyzo/core/assistant.py
+++ b/pyzo/core/assistant.py
@@ -15,7 +15,7 @@ Copy the "docs" directory to the pyzo root!
"""
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo import getResourceDirs
import os
@@ -50,20 +50,20 @@ tool_name = "Assistant"
tool_summary = "Browse qt help documents"
-class Settings(QtGui.QWidget):
+class Settings(QtWidgets.QWidget):
def __init__(self, engine):
super().__init__()
self._engine = engine
- layout = QtGui.QVBoxLayout(self)
- add_button = QtGui.QPushButton("Add")
- del_button = QtGui.QPushButton("Delete")
- self._view = QtGui.QListView()
+ layout = QtWidgets.QVBoxLayout(self)
+ add_button = QtWidgets.QPushButton("Add")
+ del_button = QtWidgets.QPushButton("Delete")
+ self._view = QtWidgets.QListView()
layout.addWidget(self._view)
- layout2 = QtGui.QHBoxLayout()
+ layout2 = QtWidgets.QHBoxLayout()
layout2.addWidget(add_button)
layout2.addWidget(del_button)
layout.addLayout(layout2)
- self._model = QtGui.QStringListModel()
+ self._model = QtWidgets.QStringListModel()
self._view.setModel(self._model)
self._model.setStringList(self._engine.registeredDocumentations())
@@ -72,7 +72,7 @@ class Settings(QtGui.QWidget):
del_button.clicked.connect(self.del_doc)
def add_doc(self):
- doc_file = QtGui.QFileDialog.getOpenFileName(
+ doc_file = QtWidgets.QFileDialog.getOpenFileName(
self,
"Select a compressed help file",
filter="Qt compressed help files (*.qch)")
@@ -85,7 +85,7 @@ class Settings(QtGui.QWidget):
if ok:
self._model.setStringList(self._engine.registeredDocumentations())
else:
- QtGui.QMessageBox.critical(self, "Error", "Error loading doc")
+ QtWidgets.QMessageBox.critical(self, "Error", "Error loading doc")
def del_doc(self):
idx = self._view.currentIndex()
@@ -98,7 +98,7 @@ class Settings(QtGui.QWidget):
self._model.setStringList(self._engine.registeredDocumentations())
-class HelpBrowser(QtGui.QTextBrowser):
+class HelpBrowser(QtWidgets.QTextBrowser):
""" Override textbrowser to implement load resource """
def __init__(self, engine):
super().__init__()
@@ -122,7 +122,7 @@ class HelpBrowser(QtGui.QTextBrowser):
return super().loadResource(typ, url)
-class PyzoAssistant(QtGui.QWidget):
+class PyzoAssistant(QtWidgets.QWidget):
"""
Show help contents and browse qt help files.
"""
@@ -132,7 +132,7 @@ class PyzoAssistant(QtGui.QWidget):
When collection_file is none, it is determined from the
appDataDir.
"""
- from pyzo.util.qt import QtHelp
+ from pyzo.util.qt import QtHelp, QtWidgets, QtWidgets
super().__init__(parent)
self.setWindowTitle('Help')
pyzoDir, appDataDir = getResourceDirs()
@@ -152,9 +152,9 @@ class PyzoAssistant(QtGui.QWidget):
# The main players:
self._content = self._engine.contentWidget()
self._index = self._engine.indexWidget()
- self._indexTab = QtGui.QWidget()
- il = QtGui.QVBoxLayout(self._indexTab)
- filter_text = QtGui.QLineEdit()
+ self._indexTab = QtWidgets.QWidget()
+ il = QtWidgets.QVBoxLayout(self._indexTab)
+ filter_text = QtWidgets.QLineEdit()
il.addWidget(filter_text)
il.addWidget(self._index)
@@ -162,31 +162,31 @@ class PyzoAssistant(QtGui.QWidget):
self._searchEngine = self._engine.searchEngine()
self._settings = Settings(self._engine)
- self._progress = QtGui.QWidget()
- pl = QtGui.QHBoxLayout(self._progress)
- bar = QtGui.QProgressBar()
+ self._progress = QtWidgets.QWidget()
+ pl = QtWidgets.QHBoxLayout(self._progress)
+ bar = QtWidgets.QProgressBar()
bar.setMaximum(0)
- pl.addWidget(QtGui.QLabel('Indexing'))
+ pl.addWidget(QtWidgets.QLabel('Indexing'))
pl.addWidget(bar)
self._searchResultWidget = self._searchEngine.resultWidget()
self._searchQueryWidget = self._searchEngine.queryWidget()
- self._searchTab = QtGui.QWidget()
- search_layout = QtGui.QVBoxLayout(self._searchTab)
+ self._searchTab = QtWidgets.QWidget()
+ search_layout = QtWidgets.QVBoxLayout(self._searchTab)
search_layout.addWidget(self._searchQueryWidget)
search_layout.addWidget(self._searchResultWidget)
- tab = QtGui.QTabWidget()
+ tab = QtWidgets.QTabWidget()
tab.addTab(self._content, "Contents")
tab.addTab(self._indexTab, "Index")
tab.addTab(self._searchTab, "Search")
tab.addTab(self._settings, "Settings")
- splitter = QtGui.QSplitter(self)
+ splitter = QtWidgets.QSplitter(self)
splitter.addWidget(tab)
splitter.addWidget(self._helpBrowser)
- layout = QtGui.QVBoxLayout(self)
+ layout = QtWidgets.QVBoxLayout(self)
layout.addWidget(splitter)
layout.addWidget(self._progress)
@@ -257,7 +257,7 @@ class PyzoAssistant(QtGui.QWidget):
self._helpBrowser.setSource(QtCore.QUrl(url))
def showHelpForTerm(self, name):
- from pyzo.util.qt import QtHelp
+ from pyzo.util.qt import QtHelp, QtWidgets, QtWidgets
# Cache for later use:
self._search_term = name
@@ -267,7 +267,7 @@ class PyzoAssistant(QtGui.QWidget):
if __name__ == '__main__':
- app = QtGui.QApplication([])
+ app = QtWidgets.QApplication([])
view = PyzoAssistant()
view.show()
app.exec()
diff --git a/pyzo/core/baseTextCtrl.py b/pyzo/core/baseTextCtrl.py
index 6537b3a..392991b 100644
--- a/pyzo/core/baseTextCtrl.py
+++ b/pyzo/core/baseTextCtrl.py
@@ -18,7 +18,7 @@ import weakref
from pyzo.core.pyzoLogging import print
import pyzo.codeeditor.parsers.tokens as Tokens
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
qt = QtGui
@@ -607,7 +607,7 @@ class AutoCompObject:
if __name__=="__main__":
- app = QtGui.QApplication([])
+ app = QtWidgets.QApplication([])
win = BaseTextCtrl(None)
# win.setStyle('.py')
tmp = "foo(bar)\nfor bar in range(5):\n print bar\n"
diff --git a/pyzo/core/compactTabWidget.py b/pyzo/core/compactTabWidget.py
index be5ec2d..5b2aa91 100644
--- a/pyzo/core/compactTabWidget.py
+++ b/pyzo/core/compactTabWidget.py
@@ -10,7 +10,7 @@ See docs of the tab widget.
"""
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import sys
if sys.version_info[0] < 3:
@@ -99,7 +99,7 @@ class TabData:
self.data = None
-class CompactTabBar(QtGui.QTabBar):
+class CompactTabBar(QtWidgets.QTabBar):
""" CompactTabBar(parent, *args, padding=(4,4,6,6), preventEqualTexts=True)
Tab bar corresponcing to the CompactTabWidget.
@@ -120,7 +120,7 @@ class CompactTabBar(QtGui.QTabBar):
barDoubleClicked = QtCore.Signal()
def __init__(self, *args, padding=(4,4,6,6), preventEqualTexts=True):
- QtGui.QTabBar.__init__(self, *args)
+ QtWidgets.QTabBar.__init__(self, *args)
# Put tab widget in document mode
self.setDocumentMode(True)
@@ -183,15 +183,15 @@ class CompactTabBar(QtGui.QTabBar):
"""
# Get current TabData instance
- tabData = QtGui.QTabBar.tabData(self, i)
+ tabData = QtWidgets.QTabBar.tabData(self, i)
if (tabData is not None) and hasattr(tabData, 'toPyObject'):
tabData = tabData.toPyObject() # Older version of Qt
# If none, make it as good as we can
if not tabData:
- name = str(QtGui.QTabBar.tabText(self, i))
+ name = str(QtWidgets.QTabBar.tabText(self, i))
tabData = TabData( name )
- QtGui.QTabBar.setTabData(self, i, tabData)
+ QtWidgets.QTabBar.setTabData(self, i, tabData)
# Done
return tabData
@@ -270,33 +270,33 @@ class CompactTabBar(QtGui.QTabBar):
## Overload events and protected functions
def tabInserted(self, i):
- QtGui.QTabBar.tabInserted(self, i)
+ QtWidgets.QTabBar.tabInserted(self, i)
# Is called when a tab is inserted
# Get given name and store
- name = str(QtGui.QTabBar.tabText(self, i))
+ name = str(QtWidgets.QTabBar.tabText(self, i))
tabData = TabData(name)
- QtGui.QTabBar.setTabData(self, i, tabData)
+ QtWidgets.QTabBar.setTabData(self, i, tabData)
# Update
self.alignTabs()
def tabRemoved(self, i):
- QtGui.QTabBar.tabRemoved(self, i)
+ QtWidgets.QTabBar.tabRemoved(self, i)
# Update
self.alignTabs()
def resizeEvent(self, event):
- QtGui.QTabBar.resizeEvent(self, event)
+ QtWidgets.QTabBar.resizeEvent(self, event)
self.alignTabs()
def showEvent(self, event):
- QtGui.QTabBar.showEvent(self, event)
+ QtWidgets.QTabBar.showEvent(self, event)
self.alignTabs()
@@ -435,14 +435,14 @@ class CompactTabBar(QtGui.QTabBar):
itemReduced = True
# Set text now
- QtGui.QTabBar.setTabText(self, i, name)
+ QtWidgets.QTabBar.setTabText(self, i, name)
# Done
return itemReduced
-class CompactTabWidget(QtGui.QTabWidget):
+class CompactTabWidget(QtWidgets.QTabWidget):
""" CompactTabWidget(parent, *args, **kwargs)
Implements a tab widget with a tabbar that is in document mode
@@ -463,13 +463,13 @@ class CompactTabWidget(QtGui.QTabWidget):
"""
def __init__(self, *args, **kwargs):
- QtGui.QTabWidget.__init__(self, *args)
+ QtWidgets.QTabWidget.__init__(self, *args)
# Set tab bar
self.setTabBar(CompactTabBar(self, **kwargs))
# Draw tabs at the top by default
- self.setTabPosition(QtGui.QTabWidget.North)
+ self.setTabPosition(QtWidgets.QTabWidget.North)
def setTabData(self, i, data):
@@ -513,10 +513,10 @@ if __name__ == '__main__':
w = CompactTabWidget()
w.show()
- w.addTab(QtGui.QWidget(w), 'aapenootjedopje')
- w.addTab(QtGui.QWidget(w), 'aapenootjedropje')
- w.addTab( QtGui.QWidget(w), 'noot en mies')
- w.addTab( QtGui.QWidget(w), 'boom bijv een iep')
- w.addTab( QtGui.QWidget(w), 'roosemarijnus')
- w.addTab( QtGui.QWidget(w), 'vis')
- w.addTab( QtGui.QWidget(w), 'vuurvuurvuur')
+ w.addTab(QtWidgets.QWidget(w), 'aapenootjedopje')
+ w.addTab(QtWidgets.QWidget(w), 'aapenootjedropje')
+ w.addTab( QtWidgets.QWidget(w), 'noot en mies')
+ w.addTab( QtWidgets.QWidget(w), 'boom bijv een iep')
+ w.addTab( QtWidgets.QWidget(w), 'roosemarijnus')
+ w.addTab( QtWidgets.QWidget(w), 'vis')
+ w.addTab( QtWidgets.QWidget(w), 'vuurvuurvuur')
diff --git a/pyzo/core/editor.py b/pyzo/core/editor.py
index 27135ac..13b9ce1 100644
--- a/pyzo/core/editor.py
+++ b/pyzo/core/editor.py
@@ -15,7 +15,7 @@ file loading/saving /reloading stuff.
import os, sys
import re, codecs
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
qt = QtGui
from pyzo.codeeditor import Manager
@@ -357,7 +357,7 @@ class PyzoEditor(BaseTextCtrl):
Momentarily highlight a piece of code to show that this is being executed
"""
- extraSelection = QtGui.QTextEdit.ExtraSelection()
+ extraSelection = QtWidgets.QTextEdit.ExtraSelection()
extraSelection.cursor = cursor
extraSelection.format.setBackground(QtCore.Qt.gray)
self.setExtraSelections([extraSelection])
@@ -401,13 +401,13 @@ class PyzoEditor(BaseTextCtrl):
if mtime != self._modifyTime:
# ask user
- dlg = QtGui.QMessageBox(self)
+ dlg = QtWidgets.QMessageBox(self)
dlg.setWindowTitle('File was changed')
dlg.setText("File has been modified outside of the editor:\n"+
self._filename)
dlg.setInformativeText("Do you want to reload?")
- t=dlg.addButton("Reload", QtGui.QMessageBox.AcceptRole) #0
- dlg.addButton("Keep this version", QtGui.QMessageBox.RejectRole) #1
+ t=dlg.addButton("Reload", QtWidgets.QMessageBox.AcceptRole) #0
+ dlg.addButton("Keep this version", QtWidgets.QMessageBox.RejectRole) #1
dlg.setDefaultButton(t)
# whatever the result, we will reset the modified time
@@ -415,7 +415,7 @@ class PyzoEditor(BaseTextCtrl):
# get result and act
result = dlg.exec_()
- if result == QtGui.QMessageBox.AcceptRole:
+ if result == QtWidgets.QMessageBox.AcceptRole:
self.reload()
else:
pass # when cancelled or explicitly said, do nothing
@@ -731,15 +731,15 @@ if __name__=="__main__":
def parseThis(self, x):
pass
pyzo.parser = DummyParser()
- EditorContextMenu = QtGui.QMenu
- app = QtGui.QApplication([])
+ EditorContextMenu = QtWidgets.QMenu
+ app = QtWidgets.QApplication([])
win = PyzoEditor(None)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"), win).activated.connect(win.copy)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+X"), win).activated.connect(win.cut)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+V"), win).activated.connect(win.paste)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Shift+V"), win).activated.connect(win.pasteAndSelect)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Z"), win).activated.connect(win.undo)
- QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Y"), win).activated.connect(win.redo)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+C"), win).activated.connect(win.copy)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+X"), win).activated.connect(win.cut)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+V"), win).activated.connect(win.paste)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Shift+V"), win).activated.connect(win.pasteAndSelect)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Z"), win).activated.connect(win.undo)
+ QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Y"), win).activated.connect(win.redo)
tmp = "foo(bar)\nfor bar in range(5):\n print bar\n"
diff --git a/pyzo/core/editorTabs.py b/pyzo/core/editorTabs.py
index 13d873f..1dbec8d 100644
--- a/pyzo/core/editorTabs.py
+++ b/pyzo/core/editorTabs.py
@@ -15,7 +15,7 @@ It also has a find/replace widget that is at the bottom of the editor.
"""
import os, sys, time, gc
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
from pyzo.core.compactTabWidget import CompactTabWidget
@@ -49,7 +49,7 @@ def simpleDialog(item, action, question, options, defaultOption):
filename = item.id()
# create button map
- mb = QtGui.QMessageBox
+ mb = QtWidgets.QMessageBox
M = { 'ok':mb.Ok, 'open':mb.Open, 'save':mb.Save, 'cancel':mb.Cancel,
'close':mb.Close, 'discard':mb.Discard, 'apply':mb.Apply,
'reset':mb.Reset, 'restoredefaults':mb.RestoreDefaults,
@@ -58,7 +58,7 @@ def simpleDialog(item, action, question, options, defaultOption):
'abort':mb.Abort, 'retry':mb.Retry, 'ignore':mb.Ignore}
# setup dialog
- dlg = QtGui.QMessageBox(pyzo.main)
+ dlg = QtWidgets.QMessageBox(pyzo.main)
dlg.setWindowTitle('Pyzo')
dlg.setText(action + " file:\n{}".format(filename))
dlg.setInformativeText(question)
@@ -146,27 +146,27 @@ class FileItem:
# todo: when this works with the new editor, put in own module.
-class FindReplaceWidget(QtGui.QFrame):
+class FindReplaceWidget(QtWidgets.QFrame):
""" A widget to find and replace text. """
def __init__(self, *args):
- QtGui.QFrame.__init__(self, *args)
+ QtWidgets.QFrame.__init__(self, *args)
self.setFocusPolicy(QtCore.Qt.ClickFocus)
# init layout
- layout = QtGui.QHBoxLayout(self)
+ layout = QtWidgets.QHBoxLayout(self)
layout.setSpacing(0)
self.setLayout(layout)
# Create some widgets first to realize a correct tab order
- self._hidebut = QtGui.QToolButton(self)
- self._findText = QtGui.QLineEdit(self)
- self._replaceText = QtGui.QLineEdit(self)
+ self._hidebut = QtWidgets.QToolButton(self)
+ self._findText = QtWidgets.QLineEdit(self)
+ self._replaceText = QtWidgets.QLineEdit(self)
if True:
# Create sub layouts
- vsubLayout = QtGui.QVBoxLayout()
+ vsubLayout = QtWidgets.QVBoxLayout()
vsubLayout.setSpacing(0)
layout.addLayout(vsubLayout, 0)
@@ -184,8 +184,8 @@ class FindReplaceWidget(QtGui.QFrame):
if True:
# Create sub layouts
- vsubLayout = QtGui.QVBoxLayout()
- hsubLayout = QtGui.QHBoxLayout()
+ vsubLayout = QtWidgets.QVBoxLayout()
+ hsubLayout = QtWidgets.QHBoxLayout()
vsubLayout.setSpacing(0)
hsubLayout.setSpacing(0)
layout.addLayout(vsubLayout, 0)
@@ -197,7 +197,7 @@ class FindReplaceWidget(QtGui.QFrame):
vsubLayout.addLayout(hsubLayout)
# Add previous button
- self._findPrev = QtGui.QToolButton(self)
+ self._findPrev = QtWidgets.QToolButton(self)
t = translate('search', 'Previous ::: Find previous occurrence of the pattern.')
self._findPrev.setText(t); self._findPrev.setToolTip(t.tt)
@@ -206,7 +206,7 @@ class FindReplaceWidget(QtGui.QFrame):
hsubLayout.addStretch(1)
# Add next button
- self._findNext = QtGui.QToolButton(self)
+ self._findNext = QtWidgets.QToolButton(self)
t = translate('search', 'Next ::: Find next occurrence of the pattern.')
self._findNext.setText(t); self._findNext.setToolTip(t.tt)
#self._findNext.setDefault(True) # Not possible with tool buttons
@@ -217,8 +217,8 @@ class FindReplaceWidget(QtGui.QFrame):
if True:
# Create sub layouts
- vsubLayout = QtGui.QVBoxLayout()
- hsubLayout = QtGui.QHBoxLayout()
+ vsubLayout = QtWidgets.QVBoxLayout()
+ hsubLayout = QtWidgets.QHBoxLayout()
vsubLayout.setSpacing(0)
hsubLayout.setSpacing(0)
layout.addLayout(vsubLayout, 0)
@@ -230,7 +230,7 @@ class FindReplaceWidget(QtGui.QFrame):
vsubLayout.addLayout(hsubLayout)
# Add replace-all button
- self._replaceAll = QtGui.QToolButton(self)
+ self._replaceAll = QtWidgets.QToolButton(self)
t = translate('search', 'Repl. all ::: Replace all matches in current document.')
self._replaceAll.setText(t); self._replaceAll.setToolTip(t.tt)
hsubLayout.addWidget(self._replaceAll, 0)
@@ -238,7 +238,7 @@ class FindReplaceWidget(QtGui.QFrame):
hsubLayout.addStretch(1)
# Add replace button
- self._replace = QtGui.QToolButton(self)
+ self._replace = QtWidgets.QToolButton(self)
t = translate('search', 'Replace ::: Replace this match.')
self._replace.setText(t); self._replace.setToolTip(t.tt)
hsubLayout.addWidget(self._replace, 0)
@@ -249,39 +249,39 @@ class FindReplaceWidget(QtGui.QFrame):
if True:
# Create sub layouts
- vsubLayout = QtGui.QVBoxLayout()
+ vsubLayout = QtWidgets.QVBoxLayout()
vsubLayout.setSpacing(0)
layout.addLayout(vsubLayout, 0)
# Add match-case checkbox
t = translate('search', 'Match case ::: Find words that match case.')
- self._caseCheck = QtGui.QCheckBox(t, self)
+ self._caseCheck = QtWidgets.QCheckBox(t, self)
self._caseCheck.setToolTip(t.tt)
vsubLayout.addWidget(self._caseCheck, 0)
# Add regexp checkbox
t = translate('search', 'RegExp ::: Find using regular expressions.')
- self._regExp = QtGui.QCheckBox(t, self)
+ self._regExp = QtWidgets.QCheckBox(t, self)
self._regExp.setToolTip(t.tt)
vsubLayout.addWidget(self._regExp, 0)
if True:
# Create sub layouts
- vsubLayout = QtGui.QVBoxLayout()
+ vsubLayout = QtWidgets.QVBoxLayout()
vsubLayout.setSpacing(0)
layout.addLayout(vsubLayout, 0)
# Add whole-word checkbox
t = translate('search', 'Whole words ::: Find only whole words.')
- self._wholeWord = QtGui.QCheckBox(t, self)
+ self._wholeWord = QtWidgets.QCheckBox(t, self)
self._wholeWord.setToolTip(t.tt)
self._wholeWord.resize(60, 16)
vsubLayout.addWidget(self._wholeWord, 0)
# Add autohide dropbox
t = translate('search', 'Auto hide ::: Hide search/replace when unused for 10 s.')
- self._autoHide = QtGui.QCheckBox(t, self)
+ self._autoHide = QtWidgets.QCheckBox(t, self)
self._autoHide.setToolTip(t.tt)
self._autoHide.resize(60, 16)
vsubLayout.addWidget(self._autoHide, 0)
@@ -377,7 +377,7 @@ class FindReplaceWidget(QtGui.QFrame):
event.accept()
return True
# Otherwise ... handle in default manner
- return QtGui.QFrame.event(self, event)
+ return QtWidgets.QFrame.event(self, event)
def handleReplacePossible(self, state):
@@ -588,7 +588,7 @@ class FileTabWidget(CompactTabWidget):
self._itemHistory = []
# # Create a corner widget
-# but = QtGui.QToolButton()
+# but = QtWidgets.QToolButton()
# but.setIcon( pyzo.icons.cross )
# but.setIconSize(QtCore.QSize(16,16))
# but.clicked.connect(self.onClose)
@@ -793,7 +793,7 @@ class FileTabWidget(CompactTabWidget):
# Add tab and widget
i = self.addTab(item.editor, item.name)
tabBut = EditorTabToolButton(self.tabBar())
- self.tabBar().setTabButton(i, QtGui.QTabBar.LeftSide, tabBut)
+ self.tabBar().setTabButton(i, QtWidgets.QTabBar.LeftSide, tabBut)
# Keep informed about changes
item.editor.somethingChanged.connect(self.updateItems)
@@ -863,12 +863,12 @@ class FileTabWidget(CompactTabWidget):
nBlocks = 0
# Update appearance of icon
- but = tabBar.tabButton(i, QtGui.QTabBar.LeftSide)
+ but = tabBar.tabButton(i, QtWidgets.QTabBar.LeftSide)
but.updateIcon(item.dirty, self._mainFile==item.id,
item.pinned, nBlocks)
-class EditorTabs(QtGui.QWidget):
+class EditorTabs(QtWidgets.QWidget):
""" The EditorTabs instance manages the open files and corresponding
editors. It does the saving loading etc.
"""
@@ -884,7 +884,7 @@ class EditorTabs(QtGui.QWidget):
def __init__(self, parent):
- QtGui.QWidget.__init__(self,parent)
+ QtWidgets.QWidget.__init__(self,parent)
# keep a booking of opened directories
self._lastpath = ''
@@ -905,7 +905,7 @@ class EditorTabs(QtGui.QWidget):
self._findReplace = FindReplaceWidget(self)
# create box layout control and add widgets
- self._boxLayout = QtGui.QVBoxLayout(self)
+ self._boxLayout = QtWidgets.QVBoxLayout(self)
self._boxLayout.addWidget(self._tabs, 1)
self._boxLayout.addWidget(self._findReplace, 0)
# spacing of widgets
@@ -1079,7 +1079,7 @@ class EditorTabs(QtGui.QWidget):
#filter += "Py+Cy+C (*.py *.pyw *.pyi *.pyx *.pxd *.c *.h *.cpp);;"
filter += "All (*)"
if True:
- filenames = QtGui.QFileDialog.getOpenFileNames(self,
+ filenames = QtWidgets.QFileDialog.getOpenFileNames(self,
msg, startdir, filter)
if isinstance(filenames, tuple): # PySide
filenames = filenames[0]
@@ -1087,7 +1087,7 @@ class EditorTabs(QtGui.QWidget):
# Example how to preselect files, can be used when the users
# opens a file in a project to select all files currently not
# loaded.
- d = QtGui.QFileDialog(self, msg, startdir, filter)
+ d = QtWidgets.QFileDialog(self, msg, startdir, filter)
d.setFileMode(d.ExistingFiles)
d.selectFile('"codeparser.py" "editorStack.py"')
d.exec_()
@@ -1119,7 +1119,7 @@ class EditorTabs(QtGui.QWidget):
# show dialog
msg = "Select a directory to open"
- dirname = QtGui.QFileDialog.getExistingDirectory(self, msg, startdir)
+ dirname = QtWidgets.QFileDialog.getExistingDirectory(self, msg, startdir)
# was a dir selected?
if not dirname:
@@ -1162,7 +1162,7 @@ class EditorTabs(QtGui.QWidget):
# Notify in logger
print("Error loading file: ", err)
# Make sure the user knows
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle("Error loading file")
m.setText(str(err))
m.setIcon(m.Warning)
@@ -1253,7 +1253,7 @@ class EditorTabs(QtGui.QWidget):
filter += "C (*.c *.h *.cpp);;"
#filter += "Py+Cy+C (*.py *.pyw *.pyi *.pyx *.pxd *.c *.h *.cpp);;"
filter += "All (*.*)"
- filename = QtGui.QFileDialog.getSaveFileName(self,
+ filename = QtWidgets.QFileDialog.getSaveFileName(self,
msg, startdir, filter)
if isinstance(filename, tuple): # PySide
filename = filename[0]
@@ -1301,7 +1301,7 @@ class EditorTabs(QtGui.QWidget):
# Notify in logger
print("Error saving file:",err)
# Make sure the user knows
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle("Error saving file")
m.setText(str(err))
m.setIcon(m.Warning)
diff --git a/pyzo/core/icons.py b/pyzo/core/icons.py
index e509652..a6c732f 100644
--- a/pyzo/core/icons.py
+++ b/pyzo/core/icons.py
@@ -12,7 +12,7 @@ that show information to the user in a very effective, yet subtle manner.
"""
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
@@ -128,7 +128,7 @@ class IconArtist:
# todo: not used; remove me?
-class TabCloseButton(QtGui.QToolButton):
+class TabCloseButton(QtWidgets.QToolButton):
""" TabCloseButton
This class implements a very compact close button to be used in tabs.
@@ -140,7 +140,7 @@ class TabCloseButton(QtGui.QToolButton):
SIZE = 5,8
def __init__(self):
- QtGui.QToolButton.__init__(self)
+ QtWidgets.QToolButton.__init__(self)
# Init
self.setIconSize(QtCore.QSize(*self.SIZE))
@@ -157,11 +157,11 @@ class TabCloseButton(QtGui.QToolButton):
tabs.tabCloseRequested.emit(index)
def enterEvent(self, event):
- QtGui.QToolButton.enterEvent(self, event)
+ QtWidgets.QToolButton.enterEvent(self, event)
self.setIcon(self.getCrossIcon2())
def leaveEvent(self, event):
- QtGui.QToolButton.leaveEvent(self, event)
+ QtWidgets.QToolButton.leaveEvent(self, event)
self.setIcon(self.getCrossIcon1())
def _createCrossPixmap(self, alpha):
@@ -204,7 +204,7 @@ class TabCloseButton(QtGui.QToolButton):
# todo: not used; remove me?
-class ToolButtonWithMenuIndication(QtGui.QToolButton):
+class ToolButtonWithMenuIndication(QtWidgets.QToolButton):
""" ToolButtonWithMenuIndication
Tool button that wraps the icon in a slightly larger icon that
@@ -219,7 +219,7 @@ class ToolButtonWithMenuIndication(QtGui.QToolButton):
SIZE = 21, 16
def __init__(self):
- QtGui.QToolButton.__init__(self)
+ QtWidgets.QToolButton.__init__(self)
# Init
self.setIconSize(QtCore.QSize(*self.SIZE))
@@ -243,9 +243,9 @@ class ToolButtonWithMenuIndication(QtGui.QToolButton):
self._menuPressed = event.pos()
def mouseMoveEvent(self, event):
- QtGui.QToolButton.mouseMoveEvent(self, event)
+ QtWidgets.QToolButton.mouseMoveEvent(self, event)
if self._menuPressed:
- dragDist = QtGui.QApplication.startDragDistance()
+ dragDist = QtWidgets.QApplication.startDragDistance()
if (event.pos()-self._menuPressed).manhattanLength() >= dragDist:
self._menuPressed = False
@@ -257,13 +257,13 @@ class ToolButtonWithMenuIndication(QtGui.QToolButton):
tabs.customContextMenuRequested.emit(pos)
def enterEvent(self, event):
- QtGui.QToolButton.enterEvent(self, event)
+ QtWidgets.QToolButton.enterEvent(self, event)
self._menuarrow = self._menuarrow2
self.setIcon()
self._menuPressed = False
def leaveEvent(self, event):
- QtGui.QToolButton.leaveEvent(self, event)
+ QtWidgets.QToolButton.leaveEvent(self, event)
self._menuarrow = self._menuarrow1
self.setIcon()
self._menuPressed = False
@@ -283,7 +283,7 @@ class ToolButtonWithMenuIndication(QtGui.QToolButton):
icon = artist.finish()
# Set icon
- QtGui.QToolButton.setIcon(self, icon)
+ QtWidgets.QToolButton.setIcon(self, icon)
def _createMenuArrowPixmap(self, strength):
@@ -293,7 +293,7 @@ class ToolButtonWithMenuIndication(QtGui.QToolButton):
-class TabToolButton(QtGui.QToolButton):
+class TabToolButton(QtWidgets.QToolButton):
""" TabToolButton
Base menu for editor and shell tabs.
@@ -303,7 +303,7 @@ class TabToolButton(QtGui.QToolButton):
SIZE = 16, 16
def __init__(self, *args):
- QtGui.QToolButton.__init__(self, *args)
+ QtWidgets.QToolButton.__init__(self, *args)
# Init
self.setIconSize(QtCore.QSize(*self.SIZE))
@@ -370,7 +370,7 @@ class TabToolButtonWithCloseButton(TabToolButton):
def mouseMoveEvent(self, event):
- QtGui.QToolButton.mouseMoveEvent(self, event)
+ QtWidgets.QToolButton.mouseMoveEvent(self, event)
new_overCross = self._isOverCross(event.pos())
if new_overCross != self._overCross:
self._overCross = new_overCross
@@ -404,7 +404,7 @@ class TabToolButtonWithCloseButton(TabToolButton):
icon = artist.finish()
# Set icon
- QtGui.QToolButton.setIcon(self, icon)
+ QtWidgets.QToolButton.setIcon(self, icon)
def _createMenuArrowPixmap(self, strength):
diff --git a/pyzo/core/main.py b/pyzo/core/main.py
index c893ba6..f4f423b 100644
--- a/pyzo/core/main.py
+++ b/pyzo/core/main.py
@@ -19,16 +19,16 @@ from queue import Queue, Empty
import pyzo
from pyzo.core.icons import IconArtist
from pyzo.core import commandline
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo.core.splash import SplashWidget
from pyzo.util import paths
from pyzo.util import zon as ssdf # zon is ssdf-light
-class MainWindow(QtGui.QMainWindow):
+class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None, locale=None):
- QtGui.QMainWindow.__init__(self, parent)
+ QtWidgets.QMainWindow.__init__(self, parent)
self._closeflag = 0 # Used during closing/restarting
@@ -67,11 +67,11 @@ class MainWindow(QtGui.QMainWindow):
pyzo.main = self
# Init dockwidget settings
- self.setTabPosition(QtCore.Qt.AllDockWidgetAreas,QtGui.QTabWidget.South)
+ self.setTabPosition(QtCore.Qt.AllDockWidgetAreas,QtWidgets.QTabWidget.South)
self.setDockOptions(
- QtGui.QMainWindow.AllowNestedDocks
- | QtGui.QMainWindow.AllowTabbedDocks
- #| QtGui.QMainWindow.AnimatedDocks
+ QtWidgets.QMainWindow.AllowNestedDocks
+ | QtWidgets.QMainWindow.AllowTabbedDocks
+ #| QtWidgets.QMainWindow.AnimatedDocks
)
# Set window atrributes
@@ -86,8 +86,8 @@ class MainWindow(QtGui.QMainWindow):
# Hold the splash screen if needed
while time.time() < splash_timeout:
- QtGui.qApp.flush()
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.flush()
+ QtWidgets.qApp.processEvents()
time.sleep(0.05)
# Populate the window (imports more code)
@@ -124,7 +124,7 @@ class MainWindow(QtGui.QMainWindow):
# To force drawing ourselves
def paintEvent(self, event):
- QtGui.QMainWindow.paintEvent(self, event)
+ QtWidgets.QMainWindow.paintEvent(self, event)
self._ispainted = True
def paintNow(self):
@@ -134,8 +134,8 @@ class MainWindow(QtGui.QMainWindow):
self._ispainted = False
self.update()
while not self._ispainted:
- QtGui.qApp.flush()
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.flush()
+ QtWidgets.qApp.processEvents()
time.sleep(0.01)
def _populate(self):
@@ -163,7 +163,7 @@ class MainWindow(QtGui.QMainWindow):
self.setCentralWidget(pyzo.editors)
# Create floater for shell
- self._shellDock = dock = QtGui.QDockWidget(self)
+ self._shellDock = dock = QtWidgets.QDockWidget(self)
dock.setFeatures(dock.DockWidgetMovable)
dock.setObjectName('shells')
dock.setWindowTitle('Shells')
@@ -297,10 +297,10 @@ class MainWindow(QtGui.QMainWindow):
# Initialize
# Get native pallette (used below)
- QtGui.qApp.nativePalette = QtGui.qApp.palette()
+ QtWidgets.qApp.nativePalette = QtWidgets.qApp.palette()
# Obtain default style name
- pyzo.defaultQtStyleName = str(QtGui.qApp.style().objectName())
+ pyzo.defaultQtStyleName = str(QtWidgets.qApp.style().objectName())
# Other than gtk+ and mac, cleanlooks looks best (in my opinion)
if 'gtk' in pyzo.defaultQtStyleName.lower():
@@ -327,19 +327,19 @@ class MainWindow(QtGui.QMainWindow):
useStandardStyle = True
# Check if this style exist, set to default otherwise
- styleNames = [name.lower() for name in QtGui.QStyleFactory.keys()]
+ styleNames = [name.lower() for name in QtWidgets.QStyleFactory.keys()]
if stylename2.lower() not in styleNames:
stylename2 = pyzo.defaultQtStyleName
# Try changing the style
- qstyle = QtGui.qApp.setStyle(stylename2)
+ qstyle = QtWidgets.qApp.setStyle(stylename2)
# Set palette
if qstyle:
if useStandardStyle:
- QtGui.qApp.setPalette(QtGui.QStyle.standardPalette(qstyle))
+ QtWidgets.qApp.setPalette(QtGui.QStyle.standardPalette(qstyle))
else:
- QtGui.qApp.setPalette(QtGui.qApp.nativePalette)
+ QtWidgets.qApp.setPalette(QtWidgets.qApp.nativePalette)
# Done
return qstyle
@@ -395,7 +395,7 @@ class MainWindow(QtGui.QMainWindow):
# print('Number of threads alive:', threading.activeCount())
# Proceed as normal
- QtGui.QMainWindow.closeEvent(self, event)
+ QtWidgets.QMainWindow.closeEvent(self, event)
# Harder exit to prevent segfault. Not really a solution,
# but it does the job until Pyside gets fixed.
@@ -428,7 +428,7 @@ class MainWindow(QtGui.QMainWindow):
def createPopupMenu(self):
# Init menu
- menu = QtGui.QMenu()
+ menu = QtWidgets.QMenu()
# Insert two items
for item in ['Editors', 'Shells']:
@@ -471,7 +471,7 @@ def loadAppIcons():
# Set as application icon. This one is used as the default for all
# windows of the application.
- QtGui.qApp.setWindowIcon(pyzo.icon)
+ QtWidgets.qApp.setWindowIcon(pyzo.icon)
# Construct another icon to show when the current shell is busy
artist = IconArtist(pyzo.icon) # extracts the 16x16 version
@@ -558,7 +558,7 @@ class _CallbackEventHandler(QtCore.QObject):
def postEventWithCallback(self, callback, *args):
self.queue.put((callback, args))
- QtGui.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
+ QtWidgets.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
def callLater(callback, *args):
""" callLater(callback, *args)
diff --git a/pyzo/core/menu.py b/pyzo/core/menu.py
index 9906d51..c130f8e 100644
--- a/pyzo/core/menu.py
+++ b/pyzo/core/menu.py
@@ -17,7 +17,7 @@ import unicodedata
import datetime
import webbrowser
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
from pyzo.core.compactTabWidget import CompactTabWidget
@@ -59,7 +59,7 @@ def buildMenus(menuBar):
if action is menuBar._lastAction:
if ((not menuBar._haveRaisedTooltip) and
action.menu().isVisible()):
- QtGui.QToolTip.hideText()
+ QtWidgets.QToolTip.hideText()
menuBar._haveRaisedTooltip = True
else:
menuBar._lastAction = action
@@ -68,7 +68,7 @@ def buildMenus(menuBar):
tt = action.statusTip()
if hasattr(action, '_shortcutsText'):
tt = tt + ' ({})'.format(action._shortcutsText) # Add shortcuts text in it
- QtGui.QToolTip.showText(QtGui.QCursor.pos(), tt)
+ QtWidgets.QToolTip.showText(QtGui.QCursor.pos(), tt)
menuBar.hovered.connect(onHover)
@@ -87,7 +87,7 @@ def getShortcut(fullName):
""" Given the full name or an action, get the shortcut
from the pyzo.config.shortcuts2 dict. A tuple is returned
representing the two shortcuts. """
- if isinstance(fullName, QtGui.QAction):
+ if isinstance(fullName, QtWidgets.QAction):
fullName = fullName.menuPath # the menuPath property is set in Menu._addAction
shortcut = '', ''
if fullName in pyzo.config.shortcuts2:
@@ -163,7 +163,7 @@ def unwrapText(text):
-class Menu(QtGui.QMenu):
+class Menu(QtWidgets.QMenu):
""" Menu(parent=None, name=None)
Base class for all menus. Has methods to add actions of all sorts.
@@ -176,7 +176,7 @@ class Menu(QtGui.QMenu):
"""
def __init__(self, parent=None, name=None):
- QtGui.QMenu.__init__(self, parent)
+ QtWidgets.QMenu.__init__(self, parent)
# Make sure that the menu has a title
if name:
@@ -267,7 +267,7 @@ class Menu(QtGui.QMenu):
"""
# Add menu in the conventional way
- a = QtGui.QMenu.addMenu(self, menu)
+ a = QtWidgets.QMenu.addMenu(self, menu)
a.menuPath = menu.menuPath
# Set icon
@@ -323,7 +323,7 @@ class Menu(QtGui.QMenu):
group = 'default'
if group not in self._groups:
#self._groups contains tuples (actiongroup, dict-of-actions)
- self._groups[group] = (QtGui.QActionGroup(self), {})
+ self._groups[group] = (QtWidgets.QActionGroup(self), {})
actionGroup,actions = self._groups[group]
actionGroup.addAction(a)
@@ -580,9 +580,9 @@ class FileMenu(Menu):
def _print(self):
editor = pyzo.editors.getCurrentEditor()
if editor is not None:
- printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
+ printer = QtWidgets.QPrinter(QtWidgets.QPrinter.HighResolution)
if True:
- filename = QtGui.QFileDialog.getSaveFileName(None,
+ filename = QtWidgets.QFileDialog.getSaveFileName(None,
'Export PDF', os.path.expanduser("~"), "*.pdf *.ps")
if isinstance(filename, tuple): # PySide
filename = filename[0]
@@ -590,7 +590,7 @@ class FileMenu(Menu):
return
printer.setOutputFileName(filename)
else:
- d = QtGui.QPrintDialog(printer)
+ d = QtWidgets.QPrintDialog(printer)
d.setWindowTitle('Print code')
d.setOption(d.PrintSelection, editor.textCursor().hasSelection())
d.setOption(d.PrintToFile, True)
@@ -650,7 +650,7 @@ class EditMenu(Menu):
def _editItemCallback(self, action):
- widget = QtGui.qApp.focusWidget()
+ widget = QtWidgets.qApp.focusWidget()
#If the widget has a 'name' attribute, call it
if hasattr(widget, action):
getattr(widget, action)()
@@ -726,7 +726,7 @@ class ViewMenu(Menu):
# Create qt theme menu
t = translate("menu", "Qt theme ::: The styling of the user interface widgets.")
self._qtThemeMenu = GeneralOptionsMenu(self, t, self._setQtTheme)
- styleNames = list(QtGui.QStyleFactory.keys()) + ['Cleanlooks+']
+ styleNames = list(QtWidgets.QStyleFactory.keys()) + ['Cleanlooks+']
styleNames.sort()
titles = [name for name in styleNames]
styleNames = [name.lower() for name in styleNames]
@@ -1257,7 +1257,7 @@ class EditorTabContextMenu(Menu):
pass
elif action == 'copypath':
filename = item.filename
- QtGui.qApp.clipboard().setText(filename)
+ QtWidgets.qApp.clipboard().setText(filename)
elif action == "pin":
item._pinned = not item._pinned
elif action == "main":
@@ -1340,7 +1340,7 @@ class RunMenu(Menu):
msg += "No editor selected."
# Show error dialog
if msg:
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Could not run"))
m.setText(translate("menu", "Could not run " + what + ":\n\n" + msg))
m.setIcon(m.Warning)
@@ -1526,7 +1526,7 @@ class RunMenu(Menu):
err = translate("menu", "Can only run scripts that are in the file system.")
# If not success, notify
if err:
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Could not run script."))
m.setText(err)
m.setIcon(m.Warning)
@@ -1620,7 +1620,7 @@ class HelpMenu(Menu):
text += "Latest available version is: {}\n\n"
text = text.format(pyzo.__version__, versions[0])
# Show message box
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Check for the latest version."))
if versions == '?':
text += "Oops, could not determine available versions.\n\n"
@@ -1693,7 +1693,7 @@ class SettingsMenu(Menu):
source code at:\r
{}
""".format(os.path.join(pyzo.pyzoDir, 'codeeditor', 'base.py'))
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Edit syntax styling"))
m.setText(unwrapText(text))
m.setIcon(m.Information)
@@ -1714,7 +1714,7 @@ class SettingsMenu(Menu):
Note that most settings require a restart for the change to
take effect.
""")
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Advanced settings"))
m.setText(unwrapText(text))
m.setIcon(m.Information)
@@ -1740,7 +1740,7 @@ class SettingsMenu(Menu):
The language has been changed.
Pyzo needs to restart for the change to take effect.
""")
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Language changed"))
m.setText(unwrapText(text))
m.setIcon(m.Information)
@@ -1882,7 +1882,7 @@ class KeyMapModel(QtCore.QAbstractItemModel):
# get text and shortcuts
key1, key2 = '', ''
- if isinstance(item, QtGui.QMenu):
+ if isinstance(item, QtWidgets.QMenu):
value = item.title()
else:
value = item.text()
@@ -1955,7 +1955,7 @@ class KeyMapModel(QtCore.QAbstractItemModel):
if index.row()<0:
return True
else:
- return isinstance(index.internalPointer(), QtGui.QMenu)
+ return isinstance(index.internalPointer(), QtWidgets.QMenu)
def index(self, row, column, parent):
# if not self.hasIndex(row, column, parent):
@@ -1987,7 +1987,7 @@ keymap = {k.Key_Enter:'Enter', k.Key_Return:'Return', k.Key_Escape:'Escape',
k.Key_Left:'Left', k.Key_Up:'Up', k.Key_Right:'Right', k.Key_Down:'Down' }
-class KeyMapLineEdit(QtGui.QLineEdit):
+class KeyMapLineEdit(QtWidgets.QLineEdit):
""" A modified version of a lineEdit object that catches the key event
and displays "Ctrl" when control was pressed, and similarly for alt and
shift, function keys and other keys.
@@ -1996,7 +1996,7 @@ class KeyMapLineEdit(QtGui.QLineEdit):
textUpdate = QtCore.Signal()
def __init__(self, *args, **kwargs):
- QtGui.QLineEdit.__init__(self, *args, **kwargs)
+ QtWidgets.QLineEdit.__init__(self, *args, **kwargs)
self.clear()
@@ -2009,17 +2009,17 @@ class KeyMapLineEdit(QtGui.QLineEdit):
# Ctrl+A, while the actually displayed value is an OS shortcut (e.g. on Mac
# Cmd-symbol + A)
def setText(self, text):
- QtGui.QLineEdit.setText(self, translateShortcutToOSNames(text))
+ QtWidgets.QLineEdit.setText(self, translateShortcutToOSNames(text))
self._shortcut = text
def text(self):
return self._shortcut
def clear(self):
- QtGui.QLineEdit.setText(self, '<enter key combination here>')
+ QtWidgets.QLineEdit.setText(self, '<enter key combination here>')
self._shortcut = ''
def focusInEvent(self, event):
#self.clear()
- QtGui.QLineEdit.focusInEvent(self, event)
+ QtWidgets.QLineEdit.focusInEvent(self, event)
def event(self,event):
# Override event handler to enable catching the Tab key
@@ -2032,7 +2032,7 @@ class KeyMapLineEdit(QtGui.QLineEdit):
self.keyReleaseEvent(event)
return True #Mark as handled
#Default: handle events as usual
- return QtGui.QLineEdit.event(self,event)
+ return QtWidgets.QLineEdit.event(self,event)
def keyPressEvent(self, event):
# get key codes
@@ -2056,14 +2056,14 @@ class KeyMapLineEdit(QtGui.QLineEdit):
# apply!
if text:
storeNativeKey, text0 = True, text
- if QtGui.qApp.keyboardModifiers() & k.AltModifier:
+ if QtWidgets.qApp.keyboardModifiers() & k.AltModifier:
text = 'Alt+' + text
- if QtGui.qApp.keyboardModifiers() & k.ShiftModifier:
+ if QtWidgets.qApp.keyboardModifiers() & k.ShiftModifier:
text = 'Shift+' + text
storeNativeKey = False
- if QtGui.qApp.keyboardModifiers() & k.ControlModifier:
+ if QtWidgets.qApp.keyboardModifiers() & k.ControlModifier:
text = 'Ctrl+' + text
- if QtGui.qApp.keyboardModifiers() & k.MetaModifier:
+ if QtWidgets.qApp.keyboardModifiers() & k.MetaModifier:
text = 'Meta+' + text
self.setText(text)
if storeNativeKey and nativekey:
@@ -2074,7 +2074,7 @@ class KeyMapLineEdit(QtGui.QLineEdit):
self.textUpdate.emit()
-class KeyMapEditDialog(QtGui.QDialog):
+class KeyMapEditDialog(QtWidgets.QDialog):
""" The prompt that is shown when double clicking
a keymap in the tree.
It notifies the user when the entered shortcut is already used
@@ -2083,7 +2083,7 @@ class KeyMapEditDialog(QtGui.QDialog):
"""
def __init__(self, *args):
- QtGui.QDialog.__init__(self, *args)
+ QtWidgets.QDialog.__init__(self, *args)
# set title
self.setWindowTitle(translate("menu dialog", 'Edit shortcut mapping'))
@@ -2096,7 +2096,7 @@ class KeyMapEditDialog(QtGui.QDialog):
self.setMaximumSize(*size2)
self.setMinimumSize(*size2)
- self._label = QtGui.QLabel("", self)
+ self._label = QtWidgets.QLabel("", self)
self._label.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
self._label.resize(size[0]-20, 100)
self._label.move(10,2)
@@ -2105,15 +2105,15 @@ class KeyMapEditDialog(QtGui.QDialog):
self._line.resize(size[0]-80, 20)
self._line.move(10,90)
- self._clear = QtGui.QPushButton("Clear", self)
+ self._clear = QtWidgets.QPushButton("Clear", self)
self._clear.resize(50, 20)
self._clear.move(size[0]-60,90)
- self._apply = QtGui.QPushButton("Apply", self)
+ self._apply = QtWidgets.QPushButton("Apply", self)
self._apply.resize(50, 20)
self._apply.move(size[0]-120,120)
- self._cancel = QtGui.QPushButton("Cancel", self)
+ self._cancel = QtWidgets.QPushButton("Cancel", self)
self._cancel.resize(50, 20)
self._cancel.move(size[0]-60,120)
@@ -2220,14 +2220,14 @@ class KeyMapEditDialog(QtGui.QDialog):
self.close()
-class KeymappingDialog(QtGui.QDialog):
+class KeymappingDialog(QtWidgets.QDialog):
""" The main keymap dialog, it has tabs corresponding with the
different menus and each tab has a tree representing the structure
of these menus. The current shortcuts are displayed.
On double clicking on an item, the shortcut can be edited. """
def __init__(self, *args):
- QtGui.QDialog.__init__(self, *args)
+ QtWidgets.QDialog.__init__(self, *args)
# set title
self.setWindowTitle(translate("menu dialog", 'Shortcut mappings'))
@@ -2252,7 +2252,7 @@ class KeymappingDialog(QtGui.QDialog):
# create treeview and model
model = KeyMapModel()
model.setRootMenu(menu)
- tree = QtGui.QTreeView(self.tab)
+ tree = QtWidgets.QTreeView(self.tab)
tree.setModel(model)
# configure treeview
tree.clicked.connect(self.onClickSelect)
@@ -2289,7 +2289,7 @@ class KeymappingDialog(QtGui.QDialog):
def popupItem(self, item, shortCutId=1):
""" Popup the dialog to change the shortcut. """
- if isinstance(item, QtGui.QAction) and item.text():
+ if isinstance(item, QtWidgets.QAction) and item.text():
# create prompt dialog
dlg = KeyMapEditDialog(self)
dlg.setFullName( item.menuPath, shortCutId==1 )
diff --git a/pyzo/core/shell.py b/pyzo/core/shell.py
index 3eb9750..9fd8985 100644
--- a/pyzo/core/shell.py
+++ b/pyzo/core/shell.py
@@ -24,7 +24,7 @@ import yoton
import pyzo
from pyzo.util import zon as ssdf # zon is ssdf-light
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
Qt = QtCore.Qt
from pyzo.codeeditor.highlighter import Highlighter
@@ -57,7 +57,7 @@ class YotonEmbedder(QtCore.QObject):
def postYotonEvent(self):
try:
- QtGui.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
+ QtWidgets.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
except Exception:
pass # If pyzo is shutting down, the app may be None
diff --git a/pyzo/core/shellInfoDialog.py b/pyzo/core/shellInfoDialog.py
index b7db015..3ae8274 100644
--- a/pyzo/core/shellInfoDialog.py
+++ b/pyzo/core/shellInfoDialog.py
@@ -12,7 +12,7 @@ Implements shell configuration dialog.
"""
import os, sys, time, re
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
from pyzo.core.compactTabWidget import CompactTabWidget
@@ -24,7 +24,7 @@ from pyzo import translate
## Implement widgets that have a common interface
-class ShellInfoLineEdit(QtGui.QLineEdit):
+class ShellInfoLineEdit(QtWidgets.QLineEdit):
def setTheText(self, value):
self.setText(value)
@@ -53,10 +53,10 @@ class ShellInfo_name(ShellInfoLineEdit):
-class ShellInfo_exe(QtGui.QComboBox):
+class ShellInfo_exe(QtWidgets.QComboBox):
def __init__(self, *args):
- QtGui.QComboBox.__init__(self, *args)
+ QtWidgets.QComboBox.__init__(self, *args)
def _interpreterName(self, p):
if p.is_conda:
@@ -100,10 +100,10 @@ class ShellInfo_exe(QtGui.QComboBox):
return value.strip()
-class ShellInfo_ipython(QtGui.QCheckBox):
+class ShellInfo_ipython(QtWidgets.QCheckBox):
def __init__(self, parent):
- QtGui.QCheckBox.__init__(self, parent)
+ QtWidgets.QCheckBox.__init__(self, parent)
t = translate('shell', 'ipython ::: Use IPython shell if available.')
self.setText(t.tt)
self.setChecked(False)
@@ -121,7 +121,7 @@ class ShellInfo_ipython(QtGui.QCheckBox):
return 'no'
-class ShellInfo_gui(QtGui.QComboBox):
+class ShellInfo_gui(QtWidgets.QComboBox):
# For (backward) compatibility
COMPAT = {'QT4':'PYQT4'}
@@ -165,14 +165,14 @@ class ShellInfo_gui(QtGui.QComboBox):
-class ShellinfoWithSystemDefault(QtGui.QVBoxLayout):
+class ShellinfoWithSystemDefault(QtWidgets.QVBoxLayout):
DISABLE_SYSTEM_DEFAULT = sys.platform == 'darwin'
SYSTEM_VALUE = ''
def __init__(self, parent, widget):
# Do not pass parent, because is a sublayout
- QtGui.QVBoxLayout.__init__(self)
+ QtWidgets.QVBoxLayout.__init__(self)
# Layout
self.setSpacing(1)
@@ -181,7 +181,7 @@ class ShellinfoWithSystemDefault(QtGui.QVBoxLayout):
# Create checkbox widget
if not self.DISABLE_SYSTEM_DEFAULT:
t = translate('shell', 'Use system default')
- self._check = QtGui.QCheckBox(t, parent)
+ self._check = QtWidgets.QCheckBox(t, parent)
self._check.stateChanged.connect(self.onCheckChanged)
self.addWidget(self._check)
@@ -243,7 +243,7 @@ class ShellInfo_pythonPath(ShellinfoWithSystemDefault):
def __init__(self, parent):
# Create sub-widget
- self._edit = QtGui.QTextEdit(parent)
+ self._edit = QtWidgets.QTextEdit(parent)
self._edit.zoomOut(1)
self._edit.setMaximumHeight(80)
self._edit.setMinimumWidth(200)
@@ -273,7 +273,7 @@ class ShellInfo_pythonPath(ShellinfoWithSystemDefault):
# def __init__(self, parent):
#
# # Create sub-widget
-# self._edit = QtGui.QLineEdit(parent)
+# self._edit = QtWidgets.QLineEdit(parent)
# self._edit.textEdited.connect(self.onEditChanged)
#
# # Instantiate
@@ -296,7 +296,7 @@ class ShellInfo_pythonPath(ShellinfoWithSystemDefault):
-class ShellInfo_startupScript(QtGui.QVBoxLayout):
+class ShellInfo_startupScript(QtWidgets.QVBoxLayout):
DISABLE_SYSTEM_DEFAULT = sys.platform == 'darwin'
SYSTEM_VALUE = '$PYTHONSTARTUP'
@@ -304,17 +304,17 @@ class ShellInfo_startupScript(QtGui.QVBoxLayout):
def __init__(self, parent):
# Do not pass parent, because is a sublayout
- QtGui.QVBoxLayout.__init__(self)
+ QtWidgets.QVBoxLayout.__init__(self)
# Create sub-widget
- self._edit1 = QtGui.QLineEdit(parent)
+ self._edit1 = QtWidgets.QLineEdit(parent)
self._edit1.textEdited.connect(self.onEditChanged)
if sys.platform.startswith('win'):
self._edit1.setPlaceholderText('C:\\path\\to\\script.py')
else:
self._edit1.setPlaceholderText('/path/to/script.py')
#
- self._edit2 = QtGui.QTextEdit(parent)
+ self._edit2 = QtWidgets.QTextEdit(parent)
self._edit2.zoomOut(1)
self._edit2.setMaximumHeight(80)
self._edit2.setMinimumWidth(200)
@@ -327,7 +327,7 @@ class ShellInfo_startupScript(QtGui.QVBoxLayout):
# Create radio widget for system default
t = translate('shell', 'Use system default')
- self._radio_system = QtGui.QRadioButton(t, parent)
+ self._radio_system = QtWidgets.QRadioButton(t, parent)
self._radio_system.toggled.connect(self.onCheckChanged)
self.addWidget(self._radio_system)
if self.DISABLE_SYSTEM_DEFAULT:
@@ -335,13 +335,13 @@ class ShellInfo_startupScript(QtGui.QVBoxLayout):
# Create radio widget for file
t = translate('shell', 'File to run at startup')
- self._radio_file = QtGui.QRadioButton(t, parent)
+ self._radio_file = QtWidgets.QRadioButton(t, parent)
self._radio_file.toggled.connect(self.onCheckChanged)
self.addWidget(self._radio_file)
# Create radio widget for code
t = translate('shell', 'Code to run at startup')
- self._radio_code = QtGui.QRadioButton(t, parent)
+ self._radio_code = QtWidgets.QRadioButton(t, parent)
self._radio_code.toggled.connect(self.onCheckChanged)
self.addWidget(self._radio_code)
@@ -437,11 +437,11 @@ class ShellInfo_argv(ShellInfoLineEdit):
-class ShellInfo_environ(QtGui.QTextEdit):
+class ShellInfo_environ(QtWidgets.QTextEdit):
EXAMPLE = 'EXAMPLE_VAR1=value1\nPYZO_PROCESS_EVENTS_WHILE_DEBUGGING=1'
def __init__(self, parent):
- QtGui.QTextEdit.__init__(self, parent)
+ QtWidgets.QTextEdit.__init__(self, parent)
self.zoomOut(1)
self.setText(self.EXAMPLE)
@@ -468,7 +468,7 @@ class ShellInfo_environ(QtGui.QTextEdit):
## The dialog class and container with tabs
-class ShellInfoTab(QtGui.QScrollArea):
+class ShellInfoTab(QtWidgets.QScrollArea):
INFO_KEYS = [ translate('shell', 'name ::: The name of this configuration.'),
translate('shell', 'exe ::: The Python executable.'),
@@ -482,17 +482,17 @@ class ShellInfoTab(QtGui.QScrollArea):
]
def __init__(self, parent):
- QtGui.QScrollArea.__init__(self, parent)
+ QtWidgets.QScrollArea.__init__(self, parent)
# Init the scroll area
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.setWidgetResizable(True)
- self.setFrameShape(QtGui.QFrame.NoFrame);
+ self.setFrameShape(QtWidgets.QFrame.NoFrame);
# Create widget and a layout
- self._content = QtGui.QWidget(parent)
- self._formLayout = QtGui.QFormLayout(self._content)
+ self._content = QtWidgets.QWidget(parent)
+ self._formLayout = QtWidgets.QFormLayout(self._content)
# Collect classes of widgets to instantiate
classes = []
@@ -508,7 +508,7 @@ class ShellInfoTab(QtGui.QScrollArea):
instance = cls(self._content)
self._shellInfoWidgets[t.key] = instance
# Create label
- label = QtGui.QLabel(t, self._content)
+ label = QtWidgets.QLabel(t, self._content)
label.setToolTip(t.tt)
# Add to layout
self._formLayout.addRow(label, instance)
@@ -516,12 +516,12 @@ class ShellInfoTab(QtGui.QScrollArea):
# Add delete button
t = translate('shell', 'Delete ::: Delete this shell configuration')
- label = QtGui.QLabel('', self._content)
- instance = QtGui.QPushButton(pyzo.icons.cancel, t, self._content)
+ label = QtWidgets.QLabel('', self._content)
+ instance = QtWidgets.QPushButton(pyzo.icons.cancel, t, self._content)
instance.setToolTip(t.tt)
instance.setAutoDefault(False)
instance.clicked.connect(self.parent().parent().onTabClose)
- deleteLayout = QtGui.QHBoxLayout()
+ deleteLayout = QtWidgets.QHBoxLayout()
deleteLayout.addWidget(instance, 0)
deleteLayout.addStretch(1)
# Add to layout
@@ -584,17 +584,17 @@ class ShellInfoTab(QtGui.QScrollArea):
-class ShellInfoDialog(QtGui.QDialog):
+class ShellInfoDialog(QtWidgets.QDialog):
""" Dialog to edit the shell configurations. """
def __init__(self, *args):
- QtGui.QDialog.__init__(self, *args)
+ QtWidgets.QDialog.__init__(self, *args)
self.setModal(True)
# Set title
self.setWindowTitle(pyzo.translate('shell', 'Shell configurations'))
# Create tab widget
- self._tabs = QtGui.QTabWidget(self)
+ self._tabs = QtWidgets.QTabWidget(self)
#self._tabs = CompactTabWidget(self, padding=(4,4,5,5))
#self._tabs.setDocumentMode(False)
self._tabs.setMovable(True)
@@ -617,7 +617,7 @@ class ShellInfoDialog(QtGui.QDialog):
w.setInfo(item)
# Enable making new tabs and closing tabs
- self._add = QtGui.QToolButton(self)
+ self._add = QtWidgets.QToolButton(self)
self._tabs.setCornerWidget(self._add)
self._add.clicked.connect(self.onAdd)
self._add.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
@@ -628,19 +628,19 @@ class ShellInfoDialog(QtGui.QDialog):
self._tabs.tabCloseRequested.connect(self.onTabClose)
# Create buttons
- cancelBut = QtGui.QPushButton("Cancel", self)
- okBut = QtGui.QPushButton("Done", self)
+ cancelBut = QtWidgets.QPushButton("Cancel", self)
+ okBut = QtWidgets.QPushButton("Done", self)
cancelBut.clicked.connect(self.close)
okBut.clicked.connect(self.applyAndClose)
# Layout for buttons
- buttonLayout = QtGui.QHBoxLayout()
+ buttonLayout = QtWidgets.QHBoxLayout()
buttonLayout.addStretch(1)
buttonLayout.addWidget(cancelBut)
buttonLayout.addSpacing(10)
buttonLayout.addWidget(okBut)
# Layout the widgets
- mainLayout = QtGui.QVBoxLayout(self)
+ mainLayout = QtWidgets.QVBoxLayout(self)
mainLayout.addSpacing(8)
mainLayout.addWidget(self._tabs,0)
mainLayout.addLayout(buttonLayout,0)
diff --git a/pyzo/core/shellStack.py b/pyzo/core/shellStack.py
index 4425ab2..81ac103 100644
--- a/pyzo/core/shellStack.py
+++ b/pyzo/core/shellStack.py
@@ -14,7 +14,7 @@ and a dialog to edit the shell configurations.
import os, sys, time, re
import webbrowser
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
from pyzo import translate
@@ -72,7 +72,7 @@ def shellTitle(shell, moreinfo=False):
return text
-class ShellStackWidget(QtGui.QWidget):
+class ShellStackWidget(QtWidgets.QWidget):
""" The shell stack widget provides a stack of shells.
It wrapps a QStackedWidget that contains the shell objects. This
@@ -92,15 +92,15 @@ class ShellStackWidget(QtGui.QWidget):
currentShellStateChanged = QtCore.Signal()
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# create toolbar
- self._toolbar = QtGui.QToolBar(self)
+ self._toolbar = QtWidgets.QToolBar(self)
self._toolbar.setMaximumHeight(25)
self._toolbar.setIconSize(QtCore.QSize(16,16))
# create stack
- self._stack = QtGui.QStackedWidget(self)
+ self._stack = QtWidgets.QStackedWidget(self)
# Populate toolbar
self._shellButton = ShellControl(self._toolbar, self._stack)
@@ -114,7 +114,7 @@ class ShellStackWidget(QtGui.QWidget):
self._condahelp = CondaHelper(self)
# widget layout
- layout = QtGui.QVBoxLayout()
+ layout = QtWidgets.QVBoxLayout()
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self._toolbar)
@@ -304,12 +304,12 @@ class ShellStackWidget(QtGui.QWidget):
-class ShellControl(QtGui.QToolButton):
+class ShellControl(QtWidgets.QToolButton):
""" A button that can be used to select a shell and start a new shell.
"""
def __init__(self, parent, shellStack):
- QtGui.QToolButton.__init__(self, parent)
+ QtWidgets.QToolButton.__init__(self, parent)
# Store reference of shell stack
self._shellStack = shellStack
@@ -392,12 +392,12 @@ class ShellControl(QtGui.QToolButton):
# todo: remove this?
-# class DebugControl(QtGui.QToolButton):
+# class DebugControl(QtWidgets.QToolButton):
# """ A button to control debugging.
# """
#
# def __init__(self, parent):
-# QtGui.QToolButton.__init__(self, parent)
+# QtWidgets.QToolButton.__init__(self, parent)
#
# # Flag
# self._debugmode = False
@@ -426,7 +426,7 @@ class ShellControl(QtGui.QToolButton):
# clearallbps = clearallbps.format(bpcount)
#
# # Set menu
-# menu = QtGui.QMenu(self)
+# menu = QtWidgets.QMenu(self)
# self.setMenu(menu)
#
# for cmd, enabled, icon, text in [
@@ -491,12 +491,12 @@ class ShellControl(QtGui.QToolButton):
-class DebugStack(QtGui.QToolButton):
+class DebugStack(QtWidgets.QToolButton):
""" A button that shows the stack trace.
"""
def __init__(self, parent):
- QtGui.QToolButton.__init__(self, parent)
+ QtWidgets.QToolButton.__init__(self, parent)
# Set text and tooltip
self._baseText = translate('debug', 'Stack')
@@ -551,7 +551,7 @@ class DebugStack(QtGui.QToolButton):
theAction = None
# Create menu and add __main__
- menu = QtGui.QMenu(self)
+ menu = QtWidgets.QMenu(self)
self.setMenu(menu)
# Fill trace
@@ -622,14 +622,14 @@ class DebugStack(QtGui.QToolButton):
editor.setTextCursor(cursor)
-class CondaHelper(QtGui.QWidget):
+class CondaHelper(QtWidgets.QWidget):
""" This sits in place of a shell to help the user download miniconda.
"""
def __init__(self, parent):
super().__init__(parent)
- self._label = QtGui.QLabel('hello world')
+ self._label = QtWidgets.QLabel('hello world')
self._label.setTextFormat(QtCore.Qt.RichText)
self._label.setWordWrap(True)
# self._label.setOpenExternalLinks(True)
@@ -638,14 +638,14 @@ class CondaHelper(QtGui.QWidget):
font.setPointSize(font.pointSize()+1)
self._label.setFont(font)
- layout = QtGui.QVBoxLayout()
+ layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)
layout.addWidget(self._label, 1)
def refresh(self):
self._label.setText('Detecting interpreters ...')
- QtGui.qApp.flush()
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.flush()
+ QtWidgets.qApp.processEvents()
self.detect()
def detect(self):
diff --git a/pyzo/core/splash.py b/pyzo/core/splash.py
index c7d3b98..c79006a 100644
--- a/pyzo/core/splash.py
+++ b/pyzo/core/splash.py
@@ -13,7 +13,7 @@ Defines splash window shown during startup.
import os, sys, time
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
STYLESHEET = """
@@ -47,21 +47,21 @@ Read more at
"""
-class LogoWidget(QtGui.QFrame):
+class LogoWidget(QtWidgets.QFrame):
def __init__(self, parent):
- QtGui.QFrame.__init__(self, parent)
+ QtWidgets.QFrame.__init__(self, parent)
self.setMinimumSize(256, 256)
self.setMaximumSize(256, 256)
-class LabelWidget(QtGui.QWidget):
+class LabelWidget(QtWidgets.QWidget):
def __init__(self, parent, distro=None):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
self.setMinimumSize(360, 256) # Ensure title fits nicely
# Create label widget and costumize
- self._label = QtGui.QLabel(self)
+ self._label = QtWidgets.QLabel(self)
self._label.setTextFormat(QtCore.Qt.RichText)
self._label.setOpenExternalLinks(True)
self._label.setWordWrap(True)
@@ -81,7 +81,7 @@ class LabelWidget(QtGui.QWidget):
# Set text
self._label.setText(text)
- layout = QtGui.QVBoxLayout(self)
+ layout = QtWidgets.QVBoxLayout(self)
self.setLayout(layout)
layout.addStretch(1)
layout.addWidget(self._label, 0)
@@ -89,17 +89,17 @@ class LabelWidget(QtGui.QWidget):
-class SplashWidget(QtGui.QWidget):
+class SplashWidget(QtWidgets.QWidget):
""" A splash widget.
"""
def __init__(self, parent, **kwargs):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
self._left = LogoWidget(self)
self._right = LabelWidget(self, **kwargs)
# Layout
- layout = QtGui.QHBoxLayout(self)
+ layout = QtWidgets.QHBoxLayout(self)
self.setLayout(layout)
#layout.setContentsMargins(0,0,0,0)
layout.setSpacing(25)
diff --git a/pyzo/pyzokernel/guiintegration.py b/pyzo/pyzokernel/guiintegration.py
index f81db72..0d275a2 100644
--- a/pyzo/pyzokernel/guiintegration.py
+++ b/pyzo/pyzokernel/guiintegration.py
@@ -271,18 +271,18 @@ class App_qt(App_base):
# Store the real application class
if not hasattr(QtGui, 'real_QApplication'):
- QtGui.real_QApplication = QtGui.QApplication
+ QtWidgets.real_QApplication = QtWidgets.QApplication
- class QApplication_hijacked(QtGui.QApplication):
+ class QApplication_hijacked(QtWidgets.QApplication):
""" QApplication_hijacked(*args, **kwargs)
Hijacked QApplication class. This class has a __new__()
method that always returns the global application
- instance, i.e. QtGui.qApp.
+ instance, i.e. QtWidgets.qApp.
- The QtGui.qApp instance is an instance of the original
- QtGui.QApplication, but with its __init__() and exec_()
+ The QtWidgets.qApp instance is an instance of the original
+ QtWidgets.QApplication, but with its __init__() and exec_()
methods replaced.
You can subclass this class; the global application instance
@@ -296,8 +296,8 @@ class App_qt(App_base):
# Instantiate an original QApplication instance if we need to
if theApp is None:
- theApp = QtGui.real_QApplication(*args, **kwargs)
- QtGui.qApp = theApp
+ theApp = QtWidgets.real_QApplication(*args, **kwargs)
+ QtWidgets.qApp = theApp
# Add attributes of cls to the instance to make it
# behave as if it were an instance of that class
@@ -370,11 +370,11 @@ class App_qt(App_base):
self.app.setQuitOnLastWindowClosed(False)
# Replace app class
- QtGui.QApplication = QApplication_hijacked
+ QtWidgets.QApplication = QApplication_hijacked
# Notify that we integrated the event loop
self.app._in_event_loop = 'Pyzo'
- QtGui._in_event_loop = 'Pyzo'
+ QtWidgets._in_event_loop = 'Pyzo'
# Use sys.excepthook to catch keyboard interrupts that occur
# in event handlers. We also want to call the curren hook
@@ -403,13 +403,13 @@ class App_qt(App_base):
timer.start()
# Enter Qt mainloop
- #self._QtGui.real_QApplication.exec_(self.app)
- self._QtGui.real_QApplication.exec_()
+ #self._QtWidgets.real_QApplication.exec_(self.app)
+ self._QtWidgets.real_QApplication.exec_()
def quit(self):
# A nicer way to quit
- self._QtGui.real_QApplication.quit()
+ self._QtWidgets.real_QApplication.quit()
@@ -420,7 +420,7 @@ class App_pyqt4(App_qt):
def importCoreAndGui(self):
# Try importing qt
import PyQt4
- from PyQt4 import QtGui, QtCore
+ from PyQt4 import QtGui, QtCore, QtWidgets
return QtGui, QtCore
@@ -431,7 +431,7 @@ class App_pyside(App_qt):
def importCoreAndGui(self):
# Try importing qt
import PySide
- from PySide import QtGui, QtCore
+ from PySide import QtGui, QtCore, QtWidgets
return QtGui, QtCore
diff --git a/pyzo/pyzokernel/guisupport.py b/pyzo/pyzokernel/guisupport.py
index 09059a6..a581082 100644
--- a/pyzo/pyzokernel/guisupport.py
+++ b/pyzo/pyzokernel/guisupport.py
@@ -110,12 +110,12 @@ def start_event_loop_wx(app=None):
def get_app_qt4(*args, **kwargs):
"""Create a new qt4 app or return an existing one."""
- from PyQt4 import QtGui
- app = QtGui.QApplication.instance()
+ from PyQt4 import QtGui, QtWidgets
+ app = QtWidgets.QApplication.instance()
if app is None:
if not args:
args = ([''],)
- app = QtGui.QApplication(*args, **kwargs)
+ app = QtWidgets.QApplication(*args, **kwargs)
return app
def is_event_loop_running_qt4(app=None):
diff --git a/pyzo/tools/__init__.py b/pyzo/tools/__init__.py
index 7ab76ee..90c76a7 100644
--- a/pyzo/tools/__init__.py
+++ b/pyzo/tools/__init__.py
@@ -36,18 +36,18 @@ displayed in the statusbar.
import os, sys, imp
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo.util import zon as ssdf
-class ToolDockWidget(QtGui.QDockWidget):
+class ToolDockWidget(QtWidgets.QDockWidget):
""" A dock widget that holds a tool.
It sets all settings, initializes the tool widget, and notifies the
tool manager on closing.
"""
def __init__(self, parent, toolManager):
- QtGui.QDockWidget.__init__(self, parent)
+ QtWidgets.QDockWidget.__init__(self, parent)
# Store stuff
self._toolManager = toolManager
@@ -55,10 +55,10 @@ class ToolDockWidget(QtGui.QDockWidget):
# Allow docking anywhere, othwerise restoring state wont work properly
# Set other settings
- self.setFeatures( QtGui.QDockWidget.DockWidgetMovable |
- QtGui.QDockWidget.DockWidgetClosable |
- QtGui.QDockWidget.DockWidgetFloatable
- #QtGui.QDockWidget.DockWidgetVerticalTitleBar
+ self.setFeatures( QtWidgets.QDockWidget.DockWidgetMovable |
+ QtWidgets.QDockWidget.DockWidgetClosable |
+ QtWidgets.QDockWidget.DockWidgetFloatable
+ #QtWidgets.QDockWidget.DockWidgetVerticalTitleBar
)
@@ -298,7 +298,7 @@ class ToolManager(QtCore.QObject):
# Does it inherit from QWidget?
plug = mod.__dict__[className]
- if not (isinstance(plug,type) and issubclass(plug,QtGui.QWidget)):
+ if not (isinstance(plug,type) and issubclass(plug,QtWidgets.QWidget)):
print("Invalid tool, tool class must inherit from QWidget!")
return None
@@ -316,7 +316,7 @@ class ToolManager(QtCore.QObject):
# Close old one
if toolId in self._activeTools:
old = self._activeTools[toolId].widget()
- self._activeTools[toolId].setWidget(QtGui.QWidget(pyzo.main))
+ self._activeTools[toolId].setWidget(QtWidgets.QWidget(pyzo.main))
if old:
old.close()
old.deleteLater()
diff --git a/pyzo/tools/pyzoFileBrowser/__init__.py b/pyzo/tools/pyzoFileBrowser/__init__.py
index fc5bf01..9f50ea3 100644
--- a/pyzo/tools/pyzoFileBrowser/__init__.py
+++ b/pyzo/tools/pyzoFileBrowser/__init__.py
@@ -44,20 +44,20 @@ import os.path as op
import pyzo
from pyzo.util import zon as ssdf
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from .browser import Browser
from .utils import cleanpath, isdir
-class PyzoFileBrowser(QtGui.QWidget):
+class PyzoFileBrowser(QtWidgets.QWidget):
""" The main tool widget. An instance of this class contains one or
more Browser instances. If there are more, they can be selected
using a tab bar.
"""
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Get config
toolId = self.__class__.__name__.lower() + '2' # This is v2 of the file browser
@@ -99,7 +99,7 @@ class PyzoFileBrowser(QtGui.QWidget):
self._browsers.append( Browser(self, self.config) )
# Layout
- layout = QtGui.QVBoxLayout(self)
+ layout = QtWidgets.QVBoxLayout(self)
self.setLayout(layout)
layout.addWidget(self._browsers[0])
layout.setSpacing(0)
@@ -139,4 +139,4 @@ class PyzoFileBrowser(QtGui.QWidget):
# Close all browsers so they can clean up the file system proxies
for browser in self._browsers:
browser.close()
- return QtGui.QWidget.closeEvent(self, event)
+ return QtWidgets.QWidget.closeEvent(self, event)
diff --git a/pyzo/tools/pyzoFileBrowser/browser.py b/pyzo/tools/pyzoFileBrowser/browser.py
index 11968e2..1a67ee1 100644
--- a/pyzo/tools/pyzoFileBrowser/browser.py
+++ b/pyzo/tools/pyzoFileBrowser/browser.py
@@ -5,13 +5,13 @@ import pyzo
from pyzo import translate
from pyzo.util import zon as ssdf
-from . import QtCore, QtGui
+from . import QtCore, QtGui, QtWidgets
from . import proxies
from .tree import Tree
from .utils import cleanpath, isdir
-class Browser(QtGui.QWidget):
+class Browser(QtWidgets.QWidget):
""" A browser consists of an address bar, and tree view, and other
widets to help browse the file system. The browser object is responsible
for tying the different browser-components together.
@@ -20,7 +20,7 @@ class Browser(QtGui.QWidget):
"""
def __init__(self, parent, config, path=None):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Store config
self.config = config
@@ -82,7 +82,7 @@ class Browser(QtGui.QWidget):
return self._importWizard
def _layout(self):
- layout = QtGui.QVBoxLayout(self)
+ layout = QtWidgets.QVBoxLayout(self)
layout.setContentsMargins(0,0,0,0)
#layout.setSpacing(6)
self.setLayout(layout)
@@ -91,7 +91,7 @@ class Browser(QtGui.QWidget):
layout.addWidget(self._pathEdit)
layout.addWidget(self._tree)
#
- subLayout = QtGui.QHBoxLayout()
+ subLayout = QtWidgets.QHBoxLayout()
subLayout.setSpacing(2)
subLayout.addWidget(self._nameFilter, 5)
subLayout.addWidget(self._searchFilter, 5)
@@ -183,12 +183,12 @@ class Browser(QtGui.QWidget):
return self._projects.currentDict()
-class LineEditWithToolButtons(QtGui.QLineEdit):
+class LineEditWithToolButtons(QtWidgets.QLineEdit):
""" Line edit to which tool buttons (with icons) can be attached.
"""
def __init__(self, parent):
- QtGui.QLineEdit.__init__(self, parent)
+ QtWidgets.QLineEdit.__init__(self, parent)
self._leftButtons = []
self._rightButtons = []
@@ -200,7 +200,7 @@ class LineEditWithToolButtons(QtGui.QLineEdit):
def _addButton(self, icon, willHaveMenu, L):
# Create button
- button = QtGui.QToolButton(self)
+ button = QtWidgets.QToolButton(self)
L.append(button)
# Customize appearance
button.setIcon(icon)
@@ -229,11 +229,11 @@ class LineEditWithToolButtons(QtGui.QLineEdit):
self._updateGeometry()
def resizeEvent(self, event):
- QtGui.QLineEdit.resizeEvent(self, event)
+ QtWidgets.QLineEdit.resizeEvent(self, event)
self._updateGeometry(True)
def showEvent(self, event):
- QtGui.QLineEdit.showEvent(self, event)
+ QtWidgets.QLineEdit.showEvent(self, event)
self._updateGeometry()
def _updateGeometry(self, light=False):
@@ -268,7 +268,7 @@ class LineEditWithToolButtons(QtGui.QLineEdit):
# Set minimum size
if not light:
- fw = QtGui.qApp.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
+ fw = QtWidgets.qApp.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
msz = self.minimumSizeHint()
w = max(msz.width(), paddingLeft + paddingRight + 10)
h = max(msz.height(), height + fw*2 + 2)
@@ -294,12 +294,12 @@ class PathInput(LineEditWithToolButtons):
self.setFocusPolicy(QtCore.Qt.StrongFocus)
# Set completion mode
- self.setCompleter(QtGui.QCompleter())
+ self.setCompleter(QtWidgets.QCompleter())
c = self.completer()
c.setCompletionMode(c.InlineCompletion)
# Set dir model to completer
- dirModel = QtGui.QDirModel(c)
+ dirModel = QtWidgets.QDirModel(c)
dirModel.setFilter(QtCore.QDir.Dirs | QtCore.QDir.NoDotAndDotDot)
c.setModel(dirModel)
@@ -358,37 +358,37 @@ class PathInput(LineEditWithToolButtons):
On focusing out, make sure that the set path is correct.
"""
if event is not None:
- QtGui.QLineEdit.focusOutEvent(self, event)
+ QtWidgets.QLineEdit.focusOutEvent(self, event)
path = self.parent()._tree.path()
self.setPath(path)
-class Projects(QtGui.QWidget):
+class Projects(QtWidgets.QWidget):
dirChanged = QtCore.Signal(str) # Emitted when the user changes the project
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Init variables
self._path = ''
# Create combo button
- self._combo = QtGui.QComboBox(self)
+ self._combo = QtWidgets.QComboBox(self)
self._combo.setEditable(False)
self.updateProjectList()
# Create star button
- self._but = QtGui.QToolButton(self)
+ self._but = QtWidgets.QToolButton(self)
self._but.setIcon( pyzo.icons.star3 )
self._but.setStyleSheet("QToolButton { padding: 0px; }");
self._but.setIconSize(QtCore.QSize(18,18))
self._but.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self._but.setPopupMode(self._but.InstantPopup)
#
- self._menu = QtGui.QMenu(self._but)
+ self._menu = QtWidgets.QMenu(self._but)
self._menu.triggered.connect(self.onMenuTriggered)
self.buildMenu()
@@ -401,7 +401,7 @@ class Projects(QtGui.QWidget):
self._combo.activated .connect(self.onProjectSelect)
# Layout
- layout = QtGui.QHBoxLayout(self)
+ layout = QtWidgets.QHBoxLayout(self)
self.setLayout(layout)
layout.addWidget(self._but)
layout.addWidget(self._combo)
@@ -495,7 +495,7 @@ class Projects(QtGui.QWidget):
elif action._id == 'name':
# Open dialog to ask for name
- name = QtGui.QInputDialog.getText(self.parent(),
+ name = QtWidgets.QInputDialog.getText(self.parent(),
translate('filebrowser', 'Project name'),
translate('filebrowser', 'New project name:'),
text=d['name'],
@@ -550,7 +550,7 @@ class NameFilter(LineEditWithToolButtons):
# Create tool button, and attach the menu
self._menuBut = self.addButtonRight(pyzo.icons['filter'], True)
- self._menu = QtGui.QMenu(self._menuBut)
+ self._menu = QtWidgets.QMenu(self._menuBut)
self._menu.triggered.connect(self.onMenuTriggered)
self._menuBut.setMenu(self._menu)
#
@@ -574,7 +574,7 @@ class NameFilter(LineEditWithToolButtons):
def setText(self, value, test=False):
""" To initialize the name filter.
"""
- QtGui.QLineEdit.setText(self, value)
+ QtWidgets.QLineEdit.setText(self, value)
if test:
self.checkFilterValue()
self._lastValue = value
@@ -602,7 +602,7 @@ class SearchFilter(LineEditWithToolButtons):
# Create tool button, and attach the menu
self._menuBut = self.addButtonRight(pyzo.icons['magnifier'], True)
- self._menu = QtGui.QMenu(self._menuBut)
+ self._menu = QtWidgets.QMenu(self._menuBut)
self._menu.triggered.connect(self.onMenuTriggered)
self._menuBut.setMenu(self._menu)
self.buildMenu()
@@ -624,7 +624,7 @@ class SearchFilter(LineEditWithToolButtons):
""" Clear text or build menu.
"""
if self.text():
- QtGui.QLineEdit.clear(self)
+ QtWidgets.QLineEdit.clear(self)
self.checkFilterValue()
else:
self.buildMenu()
diff --git a/pyzo/tools/pyzoFileBrowser/importwizard.py b/pyzo/tools/pyzoFileBrowser/importwizard.py
index b5e21d5..01dd4b1 100644
--- a/pyzo/tools/pyzoFileBrowser/importwizard.py
+++ b/pyzo/tools/pyzoFileBrowser/importwizard.py
@@ -26,7 +26,7 @@ import unicodedata
import os.path as op
import pyzo.codeeditor
-from . import QtCore, QtGui
+from . import QtCore, QtGui, QtWidgets
from pyzo import translate
@@ -60,28 +60,28 @@ class CodeView(
-class SelectFilePage(QtGui.QWizardPage):
+class SelectFilePage(QtWidgets.QWizardPage):
"""
First page of the wizard, select file and preview contents
"""
def __init__(self):
- QtGui.QWizardPage.__init__(self)
+ QtWidgets.QWizardPage.__init__(self)
self.setTitle(translate('importwizard', 'Select file'))
- self.txtFilename = QtGui.QLineEdit()
- self.btnBrowse = QtGui.QPushButton(translate('importwizard', 'Browse...'))
- self.preview = QtGui.QPlainTextEdit()
+ self.txtFilename = QtWidgets.QLineEdit()
+ self.btnBrowse = QtWidgets.QPushButton(translate('importwizard', 'Browse...'))
+ self.preview = QtWidgets.QPlainTextEdit()
self.preview.setReadOnly(True)
- vlayout = QtGui.QVBoxLayout()
- hlayout = QtGui.QHBoxLayout()
+ vlayout = QtWidgets.QVBoxLayout()
+ hlayout = QtWidgets.QHBoxLayout()
hlayout.addWidget(self.txtFilename)
hlayout.addWidget(self.btnBrowse)
vlayout.addLayout(hlayout)
- vlayout.addWidget(QtGui.QLabel(translate('importwizard', 'Preview:')))
+ vlayout.addWidget(QtWidgets.QLabel(translate('importwizard', 'Preview:')))
vlayout.addWidget(self.preview)
self.setLayout(vlayout)
@@ -95,7 +95,7 @@ class SelectFilePage(QtGui.QWizardPage):
def onBrowseClicked(self):
# Difference between PyQt4 and PySide: PySide returns filename, filter
# while PyQt4 returns only the filename
- filename = QtGui.QFileDialog.getOpenFileName(filter = 'Text files (*.txt *.csv);;All files (*.*)')
+ filename = QtWidgets.QFileDialog.getOpenFileName(filter = 'Text files (*.txt *.csv);;All files (*.*)')
if isinstance(filename, tuple):
filename = filename[0]
@@ -138,16 +138,16 @@ class SelectFilePage(QtGui.QWizardPage):
-class SetParametersPage(QtGui.QWizardPage):
+class SetParametersPage(QtWidgets.QWizardPage):
def __init__(self):
- QtGui.QWizardPage.__init__(self)
+ QtWidgets.QWizardPage.__init__(self)
self.setTitle("Select parameters")
self._columnNames = None
def genComboBox(choices):
- cbx = QtGui.QComboBox()
+ cbx = QtWidgets.QComboBox()
for choice in choices:
cbx.addItem(choice)
cbx.setEditable(True)
@@ -155,24 +155,24 @@ class SetParametersPage(QtGui.QWizardPage):
self.cbxDelimiter = genComboBox(",;")
self.cbxComments = genComboBox("#%'")
- self.sbSkipHeader = QtGui.QSpinBox()
+ self.sbSkipHeader = QtWidgets.QSpinBox()
- self.preview = QtGui.QTableWidget()
- self.preview.setSelectionModel(QtGui.QItemSelectionModel(self.preview.model())) # Work-around for reference tracking bug in PySide
+ self.preview = QtWidgets.QTableWidget()
+ self.preview.setSelectionModel(QtWidgets.QItemSelectionModel(self.preview.model())) # Work-around for reference tracking bug in PySide
self.preview.setSelectionBehavior(self.preview.SelectColumns)
self.preview.setSelectionMode(self.preview.MultiSelection)
# Layout
- formlayout = QtGui.QFormLayout()
+ formlayout = QtWidgets.QFormLayout()
formlayout.addRow('Delimiter', self.cbxDelimiter)
formlayout.addRow('Comments', self.cbxComments)
formlayout.addRow('Header rows to skip', self.sbSkipHeader)
- layout = QtGui.QVBoxLayout()
+ layout = QtWidgets.QVBoxLayout()
layout.addLayout(formlayout)
- layout.addWidget(QtGui.QLabel(
+ layout.addWidget(QtWidgets.QLabel(
translate('importwizard', 'Select columns to import:')))
layout.addWidget(self.preview)
@@ -345,7 +345,7 @@ class SetParametersPage(QtGui.QWizardPage):
# Add fields to the table
for col, field in enumerate(fields):
- cell = QtGui.QTableWidgetItem(field)
+ cell = QtWidgets.QTableWidgetItem(field)
if not inheader:
try:
float(field)
@@ -355,7 +355,7 @@ class SetParametersPage(QtGui.QWizardPage):
self.preview.setItem(lineno,col, cell)
# Add the comment
- cell = QtGui.QTableWidgetItem(commentstr)
+ cell = QtWidgets.QTableWidgetItem(commentstr)
cell.setBackground(QtGui.QBrush(QtGui.QColor("lightgreen")))
self.preview.setItem(lineno,ncols, cell)
@@ -366,7 +366,7 @@ class SetParametersPage(QtGui.QWizardPage):
for col in range(ncols):
cell = self.preview.item(row, col)
if not cell:
- cell = QtGui.QTableWidgetItem('')
+ cell = QtWidgets.QTableWidgetItem('')
self.preview.setItem(row, col, cell)
cell.setBackground(QtGui.QBrush(QtGui.QColor("khaki")))
@@ -380,7 +380,7 @@ class SetParametersPage(QtGui.QWizardPage):
self.updateHorizontalHeaderLabels()
-class ResultPage(QtGui.QWizardPage):
+class ResultPage(QtWidgets.QWizardPage):
"""
The resultpage lets the user select wether to import the data as a single
2D-array, or as one variable (1D-array) per column
@@ -390,16 +390,16 @@ class ResultPage(QtGui.QWizardPage):
"""
def __init__(self):
- QtGui.QWizardPage.__init__(self)
+ QtWidgets.QWizardPage.__init__(self)
self.setTitle("Execute import")
- self.setButtonText(QtGui.QWizard.FinishButton,
+ self.setButtonText(QtWidgets.QWizard.FinishButton,
translate('importwizard', 'Close'))
- self.rbAsArray = QtGui.QRadioButton(translate('importwizard', 'Import data as single array'))
- self.rbPerColumn = QtGui.QRadioButton(translate('importwizard', 'Import data into one variable per column'))
+ self.rbAsArray = QtWidgets.QRadioButton(translate('importwizard', 'Import data as single array'))
+ self.rbPerColumn = QtWidgets.QRadioButton(translate('importwizard', 'Import data into one variable per column'))
self.rbAsArray.setChecked(True)
- self.chkInvalidRaise = QtGui.QCheckBox(translate('importwizard', 'Raise error upon invalid data'))
+ self.chkInvalidRaise = QtWidgets.QCheckBox(translate('importwizard', 'Raise error upon invalid data'))
self.chkInvalidRaise.setChecked(True)
self.codeView = CodeView()
@@ -407,15 +407,15 @@ class ResultPage(QtGui.QWizardPage):
self.codeView.setZoom(pyzo.config.view.zoom)
self.codeView.setFont(pyzo.config.view.fontname)
- self.btnExecute = QtGui.QPushButton('Execute in current shell')
- self.btnInsert = QtGui.QPushButton('Paste into current file')
+ self.btnExecute = QtWidgets.QPushButton('Execute in current shell')
+ self.btnInsert = QtWidgets.QPushButton('Paste into current file')
- layout = QtGui.QVBoxLayout()
+ layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.rbAsArray)
layout.addWidget(self.rbPerColumn)
layout.addWidget(self.chkInvalidRaise)
- layout.addWidget(QtGui.QLabel('Resulting import code:'))
+ layout.addWidget(QtWidgets.QLabel('Resulting import code:'))
layout.addWidget(self.codeView)
layout.addWidget(self.btnExecute)
layout.addWidget(self.btnInsert)
@@ -474,7 +474,7 @@ class ResultPage(QtGui.QWizardPage):
def onBtnExecuteClicked(self):
shell = pyzo.shells.getCurrentShell()
if shell is None:
- QtGui.QMessageBox.information(self,
+ QtWidgets.QMessageBox.information(self,
translate('importwizard', 'Import data wizard'),
translate('importwizard', 'No current shell active'))
return
@@ -484,7 +484,7 @@ class ResultPage(QtGui.QWizardPage):
def onBtnInsertClicked(self):
editor = pyzo.editors.getCurrentEditor()
if editor is None:
- QtGui.QMessageBox.information(self,
+ QtWidgets.QMessageBox.information(self,
translate('importwizard', 'Import data wizard'),
translate('importwizard', 'No current file open'))
return
@@ -502,9 +502,9 @@ class ResultPage(QtGui.QWizardPage):
cursor.insertText(code)
-class ImportWizard(QtGui.QWizard):
+class ImportWizard(QtWidgets.QWizard):
def __init__(self):
- QtGui.QWizard.__init__(self)
+ QtWidgets.QWizard.__init__(self)
self.setMinimumSize(500,400)
self.resize(700,500)
@@ -526,13 +526,13 @@ class ImportWizard(QtGui.QWizard):
def onCurrentIdChanged(self, id):
# Hide the 'cancel' button on the last page
if self.nextId() == -1:
- self.button(QtGui.QWizard.CancelButton).hide()
+ self.button(QtWidgets.QWizard.CancelButton).hide()
else:
- self.button(QtGui.QWizard.CancelButton).show()
+ self.button(QtWidgets.QWizard.CancelButton).show()
def open(self, filename):
if self.isVisible():
- QtGui.QMessageBox.information(self,
+ QtWidgets.QMessageBox.information(self,
translate('importwizard', 'Import data wizard'),
translate('importwizard', 'The import data wizard is already open'))
return
@@ -550,7 +550,7 @@ class ImportWizard(QtGui.QWizard):
elif name == 'columnnames':
return self.setParametersPage.columnNames()
else:
- return QtGui.QWizard.field(self, name)
+ return QtWidgets.QWizard.field(self, name)
def setPreviewData(self, data):
self._previewData = data
diff --git a/pyzo/tools/pyzoFileBrowser/tree.py b/pyzo/tools/pyzoFileBrowser/tree.py
index 36b00fd..f04161d 100644
--- a/pyzo/tools/pyzoFileBrowser/tree.py
+++ b/pyzo/tools/pyzoFileBrowser/tree.py
@@ -15,7 +15,7 @@ import os.path as op
import pyzo
from pyzo import translate
-from . import QtCore, QtGui
+from . import QtCore, QtGui, QtWidgets
from . import tasks
from .utils import hasHiddenAttribute, getMounts, cleanpath, isdir, ext
@@ -26,7 +26,7 @@ MOUNTS = 'drives'
# Create icon provider
-iconprovider = QtGui.QFileIconProvider()
+iconprovider = QtWidgets.QFileIconProvider()
def addIconOverlays(icon, *overlays, offset=(8,0), overlay_offset=(0,0)):
@@ -186,13 +186,13 @@ def createItemsFun(browser, parent):
-class BrowserItem(QtGui.QTreeWidgetItem):
+class BrowserItem(QtWidgets.QTreeWidgetItem):
""" Abstract item in the tree widget.
"""
def __init__(self, parent, pathProxy, *args):
self._proxy = pathProxy
- QtGui.QTreeWidgetItem.__init__(self, parent, [], *args)
+ QtWidgets.QTreeWidgetItem.__init__(self, parent, [], *args)
# Set pathname to show, and icon
strippedParentPath = parent.path().rstrip('/\\')
if self.path().startswith(strippedParentPath):
@@ -212,7 +212,7 @@ class BrowserItem(QtGui.QTreeWidgetItem):
def _createDummyItem(self, txt):
ErrorItem(self, txt)
- #QtGui.QTreeWidgetItem(self, [txt])
+ #QtWidgets.QTreeWidgetItem(self, [txt])
def onDestroyed(self):
self._proxy.cancel()
@@ -407,7 +407,7 @@ class FileItem(BrowserItem):
# tree = self.treeWidget()
# pos = tree.mapFromGlobal(QtGui.QCursor.pos())
# if tree.itemAt(pos) is self:
-# QtGui.QToolTip.showText(QtGui.QCursor.pos(), result)
+# QtWidgets.QToolTip.showText(QtGui.QCursor.pos(), result)
elif isinstance(task, tasks.PeekTask):
result = task.result()
#self.clear() # Cleared when docstring task result is received
@@ -421,11 +421,11 @@ class FileItem(BrowserItem):
-class SubFileItem(QtGui.QTreeWidgetItem):
+class SubFileItem(QtWidgets.QTreeWidgetItem):
""" Tree widget item for search items.
"""
def __init__(self, parent, linenr, text, showlinenr=False):
- QtGui.QTreeWidgetItem.__init__(self, parent)
+ QtWidgets.QTreeWidgetItem.__init__(self, parent)
self._linenr = linenr
if showlinenr:
self.setText(0, 'Line %i: %s' % (linenr, text))
@@ -448,12 +448,12 @@ class SubFileItem(QtGui.QTreeWidgetItem):
-class DocstringItem(QtGui.QTreeWidgetItem):
+class DocstringItem(QtWidgets.QTreeWidgetItem):
""" Tree widget item for docstring placeholder items.
"""
def __init__(self, parent, docstring):
- QtGui.QTreeWidgetItem.__init__(self, parent)
+ QtWidgets.QTreeWidgetItem.__init__(self, parent)
self._docstring = docstring
# Get one-line version of docstring
shortText = self._docstring.split('\n',1)[0].strip()
@@ -471,15 +471,15 @@ class DocstringItem(QtGui.QTreeWidgetItem):
tree = self.treeWidget()
pos = tree.mapFromGlobal(QtGui.QCursor.pos())
if tree.itemAt(pos) is self:
- QtGui.QToolTip.showText(QtGui.QCursor.pos(), self._docstring)
+ QtWidgets.QToolTip.showText(QtGui.QCursor.pos(), self._docstring)
-class ErrorItem(QtGui.QTreeWidgetItem):
+class ErrorItem(QtWidgets.QTreeWidgetItem):
""" Tree widget item for errors and information.
"""
def __init__(self, parent, info):
- QtGui.QTreeWidgetItem.__init__(self, parent)
+ QtWidgets.QTreeWidgetItem.__init__(self, parent)
self.setText(0, info)
self.setFlags(QtCore.Qt.NoItemFlags)
font = self.font(0)
@@ -575,7 +575,7 @@ class TemporaryFileItem:
-class Tree(QtGui.QTreeWidget):
+class Tree(QtWidgets.QTreeWidget):
""" Representation of the tree view.
Instances of this class are responsible for keeping the contents
up-to-date. The Item classes above are dumb objects.
@@ -584,7 +584,7 @@ class Tree(QtGui.QTreeWidget):
dirChanged = QtCore.Signal(str) # Emitted when user goes into a subdir
def __init__(self, parent):
- QtGui.QTreeWidget.__init__(self, parent)
+ QtWidgets.QTreeWidget.__init__(self, parent)
# Initialize
self.setMinimumWidth(150)
@@ -678,7 +678,7 @@ class Tree(QtGui.QTreeWidget):
item.clear()
if hasattr(item, 'onDestroyed'):
item.onDestroyed()
- QtGui.QTreeWidget.clear(self)
+ QtWidgets.QTreeWidget.clear(self)
def mouseDoubleClickEvent(self, event):
@@ -707,7 +707,7 @@ class Tree(QtGui.QTreeWidget):
parent.clear()
# Create sub items
count = createItemsFun(self.parent(), parent)
- if not count and isinstance(parent, QtGui.QTreeWidgetItem):
+ if not count and isinstance(parent, QtWidgets.QTreeWidgetItem):
ErrorItem(parent, 'Empty directory')
# Restore state
self._restoreSelectionState()
@@ -865,7 +865,7 @@ class PopupMenu(pyzo.core.menu.Menu):
subprocess.call(('open', '-R', self._item.path()))
def _copyPath(self):
- QtGui.qApp.clipboard().setText(self._item.path())
+ QtWidgets.qApp.clipboard().setText(self._item.path())
def _runAsScript(self):
filename = self._item.path()
@@ -874,7 +874,7 @@ class PopupMenu(pyzo.core.menu.Menu):
shell.restart(filename)
else:
msg = "No shell to run code in. "
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Could not run"))
m.setText("Could not run " + filename + ":\n\n" + msg)
m.setIcon(m.Warning)
@@ -887,7 +887,7 @@ class PopupMenu(pyzo.core.menu.Menu):
shell.restart(filename)
else:
msg = "No shell to run notebook in. "
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("menu dialog", "Could not run notebook"))
m.setText("Could not run " + filename + ":\n\n" + msg)
m.setIcon(m.Warning)
@@ -922,9 +922,9 @@ class PopupMenu(pyzo.core.menu.Menu):
label = translate("filebrowser", "Give the name for the new directory")
# Ask for new filename
- s = QtGui.QInputDialog.getText(self.parent(), title,
+ s = QtWidgets.QInputDialog.getText(self.parent(), title,
label + ':\n%s' % self._item.path(),
- QtGui.QLineEdit.Normal,
+ QtWidgets.QLineEdit.Normal,
'new name'
)
if isinstance(s, tuple):
@@ -952,9 +952,9 @@ class PopupMenu(pyzo.core.menu.Menu):
filename = 'Copy of ' + filename
# Ask for new filename
- s = QtGui.QInputDialog.getText(self.parent(), title,
+ s = QtWidgets.QInputDialog.getText(self.parent(), title,
label + ':\n%s' % self._item.path(),
- QtGui.QLineEdit.Normal,
+ QtWidgets.QLineEdit.Normal,
filename
)
if isinstance(s, tuple):
@@ -969,12 +969,12 @@ class PopupMenu(pyzo.core.menu.Menu):
def onDelete(self):
# Ask for new filename
- b = QtGui.QMessageBox.question(self.parent(),
+ b = QtWidgets.QMessageBox.question(self.parent(),
translate("filebrowser", "Delete"),
translate("filebrowser", "Are you sure that you want to delete") +
':\n%s' % self._item.path(),
- QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel,
+ QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel,
)
# Push delete task
- if b is QtGui.QMessageBox.Yes:
+ if b is QtWidgets.QMessageBox.Yes:
self._item._proxy.pushTask(tasks.RemoveTask())
diff --git a/pyzo/tools/pyzoHistoryViewer.py b/pyzo/tools/pyzoHistoryViewer.py
index 04a204e..875f164 100644
--- a/pyzo/tools/pyzoHistoryViewer.py
+++ b/pyzo/tools/pyzoHistoryViewer.py
@@ -15,7 +15,7 @@ History class, which is a Qt model, and the PyzoHistoryViewer, which is a Qt vie
import sys, os, time, re
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo import translate
from pyzo.core.menu import Menu
@@ -24,7 +24,7 @@ tool_summary = "Shows the last used commands."
-class HistoryViewer(QtGui.QListView):
+class HistoryViewer(QtWidgets.QListView):
"""
The history viewer has several ways of using the data stored in the history:
- double click a single item to execute in the current shell
@@ -64,7 +64,7 @@ class HistoryViewer(QtGui.QListView):
def copy(self, event = None):
text = self.model().plainText(self.selectedIndexes())
- QtGui.qApp.clipboard().setText(text)
+ QtWidgets.qApp.clipboard().setText(text)
def _onCustomContextMenuRequested(self, pos):
self._menu.popup(self.viewport().mapToGlobal(pos))
@@ -79,7 +79,7 @@ class HistoryViewer(QtGui.QListView):
def setModel(self, model):
"""
- As QtGui.QListView.setModel, but connects appropriate signals
+ As QtWidgets.QListView.setModel, but connects appropriate signals
"""
if self.model() is not None:
self.model().rowsInserted.disconnect(self.scrollToBottom)
@@ -98,7 +98,7 @@ class PyzoHistoryViewer(HistoryViewer):
self.setModel(pyzo.shells.sharedHistory)
-class History(QtGui.QStringListModel):
+class History(QtWidgets.QStringListModel):
markerPrefix = None # Text to prepend to the marker, or None for no marker
maxLines = 100 # Only enforced upon loading
def __init__(self, fname):
diff --git a/pyzo/tools/pyzoInteractiveHelp.py b/pyzo/tools/pyzoInteractiveHelp.py
index feaa509..b36be4f 100644
--- a/pyzo/tools/pyzoInteractiveHelp.py
+++ b/pyzo/tools/pyzoInteractiveHelp.py
@@ -7,7 +7,7 @@
import sys, os, time, re
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
import pyzo
tool_name = "Interactive help"
@@ -49,34 +49,34 @@ and when double clicking on a name.
"""
-class PyzoInteractiveHelp(QtGui.QWidget):
+class PyzoInteractiveHelp(QtWidgets.QWidget):
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Create text field, checkbox, and button
- self._text = QtGui.QLineEdit(self)
- self._printBut = QtGui.QPushButton("Print", self)
+ self._text = QtWidgets.QLineEdit(self)
+ self._printBut = QtWidgets.QPushButton("Print", self)
# Create options button
- self._options = QtGui.QToolButton(self)
+ self._options = QtWidgets.QToolButton(self)
self._options.setIcon(pyzo.icons.wrench)
self._options.setIconSize(QtCore.QSize(16,16))
self._options.setPopupMode(self._options.InstantPopup)
self._options.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
# Create options menu
- self._options._menu = QtGui.QMenu()
+ self._options._menu = QtWidgets.QMenu()
self._options.setMenu(self._options._menu)
# Create browser
- self._browser = QtGui.QTextBrowser(self)
+ self._browser = QtWidgets.QTextBrowser(self)
self._browser_text = initText
# Create two sizers
- self._sizer1 = QtGui.QVBoxLayout(self)
- self._sizer2 = QtGui.QHBoxLayout()
+ self._sizer1 = QtWidgets.QVBoxLayout(self)
+ self._sizer2 = QtWidgets.QHBoxLayout()
# Put the elements together
self._sizer2.addWidget(self._text, 4)
diff --git a/pyzo/tools/pyzoSourceStructure.py b/pyzo/tools/pyzoSourceStructure.py
index 66f1d7b..d84b9ed 100644
--- a/pyzo/tools/pyzoSourceStructure.py
+++ b/pyzo/tools/pyzoSourceStructure.py
@@ -8,16 +8,16 @@
import time
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo import translate
tool_name = "Source structure"
tool_summary = "Shows the structure of your source code."
-class PyzoSourceStructure(QtGui.QWidget):
+class PyzoSourceStructure(QtWidgets.QWidget):
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Make sure there is a configuration entry for this tool
# The pyzo tool manager makes sure that there is an entry in
@@ -30,14 +30,14 @@ class PyzoSourceStructure(QtGui.QWidget):
self._config.level = 2
# Create icon for slider
- self._sliderIcon = QtGui.QToolButton(self)
+ self._sliderIcon = QtWidgets.QToolButton(self)
self._sliderIcon.setIcon(pyzo.icons.text_align_right)
self._sliderIcon.setIconSize(QtCore.QSize(16,16))
self._sliderIcon.setStyleSheet("QToolButton { border: none; padding: 0px; }")
# Create slider
- self._slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
- self._slider.setTickPosition(QtGui.QSlider.TicksBelow)
+ self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
+ self._slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
self._slider.setSingleStep(1)
self._slider.setPageStep(1)
self._slider.setRange(1,9)
@@ -45,28 +45,28 @@ class PyzoSourceStructure(QtGui.QWidget):
self._slider.valueChanged.connect(self.updateStructure)
# Create options button
- #self._options = QtGui.QPushButton(self)
+ #self._options = QtWidgets.QPushButton(self)
#self._options.setText('Options'))
#self._options.setToolTip("What elements to show.")
- self._options = QtGui.QToolButton(self)
+ self._options = QtWidgets.QToolButton(self)
self._options.setIcon(pyzo.icons.filter)
self._options.setIconSize(QtCore.QSize(16,16))
self._options.setPopupMode(self._options.InstantPopup)
self._options.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
# Create options menu
- self._options._menu = QtGui.QMenu()
+ self._options._menu = QtWidgets.QMenu()
self._options.setMenu(self._options._menu)
# Create tree widget
- self._tree = QtGui.QTreeWidget(self)
+ self._tree = QtWidgets.QTreeWidget(self)
self._tree.setHeaderHidden(True)
self._tree.itemCollapsed.connect(self.updateStructure) # keep expanded
self._tree.itemClicked.connect(self.onItemClick)
# Create two sizers
- self._sizer1 = QtGui.QVBoxLayout(self)
- self._sizer2 = QtGui.QHBoxLayout()
+ self._sizer1 = QtWidgets.QVBoxLayout(self)
+ self._sizer2 = QtWidgets.QHBoxLayout()
self._sizer1.setSpacing(2)
self._sizer1.setContentsMargins(4,4,4,4)
@@ -148,7 +148,7 @@ class PyzoSourceStructure(QtGui.QWidget):
# Notify
text = translate('pyzoSourceStructure', 'Parsing ' + editor._name + ' ...')
- thisItem = QtGui.QTreeWidgetItem(self._tree, [text])
+ thisItem = QtWidgets.QTreeWidgetItem(self._tree, [text])
# Try getting the structure right now
self.updateStructure()
@@ -228,7 +228,7 @@ class PyzoSourceStructure(QtGui.QWidget):
else:
text = "%s %s" % (type, object.name)
# Create item
- thisItem = QtGui.QTreeWidgetItem(parentItem, [text])
+ thisItem = QtWidgets.QTreeWidgetItem(parentItem, [text])
color = QtGui.QColor(colours[object.type])
thisItem.setForeground(0, QtGui.QBrush(color))
font = thisItem.font(0)
diff --git a/pyzo/tools/pyzoWebBrowser.py b/pyzo/tools/pyzoWebBrowser.py
index 883f290..5dfb730 100644
--- a/pyzo/tools/pyzoWebBrowser.py
+++ b/pyzo/tools/pyzoWebBrowser.py
@@ -8,10 +8,10 @@
import time
import urllib.request, urllib.parse
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
imported_qtwebkit = True
try:
- from pyzo.util.qt import QtWebKit
+ from pyzo.util.qt import QtWebKit, QtWidgets
except ImportError:
imported_qtwebkit = False
@@ -28,7 +28,7 @@ default_bookmarks = [ 'docs.python.org',
]
-class WebView(QtGui.QTextBrowser):
+class WebView(QtWidgets.QTextBrowser):
""" Inherit the webview class to implement zooming using
the mouse wheel.
"""
@@ -37,7 +37,7 @@ class WebView(QtGui.QTextBrowser):
loadFinished = QtCore.Signal(bool)
def __init__(self, parent):
- QtGui.QTextBrowser.__init__(self, parent)
+ QtWidgets.QTextBrowser.__init__(self, parent)
# Current url
self._url = ''
@@ -50,10 +50,10 @@ class WebView(QtGui.QTextBrowser):
def wheelEvent(self, event):
# Zooming does not work for this widget
- if QtCore.Qt.ControlModifier & QtGui.qApp.keyboardModifiers():
+ if QtCore.Qt.ControlModifier & QtWidgets.qApp.keyboardModifiers():
self.parent().wheelEvent(event)
else:
- QtGui.QTextBrowser.wheelEvent(self, event)
+ QtWidgets.QTextBrowser.wheelEvent(self, event)
def url(self):
@@ -147,13 +147,13 @@ class WebView(QtGui.QTextBrowser):
return url
-class PyzoWebBrowser(QtGui.QFrame):
+class PyzoWebBrowser(QtWidgets.QFrame):
""" The main window, containing buttons, address bar and
browser widget.
"""
def __init__(self, parent):
- QtGui.QFrame.__init__(self, parent)
+ QtWidgets.QFrame.__init__(self, parent)
# Init config
toolId = self.__class__.__name__.lower()
@@ -167,20 +167,20 @@ class PyzoWebBrowser(QtGui.QFrame):
self._config.bookMarks.append(item)
# Get style object (for icons)
- style = QtGui.QApplication.style()
+ style = QtWidgets.QApplication.style()
# Create some buttons
- self._back = QtGui.QToolButton(self)
+ self._back = QtWidgets.QToolButton(self)
self._back.setIcon(style.standardIcon(style.SP_ArrowBack))
self._back.setIconSize(QtCore.QSize(16,16))
#
- self._forward = QtGui.QToolButton(self)
+ self._forward = QtWidgets.QToolButton(self)
self._forward.setIcon(style.standardIcon(style.SP_ArrowForward))
self._forward.setIconSize(QtCore.QSize(16,16))
# Create address bar
- #self._address = QtGui.QLineEdit(self)
- self._address = QtGui.QComboBox(self)
+ #self._address = QtWidgets.QLineEdit(self)
+ self._address = QtWidgets.QComboBox(self)
self._address.setEditable(True)
self._address.setInsertPolicy(self._address.NoInsert)
#
@@ -200,8 +200,8 @@ class PyzoWebBrowser(QtGui.QFrame):
# settings.setAttribute(settings.PluginsEnabled, True)
# Layout
- self._sizer1 = QtGui.QVBoxLayout(self)
- self._sizer2 = QtGui.QHBoxLayout()
+ self._sizer1 = QtWidgets.QVBoxLayout(self)
+ self._sizer2 = QtWidgets.QHBoxLayout()
#
self._sizer2.addWidget(self._back, 0)
self._sizer2.addWidget(self._forward, 0)
@@ -258,7 +258,7 @@ class PyzoWebBrowser(QtGui.QFrame):
self._view.forward()
def wheelEvent(self, event):
- if QtCore.Qt.ControlModifier & QtGui.qApp.keyboardModifiers():
+ if QtCore.Qt.ControlModifier & QtWidgets.qApp.keyboardModifiers():
# Get amount of scrolling
degrees = event.delta() / 8.0
steps = degrees / 15.0
@@ -272,5 +272,5 @@ class PyzoWebBrowser(QtGui.QFrame):
self._config.zoomFactor = factor
# self._view.setZoomFactor(factor)
else:
- QtGui.QFrame.wheelEvent(self, event)
+ QtWidgets.QFrame.wheelEvent(self, event)
diff --git a/pyzo/tools/pyzoWorkspace.py b/pyzo/tools/pyzoWorkspace.py
index f419930..8e05bd4 100644
--- a/pyzo/tools/pyzoWorkspace.py
+++ b/pyzo/tools/pyzoWorkspace.py
@@ -8,7 +8,7 @@
import sys, os, time
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
tool_name = "Workspace"
tool_summary = "Lists the variables in the current shell's namespace."
@@ -135,7 +135,7 @@ class WorkspaceProxy(QtCore.QObject):
self.haveNewData.emit()
-class WorkspaceItem(QtGui.QTreeWidgetItem):
+class WorkspaceItem(QtWidgets.QTreeWidgetItem):
def __lt__(self, otherItem):
column = self.treeWidget().sortColumn()
@@ -145,7 +145,7 @@ class WorkspaceItem(QtGui.QTreeWidgetItem):
return self.text(column) > otherItem.text(column)
-class WorkspaceTree(QtGui.QTreeWidget):
+class WorkspaceTree(QtWidgets.QTreeWidget):
""" WorkspaceTree
The tree that displays the items in the current namespace.
@@ -159,7 +159,7 @@ class WorkspaceTree(QtGui.QTreeWidget):
"""
def __init__(self, parent):
- QtGui.QTreeWidget.__init__(self, parent)
+ QtWidgets.QTreeWidget.__init__(self, parent)
self._config = parent._config
@@ -180,7 +180,7 @@ class WorkspaceTree(QtGui.QTreeWidget):
# For menu
self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
- self._menu = QtGui.QMenu()
+ self._menu = QtWidgets.QMenu()
self._menu.triggered.connect(self.contextMenuTriggered)
# Bind to events
@@ -192,7 +192,7 @@ class WorkspaceTree(QtGui.QTreeWidget):
Show the context menu.
"""
- QtGui.QTreeView.contextMenuEvent(self, event)
+ QtWidgets.QTreeView.contextMenuEvent(self, event)
# Get if an item is selected
item = self.currentItem()
@@ -286,7 +286,7 @@ class WorkspaceTree(QtGui.QTreeWidget):
item.setToolTip(2,tt)
-class PyzoWorkspace(QtGui.QWidget):
+class PyzoWorkspace(QtWidgets.QWidget):
""" PyzoWorkspace
The main widget for this tool.
@@ -294,7 +294,7 @@ class PyzoWorkspace(QtGui.QWidget):
"""
def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
+ QtWidgets.QWidget.__init__(self, parent)
# Make sure there is a configuration entry for this tool
# The pyzo tool manager makes sure that there is an entry in
@@ -305,25 +305,25 @@ class PyzoWorkspace(QtGui.QWidget):
self._config.hideTypes = []
# Create tool button
- self._up = QtGui.QToolButton(self)
- style = QtGui.qApp.style()
+ self._up = QtWidgets.QToolButton(self)
+ style = QtWidgets.qApp.style()
self._up.setIcon( style.standardIcon(style.SP_ArrowLeft) )
self._up.setIconSize(QtCore.QSize(16,16))
# Create "path" line edit
- self._line = QtGui.QLineEdit(self)
+ self._line = QtWidgets.QLineEdit(self)
self._line.setReadOnly(True)
self._line.setStyleSheet("QLineEdit { background:#ddd; }")
self._line.setFocusPolicy(QtCore.Qt.NoFocus)
# Create options menu
- self._options = QtGui.QToolButton(self)
+ self._options = QtWidgets.QToolButton(self)
self._options.setIcon(pyzo.icons.filter)
self._options.setIconSize(QtCore.QSize(16,16))
self._options.setPopupMode(self._options.InstantPopup)
self._options.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
#
- self._options._menu = QtGui.QMenu()
+ self._options._menu = QtWidgets.QMenu()
self._options.setMenu(self._options._menu)
self.onOptionsPress() # create menu now
@@ -331,12 +331,12 @@ class PyzoWorkspace(QtGui.QWidget):
self._tree = WorkspaceTree(self)
# Set layout
- layout = QtGui.QHBoxLayout()
+ layout = QtWidgets.QHBoxLayout()
layout.addWidget(self._up, 0)
layout.addWidget(self._line, 1)
layout.addWidget(self._options, 0)
#
- mainLayout = QtGui.QVBoxLayout(self)
+ mainLayout = QtWidgets.QVBoxLayout(self)
mainLayout.addLayout(layout, 0)
mainLayout.addWidget(self._tree, 1)
mainLayout.setSpacing(2)
diff --git a/pyzo/util/_locale.py b/pyzo/util/_locale.py
index 2bad06b..4ac33e6 100644
--- a/pyzo/util/_locale.py
+++ b/pyzo/util/_locale.py
@@ -11,7 +11,7 @@ Module for locale stuff like language and translations.
import os, sys, time
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
QLocale = QtCore.QLocale
@@ -86,7 +86,7 @@ def setLanguage(languageName):
if not hasattr(QtCore, '_translators'):
QtCore._translators = []
for trans in QtCore._translators:
- QtGui.QApplication.removeTranslator(trans)
+ QtWidgets.QApplication.removeTranslator(trans)
# The default language
if localeName1 == 'C':
@@ -101,7 +101,7 @@ def setLanguage(languageName):
for localeName in [localeName1, localeName2]:
success = trans.load(what + '_' + localeName + '.tr', where)
if success:
- QtGui.QApplication.installTranslator(trans)
+ QtWidgets.QApplication.installTranslator(trans)
QtCore._translators.append(trans)
print('loading %s %s: ok' % (what, languageName))
break
diff --git a/pyzo/util/bootstrapconda.py b/pyzo/util/bootstrapconda.py
index fd73f0a..0c39bb3 100644
--- a/pyzo/util/bootstrapconda.py
+++ b/pyzo/util/bootstrapconda.py
@@ -14,7 +14,7 @@ import subprocess
import urllib.request
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo import translate
base_url = 'http://repo.continuum.io/miniconda/'
@@ -71,9 +71,9 @@ def check_for_conda_env(parent=None):
d.exec_()
-class AskToInstallConda(QtGui.QDialog):
+class AskToInstallConda(QtWidgets.QDialog):
def __init__(self, parent=None):
- QtGui.QDialog.__init__(self, parent)
+ QtWidgets.QDialog.__init__(self, parent)
self.setWindowTitle('Install a conda env?')
self.setModal(True)
@@ -85,15 +85,15 @@ class AskToInstallConda(QtGui.QDialog):
text += '.'
text += '\n(You can always launch the installer from the shell menu.)'
- self._label = QtGui.QLabel(text, self)
- self._no = QtGui.QPushButton("No thanks (dont ask again)")
- self._yes = QtGui.QPushButton("Yes, please install Python!")
+ self._label = QtWidgets.QLabel(text, self)
+ self._no = QtWidgets.QPushButton("No thanks (dont ask again)")
+ self._yes = QtWidgets.QPushButton("Yes, please install Python!")
self._no.clicked.connect(self.reject)
self._yes.clicked.connect(self.accept)
- vbox = QtGui.QVBoxLayout(self)
- hbox = QtGui.QHBoxLayout()
+ vbox = QtWidgets.QVBoxLayout(self)
+ hbox = QtWidgets.QHBoxLayout()
self.setLayout(vbox)
vbox.addWidget(self._label, 1)
vbox.addLayout(hbox, 0)
@@ -103,32 +103,32 @@ class AskToInstallConda(QtGui.QDialog):
self._yes.setDefault(1)
-class Installer(QtGui.QDialog):
+class Installer(QtWidgets.QDialog):
lineFromStdOut = QtCore.Signal(str)
def __init__(self, parent=None):
- QtGui.QDialog.__init__(self, parent)
+ QtWidgets.QDialog.__init__(self, parent)
self.setWindowTitle('Install miniconda')
self.setModal(True)
self.resize(500, 500)
text = translate('bootstrapconda', 'This will download and install miniconda on your computer.')
- self._label = QtGui.QLabel(text, self)
+ self._label = QtWidgets.QLabel(text, self)
- self._scipystack = QtGui.QCheckBox(translate('bootstrapconda', 'Also install scientific packages', self))
+ self._scipystack = QtWidgets.QCheckBox(translate('bootstrapconda', 'Also install scientific packages', self))
self._scipystack.setChecked(True)
- self._path = QtGui.QLineEdit(default_conda_dir, self)
- self._progress = QtGui.QProgressBar(self)
- self._outputLine = QtGui.QLabel(self)
- self._output = QtGui.QPlainTextEdit(self)
+ self._path = QtWidgets.QLineEdit(default_conda_dir, self)
+ self._progress = QtWidgets.QProgressBar(self)
+ self._outputLine = QtWidgets.QLabel(self)
+ self._output = QtWidgets.QPlainTextEdit(self)
self._output.setReadOnly(True)
- self._button = QtGui.QPushButton('Install', self)
+ self._button = QtWidgets.QPushButton('Install', self)
- self._outputLine.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
+ self._outputLine.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
- vbox = QtGui.QVBoxLayout(self)
+ vbox = QtWidgets.QVBoxLayout(self)
self.setLayout(vbox)
vbox.addWidget(self._label, 0)
vbox.addWidget(self._path, 0)
@@ -241,7 +241,7 @@ class Installer(QtGui.QDialog):
etime = time.time() + 0.2
while time.time() < etime:
time.sleep(0.01)
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.processEvents()
def download(self):
@@ -323,7 +323,7 @@ class Installer(QtGui.QDialog):
while p.poll() is None:
time.sleep(0.01)
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.processEvents()
catcher.join()
if p.poll():
@@ -365,7 +365,7 @@ class Installer(QtGui.QDialog):
for i in range(self._progress.value(), 100, 5):
time.sleep(0.05)
self._progress.setValue(i)
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.processEvents()
def is_64bit():
@@ -403,7 +403,7 @@ def _chunk_read(response, local_file, chunk_size=1024, initial_size=0, progress=
progress.setMaximum(total_size)
while True:
- QtGui.qApp.processEvents()
+ QtWidgets.qApp.processEvents()
chunk = response.read(chunk_size)
bytes_so_far += len(chunk)
if not chunk:
diff --git a/pyzo/util/pyzowizard.py b/pyzo/util/pyzowizard.py
index 1a7b321..3501fb8 100644
--- a/pyzo/util/pyzowizard.py
+++ b/pyzo/util/pyzowizard.py
@@ -14,7 +14,7 @@ import os
import re
import pyzo
-from pyzo.util.qt import QtCore, QtGui
+from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo import translate
from pyzo.util._locale import LANGUAGES, LANGUAGE_SYNONYMS, setLanguage
@@ -30,10 +30,10 @@ def retranslate(t):
-class PyzoWizard(QtGui.QWizard):
+class PyzoWizard(QtWidgets.QWizard):
def __init__(self, parent):
- QtGui.QWizard.__init__(self, parent)
+ QtWidgets.QWizard.__init__(self, parent)
# Set some appearance stuff
self.setMinimumSize(600, 500)
@@ -64,7 +64,7 @@ class PyzoWizard(QtGui.QWizard):
that page. startPage can be an integer or a string that matches
the classname of a page.
"""
- QtGui.QWizard.show(self)
+ QtWidgets.QWizard.show(self)
# Check startpage
if isinstance(startPage, int):
@@ -88,7 +88,7 @@ class PyzoWizard(QtGui.QWizard):
self.next()
-class BasePyzoWizardPage(QtGui.QWizardPage):
+class BasePyzoWizardPage(QtWidgets.QWizardPage):
_prefix = translate('wizard', 'Step')
@@ -97,16 +97,16 @@ class BasePyzoWizardPage(QtGui.QWizardPage):
_image_filename = ''
def __init__(self, parent, i):
- QtGui.QWizardPage.__init__(self, parent)
+ QtWidgets.QWizardPage.__init__(self, parent)
self._i = i
# Create label for description
- self._text_label = QtGui.QLabel(self)
+ self._text_label = QtWidgets.QLabel(self)
self._text_label.setTextFormat(QtCore.Qt.RichText)
self._text_label.setWordWrap(True)
# Create label for image
- self._comicLabel = QtGui.QLabel(self)
+ self._comicLabel = QtWidgets.QLabel(self)
pm = QtGui.QPixmap()
if 'logo' in self._image_filename:
pm.load(os.path.join(pyzo.pyzoDir, 'resources', 'appicons', self._image_filename))
@@ -116,7 +116,7 @@ class BasePyzoWizardPage(QtGui.QWizardPage):
self._comicLabel.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
# Layout
- theLayout = QtGui.QVBoxLayout(self)
+ theLayout = QtWidgets.QVBoxLayout(self)
self.setLayout(theLayout)
#
theLayout.addWidget(self._text_label)
@@ -174,14 +174,14 @@ class IntroWizardPage(BasePyzoWizardPage):
# Create label and checkbox
t1 = translate('wizard', "This wizard can be opened using 'Help > Pyzo wizard'")
t2 = translate('wizard', "Show this wizard on startup")
- self._label_info = QtGui.QLabel(t1, self)
- #self._check_show = QtGui.QCheckBox(t2, self)
+ self._label_info = QtWidgets.QLabel(t1, self)
+ #self._check_show = QtWidgets.QCheckBox(t2, self)
#self._check_show.stateChanged.connect(self._setNewUser)
# Create language switcher
- self._langLabel = QtGui.QLabel(translate('wizard', "Select language"), self)
+ self._langLabel = QtWidgets.QLabel(translate('wizard', "Select language"), self)
#
- self._langBox = QtGui.QComboBox(self)
+ self._langBox = QtWidgets.QComboBox(self)
self._langBox.setEditable(False)
# Fill
index, theIndex = -1, -1
@@ -202,7 +202,7 @@ class IntroWizardPage(BasePyzoWizardPage):
# self._check_show.setCheckState(QtCore.Qt.Checked)
# Create sublayout
- layout = QtGui.QHBoxLayout()
+ layout = QtWidgets.QHBoxLayout()
layout.addWidget(self._langLabel, 0)
layout.addWidget(self._langBox, 0)
layout.addStretch(2)
@@ -230,7 +230,7 @@ class IntroWizardPage(BasePyzoWizardPage):
The language has been changed for this wizard.
Pyzo needs to restart for the change to take effect application-wide.
""")
- m = QtGui.QMessageBox(self)
+ m = QtWidgets.QMessageBox(self)
m.setWindowTitle(translate("wizard", "Language changed"))
m.setText(text)
m.setIcon(m.Information)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyzo.git
More information about the debian-science-commits
mailing list