def eventLoop(args): """Starts the UI event loop and get command line parser arguments.""" app = QApplication(sys.argv) for pluginDir in pluginDirs(): # required for svg graphics support app.addLibraryPath(pluginDir) mw = MainWindow(args=args) mw.show() return app.exec_()
# Does the config dir already exist? If not # create it: optionsDir = os.path.dirname(self.optionsFilePath); if not os.path.isdir(optionsDir): os.makedirs(optionsDir, 0777); with open(self.optionsFilePath, 'wb') as outFd: self.cfgParser.write(outFd); except IOError as e: self.dialogService.showErrorMsg("Could not save options: %s" % `e`); def exit(self): QApplication.quit(); def closeEvent(self, event): QApplication.quit(); # Bubble event up: event.ignore(); if __name__ == '__main__': app = QApplication(sys.argv); #QApplication.setStyle(QCleanlooksStyle()) morserChallenge = MorseChallenger(); app.exec_(); morserChallenge.exit(); sys.exit();
self.audioSlider.setEnabled(False) self.previewLayout.addWidget(self.previewWidget) self.previewLayout.addWidget(self.audioSlider) self.statusLabel = QLabel() self.mainLayout.addWidget(self.statusLabel) # Audio Feedback Checkbox self.audioFeedbackCheckbox = QCheckBox() self.audioFeedbackCheckbox.setLayoutDirection(Qt.RightToLeft) self.audioFeedbackCheckbox.setIcon(self.headphoneIcon) self.audioFeedbackCheckbox.setToolTip("Enable Audio Feedback") self.mainLayout.addWidget(self.audioFeedbackCheckbox) def setRecordIcon(self): self.is_recording = not self.is_recording if self.is_recording: self.recordButton.setIcon(self.stopIcon) else: self.recordButton.setIcon(self.recordIcon) if __name__ == "__main__": import sys from QtGui import QApplication app = QApplication(sys.argv) main = RecordingWidget() main.show() sys.exit(app.exec_())
main_window.actionQueue_Program.triggered.connect(queue_dialog) main_window.save_and_queue_program_pushButton.clicked.connect( save_and_queue_program) main_window.actionExit.triggered.connect(main_window.close) # confirm closing of application def closeEvent(event): if not sigint_called: button = QMessageBox.question( main_window, main_window.tr('Close application'), main_window.tr('Do you really want to close the application?'), QMessageBox.Cancel | QMessageBox.Close) else: button = QMessageBox.Close if button == QMessageBox.Close: event.accept() else: event.ignore() main_window.closeEvent = closeEvent #main_window.show() main_window.showMaximized() execute_default_pose() sys.exit(app.exec_())