Example #1
0
def getPID():
    global isStarted
    if fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysqld.pid"):
        isStarted = True
        return fu.readFromFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysqld.pid").split("\n")[0]
    isStarted = False
    return None
Example #2
0
def getReadOnlyPID():
    global isReadOnlyStarted
    if fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/mysqld.pid"):
        isReadOnlyStarted = True
        return fu.readFromFile(fu.pathOfSettingsDirectory + "/Amarok/mysqld.pid").split("\n")[0]
    isReadOnlyStarted = False
    return None
Example #3
0
def restoreBackUp(_settingType="All", _isMakeBackUp=True):
    files = []
    isSuccessfully = True
    if _settingType == "database" or _settingType == "All":
        files.append("database.sqlite")
    if _settingType == "Settings" or _settingType == "All":
        files.append(uni.fileOfSettings)
    for backupFile in files:
        oldInfo = ""
        if _isMakeBackUp:
            oldInfo = fu.readFromFile(
                fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
        else:
            try:
                fu.removeFile(
                    fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
            except:
                pass
        try:
            if fu.isFile(
                    fu.joinPath(fu.pathOfSettingsDirectory, "BackUps",
                                backupFile)):
                fu.moveFileOrDir(
                    fu.joinPath(fu.pathOfSettingsDirectory, "BackUps",
                                backupFile),
                    fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
            else:
                isSuccessfully = False
        except:
            pass
        if _isMakeBackUp:
            fu.writeToFile(
                fu.joinPath(fu.pathOfSettingsDirectory, "BackUps", backupFile),
                oldInfo)
    return isSuccessfully
Example #4
0
 def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False):
     try:
         if self.sourceToSearch is None or _isReload:
             sourceToSearch = ""
             self.isMultipleSource = False
             pathToSearchs = str(self.lePathToSeach.text())
             if fu.isExist(pathToSearchs) is False and pathToSearchs.find(";") != -1:
                 self.isMultipleSource = True
             for pathToSearch in uni.getListFromListString(pathToSearchs, ";"):
                 if pathToSearch in self.sourceToSearchCache and _isLoadFromCache:
                     sourceToSearch += self.sourceToSearchCache[pathToSearch]
                 else:
                     pathToSearch = fu.checkSource(pathToSearch)
                     if pathToSearch is not None:
                         if fu.isReadableFileOrDir(pathToSearch):
                             if fu.isFile(pathToSearch) and fu.isBinary(pathToSearch) is False:
                                 sts = fu.readFromFile(pathToSearch) + "\n"
                                 sourceToSearch += sts
                                 self.sourceToSearchCache[pathToSearch] = sts
                             elif fu.isDir(pathToSearch):
                                 sts = fu.getFileTree(pathToSearch, -1, "return", "plainText", "fileList") + "\n"
                                 sourceToSearch += sts
                                 self.sourceToSearchCache[pathToSearch] = sts
             self.sourceToSearch = sourceToSearch
             if sourceToSearch != "":
                 return True
             return False
         else:
             return True
     except:
         ReportBug.ReportBug()
Example #5
0
def restoreBackUp(_settingType="All", _isMakeBackUp=True):
    files = []
    isSuccessfully = True
    if _settingType == "database" or _settingType == "All":
        files.append("database.sqlite")
    if _settingType == "Settings" or _settingType == "All":
        files.append(uni.fileOfSettings)
    for backupFile in files:
        oldInfo = ""
        if _isMakeBackUp:
            oldInfo = fu.readFromFile(fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
        else:
            try:
                fu.removeFile(fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
            except: pass
        try:
            if fu.isFile(fu.joinPath(fu.pathOfSettingsDirectory, "BackUps", backupFile)):
                fu.moveFileOrDir(fu.joinPath(fu.pathOfSettingsDirectory, "BackUps", backupFile),
                                 fu.joinPath(fu.pathOfSettingsDirectory, backupFile))
            else:
                isSuccessfully = False
        except: pass
        if _isMakeBackUp:
            fu.writeToFile(fu.joinPath(fu.pathOfSettingsDirectory, "BackUps", backupFile), oldInfo)
    return isSuccessfully
Example #6
0
def getReadOnlyPID():
    global isReadOnlyStarted
    if fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/mysqld.pid"):
        isReadOnlyStarted = True
        return fu.readFromFile(fu.pathOfSettingsDirectory +
                               "/Amarok/mysqld.pid").split("\n")[0]
    isReadOnlyStarted = False
    return None
Example #7
0
def getPID():
    global isStarted
    if fu.isFile(uni.getKDE4HomePath() +
                 "/share/apps/amarok/mysqle/mysqld.pid"):
        isStarted = True
        return fu.readFromFile(uni.getKDE4HomePath() +
                               "/share/apps/amarok/mysqle/mysqld.pid").split(
                                   "\n")[0]
    isStarted = False
    return None
Example #8
0
def read(_recordFilePath=None):
    if _recordFilePath is None:
        _recordFilePath = fu.recordFilePath
    if fu.isFile(_recordFilePath):
        return fu.readFromFile(_recordFilePath, "utf-8")
    else:
        create()
        setRecordType(1)
        fu.addToFile(_recordFilePath, recordContents)
        restoreRecordType()
        return recordContents
Example #9
0
def read(_recordFilePath=None):
    if _recordFilePath is None:
        _recordFilePath = fu.recordFilePath
    if fu.isFile(_recordFilePath):
        return fu.readFromFile(_recordFilePath, "utf-8")
    else:
        create()
        setRecordType(1)
        fu.addToFile(_recordFilePath, recordContents)
        restoreRecordType()
        return recordContents
Example #10
0
 def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False):
     try:
         if self.sourceToSearch is None or _isReload:
             sourceToSearch = ""
             self.isMultipleSource = False
             pathToSearchs = str(self.lePathToSeach.text())
             if fu.isExist(pathToSearchs) is False and pathToSearchs.find(
                     ";") != -1:
                 self.isMultipleSource = True
             for pathToSearch in uni.getListFromListString(
                     pathToSearchs, ";"):
                 if pathToSearch in self.sourceToSearchCache and _isLoadFromCache:
                     sourceToSearch += self.sourceToSearchCache[
                         pathToSearch]
                 else:
                     pathToSearch = fu.checkSource(pathToSearch)
                     if pathToSearch is not None:
                         if fu.isReadableFileOrDir(pathToSearch):
                             if fu.isFile(pathToSearch) and fu.isBinary(
                                     pathToSearch) is False:
                                 sts = fu.readFromFile(pathToSearch) + "\n"
                                 sourceToSearch += sts
                                 self.sourceToSearchCache[
                                     pathToSearch] = sts
                             elif fu.isDir(pathToSearch):
                                 sts = fu.getFileTree(
                                     pathToSearch, -1, "return",
                                     "plainText", "fileList") + "\n"
                                 sourceToSearch += sts
                                 self.sourceToSearchCache[
                                     pathToSearch] = sts
             self.sourceToSearch = sourceToSearch
             if sourceToSearch != "":
                 return True
             return False
         else:
             return True
     except:
         ReportBug.ReportBug()
Example #11
0
def installThisPlugin():
    from Core import Execute

    executeCommandOfHamsiManager = Execute.getExecuteCommandOfHamsiManager()
    iconPath = fu.joinPath(fu.themePath, "Images", "hamsi.png")
    myPluginStrings = [(" <action name=\"hamsimanager_Organize\" >\n" +
                        "  <title>" + str(
        translate("MyPlugins/Krusader", "Organize With Hamsi Manager")) + "</title>\n" +
                        "  <tooltip>" + str(
        translate("MyPlugins/Krusader", "You can organize with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + iconPath + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "You can continue to edit the folder you select with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " -t 1 --directory %aCurrent%</command>\n" +
                        "  <defaultshortcut>Ctrl+O</defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_emendDirectory\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Auto Emend Directory")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Auto emend with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "emendDirectory.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Auto emend with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --emendDirectory %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_emendDirectoryWithContents\" >\n" +
                        "  <title>" + str(
                           translate("MyPlugins/Krusader", "Auto Emend Directory (With Contents)")) + "</title>\n" +
                        "  <tooltip>" + str(translate("MyPlugins/Krusader",
                                                      "Auto emend with Hamsi Manager (With Contents)")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images",
                                                 "emendDirectoryWithContents.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Auto emend with Hamsi Manager (With Contents)")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --emendDirectoryWithContents %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_emendFile\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Auto Emend File")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Auto emend with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "emendFile.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Auto emend with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --emendFile %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_pack\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Pack It")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Pack it with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "pack.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Pack it with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --pack %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_checkIcon\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Check Directory Icon")) + "</title>\n" +
                        "  <tooltip>" + str(translate("MyPlugins/Krusader",
                                                      "Check directory icon with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "checkIcon.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Check directory icon with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --checkIcon %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_clearEmptyDirectories\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Clear Empty Directories")) + "</title>\n" +
                        "  <tooltip>" + str(translate("MyPlugins/Krusader",
                                                      "Clear empty directories with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "clearEmptyDirectories.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Clear empty directories with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --clearEmptyDirectories %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_clearUnneededs\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Clear Unneededs")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Clear unneededs with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "clearUnneededs.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Clear unneededs with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --clearUnneededs %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_clearIgnoreds\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Clear Ignoreds")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Clear ignoreds with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "clearIgnoreds.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Clear ignoreds with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --clearIgnoreds %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_copyPath\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Copy Path To Clipboard")) + "</title>\n" +
                        "  <tooltip>" + str(translate("MyPlugins/Krusader",
                                                      "Copy path to clipboard with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "copyPath.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Copy path to clipboard with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --copyPath %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_fileTree\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Build File Tree")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Build file tree with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "fileTree.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Build file tree with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --fileTree %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_removeOnlySubFiles\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Remove Sub Files")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Remove sub files with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "removeOnlySubFiles.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Remove sub files with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --removeOnlySubFiles %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_pack\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Clear It")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Clear it with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "pack.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Clear it with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --clear %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_hash\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Hash Digest")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Get hash digest with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "hash.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Get hash digest with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --hash %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_textCorrector\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Correct Content")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Correct content with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "textCorrector.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(translate("MyPlugins/Krusader",
                                                          "Correct content with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --textCorrector %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n"),
                       (" <action name=\"hamsimanager_search\" >\n" +
                        "  <title>" + str(translate("MyPlugins/Krusader", "Search")) + "</title>\n" +
                        "  <tooltip>" + str(
                           translate("MyPlugins/Krusader", "Search with Hamsi Manager")) + "</tooltip>\n" +
                        "  <icon>" + fu.joinPath(fu.themePath, "Images", "search.png") + "</icon>\n" +
                        "  <category>Hamsi Manager</category>\n" +
                        "  <description>" + str(
                           translate("MyPlugins/Krusader", "Search with Hamsi Manager")) + ".</description>\n" +
                        "  <command>" + executeCommandOfHamsiManager + " --qm --search %aCurrent%</command>\n" +
                        "  <defaultshortcut></defaultshortcut>\n" +
                        " </action>\n")]
    if uni.isRunningAsRoot():
        destinationPath = "/usr/share/apps/krusader/"
    else:
        destinationPath = uni.getKDE4HomePath() + "/share/apps/krusader/"
    try:
        pluginStrings = fu.readFromFile(destinationPath + "useractions.xml")
    except:
        if fu.isDir(destinationPath) is False:
            fu.makeDirs(destinationPath)
        if fu.isFile("/usr/share/apps/krusader/useraction_examples.xml"):
            pluginStrings = fu.readFromFile("/usr/share/apps/krusader/useraction_examples.xml")
        else:
            pluginStrings = ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                             "<!DOCTYPE KrusaderUserActions>\n" +
                             "<KrusaderUserActions>\n" +
                             "</KrusaderUserActions>\n")
    pluginString = ""
    for pstr in myPluginStrings:
        if pluginStrings.find(pstr.split("\n")[0]) == -1:
            pluginString += pstr
    pluginStrings = pluginStrings.replace("</KrusaderUserActions>", pluginString + "</KrusaderUserActions>")
    fu.writeToFile(destinationPath + "useractions.xml", pluginStrings)
    if pluginString == "":
        return "AlreadyInstalled"
    return True
Example #12
0
    base=exeBase,
    targetName="hamsi" + fileExtension,
    compress=True,
    copyDependentFiles=False,
    appendScriptToExe=False,
    appendScriptToLibrary=False,
    icon=os.path.join(HamsiManagerDirectory, "Themes/Default/Images/hamsi" + iconExtension),
    shortcutName="Hamsi Manager",
    shortcutDir="ProgramMenuFolder"
)

setup(
    name="HamsiManager",
    version=uni.version,
    description="Hamsi Manager is a file manager which was developed for extra operations.",
    long_description=fu.readFromFile(os.path.join(HamsiManagerDirectory, "Languages/About_en_GB"), "utf-8"),
    author="Murat Demir",
    author_email="*****@*****.**",
    maintainer="Murat Demir",
    maintainer_email="*****@*****.**",
    url="http://hamsiapps.com/Hamsi-Manager",
    download_url="http://sourceforge.net/projects/hamsimanager/files/",
    license="GPLv3",
    options={"build_exe": {"includes": includes,
                           "excludes": excludes,
                           "packages": packages,
                           "path": path,
                           "include_files": include_files,
    }
    },
    executables=[MainExe],
Example #13
0
    def createPage(self, _pageNo):
        pnlPage = MWidget()
        HBox = MHBoxLayout()
        pnlPage.setLayout(HBox)
        defaultLangCode = uni.getDefaultLanguageCode()
        if _pageNo == 0:
            if fu.isFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "About_" + defaultLangCode)):
                aboutFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "About_" + defaultLangCode), "utf-8")
            else:
                aboutFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "About_en_GB"), "utf-8")
            lblAbout = MLabel(str(aboutFileContent))
            lblAbout.setWordWrap(True)
            HBox.addWidget(lblAbout)
        elif _pageNo == 1:
            if fu.isFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "License_" + defaultLangCode)):
                licenceFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "License_" + defaultLangCode), "utf-8")
            else:
                licenceFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                                "License_en_GB"), "utf-8")
            teCopying = MTextEdit()
            teCopying.setPlainText(str(licenceFileContent))
            HBox.addWidget(teCopying)
        elif _pageNo == 2:
            VBox = MVBoxLayout()
            VBox.addStretch(10)
            self.isCreateDesktopShortcut = None
            self.isCreateExecutableLink = None
            self.wAvailableModules = MWidget(self)
            VBox.addWidget(self.wAvailableModules)
            self.vblAvailableModules = MVBoxLayout()
            self.checkAvailableModules()
            VBox.addStretch(1)
            if uni.isRunningAsRoot():
                self.isCreateExecutableLink = MCheckBox(
                    translate("Reconfigure", "Add To The System"))
                self.isCreateExecutableLink.setCheckState(Mt.Checked)
                lblExecutableLink = MLabel(
                    translate("Reconfigure", "Executable Link Path : "))
                self.leExecutableLink = MLineEdit(
                    str(
                        Settings.getUniversalSetting(
                            "HamsiManagerExecutableLinkPath",
                            "/usr/bin/hamsi")))
                self.connect(self.isCreateExecutableLink,
                             SIGNAL("stateChanged(int)"),
                             self.createExecutableLinkChanged)
                VBox.addWidget(self.isCreateExecutableLink)
                HBox1 = MHBoxLayout()
                HBox1.addWidget(lblExecutableLink)
                HBox1.addWidget(self.leExecutableLink, 10)
                VBox.addLayout(HBox1)
            else:
                self.isCreateDesktopShortcut = MCheckBox(
                    translate("Reconfigure", "Create Desktop Shortcut."))
                self.isCreateDesktopShortcut.setCheckState(Mt.Checked)
                VBox.addWidget(self.isCreateDesktopShortcut)
            VBox.addStretch(10)
            HBox.addLayout(VBox)
        elif _pageNo == 3:
            import MyPlugins

            VBox = MVBoxLayout()
            VBox.addStretch(10)
            wPlugins = MyPlugins.MyPluginsForSystem(self)
            HBox.addWidget(wPlugins)
            VBox.addStretch(10)
            HBox.addLayout(VBox)
        return pnlPage
