diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /contrib/QDarkStyleSheet/test | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'contrib/QDarkStyleSheet/test')
| -rwxr-xr-x | contrib/QDarkStyleSheet/test/mw_for_ui_tests.py | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/contrib/QDarkStyleSheet/test/mw_for_ui_tests.py b/contrib/QDarkStyleSheet/test/mw_for_ui_tests.py index 8228166d..be122df5 100755 --- a/contrib/QDarkStyleSheet/test/mw_for_ui_tests.py +++ b/contrib/QDarkStyleSheet/test/mw_for_ui_tests.py @@ -1,75 +1,75 @@ -#!python
-# -*- coding: utf-8 -*-
-
-"""This module provides a main window for UI tests.
-"""
-
-import logging
-import sys
-import argparse
-import qdarkstyle
-
-def get_main_window_app(qt_from='pyqt', no_dark=True):
- """Return main window application."""
-
- # set log for debug
- logging.basicConfig(level=logging.DEBUG)
-
- style = ''
-
- if qt_from == 'pyside':
- # using PySide wrapper
- from PySide.QtGui import QApplication, QMainWindow, QDockWidget
- from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
- # getting style
- style = qdarkstyle.load_stylesheet_pyside()
-
- elif qt_from == 'pyqt':
- # using PyQt4 wrapper
- from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget
- from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
- # getting style
- style = qdarkstyle.load_stylesheet_pyqt()
-
- elif qt_from == 'pyqt5':
- # using PyQt5 wrapper
- from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget
- from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
- # getting style
- style = qdarkstyle.load_stylesheet_pyqt5()
-
- elif qt_from == 'qtpy':
- # using QtPy API
- from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget
- from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
- # getting style
- style = qdarkstyle.load_stylesheet_from_environment()
-
- elif qt_from == 'pyqtgraph':
- # using PyQtGraph API
- from pyqtgraph.Qt import QtGui, QtCore
- # getting style
- style = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True)
-
- if no_dark:
- style = ''
-
- # create the application
- app = QApplication(sys.argv)
- app.setOrganizationName('QDarkStyle')
- app.setApplicationName('QDarkStyle Test')
- # setup stylesheet
- app.setStyleSheet(style)
- # create main window
- window = QMainWindow()
- window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__ +
- " - TEST - Using " + qt_from)
- # auto quit after 2s when testing on travis-ci
- if "--test" in sys.argv:
- QTimer.singleShot(2000, app.exit)
- # run
- window.showMaximized()
- app.exec_()
-
- return window
-
+#!python +# -*- coding: utf-8 -*- + +"""This module provides a main window for UI tests. +""" + +import logging +import sys +import argparse +import qdarkstyle + +def get_main_window_app(qt_from='pyqt', no_dark=True): + """Return main window application.""" + + # set log for debug + logging.basicConfig(level=logging.DEBUG) + + style = '' + + if qt_from == 'pyside': + # using PySide wrapper + from PySide.QtGui import QApplication, QMainWindow, QDockWidget + from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize + # getting style + style = qdarkstyle.load_stylesheet_pyside() + + elif qt_from == 'pyqt': + # using PyQt4 wrapper + from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget + from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize + # getting style + style = qdarkstyle.load_stylesheet_pyqt() + + elif qt_from == 'pyqt5': + # using PyQt5 wrapper + from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget + from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize + # getting style + style = qdarkstyle.load_stylesheet_pyqt5() + + elif qt_from == 'qtpy': + # using QtPy API + from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget + from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize + # getting style + style = qdarkstyle.load_stylesheet_from_environment() + + elif qt_from == 'pyqtgraph': + # using PyQtGraph API + from pyqtgraph.Qt import QtGui, QtCore + # getting style + style = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True) + + if no_dark: + style = '' + + # create the application + app = QApplication(sys.argv) + app.setOrganizationName('QDarkStyle') + app.setApplicationName('QDarkStyle Test') + # setup stylesheet + app.setStyleSheet(style) + # create main window + window = QMainWindow() + window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__ + + " - TEST - Using " + qt_from) + # auto quit after 2s when testing on travis-ci + if "--test" in sys.argv: + QTimer.singleShot(2000, app.exit) + # run + window.showMaximized() + app.exec_() + + return window + |
