def launch_gui(): global qApp global bitmaskd global browser if IS_WIN: freeze_support() bitmaskd = Process(target=run_bitmaskd) bitmaskd.start() qApp = QApplication([]) try: browser = BrowserWindow(None) except NoAuthToken as e: print('ERROR: ' + e.message) sys.exit(1) qApp.setQuitOnLastWindowClosed(True) qApp.lastWindowClosed.connect(browser.shutdown) signal.signal(signal.SIGINT, partial(_handle_kill, win=browser)) # Avoid code to get stuck inside c++ loop, returning control # to python land. timer = QtCore.QTimer() timer.timeout.connect(lambda: None) timer.start(500) browser.show() sys.exit(qApp.exec_())
def gui(): app = QApplication(argv) app.setQuitOnLastWindowClosed(False) mySW = UsbResetter() stray = SystemTrayIcon(mySW.favicon, mySW) mySW.show() stray.show() exit(app.exec_())
class Shell(ShellBase): """ Shell implementation using PySide """ def __init__(self): super(Shell, self).__init__() self.app = QApplication(sys.argv) self.app.setQuitOnLastWindowClosed(False) # 1 self.icon = QIcon(resource_path('res/icon.png')) self.menu = None self.wnd = MainWnd(self, self.icon) def quit_app(self): self.app.quit() def run(self): _logger.info("Shell is running...") self.app.exec_()
def clear(self): """Overriden Qt method """ print('~~~~ Overriden method clear() called') QLineEdit.clear(self) def purePythonMethod(self): """Pure python method. Does not override any C++ methods """ print('~~~~ Pure Python method called') self.windowTitle() # generate exception app = QApplication([]) app.setQuitOnLastWindowClosed(False) lineEdit = LineEdit() lineEdit.deleteLater() if USE_SINGLESHOT: #QTimer.singleShot(1000, lineEdit.clear) #QTimer.singleShot(1000, lineEdit.purePythonMethod) QTimer.singleShot(1000, lineEdit.selectAll) # pure C++ method else: timer = QTimer(None) timer.setSingleShot(True) timer.setInterval(1000) timer.start()
def initSearch(self): self.s.show() # self.seaProc = Popen(["python", # self.instdir + "/searchui.py"]) def initManager(self): self.m.show() # self.manProc = Popen(["python", # self.instdir + "/managerui.py"]) if __name__ == '__main__': import sys app = QApplication(sys.argv) display = app.desktop() if not QSystemTrayIcon.isSystemTrayAvailable(): QMessageBox.critical(None, "System Tray", "No system tray detected, use alternate means to \ interface with Tag Manager.") sys.exit(1) QApplication.setQuitOnLastWindowClosed(False) ignition = SysTray(display) sys.exit(app.exec_())
# coding: utf-8 import locale import sys from PySide.QtGui import QApplication from audioProcessor import AudioProcessor from gui.models.mainModel import MainModel __author__ = 'Andres' qt_app = QApplication(sys.argv) locale.setlocale(locale.LC_ALL, "spanish") # qt_app.setEffectEnabled(Qt.UI_AnimateCombo, False) qt_app.setQuitOnLastWindowClosed(False) # maximizer = Maximizer() ap = AudioProcessor(1024, 2, 44100, []) ap.start() model = MainModel() model.showView() qt_app.exec_() sys.exit(0)