Python PyQt5.QtCore.QTextStream() Examples
The following are 30
code examples of PyQt5.QtCore.QTextStream().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore
, or try the search function
.
Example #1
Source File: singleapplication.py From vidcutter with GNU General Public License v3.0 | 6 votes |
def __init__(self, appid, *argv): super(SingleApplication, self).__init__(*argv) self._appid = appid self._activationWindow = None self._activateOnMessage = False self._outSocket = QLocalSocket() self._outSocket.connectToServer(self._appid) self._isRunning = self._outSocket.waitForConnected() self._outStream = None self._inSocket = None self._inStream = None self._server = None self.settings = QSettings(SingleApplication.getSettingsPath(), QSettings.IniFormat) self.singleInstance = self.settings.value('singleInstance', 'on', type=str) in {'on', 'true'} if self._isRunning and self.singleInstance: self._outStream = QTextStream(self._outSocket) for a in argv[0][1:]: a = os.path.join(os.getcwd(), a) if os.path.isfile(a): self.sendMessage(a) break sys.exit(0) else: error = self._outSocket.error() if error == QLocalSocket.ConnectionRefusedError: self.close() QLocalServer.removeServer(self._appid) self._outSocket = None self._server = QLocalServer() self._server.listen(self._appid) self._server.newConnection.connect(self._onNewConnection)
Example #2
Source File: persepolis.py From persepolis with GNU General Public License v3.0 | 6 votes |
def setPersepolisColorScheme(self, color_scheme): self.persepolis_color_scheme = color_scheme if color_scheme == 'Dark Fusion': dark_fusion = DarkFusionPalette() self.setPalette(dark_fusion) file = QFile(":/dark_style.qss") file.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(file) self.setStyleSheet(stream.readAll()) elif color_scheme == 'Light Fusion': dark_fusion = LightFusionPalette() self.setPalette(dark_fusion) file = QFile(":/light_style.qss") file.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(file) self.setStyleSheet(stream.readAll()) # create terminal arguments
Example #3
Source File: about.py From persepolis with GNU General Public License v3.0 | 6 votes |
def __init__(self, persepolis_setting): super().__init__(persepolis_setting) self.persepolis_setting = persepolis_setting # setting window size and position size = self.persepolis_setting.value( 'AboutWindow/size', QSize(545, 375)) position = self.persepolis_setting.value( 'AboutWindow/position', QPoint(300, 300)) # read translators.txt files. # this file contains all translators. f = QFile(':/translators.txt') f.open(QIODevice.ReadOnly | QFile.Text) f_text = QTextStream(f).readAll() f.close() self.translators_textEdit.insertPlainText(f_text) self.resize(size) self.move(position)
Example #4
Source File: utils.py From Dwarf with GNU General Public License v3.0 | 6 votes |
def set_theme(theme, prefs=None): if theme: theme = theme.replace(os.pardir, '').replace('.', '') theme = theme.join(theme.split()).lower() theme_style = resource_path('assets' + os.sep + theme + '_style.qss') if not os.path.exists(theme_style): theme_style = ':/assets/' + theme + '_style.qss' if prefs is not None: prefs.put('dwarf_ui_theme', theme) try: _app = QApplication.instance() style_s = QFile(theme_style) style_s.open(QFile.ReadOnly) style_content = QTextStream(style_s).readAll() _app.setStyleSheet(_app.styleSheet() + '\n' + style_content) except Exception as e: pass # err = self.dwarf.spawn(dwarf_args.package, dwarf_args.script)
Example #5
Source File: qt_single_application.py From vorta with GNU General Public License v3.0 | 6 votes |
def __init__(self, id, *argv): super().__init__(*argv) self._id = id # Is there another instance running? self._outSocket = QLocalSocket() self._outSocket.connectToServer(self._id) self._isRunning = self._outSocket.waitForConnected() if self._isRunning: # Yes, there is. self._outStream = QTextStream(self._outSocket) self._outStream.setCodec('UTF-8') else: # No, there isn't. self._outSocket = None self._outStream = None self._inSocket = None self._inStream = None self._server = QLocalServer() self._server.removeServer(self._id) self._server.listen(self._id) self._server.newConnection.connect(self._onNewConnection)
Example #6
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #7
Source File: singleapplication.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def _onNewConnection(self): if self._inSocket: self._inSocket.readyRead.disconnect(self._onReadyRead) self._inSocket = self._server.nextPendingConnection() if not self._inSocket: return self._inStream = QTextStream(self._inSocket) self._inSocket.readyRead.connect(self._onReadyRead) if self._activateOnMessage: self.activateWindow()
Example #8
Source File: about.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent): super(LicenseTab, self).__init__(parent) self.setObjectName('license') licensefile = QFile(':/license.html') licensefile.open(QFile.ReadOnly | QFile.Text) content = QTextStream(licensefile).readAll() self.setText(content) if sys.platform in {'win32', 'darwin'}: self.setStyle(QStyleFactory.create('Fusion'))
Example #9
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #10
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetexttemp(self, fileName): textout = self.TemptextEdit.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.tempwizardPage, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #11
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetextscript(self, fileName): textout = self.script_textEdit.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.wizardPage_3, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #12
Source File: videostyle.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def loadQSS(theme) -> None: filename = ':/styles/{}.qss'.format(theme) if QFileInfo(filename).exists(): qssfile = QFile(filename) qssfile.open(QFile.ReadOnly | QFile.Text) content = QTextStream(qssfile).readAll() qApp.setStyleSheet(content)
Example #13
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetexttemp(self, fileName): textout = self.TemptextEdit.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.tempwizardPage, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #14
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #15
Source File: qtsingleapplication.py From artisan with GNU General Public License v3.0 | 5 votes |
def _onNewConnection(self): if self._inSocket: self._inSocket.readyRead.disconnect(self._onReadyRead) self._inSocket = self._server.nextPendingConnection() if not self._inSocket: return self._inStream = QTextStream(self._inSocket) self._inStream.setCodec('UTF-8') self._inSocket.readyRead.connect(self._onReadyRead) if self._activateOnMessage and self._isRunning: self.activateWindow()
Example #16
Source File: textwidget.py From lector with GNU General Public License v2.0 | 5 votes |
def openFile(self): if settings.get("file_dialog_dir"): self.curDir = '~/' else: self.curDir = settings.get("file_dialog_dir") fn = QFileDialog.getOpenFileName(self, self.tr("Open File..."), self.curDir, self.tr("HTML-Files (*.htm *.html);;All Files (*)")) QApplication.setOverrideCursor(Qt.WaitCursor) if fn: self.lastFolder = os.path.dirname(fn) if os.path.exists(fn): if os.path.isfile(fn): f = QFile(fn) if not f.open(QIODevice.ReadOnly | QIODevice.Text): QtGui.QMessageBox.information(self.parent(), self.tr("Error - Lector"), self.tr("Can't open '%s.'" % fn)) else: stream = QTextStream(f) text = stream.readAll() self.setText(text) else: QMessageBox.information(self.parent(), self.tr("Error - Lector"), self.tr("'%s' is not a file." % fn)) QApplication.restoreOverrideCursor()
Example #17
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #18
Source File: changelog.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(Changelog, self).__init__(parent, Qt.Dialog | Qt.WindowCloseButtonHint) self.parent = parent self.setWindowTitle('{} changelog'.format(qApp.applicationName())) changelog = QFile(':/CHANGELOG') changelog.open(QFile.ReadOnly | QFile.Text) content = QTextStream(changelog).readAll() label = QLabel(content, self) label.setWordWrap(True) label.setTextFormat(Qt.PlainText) buttons = QDialogButtonBox(QDialogButtonBox.Close, self) buttons.rejected.connect(self.close) scrollarea = QScrollArea(self) scrollarea.setStyleSheet('QScrollArea { background:transparent; }') scrollarea.setWidgetResizable(True) scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scrollarea.setFrameShape(QScrollArea.NoFrame) scrollarea.setWidget(label) if sys.platform in {'win32', 'darwin'}: scrollarea.setStyle(QStyleFactory.create('Fusion')) # noinspection PyUnresolvedReferences if parent.parent.stylename == 'fusion' or sys.platform in {'win32', 'darwin'}: self.setStyleSheet(''' QScrollArea {{ background-color: transparent; margin-bottom: 10px; border: none; border-right: 1px solid {}; }}'''.format('#4D5355' if parent.theme == 'dark' else '#C0C2C3')) else: self.setStyleSheet(''' QScrollArea {{ background-color: transparent; margin-bottom: 10px; border: none; }}''') layout = QVBoxLayout() layout.addWidget(scrollarea) layout.addWidget(buttons) self.setLayout(layout) self.setMinimumSize(self.sizeHint())
Example #19
Source File: qt_single_application.py From vorta with GNU General Public License v3.0 | 5 votes |
def _onNewConnection(self): if self._inSocket: self._inSocket.readyRead.disconnect(self._onReadyRead) self._inSocket = self._server.nextPendingConnection() if not self._inSocket: return self._inStream = QTextStream(self._inSocket) self._inStream.setCodec('UTF-8') self._inSocket.readyRead.connect(self._onReadyRead)
Example #20
Source File: __init__.py From TradeSim with Apache License 2.0 | 5 votes |
def load_stylesheet_pyqt5(): """ Loads the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file import qdarkstyle.pyqt5_style_rc # Load the stylesheet content from resources from PyQt5.QtCore import QFile, QTextStream f = QFile(":qdarkstyle/style.qss") if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #21
Source File: dsingleapplication.py From QMusic with GNU Lesser General Public License v2.1 | 5 votes |
def _onNewConnection(self): if self._inSocket: self._inSocket.readyRead.disconnect(self._onReadyRead) self._inSocket = self._server.nextPendingConnection() if not self._inSocket: return self._inStream = QTextStream(self._inSocket) self._inStream.setCodec('UTF-8') self._inSocket.readyRead.connect(self._onReadyRead) if self._activateOnMessage: self.activateWindow()
Example #22
Source File: dsingleapplication.py From QMusic with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, id, *argv): super(QSingleApplication, self).__init__(*argv) self._id = id self._activationWindow = None self._activateOnMessage = False self._server = None # Is there another instance running? self._outSocket = QLocalSocket() self._outSocket.connectToServer(self._id) self._outSocket.error.connect(self.handleError) self._isRunning = self._outSocket.waitForConnected() if self._isRunning: # Yes, there is. self._outStream = QTextStream(self._outSocket) self._outStream.setCodec('UTF-8') else: # No, there isn't. self._outSocket = None self._outStream = None self._inSocket = None self._inStream = None self._server = QLocalServer() self._server.listen(self._id) self._server.newConnection.connect(self._onNewConnection) self.aboutToQuit.connect(self.removeServer)
Example #23
Source File: __init__.py From PyQt5_stylesheets with Apache License 2.0 | 5 votes |
def load_stylesheet(pyside=True): """ Loads the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file if pyside: import qdarkstyle.pyside_style_rc else: import qdarkstyle.pyqt_style_rc # Load the stylesheet content from resources if not pyside: from PyQt4.QtCore import QFile, QTextStream else: from PySide.QtCore import QFile, QTextStream f = QFile(":qdarkstyle/style.qss") if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #24
Source File: __init__.py From vnpy_crypto with MIT License | 5 votes |
def load_stylesheet_pyqt5(): """ Load the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ warnings.warn( "load_stylesheet_pyqt5() will be deprecated in version 3," "set QtPy environment variable to specify the Qt binding and " "use load_stylesheet()", PendingDeprecationWarning ) # Smart import of the rc file import qdarkstyle.pyqt5_style_rc # Load the stylesheet content from resources from PyQt5.QtCore import QFile, QTextStream f = QFile(":qdarkstyle/style.qss") if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #25
Source File: dark.py From BreezeStyleSheets with MIT License | 4 votes |
def main(): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) #app.setStyle(QtWidgets.QStyleFactory.create("fusion")) window = QtWidgets.QMainWindow() # setup ui ui = example.Ui_MainWindow() ui.setupUi(window) ui.bt_delay_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_instant_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_menu_button_popup.addActions([ ui.actionAction, ui.actionAction_C ]) window.setWindowTitle("BreezeDark example") # tabify dock widgets to show bug #6 window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2) # setup stylesheet file = QFile(":/dark.qss") file.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(file) app.setStyleSheet(stream.readAll()) # auto quit after 2s when testing on travis-ci if "--travis" in sys.argv: QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()
Example #26
Source File: __init__.py From TradeSim with Apache License 2.0 | 4 votes |
def load_stylesheet(pyside=True): """ Loads the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file if pyside: import qdarkstyle.pyside_style_rc else: import qdarkstyle.pyqt_style_rc # Load the stylesheet content from resources if not pyside: # PyQt 4/5 compatibility try: from PyQt4.QtCore import QFile, QTextStream except ImportError: from PyQt5.QtCore import QFile, QTextStream else: from PySide.QtCore import QFile, QTextStream f = QFile(":qdarkstyle/style.qss") if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #27
Source File: __init__.py From PyQt5_stylesheets with Apache License 2.0 | 4 votes |
def load_stylesheet_pyqt5(**kwargs): """ Loads the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file if kwargs["style"] == "style_Dark": import PyQt5_stylesheets.pyqt5_style_Dark_rc if kwargs["style"] == "style_DarkOrange": import PyQt5_stylesheets.pyqt5_style_DarkOrange_rc if kwargs["style"] == "style_Classic": import PyQt5_stylesheets.pyqt5_style_Classic_rc if kwargs["style"] == "style_navy": import PyQt5_stylesheets.pyqt5_style_navy_rc if kwargs["style"] == "style_gray": import PyQt5_stylesheets.pyqt5_style_gray_rc if kwargs["style"] == "style_blue": import PyQt5_stylesheets.pyqt5_style_blue_rc if kwargs["style"] == "style_black": import PyQt5_stylesheets.pyqt5_style_black_rc # Load the stylesheet content from resources from PyQt5.QtCore import QFile, QTextStream f = QFile(":PyQt5_stylesheets/%s.qss"%kwargs["style"]) if not f.exists(): f = QFile(":PyQt5_stylesheets/%s.css"%kwargs["style"]) if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #28
Source File: qtsingleapplication.py From artisan with GNU General Public License v3.0 | 4 votes |
def __init__(self, _id,_viewer_id, *argv): if sys.platform.startswith("darwin") and mp.current_process().name == "WebLCDs": import AppKit info = AppKit.NSBundle.mainBundle().infoDictionary() # @UndefinedVariable info["LSBackgroundOnly"] = "1" super(QtSingleApplication, self).__init__(*argv) self._id = _id self._viewer_id = _viewer_id self._activationWindow = None self._activateOnMessage = False self._outSocket = None self._isRunning = False self._server = None # we exclude the WebLCDs parallel process from participating any Artisan inter-app communication if mp.current_process().name != "WebLCDs": # Is there another instance running? self._outSocket = QLocalSocket() self._outSocket.connectToServer(self._id) self._isRunning = self._outSocket.waitForConnected(-1) if self._isRunning: # Yes, there is. self._outStream = QTextStream(self._outSocket) self._outStream.setCodec('UTF-8') # Is there another viewer running? self._outSocketViewer = QLocalSocket() self._outSocketViewer.connectToServer(self._viewer_id) self._isRunningViewer = self._outSocketViewer.waitForConnected(-1) if self._isRunningViewer: self._outStreamViewer = QTextStream(self._outSocketViewer) self._outStreamViewer.setCodec('UTF-8') else: # app is running, we announce us as viewer app # First we remove existing servers of that name that might not have been properly closed as the server died QLocalServer.removeServer(self._viewer_id) self._outSocketViewer = None self._outStreamViewer = None self._inSocket = None self._inStream = None self._server = QLocalServer() self._server.listen(self._viewer_id) self._server.newConnection.connect(self._onNewConnection) else: self._isRunningViewer = False # No, there isn't. # First we remove existing servers of that name that might not have been properly closed as the server died QLocalServer.removeServer(self._id) self._outSocket = None self._outStream = None self._inSocket = None self._inStream = None self._server = QLocalServer() self._server.listen(self._id) self._server.newConnection.connect(self._onNewConnection)
Example #29
Source File: __init__.py From vnpy_crypto with MIT License | 4 votes |
def load_stylesheet(pyside=True): """ Load the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ warnings.warn( "load_stylesheet() will not receive pyside parameter in version 3. " "Set QtPy environment variable to specify the Qt binding insteady.", FutureWarning ) # Smart import of the rc file if pyside: import qdarkstyle.pyside_style_rc else: import qdarkstyle.pyqt_style_rc # Load the stylesheet content from resources if not pyside: from PyQt4.QtCore import QFile, QTextStream else: from PySide.QtCore import QFile, QTextStream f = QFile(":qdarkstyle/style.qss") if not f.exists(): _logger().error("Unable to load stylesheet, file not found in " "resources") return "" else: f.open(QFile.ReadOnly | QFile.Text) ts = QTextStream(f) stylesheet = ts.readAll() if platform.system().lower() == 'darwin': # see issue #12 on github mac_fix = ''' QDockWidget::title { background-color: #31363b; text-align: center; height: 12px; } ''' stylesheet += mac_fix return stylesheet
Example #30
Source File: light.py From BreezeStyleSheets with MIT License | 4 votes |
def main(): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) #app.setStyle(QtWidgets.QStyleFactory.create("fusion")) window = QtWidgets.QMainWindow() # setup ui ui = example.Ui_MainWindow() ui.setupUi(window) ui.bt_delay_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_instant_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_menu_button_popup.addActions([ ui.actionAction, ui.actionAction_C ]) window.setWindowTitle("Breeze example") # tabify dock widgets to show bug #6 window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2) # setup stylesheet file = QFile(":/light.qss") file.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(file) app.setStyleSheet(stream.readAll()) # auto quit after 2s when testing on travis-ci if "--travis" in sys.argv: QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()