From: Ralf Jung Date: Mon, 21 Sep 2015 15:03:51 +0000 (+0200) Subject: port to Qt5 X-Git-Url: https://git.ralfj.de/lilass.git/commitdiff_plain/c397141396a8b1c0fb8e3a90a971dd42c75c0735?ds=inline;hp=-c port to Qt5 --- c397141396a8b1c0fb8e3a90a971dd42c75c0735 diff --git a/README.rst b/README.rst index 56ae9d2..0e06f63 100644 --- a/README.rst +++ b/README.rst @@ -29,8 +29,8 @@ Simply run ``lilass`` to start the interactive mode. A window will pop up, allowing you to select which screens are enabled, their resolution, and how they are positioned relatively to each other. The option ``--frontend`` (or ``-f``) can be used to choose the frontend which opens the window. Currently, the -frontends ``qt`` and ``zenity`` are available. LiLaSS attempts to choose an -adequate frontend automatically. +frontends ``qt`` (using Qt5) and ``zenity`` are available. LiLaSS attempts to +choose an adequate frontend automatically. The option ``--relative-position`` (``-r``) suppresses the interactive configuration. Instead, the given given option (``left``, ``right``, ``above``, diff --git a/qt_frontend.py b/qt_frontend.py index 62e3b84..6e41d55 100644 --- a/qt_frontend.py +++ b/qt_frontend.py @@ -19,9 +19,9 @@ from screen import RelativeScreenPosition, ScreenSetup try: # Be fine with PyQt4 not being installed - from PyQt4 import QtCore, QtGui, uic + from PyQt5 import QtCore, QtWidgets, uic - class PositionSelection(QtGui.QDialog): + class PositionSelection(QtWidgets.QDialog): def __init__(self, situation): # set up main window super(PositionSelection, self).__init__() @@ -95,7 +95,7 @@ try: self.posLabel2.setEnabled(bothEnabled) self.relPos.setEnabled(bothEnabled) # avoid having no screen - self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(intEnabled or extEnabled) + self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(intEnabled or extEnabled) def run(self): self.exec_() @@ -109,13 +109,13 @@ except ImportError: # Qt frontend class QtFrontend: def __init__(self): - from PyQt4 import QtGui - self.app = QtGui.QApplication(sys.argv) + from PyQt5 import QtWidgets + self.app = QtWidgets.QApplication(sys.argv) print("Qt loaded") def error(self, message): - from PyQt4 import QtGui - QtGui.QMessageBox.critical(None, 'Fatal error', message) + from PyQt5 import QtWidgets + QtWidgets.QMessageBox.critical(None, 'Fatal error', message) def setup(self, situation): return PositionSelection(situation).run() @@ -123,7 +123,7 @@ class QtFrontend: @staticmethod def isAvailable(): try: - import PyQt4 + import PyQt5 return True except ImportError: return False