def setup_app(): QCoreApplication.setAttribute(Qt.AA_DisableHighDpiScaling) app = QApplication(sys.argv) splash = QSplashScreen() pixmap = QPixmap(os.path.join(QGRAIN_ROOT_PATH, "assets", "icon.png")) pixmap.setDevicePixelRatio(1.0) splash.setPixmap(pixmap) splash.show() create_necessary_folders() app.setWindowIcon(QIcon(pixmap)) app.setApplicationDisplayName(f"QGrain ({QGRAIN_VERSION})") app.setApplicationVersion(QGRAIN_VERSION) app.setStyle(QStyleFactory.create("Fusion")) app.setStyleSheet("""* {font-family:Arial,Helvetica,Tahoma,Verdana; color:#000000;background-color:#c4cbcf;alternate-background-color:#b2bbbe; selection-color:#ffffff;selection-background-color:#555f69}""") plt.style.use(["science", "no-latex"]) plt.set_cmap("tab10") plt.rcParams["axes.facecolor"] = "#c4cbcf" plt.rcParams["figure.facecolor"] = "#c4cbcf" plt.rcParams["savefig.dpi"] = 300.0 plt.rcParams["savefig.facecolor"] = "white" plt.rcParams["savefig.transparent"] = True plt.rcParams["figure.max_open_warning"] = False setup_language(app) setup_logging() return app, splash
def main(): """The main routine.""" # Define the names of the organization and the application # The value is used by the QSettings class when it is constructed using # the empty constructor. This saves having to repeat this information # each time a QSettings object is created. # The default scope is QSettings::UserScope QCoreApplication.setOrganizationName("labsquare") QCoreApplication.setApplicationName("cutevariant") QCoreApplication.setApplicationVersion(__version__) # Process command line arguments app = QApplication(sys.argv) process_arguments(app) # Load app styles load_styles(app) # # Uncomment those line to clear settings # settings = QSettings() # settings.clear() # Set icons set setFontPath(cm.FONT_FILE) # Translations load_translations(app) # debug settings # from cutevariant.gui.settings import * # w = SettingsWidget() # w.show() # Splash screen splash = QSplashScreen() splash.setPixmap(QPixmap(cm.DIR_ICONS + "splash.png")) splash.showMessage(f"Version {__version__}") splash.show() app.processEvents() # Drop settings if old version settings = QSettings() settings_version = settings.value("version", None) if settings_version is None or parse_version( settings_version) < parse_version(__version__): settings.clear() settings.setValue("version", __version__) # Display w = MainWindow() # STYLES = cm.DIR_STYLES + "frameless.qss" # with open(STYLES,"r") as file: # w.setStyleSheet(file.read()) w.show() splash.finish(w) app.exec_()