Example #14
0
 Settings.checkSettings()
 uni.printForDevelopers("Before uni.fillMySettings")
 uni.fillMySettings()
 if isActivePyKDE4:
     uni.printForDevelopers("ActivePyKDE4")
     appName = "HamsiManager"
     programName = ki18n("Hamsi Manager")
     version = uni.version
     appLicense = MAboutData.License_GPL_V3
     appCopyright = ki18n(str("Murat Demir ([email protected])"))
     kde4LangCode = uni.MySettings["language"]
     text = ki18n(str(""))
     homePage = str("hamsiapps.com")
     bugEmail = str("Murat Demir ([email protected])")
     if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + kde4LangCode)):
         aboutFileContent = fu.readFromFile(
             fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + kde4LangCode), "utf-8")
     else:
         aboutFileContent = fu.readFromFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_en_GB"),
                                            "utf-8")
     description = ki18n(str(aboutFileContent))
     uni.printForDevelopers("Before MAboutData")
     aboutOfHamsiManager = MAboutData(appName, uni.Catalog, programName, version, description,
                                      appLicense, appCopyright, text, homePage, bugEmail)
     aboutOfHamsiManager.addAuthor(ki18n(str("Murat Demir")), ki18n(str("Project Manager and Developer")),
                                   "*****@*****.**", "hamsiapps.com")
     aboutOfHamsiManager.setProgramIconName(str(fu.joinPath(fu.themePath, "Images", "hamsi.png")))
     if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + kde4LangCode)):
         aboutOfHamsiManager.addLicenseTextFile(
             str(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + kde4LangCode)))
     else:
         aboutOfHamsiManager.addLicenseTextFile(
Example #15
0
def getScript(_filePath):
    _filePath = fu.checkSource(_filePath, "file", False)
    if _filePath is not None:
        return fu.readFromFile(_filePath)
    return None
Example #16
0
    def createPage(self, _pageNo):
        pnlPage = MWidget()
        HBox = MHBoxLayout()
        pnlPage.setLayout(HBox)
        defaultLangCode = uni.getDefaultLanguageCode()
        if _pageNo == 0:
            if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + defaultLangCode)):
                aboutFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + defaultLangCode), "utf-8")
            else:
                aboutFileContent = fu.readFromFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_en_GB"),
                                                   "utf-8")
            lblAbout = MLabel(str(aboutFileContent))
            lblAbout.setWordWrap(True)
            HBox.addWidget(lblAbout)
        elif _pageNo == 1:
            if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + defaultLangCode)):
                licenceFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + defaultLangCode), "utf-8")
            else:
                licenceFileContent = fu.readFromFile(
                    fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_en_GB"), "utf-8")
            teCopying = MTextEdit()
            teCopying.setPlainText(str(licenceFileContent))
            HBox.addWidget(teCopying)
        elif _pageNo == 2:
            VBox = MVBoxLayout()
            VBox.addStretch(10)
            self.isCreateDesktopShortcut = None
            self.isCreateExecutableLink = None
            self.wAvailableModules = MWidget(self)
            VBox.addWidget(self.wAvailableModules)
            self.vblAvailableModules = MVBoxLayout()
            self.checkAvailableModules()
            VBox.addStretch(1)
            if uni.isRunningAsRoot():
                self.isCreateExecutableLink = MCheckBox(translate("Reconfigure", "Add To The System"))
                self.isCreateExecutableLink.setCheckState(Mt.Checked)
                lblExecutableLink = MLabel(translate("Reconfigure", "Executable Link Path : "))
                self.leExecutableLink = MLineEdit(
                    str(Settings.getUniversalSetting("HamsiManagerExecutableLinkPath", "/usr/bin/hamsi")))
                self.connect(self.isCreateExecutableLink, SIGNAL("stateChanged(int)"), self.createExecutableLinkChanged)
                VBox.addWidget(self.isCreateExecutableLink)
                HBox1 = MHBoxLayout()
                HBox1.addWidget(lblExecutableLink)
                HBox1.addWidget(self.leExecutableLink, 10)
                VBox.addLayout(HBox1)
            else:
                self.isCreateDesktopShortcut = MCheckBox(translate("Reconfigure", "Create Desktop Shortcut."))
                self.isCreateDesktopShortcut.setCheckState(Mt.Checked)
                VBox.addWidget(self.isCreateDesktopShortcut)
            VBox.addStretch(10)
            HBox.addLayout(VBox)
        elif _pageNo == 3:
            import MyPlugins

            VBox = MVBoxLayout()
            VBox.addStretch(10)
            wPlugins = MyPlugins.MyPluginsForSystem(self)
            HBox.addWidget(wPlugins)
            VBox.addStretch(10)
            HBox.addLayout(VBox)
        return pnlPage
Example #17
0
 def createPage(self, _pageNo):
     pnlPage = MWidget()
     HBox = MHBoxLayout()
     pnlPage.setLayout(HBox)
     if _pageNo == 0:
         if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + defaultLangCode)):
             aboutFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_" + defaultLangCode), "utf-8")
         else:
             aboutFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages", "About_en_GB"), "utf-8")
         lblAbout = MLabel(str(aboutFileContent))
         lblAbout.setWordWrap(True)
         HBox.addWidget(lblAbout)
     elif _pageNo == 1:
         if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + defaultLangCode)):
             licenceFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_" + defaultLangCode), "utf-8")
         else:
             licenceFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages", "License_en_GB"), "utf-8")
         teCopying = MTextEdit()
         teCopying.setPlainText(str(licenceFileContent))
         HBox.addWidget(teCopying)
     elif _pageNo == 2:
         lblPleaseSelect = MLabel(translate("Install", "Please Select A Folder For Installation."))
         installationDirPath = Settings.getUniversalSetting("HamsiManagerPath", None)
         if installationDirPath is not None:
             installationDirPath = fu.getDirName(installationDirPath)
         else:
             installationDirPath = fu.joinPath(fu.getDirName(fu.HamsiManagerDirectory), "Hamsi")
         self.leInstallationDirectory = MLineEdit(
             str(Settings.getUniversalSetting("pathOfInstallationDirectory", str(installationDirPath))))
         self.pbtnSelectInstallationDirectory = MPushButton(translate("Install", "Browse"))
         self.connect(self.pbtnSelectInstallationDirectory, SIGNAL("clicked()"),
                      self.selectInstallationDirectory)
         VBox = MVBoxLayout()
         VBox.addStretch(10)
         VBox.addWidget(lblPleaseSelect)
         HBox1 = MHBoxLayout()
         HBox1.addWidget(self.leInstallationDirectory)
         HBox1.addWidget(self.pbtnSelectInstallationDirectory)
         VBox.addLayout(HBox1)
         VBox.addStretch(10)
         HBox.addLayout(VBox)
     elif _pageNo == 3:
         VBox = MVBoxLayout()
         self.lblActions = MLabel("")
         self.prgbState = MProgressBar()
         VBox.addWidget(self.lblActions)
         VBox.addWidget(self.prgbState)
         HBox.addLayout(VBox)
     elif _pageNo == 4:
         VBox = MVBoxLayout()
         self.lblFinished = MLabel(translate("Install", "Installation Complete."))
         VBox.addStretch(10)
         VBox.addWidget(self.lblFinished)
         VBox.addStretch(2)
         self.isCreateDesktopShortcut = None
         self.isCreateExecutableLink = None
         if uni.isRunningAsRoot():
             self.isCreateExecutableLink = MCheckBox(translate("Install", "Add To The System"))
             self.isCreateExecutableLink.setCheckState(Mt.Checked)
             lblExecutableLink = MLabel(translate("Install", "Executable Link Path : "))
             self.leExecutableLink = MLineEdit(
                 str(Settings.getUniversalSetting("HamsiManagerExecutableLinkPath", "/usr/bin/hamsi")))
             self.connect(self.isCreateExecutableLink, SIGNAL("stateChanged(int)"),
                          self.createExecutableLinkChanged)
             VBox.addWidget(self.isCreateExecutableLink)
             HBox1 = MHBoxLayout()
             HBox1.addWidget(lblExecutableLink)
             HBox1.addWidget(self.leExecutableLink)
             VBox.addLayout(HBox1)
         else:
             self.isCreateDesktopShortcut = MCheckBox(translate("Install", "Create Desktop Shortcut."))
             self.isCreateDesktopShortcut.setCheckState(Mt.Checked)
             VBox.addWidget(self.isCreateDesktopShortcut)
         VBox.addStretch(10)
         HBox.addLayout(VBox)
     return pnlPage
