Esempio n. 1
0
def getLibraryDirectoryPath():
    global libPath
    if libPath is None:
        if isActivePyKDE4:
            from PyKDE4 import pykdeconfig

            libPath = pykdeconfig._pkg_config["kdelibdir"]
        else:
            try:
                from Core import Execute

                libPath = Execute.getCommandResult(["kde4-config", "--path", "lib"]).split(":")[1][:-2]
            except:
                if fu.isDir("/usr/lib64"):
                    libPath = "/usr/lib64"
                else:
                    libPath = "/usr/lib"
    return libPath
Esempio n. 2
0
def getLibraryDirectoryPath():
    global libPath
    if libPath is None:
        if isActivePyKDE4:
            from PyKDE4 import pykdeconfig

            libPath = pykdeconfig._pkg_config["kdelibdir"]
        else:
            try:
                from Core import Execute

                libPath = Execute.getCommandResult(
                    ["kde4-config", "--path", "lib"]).split(":")[1][:-2]
            except:
                if fu.isDir("/usr/lib64"):
                    libPath = "/usr/lib64"
                else:
                    libPath = "/usr/lib"
    return libPath
Esempio n. 3
0
def getKDE4HomePath():
    if isAvailableKDE4():
        try:
            if isActivePyKDE4:
                from PyKDE4.kdecore import KStandardDirs

                kdedirPath = str(KStandardDirs().localkdedir())
                if kdedirPath[-1] == os.sep:
                    kdedirPath = kdedirPath[:-1]
            else:
                from Core import Execute

                kdedirPath = Execute.getCommandResult(["kde4-config", "--localprefix"])[:-2]
            return kdedirPath
        except: pass
    if fu.isDir(fu.joinPath(fu.userDirectoryPath, ".kde4", "share", "config")):
        return fu.joinPath(fu.userDirectoryPath, ".kde4")
    else:
        return fu.joinPath(fu.userDirectoryPath, ".kde")
Esempio n. 4
0
def getKDE4HomePath():
    if isAvailableKDE4():
        try:
            if isActivePyKDE4:
                from PyKDE4.kdecore import KStandardDirs

                kdedirPath = str(KStandardDirs().localkdedir())
                if kdedirPath[-1] == os.sep:
                    kdedirPath = kdedirPath[:-1]
            else:
                from Core import Execute

                kdedirPath = Execute.getCommandResult(
                    ["kde4-config", "--localprefix"])[:-2]
            return kdedirPath
        except:
            pass
    if fu.isDir(fu.joinPath(fu.userDirectoryPath, ".kde4", "share", "config")):
        return fu.joinPath(fu.userDirectoryPath, ".kde4")
    else:
        return fu.joinPath(fu.userDirectoryPath, ".kde")
Esempio n. 5
0
def getUserDesktopPath():
    desktopPath = None
    if isActivePyKDE4:
        from PyKDE4.kdeui import KGlobalSettings

        desktopPath = str(KGlobalSettings.desktopPath())
    elif isAvailableKDE4():
        from Core import Execute

        desktopPath = Execute.getCommandResult(["kde4-config", "--userpath", "desktop"])[:-2]
    elif isWindows:
        from win32com.shell import shell, shellcon

        desktopPath = shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOP, 0, 0)
    else:
        desktopNames = [str(translate("Variables", "Desktop")), "Desktop"]
        for dirName in desktopNames:
            if fu.isDir(fu.joinPath(fu.userDirectoryPath, dirName)):
                desktopPath = fu.joinPath(fu.userDirectoryPath, dirName)
                break
            else:
                desktopPath = fu.userDirectoryPath
    return desktopPath
Esempio n. 6
0
def getUserDesktopPath():
    desktopPath = None
    if isActivePyKDE4:
        from PyKDE4.kdeui import KGlobalSettings

        desktopPath = str(KGlobalSettings.desktopPath())
    elif isAvailableKDE4():
        from Core import Execute

        desktopPath = Execute.getCommandResult(
            ["kde4-config", "--userpath", "desktop"])[:-2]
    elif isWindows:
        from win32com.shell import shell, shellcon

        desktopPath = shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOP, 0, 0)
    else:
        desktopNames = [str(translate("Variables", "Desktop")), "Desktop"]
        for dirName in desktopNames:
            if fu.isDir(fu.joinPath(fu.userDirectoryPath, dirName)):
                desktopPath = fu.joinPath(fu.userDirectoryPath, dirName)
                break
            else:
                desktopPath = fu.userDirectoryPath
    return desktopPath
            SOURCES += fileName.replace(fu.HamsiManagerDirectory + fu.sep, "") + " \\\n         "

    for fileName in ["Languages" + fu.sep + "HamsiManager_tr_TR.ts",
                     "Languages" + fu.sep + "HamsiManager_untranslated.ts"]:
        TRANSLATIONS += fileName + " \\\n         "

    proFileContent = proFileContent.replace("%SOURCES%", SOURCES)
    proFileContent = proFileContent.replace("%TRANSLATIONS%", TRANSLATIONS)

    fu.writeToFile(proFile, proFileContent)

    args = ["pylupdate4"]
    #args.append("-noobsolete") # Uncomment me if you want to remove old translations from .ts files.
    args.append("-verbose")
    args.append(proFile)

    print (Execute.getCommandResult(args, fu.HamsiManagerDirectory))

    proFileContent = proFileContent.replace("Languages" + fu.sep + "HamsiManager_untranslated.ts \\\n         ", "")
    fu.writeToFile(proFile, proFileContent)

    args = ["lrelease"]
    args.append("-compress")
    args.append(proFile)
    print (Execute.getCommandResult(args, fu.HamsiManagerDirectory))

    print ("Translation files have been updated successfully.")



    for fileName in [
            "Languages" + fu.sep + "HamsiManager_tr_TR.ts",
            "Languages" + fu.sep + "HamsiManager_untranslated.ts"
    ]:
        TRANSLATIONS += fileName + " \\\n         "

    proFileContent = proFileContent.replace("%SOURCES%", SOURCES)
    proFileContent = proFileContent.replace("%TRANSLATIONS%", TRANSLATIONS)

    fu.writeToFile(proFile, proFileContent)

    args = ["pylupdate4"]
    #args.append("-noobsolete") # Uncomment me if you want to remove old translations from .ts files.
    args.append("-verbose")
    args.append(proFile)

    print(Execute.getCommandResult(args, fu.HamsiManagerDirectory))

    proFileContent = proFileContent.replace(
        "Languages" + fu.sep + "HamsiManager_untranslated.ts \\\n         ",
        "")
    fu.writeToFile(proFile, proFileContent)

    args = ["lrelease"]
    args.append("-compress")
    args.append(proFile)
    print(Execute.getCommandResult(args, fu.HamsiManagerDirectory))

    print("Translation files have been updated successfully.")