Beispiel #1
0
 def uninstallPlugin(self, _pluginName, _isQuiet=False):
     isUninstalled = False
     pluginModule = __import__("MyPlugins." + _pluginName, globals(), locals(),
                               ["pluginName", "pluginFiles", "pluginDirectory", "uninstallThisPlugin",
                                "setupDirectory", "pluginVersion"], 0)
     if pluginModule.uninstallThisPlugin is None:
         if pluginModule.pluginDirectory == "":
             for pluginFile in pluginModule.pluginFiles:
                 if fu.isFile(fu.joinPath(pluginModule.setupDirectory, pluginFile)):
                     fu.removeFileOrDir(fu.joinPath(pluginModule.setupDirectory, pluginFile))
             isUninstalled = True
         else:
             if fu.isDir(fu.joinPath(pluginModule.setupDirectory, pluginModule.pluginDirectory)):
                 fu.removeFileOrDir(fu.joinPath(pluginModule.setupDirectory, pluginModule.pluginDirectory))
             isUninstalled = True
     else:
         isUninstalled = pluginModule.uninstallThisPlugin()
     if isUninstalled:
         Settings.setUniversalSetting(str(pluginModule.pluginName), str(""))
         if _isQuiet is False:
             Dialogs.show(translate("MyPlugins", "Plug-in Uninstallation Is Complete"),
                          str(translate("MyPlugins", "\"%s\" is uninstalled on your system.")) % (
                              pluginModule.pluginName))
     elif isUninstalled == "AlreadyUninstalled":
         if _isQuiet is False:
             Dialogs.show(translate("MyPlugins", "Plug-in Already Uninstalled"),
                          str(translate("MyPlugins", "\"%s\" already uninstalled on your system.")) % (
                              pluginModule.pluginName))
     else:
         if _isQuiet is False:
             Dialogs.showError(translate("MyPlugins", "Plug-in Uninstallation Failed"),
                               str(translate("MyPlugins", "\"%s\" failed to uninstall on your system.")) % (
                                   pluginModule.pluginName))
