Exemplo n.º 1
0
 def loadSettings(self):
     settings = QSafeSettings("falkTX", "CarlaKeyboard")
     self.setPcKeyboardLayout(
         settings.value("PcKeyboardLayout", self.fkPcKeyLayout, str))
     self.setPcKeyboardOffset(
         settings.value("PcKeyboardOffset", self.fPcKeybOffset, int))
     self.setColor(
         settings.value("HighlightColor", self.fHighlightColor, str))
     del settings
Exemplo n.º 2
0
    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()
Exemplo n.º 3
0
    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()