コード例 #1
0
ファイル: uninstall.py プロジェクト: sahwar/hamsi-manager
        def createPage(self, _pageNo):
            pnlPage = MWidget()
            HBox = MHBoxLayout()
            pnlPage.setLayout(HBox)
            if _pageNo == 0:
                VBox = MVBoxLayout()
                self.lblAreYouSure = MLabel(
                    translate(
                        "Uninstall",
                        "Are you sure you want to uninstall Hamsi Manager?"))
                VBox.addStretch(10)
                VBox.addWidget(self.lblAreYouSure)
                VBox.addStretch(10)
                HBox.addLayout(VBox)
            if _pageNo == 1:
                lblPleaseSelect = MLabel(
                    translate(
                        "Uninstall",
                        "Please Select Directory Of Hamsi Manager To Uninstall."
                    ))
                UninstallationDirPath = fu.getDirName(
                    str(
                        Settings.getUniversalSetting(
                            "HamsiManagerPath",
                            str(fu.HamsiManagerDirectory))))
                self.leUninstallationDirectory = MLineEdit(
                    str(
                        Settings.getUniversalSetting(
                            "pathOfInstallationDirectory",
                            str(UninstallationDirPath))))
                self.pbtnSelectUninstallationDirectory = MPushButton(
                    translate("Uninstall", "Browse"))
                self.connect(self.pbtnSelectUninstallationDirectory,
                             SIGNAL("clicked()"),
                             self.selectUninstallationDirectory)
                VBox = MVBoxLayout()
                VBox.addStretch(2)
                VBox.addWidget(lblPleaseSelect)
                HBox1 = MHBoxLayout()
                HBox1.addWidget(self.leUninstallationDirectory)
                HBox1.addWidget(self.pbtnSelectUninstallationDirectory)
                VBox.addLayout(HBox1)
                VBox.addStretch(2)
                HBox.addLayout(VBox)
            elif _pageNo == 2:
                import MyPlugins

                self.lblFinished = MLabel(
                    translate("Uninstall", "Uninstallation Completed."))
                VBox = MVBoxLayout()
                VBox.addStretch(2)
                VBox.addWidget(self.lblFinished)
                VBox.addStretch(2)
                wPlugins = MyPlugins.MyPluginsForSystem(pnlPage, "uninstall")
                VBox.addWidget(wPlugins)
                VBox.addStretch(2)
                HBox.addLayout(VBox)
            return pnlPage
コード例 #2
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 def fillPlugins(self):
     self.lstwPluginList.clear()
     self.myPluginsNames = []
     for plugin in uni.getMyPluginsNames():
         pluginModule = __import__(
             "MyPlugins." + plugin, globals(), locals(),
             ["pluginName", "pluginVersion", "isInstallable"], 0)
         if pluginModule.isInstallable():
             installedVersion = Settings.getUniversalSetting(
                 str(pluginModule.pluginName), "")
             if installedVersion == "":
                 details = translate("MyPlugins", "Could Not Be Determined")
             elif installedVersion != pluginModule.pluginVersion:
                 details = translate("MyPlugins", "Have A New Version")
             else:
                 details = translate("MyPlugins", "Installed")
             self.lstwPluginList.addItem(
                 str(pluginModule.pluginName) + "\n\t" + details)
             self.myPluginsNames.append(plugin)
     if self.lstwPluginList.count() == 0:
         self.lstwPluginList.addItem(
             translate(
                 "MyPlugins",
                 "Could not find the appropriate plug-in to your system"))
         self.pbtnInstall.setEnabled(False)
コード例 #3
0
ファイル: uninstall.py プロジェクト: supermurat/hamsi-manager
        def createPage(self, _pageNo):
            pnlPage = MWidget()
            HBox = MHBoxLayout()
            pnlPage.setLayout(HBox)
            if _pageNo == 0:
                VBox = MVBoxLayout()
                self.lblAreYouSure = MLabel(translate("Uninstall", "Are you sure you want to uninstall Hamsi Manager?"))
                VBox.addStretch(10)
                VBox.addWidget(self.lblAreYouSure)
                VBox.addStretch(10)
                HBox.addLayout(VBox)
            if _pageNo == 1:
                lblPleaseSelect = MLabel(
                    translate("Uninstall", "Please Select Directory Of Hamsi Manager To Uninstall."))
                UninstallationDirPath = fu.getDirName(
                    str(Settings.getUniversalSetting("HamsiManagerPath", str(fu.HamsiManagerDirectory))))
                self.leUninstallationDirectory = MLineEdit(
                    str(Settings.getUniversalSetting("pathOfInstallationDirectory", str(UninstallationDirPath))))
                self.pbtnSelectUninstallationDirectory = MPushButton(translate("Uninstall", "Browse"))
                self.connect(self.pbtnSelectUninstallationDirectory, SIGNAL("clicked()"),
                             self.selectUninstallationDirectory)
                VBox = MVBoxLayout()
                VBox.addStretch(2)
                VBox.addWidget(lblPleaseSelect)
                HBox1 = MHBoxLayout()
                HBox1.addWidget(self.leUninstallationDirectory)
                HBox1.addWidget(self.pbtnSelectUninstallationDirectory)
                VBox.addLayout(HBox1)
                VBox.addStretch(2)
                HBox.addLayout(VBox)
            elif _pageNo == 2:
                import MyPlugins

                self.lblFinished = MLabel(translate("Uninstall", "Uninstallation Completed."))
                VBox = MVBoxLayout()
                VBox.addStretch(2)
                VBox.addWidget(self.lblFinished)
                VBox.addStretch(2)
                wPlugins = MyPlugins.MyPluginsForSystem(pnlPage, "uninstall")
                VBox.addWidget(wPlugins)
                VBox.addStretch(2)
                HBox.addLayout(VBox)
            return pnlPage