Beispiel #2
0
 def uninstallPlugin(self, _pluginName, _isQuiet=False):
     isUninstalled = False
     pluginModule = __import__(
         "MyPlugins." + _pluginName, globals(), locals(), [
             "pluginName", "pluginFiles", "pluginDirectory",
             "uninstallThisPlugin", "setupDirectory", "pluginVersion"
         ], 0)
     if pluginModule.uninstallThisPlugin is None:
         if pluginModule.pluginDirectory == "":
             for pluginFile in pluginModule.pluginFiles:
                 if fu.isFile(
                         fu.joinPath(pluginModule.setupDirectory,
                                     pluginFile)):
                     fu.removeFileOrDir(
                         fu.joinPath(pluginModule.setupDirectory,
                                     pluginFile))
             isUninstalled = True
         else:
             if fu.isDir(
                     fu.joinPath(pluginModule.setupDirectory,
                                 pluginModule.pluginDirectory)):
                 fu.removeFileOrDir(
                     fu.joinPath(pluginModule.setupDirectory,
                                 pluginModule.pluginDirectory))
             isUninstalled = True
     else:
         isUninstalled = pluginModule.uninstallThisPlugin()
     if isUninstalled:
         Settings.setUniversalSetting(str(pluginModule.pluginName), str(""))
         if _isQuiet is False:
             Dialogs.show(
                 translate("MyPlugins",
                           "Plug-in Uninstallation Is Complete"),
                 str(
                     translate("MyPlugins",
                               "\"%s\" is uninstalled on your system.")) %
                 (pluginModule.pluginName))
     elif isUninstalled == "AlreadyUninstalled":
         if _isQuiet is False:
             Dialogs.show(
                 translate("MyPlugins", "Plug-in Already Uninstalled"),
                 str(
                     translate(
                         "MyPlugins",
                         "\"%s\" already uninstalled on your system.")) %
                 (pluginModule.pluginName))
     else:
         if _isQuiet is False:
             Dialogs.showError(
                 translate("MyPlugins", "Plug-in Uninstallation Failed"),
                 str(
                     translate(
                         "MyPlugins",
                         "\"%s\" failed to uninstall on your system.")) %
                 (pluginModule.pluginName))
 def reConfigure(self):
     try:
         oldPathOfExecutableHamsi = Settings.getUniversalSetting("HamsiManagerExecutableLinkPath", "/usr/bin/hamsi")
         if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop")):
             if fu.isWritableFileOrDir(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop")):
                 MyConfigure.reConfigureFile(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop"))
         if self.isCreateDesktopShortcut is not None:
             if self.isCreateDesktopShortcut.checkState() == Mt.Checked:
                 desktopPath = uni.getUserDesktopPath()
                 if uni.isWindows:
                     MyConfigure.createShortCutFile(fu.joinPath(desktopPath, "Hamsi Manager.lnk"))
                 else:
                     fileContent = MyConfigure.getConfiguredDesktopFileContent()
                     fu.writeToFile(fu.joinPath(desktopPath, "HamsiManager.desktop"), fileContent)
         if uni.isRunningAsRoot():
             executableLink = str(self.leExecutableLink.text())
             if self.isCreateExecutableLink is not None:
                 if self.isCreateExecutableLink.checkState() == Mt.Checked:
                     if executableLink.strip() != "":
                         HamsiManagerFileName = Execute.findExecutableBaseName("HamsiManager")
                         if fu.isFile(executableLink):
                             fu.removeFileOrDir(executableLink)
                         fu.createSymLink(fu.joinPath(fu.HamsiManagerDirectory, HamsiManagerFileName),
                                          executableLink)
                         Settings.setUniversalSetting("HamsiManagerExecutableLinkPath", executableLink)
                         if oldPathOfExecutableHamsi != executableLink:
                             if fu.isFile(oldPathOfExecutableHamsi):
                                 answer = Dialogs.ask(translate("Reconfigure", "Other Hamsi Manager Was Detected"),
                                                      str(translate("Reconfigure",
                                                                    "Other Hamsi Manager executable file was detected. Are you want to delete old executable file? You can delete this old executable file : \"%s\"")) % (
                                                          oldPathOfExecutableHamsi))
                                 if answer != Dialogs.Yes:
                                     fu.removeFile(oldPathOfExecutableHamsi)
                     if fu.isDir("/usr/share/applications/"):
                         fileContent = MyConfigure.getConfiguredDesktopFileContent()
                         fu.writeToFile("/usr/share/applications/HamsiManager.desktop", fileContent)
         if uni.isRunningAsRoot() is False:
             if fu.isDir(fu.joinPath(fu.userDirectoryPath, ".local", "applications")) is False:
                 fu.makeDirs(fu.joinPath(fu.userDirectoryPath, ".local", "applications"))
             fileContent = MyConfigure.getConfiguredDesktopFileContent()
             fu.writeToFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"),
                            fileContent)
         MyConfigure.installKDE4Languages()
         self.isInstallFinished = True
     except:
         ReportBug.ReportBug()
Beispiel #4
0
 def installPlugin(self, _pluginName, _isQuiet=False):
     isInstalled = False
     pluginModule = __import__("MyPlugins." + _pluginName, globals(), locals(),
                               ["pluginName", "pluginFiles", "pluginDirectory", "installThisPlugin",
                                "setupDirectory", "pluginVersion"], 0)
     if pluginModule.installThisPlugin is None:
         if pluginModule.pluginDirectory == "":
             try: fu.makeDirs(pluginModule.setupDirectory)
             except: pass
             for pluginFile in pluginModule.pluginFiles:
                 fu.copyOrChange(fu.joinPath(fu.HamsiManagerDirectory, "MyPlugins", _pluginName, pluginFile),
                                 fu.joinPath(pluginModule.setupDirectory, pluginFile), "file", "only", True)
                 MyConfigure.reConfigureFile(fu.joinPath(pluginModule.setupDirectory, pluginFile))
             isInstalled = True
         else:
             oldFilePath = fu.joinPath(fu.HamsiManagerDirectory, "MyPlugins", _pluginName,
                                       pluginModule.pluginDirectory)
             newFilePath = fu.copyOrChange(oldFilePath,
                                           fu.joinPath(pluginModule.setupDirectory, pluginModule.pluginDirectory),
                                           "directory", "only", True)
             if newFilePath != oldFilePath:
                 isInstalled = True
     else:
         isInstalled = pluginModule.installThisPlugin()
     if isInstalled:
         Settings.setUniversalSetting(str(pluginModule.pluginName), str(pluginModule.pluginVersion))
         if _isQuiet is False:
             Dialogs.show(translate("MyPlugins", "Plug-in Installation Is Complete"),
                          str(translate("MyPlugins", "\"%s\" is installed on your system.")) % (
                              pluginModule.pluginName))
     elif isInstalled == "AlreadyInstalled":
         if _isQuiet is False:
             Dialogs.show(translate("MyPlugins", "Plug-in Already Installed"),
                          str(translate("MyPlugins", "\"%s\" already installed on your system.")) % (
                              pluginModule.pluginName))
     else:
         if _isQuiet is False:
             Dialogs.showError(translate("MyPlugins", "Plug-in Installation Failed"),
                               str(translate("MyPlugins", "\"%s\" failed to install on your system.")) % (
                                   pluginModule.pluginName))
Beispiel #5
0
        def finish(self):
            try:
                if fu.isFile(fu.joinPath(self.installationDirectory, "HamsiManager.desktop")):
                    MyConfigure.reConfigureFile(fu.joinPath(self.installationDirectory, "HamsiManager.desktop"),
                                                self.installationDirectory)
                if self.isCreateDesktopShortcut is not None:
                    if self.isCreateDesktopShortcut.checkState() == Mt.Checked:
                        desktopPath = uni.getUserDesktopPath()
                        if uni.isWindows:
                            MyConfigure.createShortCutFile(fu.joinPath(desktopPath, "Hamsi Manager.lnk"),
                                                           self.installationDirectory)
                        else:
                            fileContent = MyConfigure.getConfiguredDesktopFileContent(self.installationDirectory)
                            fu.writeToFile(fu.joinPath(desktopPath, "HamsiManager.desktop"), fileContent)
                if self.isCreateExecutableLink is not None:
                    executableLink = str(self.leExecutableLink.text())
                    if self.isCreateExecutableLink.checkState() == Mt.Checked:
                        if executableLink.strip() != "":
                            executableLink = fu.checkNewDestination(executableLink)
                            if executableLink:
                                HamsiManagerFileName = Execute.findExecutableBaseName("HamsiManager")
                                fu.createSymLink(fu.joinPath(self.installationDirectory, HamsiManagerFileName),
                                                 executableLink)
                                Settings.setUniversalSetting("HamsiManagerExecutableLinkPath", executableLink)
                        if fu.isDir("/usr/share/applications/"):
                            fileContent = MyConfigure.getConfiguredDesktopFileContent(self.installationDirectory)
                            fu.writeToFile("/usr/share/applications/HamsiManager.desktop", fileContent)
                if uni.isRunningAsRoot() is False:
                    if fu.isDir(fu.joinPath(fu.userDirectoryPath, ".local", "applications")) is False:
                        fu.makeDirs(fu.joinPath(fu.userDirectoryPath, ".local", "applications"))
                    fileContent = MyConfigure.getConfiguredDesktopFileContent(self.installationDirectory)
                    fu.writeToFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"),
                                   fileContent)
                self.isInstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
