def closeApp(self): self.nodeManager.stop() self.config['warren']['last_window_pos'] = [ str(self.x()), str(self.y()) ] self.config.write() qApp.quit()
def impl(self): try: # Capture the window before we change anything beforeImg = QPixmap.grabWindow( self.w.winId() ).toImage() # Change the visibility of the *selected* layer self.o2.visible = False self.w.repaint() # Make sure the GUI is caught up on paint events QApplication.processEvents() # We must sleep for the screenshot to be right. time.sleep(0.1) # Capture the window now that we've changed a layer. afterImg = QPixmap.grabWindow( self.w.winId() ).toImage() # Optional: Save the files so we can inspect them ourselves... #beforeImg.save('before.png') #afterImg.save('after.png') # Before and after should NOT match. assert beforeImg != afterImg except: # Catch all exceptions and print them # We must finish so we can quit the app. import traceback traceback.print_exc() TestLayerWidget.errors = True qApp.quit()
def finished(self): """Catch the signal emitted when the track has finished if the app is in cli mode then quit after the track has finished """ #print('Caught finished') if self.disableGui or self.quitOnFinish: qApp.quit()
def cleanupAndQuit(self): """ cleans state before shutting down app. """ # TODO:make sure to shutdown all child process / threads # in conductor self.conductor.cleanup() qApp.quit()
def cleanExit(self): # Provides an "ARE YOU SURE" method for clean exits. if self.state == 2: # See setState() reply = QMessageBox.question(self, 'Message', self.quit_msg, QMessageBox.Yes, QMessageBox.No) if reply == QMessageBox.Yes: qApp.quit() else: pass else: qApp.quit()
def catchStateChanged(self, newstate, oldstate): """Catch the stateChanged signal to check for errors quit app if in CLI mode """ #print('State = ' + str(newstate)) #print('Meta Info') #print(self.mediaObject.metaData()) if newstate == Phonon.ErrorState: print('Error playing back file') if self.disableGui: qApp.quit()
def closeAndQuit(self, quitApp=True): self.projectManager.closeCurrentProject() # Stop the thread that checks for log config changes. ilastik.ilastik_logging.stopUpdates() # Close the window first, so applets can reimplement hideEvent() and such. self.close() # For testing purposes, sometimes this function is called even though we don't want to really quit. if quitApp: qApp.quit()
def closeEvent(self, event): """ Handling saving state before application when application is being closed. """ settings = QtCore.QSettings() settings.setValue("main_WindowGeometry", self.saveGeometry()) settings.setValue("mainWindowState", self.saveState()) settings.setValue("backgroundColor", self.background_color) settings.setValue("textColor", self.text_color) settings.setValue("labelColor", self.label_color) #screen_shape = QtGui.QDesktopWidget().screenGeometry() main_window = self.window() width = main_window.frameGeometry().width() height = main_window.frameGeometry().height() settings.setValue('screen_shape', (width, height)) qpos = self.pos() pos = qpos.x(), qpos.y() settings.setValue('pos', pos) qApp.quit()
def quitApp(): qApp.quit()
def on_actionExit_clicked(self): print('Exiting...') qApp.quit()
def keyPressEvent(self, ev): if ev.key() == Qt.Key_Escape: qApp.quit()
def close(self): qApp.quit()
def app_exit(self): shutil.rmtree(tmp_dir) return qApp.quit()
def quit(self): qApp.quit()
def closeApp(self): self.nodeManager.stop() self.config['warren']['last_window_pos'] = [str(self.x()),str(self.y())] self.config.write() qApp.quit()
def quitApp(): if qApp is not None: qApp.quit()
def interpret(self, command): """Interprets command Returns turple (output, exitCode) """ print '~~~~~~~~~ interpret' ec = pConsoleCommand.NotFound output, ec = pConsoleCommand.interpret( command) parts = self.parseCommands( command ) if parts: cmd = parts.takeFirst() else: cmd = '' if ec != pConsoleCommand.NotFound : # nothing to do pass elif cmd == "ls" : if sys.platform.startswith('win'): cmd = "dir %s" % \ " ".join(pConsoleCommand.quotedStringList(parts)).trim() else: cmd = "dir %s" % " ".join( \ pConsoleCommand.quotedStringList(parts)).trimmed() process = QProcess() process.setProcessChannelMode( QProcess.MergedChannels ) process.start( cmd ) process.waitForStarted() process.waitForFinished() output = process.readAll().trimmed() ec = process.exitCode() elif cmd == "echo" : if parts: output = "\n".join(parts) ec = pConsoleCommand.Error else: output = pConsole.tr(console, "No argument given" ) ec = pConsoleCommand.Success elif cmd == "quit": output = pConsole.tr(console, "Quitting the application..." ) ec = pConsoleCommand.Success QTimer.singleShot(1000, qApp.quit() ) elif cmd == "style" : if parts.count() != 1 : output = pConsole.tr(console, "%s take only 1 parameter, %d given" % (cmd, len(parts)) ) ec = pConsoleCommand.Error elif parts[-1] == "list" : output = pConsole.tr(console, "Available styles:\n%s" % '\n'.join(QStyleFactory.keys()) ) ec = pConsoleCommand.Success else: styleExists = parts[-1].lower() in \ [key.lower() for key in QStyleFactory.keys()] if styleExists: output = pConsole.tr(console, "Setting style to %s..." % parts[-1]) self.mMainWindow.setCurrentStyle( parts[-1] ) ec = pConsoleCommand.Success else: output = pConsole.tr(console, "This style does not exists" ) ec = pConsoleCommand.Error return (output, ec)
def __quit(self): self.__saveSettings() qApp.quit()
def process_return_code(self, ret): if ret == QMessageBox.Yes: qApp.quit() elif ret == QMessageBox.No: pass