app.setOrganizationDomain('http://www.cdu.edu.cn') app.setApplicationName('Krait') #support windows 7, 10 taskbar icon import ctypes if os.name == 'nt': myappid = 'CDU.Krait.ssr.1.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) import splash_rc splash_img = QPixmap(":/icons/splash.png") splash = QSplashScreen(splash_img) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen | Qt.FramelessWindowHint) splash.setStyleSheet(''' font-family:"Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; ''') splash.setEnabled(False) splash.show() def show_splash_msg(msg): splash.showMessage(msg, Qt.AlignCenter | Qt.AlignBottom, Qt.white) app.processEvents() import krait_rc show_splash_msg("Loading icon resources...") import config show_splash_msg("Loading configurations...") from libs import * show_splash_msg("Loading search engines...") import utils
#set font family QFontDatabase.addApplicationFont(":/fonts/roboto.ttf") QFontDatabase.addApplicationFont(":/fonts/robotomono.ttf") #support windows 7, 10 taskbar icon import ctypes if os.name == 'nt': myappid = 'BIG.Krait.ssr.1.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) splash_img = QPixmap(":/icons/splash.png") splash = QSplashScreen(splash_img) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen | Qt.FramelessWindowHint) splash.setStyleSheet("font-family:Roboto; font-size: 14px;") splash.setEnabled(False) splash.show() def show_splash_msg(msg): splash.showMessage(msg, Qt.AlignCenter | Qt.AlignBottom, Qt.white) app.processEvents() #show_splash_msg("Loading icon resources...") import config show_splash_msg("Loading configurations...") from libs import * show_splash_msg("Loading search engines...") import utils show_splash_msg("Loading utils library...") import detail
def main(): if parser.lang: sys_locale = parser.lang[0] else: sys_locale = QtCore.QLocale.system().name() translator = QtCore.QTranslator() #load intern dialogs translations qtTranslator = QtCore.QTranslator() qtTranslator.load("qt_" + sys_locale, QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)) #load translations files translations_path = os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage") trasnlations = os.path.exists(translations_path) if trasnlations and (os.getenv("PINGUINO_MODE") == "NORMAL"): translations_file = "pinguino_" + sys_locale if translations_file + ".qm" in os.listdir(translations_path): translator.load(os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage", "pinguino_{}.qm".format(sys_locale))) elif "_" in sys_locale: sys_locale = sys_locale[:sys_locale.find("_")] translations_file = "pinguino_" + sys_locale if translations_file + ".qm" in os.listdir(translations_path): translator.load(os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage", "pinguino_{}.qm".format(sys_locale))) app = QApplication(sys.argv) #Splash (pinguino\qtgui\resources\art) #pixmap = QPixmap(":/logo/art/splash.png") pixmap = QPixmap("pinguino/qtgui/resources/art/splash.png") #pixmap = QPixmap("pinguino/qtgui/resources/art/pinguino_logo_background_blue-256x256.png") #pixmap = QPixmap(760, 256) #pixmap.fill(QtGui.QColor("#4d4d4d")) # keep the splash screen above all the other windows on the desktop splash = QSplashScreen(pixmap, QtCore.Qt.WindowStaysOnTopHint) splash.show() splash.setStyleSheet(""" font-family: inherit; font-weight: normal; font-size: 11pt; """) # update the splash screen with messages def splash_write(msg): if not splash is None: splash.showMessage("\t" + msg, color=QtGui.QColor("#4d4d4d"), alignment=QtCore.Qt.AlignBottom) splash_write(NAME + " " + MAJOR) app.processEvents() app.installTranslator(qtTranslator) if trasnlations: app.installTranslator(translator) frame = PinguinoIDE(splash_write=splash_write) frame.show() if not splash is None: splash.finish(frame) app.exec_()