Beispiel #6
0
        def install(self):
            try:
                MApplication.processEvents()
                self.installationDirectory = str(self.leInstallationDirectory.text())
                if len(self.installationDirectory) > 0:
                    if self.installationDirectory[-1] == fu.sep:
                        self.installationDirectory = self.installationDirectory[:-1]
                    if self.installationDirectory == fu.HamsiManagerDirectory:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                          translate("Install",
                                                    "The selected path is Hamsi Manager source directory.<br>Please choose a valid installation path."))
                    elif fu.isFile(self.installationDirectory) is False:
                        isMakeInstall = True
                        if fu.isDir(self.installationDirectory) is False:
                            self.lblActions.setText(translate("Install", "Creating Installation Folder..."))
                            fu.makeDirs(self.installationDirectory)
                        elif len(fu.listDir(self.installationDirectory)) > 0:
                            currenctAnswer = Dialogs.askSpecial(
                                translate("Install", "The Installation Path You Selected Is Not Empty."),
                                translate("Install",
                                          "If the path you selected is an \"Hamsi Manager\" installation path, <b>I recommend you to delete the older files.</b><br>Do you want me to clear the installation path/folder for you?<br><b>Note: </b> Your personal settings are <b>never deleted</b>."),
                                translate("Install", "Yes (Recommended)"),
                                translate("Install", "No (Overwrite)"),
                                translate("Install", "Cancel"))
                            if currenctAnswer == translate("Install", "Yes (Recommended)"):
                                self.lblActions.setText(translate("Install", "Clearing Installation Path..."))
                                try:fu.removeFileOrDir(self.installationDirectory)
                                except:pass
                                fu.makeDirs(self.installationDirectory)
                                isMakeInstall = True
                            elif currenctAnswer == translate("Install", "No (Overwrite)"):
                                isMakeInstall = True
                            else:
                                isMakeInstall = False
                        if isMakeInstall:
                            Settings.setUniversalSetting("pathOfInstallationDirectory", self.installationDirectory)
                            directoriesAndFiles = fu.readDirectoryWithSubDirectories(fu.HamsiManagerDirectory)
                            self.prgbState.setRange(0, len(directoriesAndFiles))
                            self.lblActions.setText(translate("Install", "Copying Files And Folders..."))
                            installFileName = Execute.findExecutableBaseName("HamsiManagerInstaller")
                            for fileNo, fileName in enumerate(directoriesAndFiles):
                                MApplication.processEvents()
                                newFileName = self.installationDirectory + fileName.replace(fu.HamsiManagerDirectory,"")
                                if fu.isDir(fileName) and fileName.find(".svn") == -1:
                                    try: fu.makeDirs(newFileName)
                                    except: pass
                                elif (fu.isFile(fileName) and fu.getBaseName(fileName) != "install.py" and
                                        fu.getBaseName(fileName) != installFileName and fileName.find(".svn") == -1):
                                    try:
                                        fu.copyFileOrDir(fileName, newFileName)
                                    except:
                                        fileContent = fu.readFromBinaryFile(fileName)
                                        fu.writeToBinaryFile(newFileName, fileContent)
                                self.prgbState.setValue(fileNo + 1)
                            self.pageNo += 1
                            MyConfigure.installKDE4Languages()
                        else:
                            self.pageNo -= 1
                    else:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                          translate("Install",
                                                    "The selected path points to a file not a folder.<br>Please choose a valid installation path."))
                else:
                    self.pageNo -= 1
                    self.lblActions.setText("")
                    Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                      translate("Install",
                                                "The selected path points to a file not a folder.<br>Please choose a valid installation path."))
                self.pageChanged(True)
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
Beispiel #7
0
        def finish(self):
            try:
                if fu.isFile(
                        fu.joinPath(self.installationDirectory,
                                    "HamsiManager.desktop")):
                    MyConfigure.reConfigureFile(
                        fu.joinPath(self.installationDirectory,
                                    "HamsiManager.desktop"),
                        self.installationDirectory)
                if self.isCreateDesktopShortcut is not None:
                    if self.isCreateDesktopShortcut.checkState() == Mt.Checked:
                        desktopPath = uni.getUserDesktopPath()
                        if uni.isWindows:
                            MyConfigure.createShortCutFile(
                                fu.joinPath(desktopPath, "Hamsi Manager.lnk"),
                                self.installationDirectory)
                        else:
                            fileContent = MyConfigure.getConfiguredDesktopFileContent(
                                self.installationDirectory)
                            fu.writeToFile(
                                fu.joinPath(desktopPath,
                                            "HamsiManager.desktop"),
                                fileContent)
                if self.isCreateExecutableLink is not None:
                    executableLink = str(self.leExecutableLink.text())
                    if self.isCreateExecutableLink.checkState() == Mt.Checked:
                        if executableLink.strip() != "":
                            executableLink = fu.checkNewDestination(
                                executableLink)
                            if executableLink:
                                HamsiManagerFileName = Execute.findExecutableBaseName(
                                    "HamsiManager")
                                fu.createSymLink(
                                    fu.joinPath(self.installationDirectory,
                                                HamsiManagerFileName),
                                    executableLink)
                                Settings.setUniversalSetting(
                                    "HamsiManagerExecutableLinkPath",
                                    executableLink)
                        if fu.isDir("/usr/share/applications/"):
                            fileContent = MyConfigure.getConfiguredDesktopFileContent(
                                self.installationDirectory)
                            fu.writeToFile(
                                "/usr/share/applications/HamsiManager.desktop",
                                fileContent)
                if uni.isRunningAsRoot() is False:
                    if fu.isDir(
                            fu.joinPath(fu.userDirectoryPath, ".local",
                                        "applications")) is False:
                        fu.makeDirs(
                            fu.joinPath(fu.userDirectoryPath, ".local",
                                        "applications"))
                    fileContent = MyConfigure.getConfiguredDesktopFileContent(
                        self.installationDirectory)
                    fu.writeToFile(
                        fu.joinPath(fu.userDirectoryPath, ".local",
                                    "applications", "HamsiManager.desktop"),
                        fileContent)
                self.isInstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