Example #18
0
 def createPage(self, _pageNo):
     pnlPage = MWidget()
     HBox = MHBoxLayout()
     pnlPage.setLayout(HBox)
     if _pageNo == 0:
         if fu.isFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "About_" + defaultLangCode)):
             aboutFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "About_" + defaultLangCode), "utf-8")
         else:
             aboutFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "About_en_GB"), "utf-8")
         lblAbout = MLabel(str(aboutFileContent))
         lblAbout.setWordWrap(True)
         HBox.addWidget(lblAbout)
     elif _pageNo == 1:
         if fu.isFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "License_" + defaultLangCode)):
             licenceFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "License_" + defaultLangCode), "utf-8")
         else:
             licenceFileContent = fu.readFromFile(
                 fu.joinPath(fu.HamsiManagerDirectory, "Languages",
                             "License_en_GB"), "utf-8")
         teCopying = MTextEdit()
         teCopying.setPlainText(str(licenceFileContent))
         HBox.addWidget(teCopying)
     elif _pageNo == 2:
         lblPleaseSelect = MLabel(
             translate("Install",
                       "Please Select A Folder For Installation."))
         installationDirPath = Settings.getUniversalSetting(
             "HamsiManagerPath", None)
         if installationDirPath is not None:
             installationDirPath = fu.getDirName(installationDirPath)
         else:
             installationDirPath = fu.joinPath(
                 fu.getDirName(fu.HamsiManagerDirectory), "Hamsi")
         self.leInstallationDirectory = MLineEdit(
             str(
                 Settings.getUniversalSetting(
                     "pathOfInstallationDirectory",
                     str(installationDirPath))))
         self.pbtnSelectInstallationDirectory = MPushButton(
             translate("Install", "Browse"))
         self.connect(self.pbtnSelectInstallationDirectory,
                      SIGNAL("clicked()"),
                      self.selectInstallationDirectory)
         VBox = MVBoxLayout()
         VBox.addStretch(10)
         VBox.addWidget(lblPleaseSelect)
         HBox1 = MHBoxLayout()
         HBox1.addWidget(self.leInstallationDirectory)
         HBox1.addWidget(self.pbtnSelectInstallationDirectory)
         VBox.addLayout(HBox1)
         VBox.addStretch(10)
         HBox.addLayout(VBox)
     elif _pageNo == 3:
         VBox = MVBoxLayout()
         self.lblActions = MLabel("")
         self.prgbState = MProgressBar()
         VBox.addWidget(self.lblActions)
         VBox.addWidget(self.prgbState)
         HBox.addLayout(VBox)
     elif _pageNo == 4:
         VBox = MVBoxLayout()
         self.lblFinished = MLabel(
             translate("Install", "Installation Complete."))
         VBox.addStretch(10)
         VBox.addWidget(self.lblFinished)
         VBox.addStretch(2)
         self.isCreateDesktopShortcut = None
         self.isCreateExecutableLink = None
         if uni.isRunningAsRoot():
             self.isCreateExecutableLink = MCheckBox(
                 translate("Install", "Add To The System"))
             self.isCreateExecutableLink.setCheckState(Mt.Checked)
             lblExecutableLink = MLabel(
                 translate("Install", "Executable Link Path : "))
             self.leExecutableLink = MLineEdit(
                 str(
                     Settings.getUniversalSetting(
                         "HamsiManagerExecutableLinkPath",
                         "/usr/bin/hamsi")))
             self.connect(self.isCreateExecutableLink,
                          SIGNAL("stateChanged(int)"),
                          self.createExecutableLinkChanged)
             VBox.addWidget(self.isCreateExecutableLink)
             HBox1 = MHBoxLayout()
             HBox1.addWidget(lblExecutableLink)
             HBox1.addWidget(self.leExecutableLink)
             VBox.addLayout(HBox1)
         else:
             self.isCreateDesktopShortcut = MCheckBox(
                 translate("Install", "Create Desktop Shortcut."))
             self.isCreateDesktopShortcut.setCheckState(Mt.Checked)
             VBox.addWidget(self.isCreateDesktopShortcut)
         VBox.addStretch(10)
         HBox.addLayout(VBox)
     return pnlPage
Example #19
0
def reConfigureFile(_filePath, _installationDirectory=fu.HamsiManagerDirectory, _executeCommandOfHamsiManager=None):
    fileContent = getConfiguredContent(fu.readFromFile(_filePath), _executeCommandOfHamsiManager)
    fileContent = fileContent.replace(fu.HamsiManagerDirectory, _installationDirectory)
    fu.writeToFile(_filePath, fileContent)