def splash(self): pixmap = QPixmap(".\\gui\\pyspec_less_ugly_shorter.png") smallerPixmap = pixmap.scaled(256, 256, Qt.KeepAspectRatio, Qt.SmoothTransformation) splash = QSplashScreen(smallerPixmap, Qt.WindowStaysOnTopHint) splash.setMask(smallerPixmap.mask()) splash.setWindowFlag(Qt.WindowStaysOnTopHint) splash.show() self.processEvents() self.init_logging() self.processEvents() log.info("Initialization of views, models, controllers...") time.sleep(2) self.processEvents() self.mainModel = MainModel() self.mainCtrl = MainController() self.mainWindow = MainWindow(self.mainModel, self.mainCtrl) self.mainWindow.setWindowTitle("PySpec Software") self.mainWindow.setAttribute(Qt.WA_AlwaysStackOnTop) self.processEvents() log.info("Initialization completed.") self.processEvents() self.mainWindow.show() log.info("This is the MAIN THREAD")
def save(self): """ Saves data to the current JSON-file. If none is selected, a file dialog is opened. """ if self.json_file: save_json_data(self.data, self.json_file) self.log("Saved file.") else: self.save_as() if __name__ == "__main__": app = QApplication(sys.argv) app.setWindowIcon(QIcon("gui/icons/thermopack_icon.ico")) # Load stylesheet stylesheet = open("gui/stylesheet.qss", "r") app.setStyleSheet(stylesheet.read()) stylesheet.close() # Image shown when application is loading splash = QSplashScreen(QPixmap("gui/images/Thermopack logo.png")) splash.setWindowFlag(Qt.WindowStaysOnTopHint) splash.show() QTimer.singleShot(500, splash.close) win = ThermopackGUIApp() win.show() sys.exit(app.exec_())