Beispiel #8
0
        def install(self):
            try:
                MApplication.processEvents()
                self.installationDirectory = str(
                    self.leInstallationDirectory.text())
                if len(self.installationDirectory) > 0:
                    if self.installationDirectory[-1] == fu.sep:
                        self.installationDirectory = self.installationDirectory[:
                                                                                -1]
                    if self.installationDirectory == fu.HamsiManagerDirectory:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(
                            translate("Install",
                                      "The path you selected is not valid."),
                            translate(
                                "Install",
                                "The selected path is Hamsi Manager source directory.<br>Please choose a valid installation path."
                            ))
                    elif fu.isFile(self.installationDirectory) is False:
                        isMakeInstall = True
                        if fu.isDir(self.installationDirectory) is False:
                            self.lblActions.setText(
                                translate("Install",
                                          "Creating Installation Folder..."))
                            fu.makeDirs(self.installationDirectory)
                        elif len(fu.listDir(self.installationDirectory)) > 0:
                            currenctAnswer = Dialogs.askSpecial(
                                translate(
                                    "Install",
                                    "The Installation Path You Selected Is Not Empty."
                                ),
                                translate(
                                    "Install",
                                    "If the path you selected is an \"Hamsi Manager\" installation path, <b>I recommend you to delete the older files.</b><br>Do you want me to clear the installation path/folder for you?<br><b>Note: </b> Your personal settings are <b>never deleted</b>."
                                ), translate("Install", "Yes (Recommended)"),
                                translate("Install", "No (Overwrite)"),
                                translate("Install", "Cancel"))
                            if currenctAnswer == translate(
                                    "Install", "Yes (Recommended)"):
                                self.lblActions.setText(
                                    translate("Install",
                                              "Clearing Installation Path..."))
                                try:
                                    fu.removeFileOrDir(
                                        self.installationDirectory)
                                except:
                                    pass
                                fu.makeDirs(self.installationDirectory)
                                isMakeInstall = True
                            elif currenctAnswer == translate(
                                    "Install", "No (Overwrite)"):
                                isMakeInstall = True
                            else:
                                isMakeInstall = False
                        if isMakeInstall:
                            Settings.setUniversalSetting(
                                "pathOfInstallationDirectory",
                                self.installationDirectory)
                            directoriesAndFiles = fu.readDirectoryWithSubDirectories(
                                fu.HamsiManagerDirectory)
                            self.prgbState.setRange(0,
                                                    len(directoriesAndFiles))
                            self.lblActions.setText(
                                translate("Install",
                                          "Copying Files And Folders..."))
                            installFileName = Execute.findExecutableBaseName(
                                "HamsiManagerInstaller")
                            for fileNo, fileName in enumerate(
                                    directoriesAndFiles):
                                MApplication.processEvents()
                                newFileName = self.installationDirectory + fileName.replace(
                                    fu.HamsiManagerDirectory, "")
                                if fu.isDir(fileName) and fileName.find(
                                        ".svn") == -1:
                                    try:
                                        fu.makeDirs(newFileName)
                                    except:
                                        pass
                                elif (fu.isFile(fileName) and
                                      fu.getBaseName(fileName) != "install.py"
                                      and fu.getBaseName(fileName) !=
                                      installFileName
                                      and fileName.find(".svn") == -1):
                                    try:
                                        fu.copyFileOrDir(fileName, newFileName)
                                    except:
                                        fileContent = fu.readFromBinaryFile(
                                            fileName)
                                        fu.writeToBinaryFile(
                                            newFileName, fileContent)
                                self.prgbState.setValue(fileNo + 1)
                            self.pageNo += 1
                            MyConfigure.installKDE4Languages()
                        else:
                            self.pageNo -= 1
                    else:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(
                            translate("Install",
                                      "The path you selected is not valid."),
                            translate(
                                "Install",
                                "The selected path points to a file not a folder.<br>Please choose a valid installation path."
                            ))
                else:
                    self.pageNo -= 1
                    self.lblActions.setText("")
                    Dialogs.showError(
                        translate("Install",
                                  "The path you selected is not valid."),
                        translate(
                            "Install",
                            "The selected path points to a file not a folder.<br>Please choose a valid installation path."
                        ))
                self.pageChanged(True)
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
Beispiel #9
0
 def installPlugin(self, _pluginName, _isQuiet=False):
     isInstalled = False
     pluginModule = __import__(
         "MyPlugins." + _pluginName, globals(), locals(), [
             "pluginName", "pluginFiles", "pluginDirectory",
             "installThisPlugin", "setupDirectory", "pluginVersion"
         ], 0)
     if pluginModule.installThisPlugin is None:
         if pluginModule.pluginDirectory == "":
             try:
                 fu.makeDirs(pluginModule.setupDirectory)
             except:
                 pass
             for pluginFile in pluginModule.pluginFiles:
                 fu.copyOrChange(
                     fu.joinPath(fu.HamsiManagerDirectory, "MyPlugins",
                                 _pluginName, pluginFile),
                     fu.joinPath(pluginModule.setupDirectory, pluginFile),
                     "file", "only", True)
                 MyConfigure.reConfigureFile(
                     fu.joinPath(pluginModule.setupDirectory, pluginFile))
             isInstalled = True
         else:
             oldFilePath = fu.joinPath(fu.HamsiManagerDirectory,
                                       "MyPlugins", _pluginName,
                                       pluginModule.pluginDirectory)
             newFilePath = fu.copyOrChange(
                 oldFilePath,
                 fu.joinPath(pluginModule.setupDirectory,
                             pluginModule.pluginDirectory), "directory",
                 "only", True)
             if newFilePath != oldFilePath:
                 isInstalled = True
     else:
         isInstalled = pluginModule.installThisPlugin()
     if isInstalled:
         Settings.setUniversalSetting(str(pluginModule.pluginName),
                                      str(pluginModule.pluginVersion))
         if _isQuiet is False:
             Dialogs.show(
                 translate("MyPlugins", "Plug-in Installation Is Complete"),
                 str(
                     translate("MyPlugins",
                               "\"%s\" is installed on your system.")) %
                 (pluginModule.pluginName))
     elif isInstalled == "AlreadyInstalled":
         if _isQuiet is False:
             Dialogs.show(
                 translate("MyPlugins", "Plug-in Already Installed"),
                 str(
                     translate("MyPlugins",
                               "\"%s\" already installed on your system."))
                 % (pluginModule.pluginName))
     else:
         if _isQuiet is False:
             Dialogs.showError(
                 translate("MyPlugins", "Plug-in Installation Failed"),
                 str(
                     translate("MyPlugins",
                               "\"%s\" failed to install on your system."))
                 % (pluginModule.pluginName))
