def main(): app = QApplication(sys.argv) app.setStyle(QtWidgets.QStyleFactory.create("Fusion")) p = app.palette() p.setColor(QPalette.Base, QColor(40, 40, 40)) p.setColor(QPalette.Window, QColor(55, 55, 55)) p.setColor(QPalette.Button, QColor(49, 49, 49)) p.setColor(QPalette.Highlight, QColor(135, 135, 135)) p.setColor(QPalette.ButtonText, QColor(155, 155, 155)) p.setColor(QPalette.WindowText, QColor(155, 155, 155)) p.setColor(QPalette.Text, QColor(155, 155, 155)) p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42)) p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90)) app.setPalette(p) QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns") main = Window() main.setWindowTitle('Detection') main.setWindowIcon(QtGui.QIcon('assets/icon.png')) main.show() try: sys.exit(app.exec_()) except KeyboardInterrupt: pass
def main(): app = QApplication(sys.argv) app.setStyle(QtWidgets.QStyleFactory.create("Fusion")) p = app.palette() p.setColor(QPalette.Base, QColor(40, 40, 40)) p.setColor(QPalette.Window, QColor(55, 55, 55)) p.setColor(QPalette.Button, QColor(49, 49, 49)) p.setColor(QPalette.Highlight, QColor(135, 135, 135)) p.setColor(QPalette.ButtonText, QColor(155, 155, 155)) p.setColor(QPalette.WindowText, QColor(155, 155, 155)) p.setColor(QPalette.Text, QColor(155, 155, 155)) p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42)) p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90)) app.setPalette(p) QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns") main = Window() main.setWindowTitle('Detection') main.setWindowIcon(QtGui.QIcon('assets/icon.png')) main.show() try: sys.exit(app.exec_()) except KeyboardInterrupt: pass
def showError(message): from PyQt5.QtWidgets import QApplication, QErrorMessage, QCheckBox, \ QPushButton, QLabel, QStyle from PyQt5.QtCore import Qt QApplication.addLibraryPath('./Qt/plugins') app = QApplication(sys.argv) app.setQuitOnLastWindowClosed(True) # 设置内置错误图标 app.setWindowIcon(app.style().standardIcon(QStyle.SP_MessageBoxCritical)) w = QErrorMessage() w.finished.connect(lambda _: app.quit) w.resize(600, 400) # 去掉右上角? w.setWindowFlags(w.windowFlags() & ~Qt.WindowContextHelpButtonHint) w.setWindowTitle(w.tr('Error')) # 隐藏图标、勾选框、按钮 w.findChild(QLabel, '').setVisible(False) w.findChild(QCheckBox, '').setVisible(False) w.findChild(QPushButton, '').setVisible(False) w.showMessage(escape(message)) sys.exit(app.exec_())
from padmr.instr.lia.controls import LockinSettings from padmr.instr.zurich_lia.controls import ZiLockinSettings from padmr.instr.laser.controls import TopticaSettings, TopticaInstr from padmr.instr.mono.controls import MonoSettings from padmr.instr.cg635.controls import CG635Settings from padmr.instr.cryostat.controls import CryostatSettings from padmr.instr.smb100a.controls import SMB100ASettings #TODO: # 1. Split "initialize_settings_window" to create also an "update_settings_window" # 2. Remove all the unnecessary "bools" from the signals (c.f. connect_instr_signal, which works fine) # 3. Get rid of the silly "set_tab" and "set_all_tabs". Only with the lock-in would you want to change a lot at once pyqt = os.path.dirname( PyQt5.__file__ ) # This and the following line are essential to make guis run QApplication.addLibraryPath(os.path.join(pyqt, "plugins")) class Presets: # Presumably I should incorporate these into the Settings file. It seems silly to have both def __init__(self): self.probe_wl_start = 400 self.probe_wl_end = 700 self.probe_wl_num_steps = 31 # self.probe_wl_step_size = 5 self.pump_mod_freq_start = 25 # kHz self.pump_mod_freq_end = 200000 self.pump_mod_freq_steps = 3 # later set this to 20 or something self.field_start = 2000 self.field_end = 4500 self.field_num_steps = 151
if __name__ == '__main__': parser = argparse.ArgumentParser(\ description='Test script for tiled graphicview widget') parser.add_argument('--file', '-f', help='hdf file to load', default=None) args = parser.parse_args() if args.file is not None and not os.path.isfile(args.file): raise SystemExit("File does not exist!") app = QApplication(sys.argv) # windows always sucks!! if sys.platform.startswith("win"): sqldrivers = join(dirname(QtGui.__file__), "plugins") app.addLibraryPath(sqldrivers) splash_pix = QPixmap(':annotationtool_about.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() splash.showMessage(version.information, alignment=Qt.AnchorHorizontalCenter| Qt.AnchorVerticalCenter) app.processEvents() mw = AtMainWindow(args.file) mw.show() app.thread().msleep(1000) splash.finish(mw)
def main(): # make the Python warnings go to Friture logger logging.captureWarnings(True) logFormat = "%(asctime)s %(levelname)s %(name)s: %(message)s" formatter = logging.Formatter(logFormat) logFileName = "friture.log.txt" dirs = appdirs.AppDirs("Friture", "") logDir = dirs.user_data_dir try: os.makedirs(logDir) except OSError as e: if e.errno != errno.EEXIST: raise logFilePath = os.path.join(logDir, logFileName) # log to file fileHandler = logging.handlers.RotatingFileHandler(logFilePath, maxBytes=100000, backupCount=5) fileHandler.setLevel(logging.DEBUG) fileHandler.setFormatter(formatter) rootLogger = logging.getLogger() rootLogger.setLevel(logging.DEBUG) rootLogger.addHandler(fileHandler) if hasattr(sys, "frozen"): # redirect stdout and stderr to the logger if this is a pyinstaller bundle sys.stdout = StreamToLogger(logging.getLogger('STDOUT'), logging.INFO) sys.stderr = StreamToLogger(logging.getLogger('STDERR'), logging.ERROR) else: # log to console if this is not a pyinstaller bundle console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) rootLogger.addHandler(console) # make Qt logs go to Friture logger QtCore.qInstallMessageHandler(qt_message_handler) logger = logging.getLogger(__name__) logger.info("Friture %s starting on %s (%s)", friture.__version__, platform.system(), sys.platform) # make sure Qt loads the desktop OpenGL stack, rather than OpenGL ES or a software OpenGL # only the former option is compatible with the use of PyOpenGL QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseDesktopOpenGL) if platform.system() == "Windows": logger.info("Applying Windows-specific setup") # enable automatic scaling for high-DPI screens os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" # set the App ID for Windows 7 to properly display the icon in the # taskbar. import ctypes myappid = 'Friture.Friture.Friture.current' # arbitrary string try: ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( myappid) except: logger.error( "Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal." ) app = QApplication(sys.argv) if platform.system() == "Darwin": logger.info("Applying Mac OS-specific setup") # help the packaged application find the Qt plugins (imageformats and platforms) pluginsPath = os.path.normpath( os.path.join(QApplication.applicationDirPath(), os.path.pardir, 'PlugIns')) logger.info("Adding the following to the Library paths: %s", pluginsPath) QApplication.addLibraryPath(pluginsPath) # on macOS, OpenGL 2.1 does not work well # request a 3.2 Core context instead format = QSurfaceFormat() format.setDepthBufferSize(24) format.setStencilBufferSize(8) format.setVersion(3, 2) format.setProfile(QSurfaceFormat.CoreProfile) QSurfaceFormat.setDefaultFormat(format) # Splash screen #pixmap = QPixmap(":/images/splash.png") #splash = QSplashScreen(pixmap) #splash.show() #splash.showMessage("Initializing the audio subsystem") app.processEvents() window = Friture() window.show() #splash.finish(window) profile = "no" # "python" or "kcachegrind" or anything else to disable if len(sys.argv) > 1: if sys.argv[1] == "--python": profile = "python" elif sys.argv[1] == "--kcachegrind": profile = "kcachegrind" elif sys.argv[1] == "--no": profile = "no" else: logger.info("command-line arguments (%s) not recognized", sys.argv[1:]) return_code = 0 if profile == "python": import cProfile import pstats # friture.cprof can be visualized with SnakeViz # http://jiffyclub.github.io/snakeviz/ # snakeviz friture.cprof cProfile.runctx('app.exec_()', globals(), locals(), filename="friture.cprof") logger.info("Profile saved to '%s'", "friture.cprof") stats = pstats.Stats("friture.cprof") stats.strip_dirs().sort_stats('time').print_stats(20) stats.strip_dirs().sort_stats('cumulative').print_stats(20) elif profile == "kcachegrind": import cProfile import lsprofcalltree p = cProfile.Profile() p.run('app.exec_()') k = lsprofcalltree.KCacheGrind(p) with open('cachegrind.out.00000', 'wb') as data: k.output(data) else: return_code = app.exec_() # explicitly delete the main windows instead of waiting for the interpreter shutdown # tentative to prevent errors on exit on macos del window sys.exit(return_code)
def main(): print("Platform is %s (%s)" %(platform.system(), sys.platform)) if platform.system() == "Windows": print("Applying Windows-specific setup") # On Windows, redirect stderr to a file import imp import ctypes if (hasattr(sys, "frozen") or # new py2exe hasattr(sys, "importers") or # old py2exe imp.is_frozen("__main__")): # tools/freeze sys.stderr = open(os.path.expanduser("~/friture.exe.log"), "w") # set the App ID for Windows 7 to properly display the icon in the # taskbar. myappid = 'Friture.Friture.Friture.current' # arbitrary string try: ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) except: print("Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal.") app = QApplication(sys.argv) if platform.system() == "Darwin": if hasattr(sys, "frozen"): #py2app sys.stdout = open(os.path.expanduser("~/friture.out.txt"), "w") sys.stderr = open(os.path.expanduser("~/friture.err.txt"), "w") print("Applying Mac OS-specific setup") # help the py2app-packaged application find the Qt plugins (imageformats and platforms) pluginsPath = os.path.normpath(os.path.join(QApplication.applicationDirPath(), os.path.pardir, 'PlugIns')) print("Adding the following to the Library paths: " + pluginsPath) QApplication.addLibraryPath(pluginsPath) # Splash screen pixmap = QPixmap(":/images/splash.png") splash = QSplashScreen(pixmap) splash.show() splash.showMessage("Initializing the audio subsystem") app.processEvents() # Logger class logger = Logger() window = Friture(logger) window.show() splash.finish(window) profile = "no" # "python" or "kcachegrind" or anything else to disable if len(sys.argv) > 1: if sys.argv[1] == "--python": profile = "python" elif sys.argv[1] == "--kcachegrind": profile = "kcachegrind" elif sys.argv[1] == "--no": profile = "no" else: print("command-line arguments (%s) not recognized" % sys.argv[1:]) if profile == "python": import cProfile import pstats cProfile.runctx('app.exec_()', globals(), locals(), filename="friture.cprof") stats = pstats.Stats("friture.cprof") stats.strip_dirs().sort_stats('time').print_stats(20) stats.strip_dirs().sort_stats('cumulative').print_stats(20) sys.exit(0) elif profile == "kcachegrind": import cProfile import lsprofcalltree p = cProfile.Profile() p.run('app.exec_()') k = lsprofcalltree.KCacheGrind(p) with open('cachegrind.out.00000', 'wb') as data: k.output(data) sys.exit(0) else: sys.exit(app.exec_())
from platform import system # needs to be done before any other PyQt import import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) # on Qt5, the platform plugin cocoa is not found in the plugin directory (dispite the qt.conf file) if we do not # extend the libraryPath accordingly if system() == 'Darwin': try: if str(sys.frozen) == "macosx_app": from PyQt5.QtWidgets import QApplication QApplication.addLibraryPath( str(os.path.dirname(os.path.abspath(__file__))) + "/qt_plugins/") except: try: if str(sys.frozen) == "macosx_app": from PyQt4.QtGui import QApplication QApplication.addLibraryPath( str(os.path.dirname(os.path.abspath(__file__))) + "/qt_plugins/") except: pass elif system().startswith("Windows"): try: ib = ( hasattr(sys, "frozen") or # new py2exe hasattr(sys, "importers") # old py2exe
cmd += ' -threshold=' + str(self.ui.threshold.value()) cmd += ' -memLimit=' + str(self.ui.memLimit.value()) cmd += ' -abortOnOpenCLError=' + str( int(self.ui.abortOnOpenCLError.isChecked())) cmd += ' -inputFile=' cmd += '"' + self.ui.table.item(row, 4).text() + '"' self.ui.command.setText('"' + self.denoiserPath + '"' + cmd) return cmd def runLocally(self): self.ui.progressBar.setValue(0) table = self.ui.table count = table.rowCount() cmd = '' if count: for row in range(count): if table.cellWidget(row, 0).layout().itemAt(0).widget().isChecked(): self.buildCommand(row) cmd += self.ui.command.text() + r' & ' service = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE) if __name__ == '__main__': from PyQt5.QtWidgets import QApplication QApplication.addLibraryPath(os.path.dirname(__file__)) app = QApplication(sys.argv) window = mainWindow() sys.exit(app.exec_())
def __init__(self, appName = "Carla2", libPrefix = None): object.__init__(self) # try to find styles dir stylesDir = "" CWDl = CWD.lower() # standalone, installed system-wide linux if libPrefix is not None: stylesDir = os.path.join(libPrefix, "lib", "carla") # standalone, local source elif CWDl.endswith("source"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "bin")) if WINDOWS: # Fixes local wine build QApplication.addLibraryPath("C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # plugin elif CWDl.endswith("resources"): # installed system-wide linux if CWDl.endswith("/share/carla/resources"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "..", "..", "lib", "carla")) # local source elif CWDl.endswith("native-plugins%sresources" % os.sep): stylesDir = os.path.abspath(os.path.join(CWD, "..", "..", "..", "..", "bin")) # other else: stylesDir = os.path.abspath(os.path.join(CWD, "..")) # everything else else: stylesDir = CWD if os.path.exists(stylesDir): QApplication.addLibraryPath(stylesDir) if WINDOWS: stylesDir = "" elif config_UseQt5: stylesDir = "" else: self._createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self._createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self._createApp(appName) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue) print("Using \"%s\" theme" % self.fApp.style().objectName())
def main(): app = QApplication(sys.argv) QApplication.addLibraryPath("plugins") ui = MainUi() ui.show() sys.exit(app.exec_())
def __init__(self, appName="Carla2", libPrefix=None): object.__init__(self) # try to find styles dir stylesDir = "" CWDl = CWD.lower() # standalone, installed system-wide linux if libPrefix is not None: stylesDir = os.path.join(libPrefix, "lib", "carla") # standalone, local source elif CWDl.endswith("source"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "bin")) if WINDOWS: # Fixes local wine build QApplication.addLibraryPath( "C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # plugin elif CWDl.endswith("resources"): # installed system-wide linux if CWDl.endswith("/share/carla/resources"): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "lib", "carla")) # local source elif CWDl.endswith("native-plugins%sresources" % os.sep): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "..", "bin")) # other else: stylesDir = os.path.abspath(os.path.join(CWD, "..")) # everything else else: stylesDir = CWD if os.path.exists(stylesDir): QApplication.addLibraryPath(stylesDir) if WINDOWS: stylesDir = "" elif config_UseQt5: stylesDir = "" else: self._createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self._createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self._createApp(appName) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue) print("Using \"%s\" theme" % self.fApp.style().objectName())
from bokeh.core.property_mixins import LineProps from bokeh.models.annotations import LabelSet, Label from bokeh.models.arrow_heads import TeeHead from bokeh.models.tools import WheelZoomTool, PanTool mpl.use('WXAgg') mpl.interactive(False) import pylab as pl from pylab import get_current_fig_manager as gcfm import numpy as np import random import wx if os.name == "nt": # if windows pyqt_plugins = os.path.join(os.path.dirname(PyQt5.__file__), "..", "..", "..", "Library", "plugins") QApplication.addLibraryPath(pyqt_plugins) class Visualizer(object): ''' used to visualize data ''' def __init__(self): ''' Constructor ''' def draw_all_pattern_graphs(self, pattern_df, target_col, if_not_empty=False,
def set_value3(self, l): tem = l[0] length = l[1] self.label_6.setText(f"Files: {tem} / {length}") def set_value4(self, l): if l == -1: self.label_5.setText(f"<font color=#FF0000>Manifest file error. </font>") self.thread.terminate() def closeEvent(self, event): reply = QMessageBox.question(self, 'Message', "Are you sure to close?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: event.accept() else: event.ignore() if __name__ == '__main__': QApplication.addLibraryPath("./plugins") app = QApplication(sys.argv) window = MyWindow() window.setWindowTitle("TCGAD") window.setWindowIcon(QIcon('./down.PNG')) window.show() sys.exit(app.exec_())
import sys from UI import main_window from PyQt5.QtWidgets import QApplication, QMainWindow if __name__ =='__main__': QApplication.addLibraryPath('./') app = QApplication(sys.argv) MainWindow = QMainWindow() ui = main_window.Ui_Mainwindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
import sys import traceback __Author__ = """By: Irony QQ: 892768447 Email: [email protected]""" __Copyright__ = 'Copyright (c) 2019 Irony' __Version__ = 1.0 sys.path.append(os.path.abspath('Library.zip')) from PyQt5.QtWidgets import QApplication libpath = os.path.abspath('Lib/site-packages/PyQt5/Qt/plugins') if os.path.exists(libpath): QApplication.addLibraryPath(libpath) def escape(s): s = s.replace("&", "&") s = s.replace("<", "<") s = s.replace(">", ">") s = s.replace('"', """) s = s.replace('\'', "'") s = s.replace('\n', '<br/>') s = s.replace(' ', ' ') return s def showError(message): from PyQt5.QtWidgets import QErrorMessage, QCheckBox, \
def __init__(self, appName="Carla2", libPrefix=None): object.__init__(self) pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith( ("frontend", "resources")) and os.getenv("CXFREEZE") is None: if kIs64bit: path = "H:\\builds\\msys2-x86_64\\mingw64\\share\\qt5\\plugins" else: path = "H:\\builds\\msys2-i686\\mingw32\\share\\qt5\\plugins" QApplication.addLibraryPath(path) # Use binary dir as library path if os.path.exists(pathBinaries): QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it else: stylesDir = "" # base settings settings = QSafeSettings("falkTX", appName) useProTheme = MACOS or settings.value( CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") if WINDOWS: carlastyle = os.path.join(pathBinaries, "styles", "carlastyle.dll") self._stylelib = CDLL(carlastyle, RTLD_GLOBAL) self._stylelib.set_qt_app_style.argtypes = None self._stylelib.set_qt_app_style.restype = None self._stylelib.set_qt_app_style() # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str).lower() if MACOS or proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue)
mark_conditions from longcalc import LongCalculation, pickle_mesh, pickle_solutions from tools import tooltips, openDialog, addContextMenu from solutiontab import SolutionTab from dolfin import set_log_active, parameters parameters['allow_extrapolation'] = True # solver will have an option to switch to EIGEN # if USE_EIGEN: # parameters['linear_algebra_backend'] = 'Eigen' # set_log_level(50) set_log_active(False) # fix for missing qt plugins in app if not QApplication.libraryPaths(): QApplication.addLibraryPath(str(os.environ['RESOURCEPATH'] + '/qt_plugins')) class MainWindow(QMainWindow, Ui_MainWindow): """ Main application window. """ def __init__(self): """ Initialize main window. """ QMainWindow.__init__(self) self.mesh = None self.dim = 2 self.solver = None # Set up the user interface from Designer. self.setupUi(self) self.resize( QSize(settings.get('citewidth'), settings.get('citeheight')))
def __init__(self, appName="Carla2", libPrefix=None): pathBinaries, _ = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith( ("frontend", "resources")) and os.getenv("CXFREEZE") is None: if kIs64bit: path = "H:\\builds\\msys2-x86_64\\mingw64\\share\\qt5\\plugins" else: path = "H:\\builds\\msys2-i686\\mingw32\\share\\qt5\\plugins" QApplication.addLibraryPath(path) # Use binary dir as library path if os.path.exists(pathBinaries): QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it else: stylesDir = "" # base settings settings = QSafeSettings("falkTX", appName) useProTheme = MACOS or settings.value( CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") if WINDOWS: carlastyle = os.path.join(pathBinaries, "styles", "carlastyle.dll") self._stylelib = CDLL(carlastyle, RTLD_GLOBAL) self._stylelib.set_qt_app_style.argtypes = None self._stylelib.set_qt_app_style.restype = None self._stylelib.set_qt_app_style() # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str).lower() if MACOS or proThemeColor == "black": self.createPaletteBlack() elif proThemeColor == "blue": self.createPaletteBlue()
def __init__(self, appName="Carla2", libPrefix=None): pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith( ("frontend", "resources")) and os.getenv("CXFREEZE") is None: if kIs64bit: path = "H:\\PawPawBuilds\\targets\\win64\\lib\\qt5\\plugins" else: path = "H:\\PawPawBuilds\\targets\\win32\\lib\\qt5\\plugins" QApplication.addLibraryPath(path) # Use binary dir as library path if os.path.exists(pathBinaries): QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it else: stylesDir = "" # Set up translations currentLocale = QLocale() appTranslator = QTranslator() sysTranslator = None pathTranslations = os.path.join(pathResources, "translations") if appTranslator.load(currentLocale, "carla", "_", pathTranslations): sysTranslator = QTranslator() pathSysTranslations = pathTranslations if not sysTranslator.load(currentLocale, "qt", "_", pathSysTranslations): pathSysTranslations = QLibraryInfo.location( QLibraryInfo.TranslationsPath) sysTranslator.load(currentLocale, "qt", "_", pathSysTranslations) else: appTranslator = None self.fAppTranslator = appTranslator self.fSysTranslator = sysTranslator # base settings settings = QSafeSettings("falkTX", appName) useProTheme = MACOS or settings.value( CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") if WINDOWS: carlastyle1 = os.path.join(pathBinaries, "styles", "carlastyle.dll") carlastyle2 = os.path.join(pathResources, "styles", "carlastyle.dll") carlastyle = carlastyle2 if os.path.exists( carlastyle2) else carlastyle1 self._stylelib = CDLL(carlastyle, RTLD_GLOBAL) self._stylelib.set_qt_app_style.argtypes = None self._stylelib.set_qt_app_style.restype = None self._stylelib.set_qt_app_style() # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str).lower() if MACOS or proThemeColor == "black": self.createPaletteBlack() elif proThemeColor == "blue": self.createPaletteBlue()
''' 整个应用的主流程,启动文件,主要是最开始实例化数据处理类,然后登陆,成功了就进入主界面,addClass函数是用来连接信号和信号槽的 ''' from PyQt5.QtWidgets import QApplication, QDialog import sys from data import Data from Gui.loginGui import LoginGui from Gui.mainGui import MainGui QApplication.addLibraryPath(r"env\Lib\site-packages\PyQt5\Qt\plugins") app = QApplication(sys.argv) data = Data() loginGui = LoginGui() data.addClass(loginGui) loginGui.show() if loginGui.exec() == QDialog.Accepted: mainGui = MainGui() data.addClass(mainGui) mainGui.show() app.exec()
# Copyright (c) 2018 Riverbank Computing Limited <*****@*****.**> # # This file is part of PyQt5. # # This file may be used under the terms of the GNU General Public License # version 3.0 as published by the Free Software Foundation and appearing in # the file LICENSE included in the packaging of this file. Please review the # following information to ensure the GNU General Public License version 3.0 # requirements will be met: http://www.gnu.org/copyleft/gpl.html. # # If you do not wish to use this file under the terms of the GPL version 3.0 # then you may purchase a commercial license. For more information contact # [email protected]. # # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. import os dir = os.path.join(os.path.dirname(__file__), 'bin;') os.environ['path'] = dir + os.environ['path'] from PyQt5.QtWidgets import QApplication QApplication.addLibraryPath(os.path.join(os.path.dirname(__file__), "plugins"))
def main(): print("Platform is %s (%s)" % (platform.system(), sys.platform)) if platform.system() == "Windows": print("Applying Windows-specific setup") # On Windows, redirect stderr to a file import imp import ctypes if (hasattr(sys, "frozen") or # new py2exe hasattr(sys, "importers") or # old py2exe imp.is_frozen("__main__")): # tools/freeze sys.stderr = open(os.path.expanduser("~/friture.exe.log"), "w") # set the App ID for Windows 7 to properly display the icon in the # taskbar. myappid = 'Friture.Friture.Friture.current' # arbitrary string try: ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( myappid) except: print( "Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal." ) app = QApplication(sys.argv) if platform.system() == "Darwin": if hasattr(sys, "frozen"): #py2app sys.stdout = open(os.path.expanduser("~/friture.out.txt"), "w") sys.stderr = open(os.path.expanduser("~/friture.err.txt"), "w") print("Applying Mac OS-specific setup") # help the py2app-packaged application find the Qt plugins (imageformats and platforms) pluginsPath = os.path.normpath( os.path.join(QApplication.applicationDirPath(), os.path.pardir, 'PlugIns')) print("Adding the following to the Library paths: " + pluginsPath) QApplication.addLibraryPath(pluginsPath) # Splash screen pixmap = QPixmap(":/images/splash.png") splash = QSplashScreen(pixmap) splash.show() splash.showMessage("Initializing the audio subsystem") app.processEvents() # Logger class logger = Logger() window = Friture(logger) window.show() splash.finish(window) profile = "no" # "python" or "kcachegrind" or anything else to disable if len(sys.argv) > 1: if sys.argv[1] == "--python": profile = "python" elif sys.argv[1] == "--kcachegrind": profile = "kcachegrind" elif sys.argv[1] == "--no": profile = "no" else: print("command-line arguments (%s) not recognized" % sys.argv[1:]) if profile == "python": import cProfile import pstats cProfile.runctx('app.exec_()', globals(), locals(), filename="friture.cprof") stats = pstats.Stats("friture.cprof") stats.strip_dirs().sort_stats('time').print_stats(20) stats.strip_dirs().sort_stats('cumulative').print_stats(20) sys.exit(0) elif profile == "kcachegrind": import cProfile import lsprofcalltree p = cProfile.Profile() p.run('app.exec_()') k = lsprofcalltree.KCacheGrind(p) with open('cachegrind.out.00000', 'wb') as data: k.output(data) sys.exit(0) else: sys.exit(app.exec_())
mark_conditions from longcalc import LongCalculation, pickle_mesh, pickle_solutions from tools import tooltips, openDialog, addContextMenu from solutiontab import SolutionTab from dolfin import set_log_active, parameters parameters['allow_extrapolation'] = True # solver will have an option to switch to EIGEN # if USE_EIGEN: # parameters['linear_algebra_backend'] = 'Eigen' # set_log_level(50) set_log_active(False) # fix for missing qt plugins in app if not QApplication.libraryPaths(): QApplication.addLibraryPath(str(os.environ['RESOURCEPATH'] + '/qt_plugins')) class MainWindow(QMainWindow, Ui_MainWindow): """ Main application window. """ def __init__(self): """ Initialize main window. """ QMainWindow.__init__(self) self.mesh = None self.dim = 2 self.solver = None # Set up the user interface from Designer. self.setupUi(self)
import sys import imp import os from platform import system from artisanlib import main # needs to be done before any other PyQt import import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) # on Qt5, the platform plugin cocoa/windows is not found in the plugin directory (dispite the qt.conf file) if we do not # extend the libraryPath accordingly if system() == 'Darwin': from PyQt5.QtWidgets import QApplication QApplication.addLibraryPath(str(os.path.dirname(os.path.abspath( __file__ ))) + "/qt_plugins/") elif system().startswith("Windows"): ib = (hasattr(sys, "frozen") or # new py2exe hasattr(sys, "importers") # old py2exe or imp.is_frozen("__main__")) # tools/freeze from PyQt5.QtWidgets import QApplication if ib: QApplication.addLibraryPath(str(os.path.dirname(os.path.abspath( __file__ ))) + "\\qt_plugins\\") else: QApplication.addLibraryPath("c:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") import numpy from multiprocessing import freeze_support
def __init__(self, appName = "Carla2", libPrefix = None): object.__init__(self) pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith(("frontend", "resources")) and os.getenv("CXFREEZE") is None: QApplication.addLibraryPath("C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # Use binary dir as library path (except in Windows) if os.path.exists(pathBinaries) and not WINDOWS: QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it in Qt5 elif config_UseQt5: stylesDir = "" else: self.createApp(appName) return forceTheme = MACOS or (WINDOWS and not config_UseQt5) # base settings settings = QSettings("falkTX", appName) useProTheme = forceTheme or settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if forceTheme or proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue)
def mainUI(): app = QApplication(sys.argv) app.addLibraryPath('./plugins') client = Client() client.show() sys.exit(client.exec_())
import PyQt5 from PyQt5.QtWidgets import QApplication ############ # SHITCODE # ######################################################################################################################## _platform = platform.system().lower() ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir) LIB_DIR = os.path.join(ROOT_DIR, 'externals', 'build', "%s%s" % (_platform if _platform != 'darwin' else 'osx', platform.architecture()[0][0:2]), 'release', 'lib') if _platform == 'windows': QApplication.addLibraryPath(os.path.join(os.path.dirname(PyQt5.__file__), "plugins")) ctypes.windll.LoadLibrary( os.path.join(ROOT_DIR, 'externals', 'build', 'windows64', 'Release', 'lib', 'nanomsg.dll')) # ctypes.windll.LoadLibrary('nanomsg.dll') sys.path.insert(0, 'C:\Python34\lib\site-packages') else: _original_load = ctypes.cdll.LoadLibrary ctypes.cdll.LoadLibrary = lambda x: _original_load(os.path.join(LIB_DIR, x)) sys.path.insert(0, os.path.join(ROOT_DIR, "playground", "src")) instance_counter = 0 if __name__ == '__main__': global instance_counter
import os from platform import system # needs to be done before any other PyQt import import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) # on Qt5, the platform plugin cocoa is not found in the plugin directory (dispite the qt.conf file) if we do not # extend the libraryPath accordingly if system() == 'Darwin': try: if str(sys.frozen) == "macosx_app": from PyQt5.QtWidgets import QApplication QApplication.addLibraryPath(str(os.path.dirname(os.path.abspath( __file__ ))) + "/qt_plugins/") except: try: if str(sys.frozen) == "macosx_app": from PyQt4.QtGui import QApplication QApplication.addLibraryPath(str(os.path.dirname(os.path.abspath( __file__ ))) + "/qt_plugins/") except: pass elif system().startswith("Windows"): try: ib = (hasattr(sys, "frozen") or # new py2exe hasattr(sys, "importers") # old py2exe or imp.is_frozen("__main__")) # tools/freeze from PyQt5.QtWidgets import QApplication if ib: QApplication.addLibraryPath(os.path.join(os.path.dirname(os.path.realpath(sys.executable)), "plugins"))
if __name__ == '__main__': parser = argparse.ArgumentParser(\ description='Test script for tiled graphicview widget') parser.add_argument('--file', '-f', help='hdf file to load', default=None) args = parser.parse_args() if args.file is not None and not os.path.isfile(args.file): raise SystemExit("File does not exist!") app = QApplication(sys.argv) # windows always sucks!! if sys.platform.startswith("win"): sqldrivers = join(dirname(QtGui.__file__), "plugins") app.addLibraryPath(sqldrivers) splash_pix = QPixmap(':annotationtool_about.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() splash.showMessage(version.information, alignment=Qt.AnchorHorizontalCenter | Qt.AnchorVerticalCenter) app.processEvents() mw = AtMainWindow(args.file) mw.show() app.thread().msleep(1000) splash.finish(mw) sys.exit(app.exec_())
def __init__(self, appName = "Carla2", libPrefix = None): object.__init__(self) pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS LV2 plugin if MACOS and os.path.exists(CWD): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and (CWD.endswith("source") or os.getenv("CXFREEZE") is not None): QApplication.addLibraryPath("C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # Use binary dir as library path (except in Windows) if os.path.exists(pathBinaries) and not WINDOWS: QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it in Qt5 elif config_UseQt5: stylesDir = "" else: self.createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue)
def __init__(self, appName = "Carla2", libPrefix = None): object.__init__(self) # try to find styles dir stylesDir = "" CWDl = CWD.lower() if libPrefix is not None: stylesDir = os.path.join(libPrefix, "lib", "carla") elif CWDl.endswith("resources"): if CWDl.endswith("native-plugins%sresources" % os.sep): stylesDir = os.path.abspath(os.path.join(CWD, "..", "..", "..", "..", "bin")) elif "carla-native.lv2" in sys.argv[0]: stylesDir = os.path.abspath(os.path.join(CWD, "..", "..", "..", "lib", "lv2", "carla-native.lv2")) else: stylesDir = os.path.abspath(os.path.join(CWD, "..", "..", "..", "lib", "carla")) elif CWDl.endswith("source"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "bin")) if stylesDir: QApplication.addLibraryPath(stylesDir) elif not config_UseQt5: self._createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, True, type=bool) if not useProTheme: self._createApp(appName) return if config_UseQt5: # set initial Qt stuff customFont = QFont("DejaVu Sans [Book]") customFont.setBold(False) customFont.setItalic(False) customFont.setOverline(False) customFont.setKerning(True) customFont.setHintingPreference(QFont.PreferFullHinting) customFont.setPixelSize(12) customFont.setWeight(QFont.Normal) QApplication.setDesktopSettingsAware(False) QApplication.setFont(customFont) # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self._createApp(appName) if config_UseQt5: self.fApp.setFont(customFont) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, "Black", type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue) print("Using \"%s\" theme" % self.fApp.style().objectName())