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 saveSettings(self):
        if self.fInitalizing:
            return

        settings = QSafeSettings("falkTX", "CarlaKeyboard")
        settings.setValue("PcKeyboardLayout", self.fkPcKeyLayout)
        settings.setValue("PcKeyboardOffset", self.fPcKeybOffset)
        settings.setValue("HighlightColor", self.fHighlightColor)
        del settings
Exemplo n.º 3
0
def init(appName, scene, callback, debug=False):
    if debug:
        print("PatchCanvas::init(\"%s\", %s, %s, %s)" %
              (appName, scene, callback, bool2str(debug)))

    if canvas.initiated:
        qCritical("PatchCanvas::init() - already initiated")
        return

    if not callback:
        qFatal("PatchCanvas::init() - fatal error: callback not set")
        return

    canvas.callback = callback
    canvas.debug = debug
    canvas.scene = scene

    canvas.last_z_value = 0
    canvas.last_connection_id = 0
    canvas.initial_pos = QPointF(0, 0)
    canvas.size_rect = QRectF()

    if not canvas.qobject:
        canvas.qobject = CanvasObject()
    if not canvas.settings:
        canvas.settings = QSafeSettings("falkTX", appName)

    if canvas.theme:
        del canvas.theme
        canvas.theme = None

    for i in range(Theme.THEME_MAX):
        this_theme_name = getThemeName(i)
        if this_theme_name == options.theme_name:
            canvas.theme = Theme(i)
            break

    if not canvas.theme:
        canvas.theme = Theme(getDefaultTheme())

    canvas.scene.updateTheme()

    canvas.initiated = True
Exemplo n.º 4
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.º 5
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()