Beispiel #10
0
 def reConfigure(self):
     try:
         oldPathOfExecutableHamsi = Settings.getUniversalSetting(
             "HamsiManagerExecutableLinkPath", "/usr/bin/hamsi")
         if fu.isFile(
                 fu.joinPath(fu.HamsiManagerDirectory,
                             "HamsiManager.desktop")):
             if fu.isWritableFileOrDir(
                     fu.joinPath(fu.HamsiManagerDirectory,
                                 "HamsiManager.desktop")):
                 MyConfigure.reConfigureFile(
                     fu.joinPath(fu.HamsiManagerDirectory,
                                 "HamsiManager.desktop"))
         if self.isCreateDesktopShortcut is not None:
             if self.isCreateDesktopShortcut.checkState() == Mt.Checked:
                 desktopPath = uni.getUserDesktopPath()
                 if uni.isWindows:
                     MyConfigure.createShortCutFile(
                         fu.joinPath(desktopPath, "Hamsi Manager.lnk"))
                 else:
                     fileContent = MyConfigure.getConfiguredDesktopFileContent(
                     )
                     fu.writeToFile(
                         fu.joinPath(desktopPath, "HamsiManager.desktop"),
                         fileContent)
         if uni.isRunningAsRoot():
             executableLink = str(self.leExecutableLink.text())
             if self.isCreateExecutableLink is not None:
                 if self.isCreateExecutableLink.checkState() == Mt.Checked:
                     if executableLink.strip() != "":
                         HamsiManagerFileName = Execute.findExecutableBaseName(
                             "HamsiManager")
                         if fu.isFile(executableLink):
                             fu.removeFileOrDir(executableLink)
                         fu.createSymLink(
                             fu.joinPath(fu.HamsiManagerDirectory,
                                         HamsiManagerFileName),
                             executableLink)
                         Settings.setUniversalSetting(
                             "HamsiManagerExecutableLinkPath",
                             executableLink)
                         if oldPathOfExecutableHamsi != executableLink:
                             if fu.isFile(oldPathOfExecutableHamsi):
                                 answer = Dialogs.ask(
                                     translate(
                                         "Reconfigure",
                                         "Other Hamsi Manager Was Detected"
                                     ),
                                     str(
                                         translate(
                                             "Reconfigure",
                                             "Other Hamsi Manager executable file was detected. Are you want to delete old executable file? You can delete this old executable file : \"%s\""
                                         )) % (oldPathOfExecutableHamsi))
                                 if answer != Dialogs.Yes:
                                     fu.removeFile(oldPathOfExecutableHamsi)
                     if fu.isDir("/usr/share/applications/"):
                         fileContent = MyConfigure.getConfiguredDesktopFileContent(
                         )
                         fu.writeToFile(
                             "/usr/share/applications/HamsiManager.desktop",
                             fileContent)
         if uni.isRunningAsRoot() is False:
             if fu.isDir(
                     fu.joinPath(fu.userDirectoryPath, ".local",
                                 "applications")) is False:
                 fu.makeDirs(
                     fu.joinPath(fu.userDirectoryPath, ".local",
                                 "applications"))
             fileContent = MyConfigure.getConfiguredDesktopFileContent()
             fu.writeToFile(
                 fu.joinPath(fu.userDirectoryPath, ".local", "applications",
                             "HamsiManager.desktop"), fileContent)
         MyConfigure.installKDE4Languages()
         self.isInstallFinished = True
     except:
         ReportBug.ReportBug()