def checkEmbeddedDB(): global isAskEmbeddedDBConfiguration if uni.getBoolValue("isReadOnlyAmarokDB"): if (fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") and fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql") and fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf")): return startReadOnlyEmbeddedDB() else: if isAskEmbeddedDBConfiguration: isAskEmbeddedDBConfiguration = False answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"), translate("Amarok", "Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?")) if answer == Dialogs.Yes: ReadOnlyEmbeddedDBConfigurator() else: return False else: if (fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql/db.frm") and fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")): return startEmbeddedDB() else: if isAskEmbeddedDBConfiguration: isAskEmbeddedDBConfiguration = False answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"), translate("Amarok", "Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?")) if answer == Dialogs.Yes: EmbeddedDBConfigurator() else: return False return checkEmbeddedDB()
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
def createReadOnlyEmbeddedDB(_isNoAlertIfSuccessfully=True): stopReadOnlyEmbeddedDB() if fu.isDir(fu.pathOfSettingsDirectory + "/Amarok"): fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok") fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle") fu.copyFileOrDir( fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql", fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql", ) fu.copyFileOrDir( fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my-readOnly.cnf", fu.pathOfSettingsDirectory + "/Amarok/my.cnf") MyConfigure.reConfigureFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf") fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") fu.copyFileOrDir( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile0", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile0") fu.copyFileOrDir( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile1", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile1") fu.copyFileOrDir( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ibdata1", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ibdata1") generateReadOnlyEmbeddedD() if _isNoAlertIfSuccessfully is False: Dialogs.show( translate("EmbeddedDBCore", "Created Embedded Server"), translate( "EmbeddedDBCore", "Embedded Amarok database server created and generated.")) return True
def backupEmbeddedDB(): if fu.isDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi"): fu.removeFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi") fu.copyFileOrDir( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi")
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
def configureEmbeddedDB(_isNoAlertIfSuccessfully=True): stopEmbeddedDB() backupEmbeddedDB() fu.copyDirContent(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql") fu.copyFileOrDir(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my.cnf", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf") MyConfigure.reConfigureFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf") if _isNoAlertIfSuccessfully is False: Dialogs.show(translate("EmbeddedDBCore", "Created Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server created and generated.")) return True
def connectAndGetDB(): global dbConnection if dbConnection is None: if uni.getBoolValue("amarokIsUseHost"): dbConnection = mdb.connect(host=uni.MySettings["amarokDBHost"], port=int( uni.MySettings["amarokDBPort"]), user=uni.MySettings["amarokDBUser"], passwd=uni.MySettings["amarokDBPass"], db=uni.MySettings["amarokDBDB"]) dbConnection.set_character_set('utf8') dbConnection.query('SET NAMES utf8;') dbConnection.query('SET CHARACTER SET utf8;') dbConnection.query('SET character_set_connection=utf8;') else: if uni.getBoolValue("isReadOnlyAmarokDB"): dbConnection = mdb.connect( read_default_file=fu.pathOfSettingsDirectory + "/Amarok/my.cnf", read_default_group="client", db="amarok") else: dbConnection = mdb.connect( read_default_file=uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf", read_default_group="client", db="amarok") return dbConnection
def configureEmbeddedDB(_isNoAlertIfSuccessfully=True): stopEmbeddedDB() backupEmbeddedDB() fu.copyDirContent( fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql") fu.copyFileOrDir( fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my.cnf", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf") MyConfigure.reConfigureFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf") if _isNoAlertIfSuccessfully is False: Dialogs.show( translate("EmbeddedDBCore", "Created Embedded Server"), translate( "EmbeddedDBCore", "Embedded Amarok database server created and generated.")) return True
def generateReadOnlyEmbeddedD(_isNoAlertIfSuccessfully=True): stopReadOnlyEmbeddedDB() if fu.isExist(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok"): fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/amarok", fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") if _isNoAlertIfSuccessfully is False: Dialogs.show(translate("EmbeddedDBCore", "Generated Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server generated.")) return True
def checkEmbeddedDB(): global isAskEmbeddedDBConfiguration if uni.getBoolValue("isReadOnlyAmarokDB"): if (fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") and fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql") and fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf")): return startReadOnlyEmbeddedDB() else: if isAskEmbeddedDBConfiguration: isAskEmbeddedDBConfiguration = False answer = Dialogs.ask( translate("Amarok", "Amarok Database Must Be Configure"), translate( "Amarok", "Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?" )) if answer == Dialogs.Yes: ReadOnlyEmbeddedDBConfigurator() else: return False else: if (fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql/db.frm") and fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")): return startEmbeddedDB() else: if isAskEmbeddedDBConfiguration: isAskEmbeddedDBConfiguration = False answer = Dialogs.ask( translate("Amarok", "Amarok Database Must Be Configure"), translate( "Amarok", "Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?" )) if answer == Dialogs.Yes: EmbeddedDBConfigurator() else: return False return checkEmbeddedDB()
def createReadOnlyEmbeddedDB(_isNoAlertIfSuccessfully=True): stopReadOnlyEmbeddedDB() if fu.isDir(fu.pathOfSettingsDirectory + "/Amarok"): fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok") fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle") fu.copyFileOrDir(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql", fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql", ) fu.copyFileOrDir(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my-readOnly.cnf", fu.pathOfSettingsDirectory + "/Amarok/my.cnf") MyConfigure.reConfigureFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf") fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile0", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile0") fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile1", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile1") fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ibdata1", fu.pathOfSettingsDirectory + "/Amarok/mysqle/ibdata1") generateReadOnlyEmbeddedD() if _isNoAlertIfSuccessfully is False: Dialogs.show(translate("EmbeddedDBCore", "Created Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server created and generated.")) return True
def generateReadOnlyEmbeddedD(_isNoAlertIfSuccessfully=True): stopReadOnlyEmbeddedDB() if fu.isExist(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok"): fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") fu.copyFileOrDir( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/amarok", fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") if _isNoAlertIfSuccessfully is False: Dialogs.show( translate("EmbeddedDBCore", "Generated Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server generated.")) return True
def installKDE4Language(_language="tr_TR"): if uni.isAvailableKDE4(): KDELocalateDir = fu.joinPath(uni.getKDE4HomePath(), "share", "locale", str(_language[:2]), "LC_MESSAGES") if uni.isRunningAsRoot(): KDELocalateDir = fu.joinPath("/usr", "share", "locale", str(_language[:2]), "LC_MESSAGES") KDELocalateDir = str(KDELocalateDir) langFile = fu.joinPath(fu.HamsiManagerDirectory, "Languages", "DontTranslate", str(_language), "HamsiManager.mo") if fu.isFile(fu.joinPath(KDELocalateDir, "HamsiManager.mo")) is False: if fu.isFile(langFile): if fu.isDir(KDELocalateDir) is False: fu.makeDirs(KDELocalateDir) fu.copyFileOrDir(langFile, fu.joinPath(KDELocalateDir, "HamsiManager.mo")) return True return False
def startEmbeddedDB(_isNoAlertIfSuccessfully=True): global isStarted if isStarted: return True if uni.checkMysqldSafe(): Execute.executeWithThread([uni.MySettings["pathOfMysqldSafe"], "--defaults-file=" + uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf"]) Dialogs.sleep(translate("EmbeddedDBCore", "Starting Embedded Server..."), 3) if _isNoAlertIfSuccessfully is False: Dialogs.show(translate("EmbeddedDBCore", "Started Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server started.")) isStarted = True return True isStarted = False return False
def connectAndGetDB(): global dbConnection if dbConnection is None: if uni.getBoolValue("amarokIsUseHost"): dbConnection = mdb.connect(host=uni.MySettings["amarokDBHost"], port=int(uni.MySettings["amarokDBPort"]), user=uni.MySettings["amarokDBUser"], passwd=uni.MySettings["amarokDBPass"], db=uni.MySettings["amarokDBDB"]) dbConnection.set_character_set('utf8') dbConnection.query('SET NAMES utf8;') dbConnection.query('SET CHARACTER SET utf8;') dbConnection.query('SET character_set_connection=utf8;') else: if uni.getBoolValue("isReadOnlyAmarokDB"): dbConnection = mdb.connect(read_default_file=fu.pathOfSettingsDirectory + "/Amarok/my.cnf", read_default_group="client", db="amarok") else: dbConnection = mdb.connect(read_default_file=uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf", read_default_group="client", db="amarok") return dbConnection
def startEmbeddedDB(_isNoAlertIfSuccessfully=True): global isStarted if isStarted: return True if uni.checkMysqldSafe(): Execute.executeWithThread([ uni.MySettings["pathOfMysqldSafe"], "--defaults-file=" + uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf" ]) Dialogs.sleep( translate("EmbeddedDBCore", "Starting Embedded Server..."), 3) if _isNoAlertIfSuccessfully is False: Dialogs.show( translate("EmbeddedDBCore", "Started Embedded Server"), translate("EmbeddedDBCore", "Embedded Amarok database server started.")) isStarted = True return True isStarted = False return False
def uninstallThisPlugin(): isAlreadyuninstalled = True if uni.isRunningAsRoot(): destinationPath = "/usr/share/apps/krusader/" else: destinationPath = uni.getKDE4HomePath() + "/share/apps/krusader/" if fu.isFile(fu.joinPath(destinationPath, "useractions.xml")): import xml.etree.ElementTree as ET doc = ET.parse(fu.joinPath(destinationPath, "useractions.xml")) KrusaderUserActions = doc.getroot() actions = doc.findall("action") for act in doc.findall("action"): if act.get("name").find("hamsimanager") != -1: KrusaderUserActions.remove(act) isAlreadyuninstalled = False actions = doc.findall("action") doc.write(fu.joinPath(destinationPath, "useractions.xml")) if isAlreadyuninstalled: return "AlreadyUninstalled" return True
# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Hamsi Manager is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with HamsiManager; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from Core.MyObjects import * from Core import Universals as uni pluginName = str(translate("MyPlugins/InTheAmarok", "Hamsi Manager In The Amarok")) pluginVersion = "0.4" pluginFiles = [] pluginDirectory = "HamsiManagerInTheAmarok" installThisPlugin = None uninstallThisPlugin = None if uni.isRunningAsRoot(): setupDirectory = "/usr/share/apps/amarok/scripts" else: setupDirectory = uni.getKDE4HomePath() + "/share/apps/amarok/scripts" def isInstallable(): return uni.isAvailableKDE4()
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
# # Hamsi Manager is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with HamsiManager; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from Core.MyObjects import * from Core import Universals as uni pluginName = str(translate("MyPlugins/KDE4_SM", "For KDE4 Applications` Service Menus")) pluginVersion = "1.0" pluginFiles = ["HamsiManager_KDE4_SM.desktop", "HamsiManager_KDE4_SM_Dir.desktop", "HamsiManager_KDE4_SM_File.desktop"] pluginDirectory = "" installThisPlugin = None uninstallThisPlugin = None if uni.isRunningAsRoot(): setupDirectory = "/usr/share/kde4/services/ServiceMenus" else: setupDirectory = uni.getKDE4HomePath() + "/share/kde4/services/ServiceMenus" def isInstallable(): return uni.isAvailableKDE4()
def backupEmbeddedDB(): if fu.isDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi"): fu.removeFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi") fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi")
def restoreEmbeddedDB(): fu.copyDirContent(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle")
def isHasEmbeddedDBBackup(): return fu.isDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi")
def isHasEmbeddedDBBackup(): return fu.isDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi")
def restoreEmbeddedDB(): fu.copyDirContent( uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi", uni.getKDE4HomePath() + "/share/apps/amarok/mysqle")
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with HamsiManager; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from Core.MyObjects import * from Core import Universals as uni pluginName = str( translate("MyPlugins/KDE4_SM", "For KDE4 Applications` Service Menus")) pluginVersion = "1.0" pluginFiles = [ "HamsiManager_KDE4_SM.desktop", "HamsiManager_KDE4_SM_Dir.desktop", "HamsiManager_KDE4_SM_File.desktop" ] pluginDirectory = "" installThisPlugin = None uninstallThisPlugin = None if uni.isRunningAsRoot(): setupDirectory = "/usr/share/kde4/services/ServiceMenus" else: setupDirectory = uni.getKDE4HomePath( ) + "/share/kde4/services/ServiceMenus" def isInstallable(): return uni.isAvailableKDE4()