コード例 #4
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()
コード例 #5
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
 def fillPlugins(self):
     self.lstwPluginList.clear()
     self.myPluginsNames = []
     for plugin in uni.getMyPluginsNames():
         pluginModule = __import__("MyPlugins." + plugin, globals(), locals(),
                                   ["pluginName", "pluginVersion", "isInstallable"], 0)
         if pluginModule.isInstallable():
             installedVersion = Settings.getUniversalSetting(str(pluginModule.pluginName), "")
             if installedVersion == "":
                 details = translate("MyPlugins", "Could Not Be Determined")
             elif installedVersion != pluginModule.pluginVersion:
                 details = translate("MyPlugins", "Have A New Version")
             else:
                 details = translate("MyPlugins", "Installed")
             self.lstwPluginList.addItem(str(pluginModule.pluginName) + "\n\t" + details)
             self.myPluginsNames.append(plugin)
     if self.lstwPluginList.count() == 0:
         self.lstwPluginList.addItem(translate("MyPlugins", "Could not find the appropriate plug-in to your system"))
         self.pbtnInstall.setEnabled(False)
コード例 #6
0
ファイル: uninstall.py プロジェクト: sahwar/hamsi-manager
        def finish(self):
            try:
                if uni.isRunningAsRoot():
                    executableLink = Settings.getUniversalSetting(
                        "HamsiManagerExecutableLinkPath",
                        str("/usr/bin/hamsi"))
                    if fu.isFile(executableLink) or fu.isLink(executableLink):
                        fu.removeFileOrDir(executableLink)
                else:
                    desktopPath = uni.getUserDesktopPath()
                    if uni.isWindows:
                        if fu.isFile(
                                fu.joinPath(desktopPath, "Hamsi Manager.lnk")):
                            fu.removeFileOrDir(
                                fu.joinPath(desktopPath, "Hamsi Manager.lnk"))
                    else:
                        if fu.isFile(
                                fu.joinPath(desktopPath,
                                            "HamsiManager.desktop")):
                            fu.removeFileOrDir(
                                fu.joinPath(desktopPath,
                                            "HamsiManager.desktop"))
                    if fu.isFile(
                            fu.joinPath(fu.userDirectoryPath, ".local",
                                        "applications",
                                        "HamsiManager.desktop")):
                        fu.removeFileOrDir(
                            fu.joinPath(fu.userDirectoryPath, ".local",
                                        "applications",
                                        "HamsiManager.desktop"))
                self.isUninstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
コード例 #7
0
ファイル: uninstall.py プロジェクト: supermurat/hamsi-manager
        def finish(self):
            try:
                if uni.isRunningAsRoot():
                    executableLink = Settings.getUniversalSetting("HamsiManagerExecutableLinkPath",
                                                                  str("/usr/bin/hamsi"))
                    if fu.isFile(executableLink) or fu.isLink(executableLink):
                        fu.removeFileOrDir(executableLink)
                else:
                    desktopPath = uni.getUserDesktopPath()
                    if uni.isWindows:
                        if fu.isFile(fu.joinPath(desktopPath, "Hamsi Manager.lnk")):
                            fu.removeFileOrDir(fu.joinPath(desktopPath, "Hamsi Manager.lnk"))
                    else:
                        if fu.isFile(fu.joinPath(desktopPath, "HamsiManager.desktop")):
                            fu.removeFileOrDir(fu.joinPath(desktopPath, "HamsiManager.desktop"))
                    if fu.isFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop")):
                        fu.removeFileOrDir(
                            fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"))
                self.isUninstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
コード例 #8
0
ファイル: install.py プロジェクト: supermurat/hamsi-manager
 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
コード例 #9
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
コード例 #10
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
コード例 #11
0
ファイル: Configurator.py プロジェクト: sahwar/hamsi-manager
 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()
コード例 #12
0
ファイル: Configurator.py プロジェクト: sahwar/hamsi-manager
    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