Ejemplo n.º 1
0
 def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
     try:
         if uni.getBoolValue("isForceOpenWithDefaultApplication"):
             _path = fu.checkSource(_filePath)
             Execute.openWith([_path])
         else:
             _path = fu.checkSource(_filePath, "file", False)
             if _path is not None:
                 isOpened = False
                 mtype = fu.getMimeType(_path)
                 if mtype[0] is not None:
                     if mtype[0].split("/")[0] == "text":
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif mtype[0].split("/")[0] == "audio":
                         if Taggers.getTagger(True) is not None:
                             MusicDetails.MusicDetails(_path, _isOpenDetailsOnNewWindow)
                             isOpened = True
                     elif mtype[0].split("/")[0] == "image":
                         ImageDetails.ImageDetails(_path, "file", _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 else:
                     if fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 if isOpened is False:
                     if uni.getBoolValue("isOpenWithDefaultApplication"):
                         Execute.openWith([_path])
                     else:
                         Dialogs.showError(translate("Details", "File Is Not Supported"),
                                           str(translate("Details",
                                                         "\"%s\" couldn't opened. This file is not supported.")) % Organizer.getLink(
                                               str(_path)))
             elif fu.isDir(_filePath):
                 if uni.getBoolValue("isOpenWithDefaultApplication"):
                     Execute.openWith([_filePath])
                 else:
                     Dialogs.showError(translate("Details", "Directories Is Not Supported"),
                                       str(translate("Details",
                                                     "\"%s\" couldn't opened. Directories is not supported to show details.")) % Organizer.getLink(
                                           str(_filePath)))
             else:
                 Dialogs.showError(translate("Details", "File Is Not Exist"),
                                   str(translate("Details",
                                                 "\"%s\" couldn't opened. This file is not exist.")) % Organizer.getLink(
                                       str(_filePath)))
     except:
         answer = Dialogs.askSpecial(translate("Details", "File Couldn't Opened"),
                                     str(translate("Details",
                                                   "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us.")) % Organizer.getLink(
                                         str(_filePath)),
                                     translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None)
         if answer == translate("QuickMake", "Report This Bug"):
             ReportBug.ReportBug()
Ejemplo n.º 2
0
 def checkFileExtensions(self,
                         _columnKey,
                         _columnKeyOfSource,
                         _isCheckFile=False):
     columnNo = self.getColumnNoFromKey(_columnKey)
     isYesToAll, isNoToAll = False, False
     for rowNo in range(self.rowCount()):
         if _isCheckFile:
             if fu.isFile(self.values[rowNo]["path"]) is False:
                 continue
         if _columnKey == _columnKeyOfSource:
             sFileExt = fu.getFileExtension(
                 self.values[rowNo][_columnKeyOfSource])
             sFilePath = self.values[rowNo]["path"]
         else:
             columnNoOfSource = self.getColumnNoFromKey(_columnKeyOfSource)
             sFileExt = fu.getFileExtension(
                 str(self.item(rowNo, columnNoOfSource).text()))
             sFilePath = str(self.item(rowNo, _columnKeyOfSource).text())
         cFileName = str(self.item(rowNo, columnNo).text())
         if sFileExt != "":
             if fu.getFileExtension(cFileName) != sFileExt:
                 if isYesToAll:
                     answer = Dialogs.Yes
                 elif isNoToAll:
                     answer = Dialogs.No
                 else:
                     answer = Dialogs.askSpecial(
                         translate("Tables", "Incorrect File Extension"),
                         str(
                             translate(
                                 "Tables",
                                 "\"%s\": the file extension is different from the source file extension.<br>Do you want to set the source file extension?<br><b>Source file : </b>\"%s\""
                             )) % (cFileName, sFilePath),
                         translate("Dialogs", "Yes"),
                         translate("Dialogs", "No"),
                         translate("Dialogs", "Yes To All"),
                         translate("Dialogs", "No To All"))
                 if answer == translate("Dialogs", "Yes To All"):
                     isYesToAll = True
                     answer = Dialogs.Yes
                 elif answer == translate("Dialogs", "No To All"):
                     isNoToAll = True
                     answer = Dialogs.No
                 if answer == Dialogs.Yes or answer == translate(
                         "Dialogs", "Yes"):
                     self.item(rowNo, columnNo).setText(
                         str(cFileName + "." + sFileExt))
Ejemplo n.º 3
0
 def askHiddenColumn(self, _columnKey, _isYesToAll=True):
     if _isYesToAll is False:
         self.isAskShowHiddenColumn = True
     if self.isAskShowHiddenColumn:
         if _isYesToAll:
             answer = Dialogs.askSpecial(
                 translate("Tables", "Hidden Field"),
                 str(
                     translate(
                         "Tables",
                         "\"%s\": you have hidden this field in the table.<br>Do you want to activate this field and perform the action?"
                     )) % (self.getColumnNameFromKey(_columnKey)),
                 translate("Dialogs", "Yes"), translate("Dialogs", "No"),
                 translate("Dialogs", "Yes To All"))
         else:
             answer = Dialogs.ask(
                 translate("Tables", "Hidden Field"),
                 str(
                     translate(
                         "Tables",
                         "\"%s\": you have hidden this field in the table.<br>Do you want to activate this field and perform the action?"
                     )) % (self.getColumnNameFromKey(_columnKey)))
         if answer == Dialogs.No or answer == translate("Dialogs", "No"):
             Dialogs.showError(
                 translate("Tables", "Action Cancelled"),
                 translate(
                     "Tables",
                     "You have cancelled the action.<br>You can make the necessary changes and reperform the action."
                 ))
             return False
         elif answer == translate("Dialogs", "Yes To All"):
             self.isAskShowHiddenColumn = False
     self.mContextMenuColumnsActions[self.getColumnNoFromKey(
         _columnKey)].setChecked(True)
     self.refreshShowedAndHiddenColumns()
     return True
Ejemplo n.º 4
0
                        fu.removeFileOrDir(
                            fu.joinPath(fu.userDirectoryPath, ".local",
                                        "applications",
                                        "HamsiManager.desktop"))
                self.isUninstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()

    if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
        answer = Dialogs.askSpecial(
            translate("Uninstall", "Are You Want To Run As Root?"),
            translate(
                "Uninstall",
                "Hamsi Manager Uninstaller is running with user privileges.<br>Do you want to run Hamsi Manager Uninstaller with root rights?"
            ), translate("Uninstall", "Yes"),
            translate("Uninstall", "No (Continue as is)"), None)
        if answer == translate("Uninstall", "Yes"):
            NewApp = Execute.executeAsRootWithThread([],
                                                     "HamsiManagerUninstaller")
            sys.exit()
    try:
        MainWidget = Main()
        MainWidget.setWindowTitle(
            translate("Uninstall", "Hamsi Manager Uninstaller") + " " +
            uni.version)
        MainWidget.setGeometry(300, 300, 650, 350)
        MainWidget.show()
        uni.isStartingSuccessfully = True
Ejemplo n.º 5
0
    def __init__(self, _errorDetails="", _pathOfReportFile=None):
        global isClose
        currentMainWindow = getMainWindow()
        if uni.isStartingSuccessfully:
            isShowFixMe = False
        else:
            isShowFixMe = True
        if currentMainWindow is None:
            setMainWindow(self)
        try: MDialog.__init__(self, currentMainWindow)
        except: MDialog.__init__(self, None)
        self.pathOfReportFile = _pathOfReportFile
        self.namMain = None
        self.nrqPost = None
        self.nrpBack = None
        isClose = False
        try:
            if isActivePyKDE4:
                self.setButtons(MDialog.NoDefault)
        except: pass

        try:
            if Dialogs.pnlState is not None:
                Dialogs.showState("", 1, 1)
        except: pass
        pnlMain = MWidget(self)
        self.vblMain = MVBoxLayout(pnlMain)
        self.pbtnSendAndClose = MPushButton(translate("ReportBug", "Send And Close"))
        self.pbtnCancel = MPushButton(translate("ReportBug", "Cancel"))
        self.connect(self.pbtnSendAndClose, SIGNAL("clicked()"), self.sendAndClose)
        self.connect(self.pbtnCancel, SIGNAL("clicked()"), self.cancel)
        self.pbtnShowDetailsPage = MPushButton(translate("ReportBug", "Show Details File"))
        self.pbtnCheckUpdate = MPushButton(translate("ReportBug", "Check Update"))
        self.cckbIsSendTableContents = Options.MyCheckBox(self, translate("ReportBug",
                                                                          "Send Table Contents For More Details"), 0,
                                                          _stateChanged=self.isSendTableContents)
        self.teErrorDetails = MTextEdit()
        try:
            self.teErrorDetails.setHtml(str(_errorDetails.replace("<hr>", "")))
        except:
            self.teErrorDetails.setHtml(translate("ReportBug",
                                                  "I cannot send the error details due to some character errors.<br>To see the details, please click on the \"Show details file\" button."))
            self.teErrorDetails.setEnabled(False)
        self.connect(self.pbtnShowDetailsPage, SIGNAL("clicked()"), self.showDetailsPage)
        self.connect(self.pbtnCheckUpdate, SIGNAL("clicked()"), self.checkUpdate)
        self.teErrorDetails.setMinimumHeight(220)
        self.vblMain.addWidget(self.teErrorDetails, 20)
        self.vblMain.addWidget(self.cckbIsSendTableContents, 1)
        lblUserNotes = MLabel(translate("ReportBug", "Notes : "))
        lblName = MLabel(translate("ReportBug", "Name And Surname : "))
        lblEMailAddress = MLabel(translate("ReportBug", "E-mail Address : "))
        lblAlert = MLabel(translate("ReportBug",
                                    "Note : Will be kept strictly confidential. It will be used solely to learn information about of your report."))
        self.teUserNotes = MTextEdit(self)
        self.leName = MLineEdit(self)
        self.leEMailAddress = MLineEdit(self)
        hbox1 = MHBoxLayout()
        hbox1.addWidget(lblUserNotes, 1)
        hbox1.addWidget(self.teUserNotes, 20)
        hbox2 = MHBoxLayout()
        hbox2.addWidget(lblName, 1)
        hbox2.addWidget(self.leName, 20)
        hbox3 = MHBoxLayout()
        hbox3.addWidget(lblEMailAddress, 1)
        hbox3.addWidget(self.leEMailAddress, 20)
        hbox0 = MHBoxLayout()
        hbox0.addWidget(self.pbtnShowDetailsPage, 1)
        hbox0.addWidget(self.pbtnCheckUpdate, 1)
        hbox0.addStretch(2)
        hbox0.addWidget(self.pbtnSendAndClose, 1)
        hbox0.addWidget(self.pbtnCancel, 1)
        VBox1 = MVBoxLayout()
        VBox1.addLayout(hbox2)
        VBox1.addLayout(hbox3)
        VBox1.addWidget(lblAlert)
        gboxContactInformations = MGroupBox(translate("ReportBug", "Contact Informations : "))
        gboxContactInformations.setLayout(VBox1)
        self.vblMain.addLayout(hbox1, 1)
        self.vblMain.addWidget(gboxContactInformations, 1)
        self.vblMain.addLayout(hbox0, 1)
        try:
            if isActivePyKDE4:
                self.setMainWidget(pnlMain)
            else:
                self.setLayout(self.vblMain)
        except:
            self.setLayout(self.vblMain)
        self.setWindowTitle(translate("ReportBug", "Please Report This Bug!.."))
        self.setMaximumSize(600, 375)
        self.show()
        self.setMaximumSize(10000, 10000)
        if isShowFixMe and isQuickMake is False and uni.loggingLevel != logging.DEBUG:
            try:
                answer = Dialogs.askSpecial(translate("ReportBug", "I Have A Suggestion!"),
                                            translate("ReportBug", "<b>Please check the following: ;</b><br>" +
                                                      "<b>1-)</b>If you have received this error when you were checking the last folder, reset the \"Last Directory\",<br>" +
                                                      "<b>2-)</b>If you have received this error due to your changed settings, reset the \"Settings\",<br>" +
                                                      "<b>3-)</b>If you continue to receive this error even after resetting the settings, reset \"All\".<br>" +
                                                      "<br><b>You can enable Hamsi Manager to run as normal.<br>Please take a moment to send us the error report.</b>"),
                                            translate("ReportBug", "Last Directory"),
                                            translate("ReportBug", "All"),
                                            translate("ReportBug", "Settings"),
                                            translate("ReportBug", "Ignore"))
                if answer == translate("ReportBug", "Last Directory"):
                    Settings.setting().setValue("lastDirectory", trQVariant(fu.userDirectoryPath))
                elif answer == translate("ReportBug", "Settings"):
                    Settings.reFillSettings(True)
                elif answer == translate("ReportBug", "All"):
                    Settings.reFillAll(True)
            except: pass
Ejemplo n.º 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()
Ejemplo n.º 7
0
 def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
     try:
         if uni.getBoolValue("isForceOpenWithDefaultApplication"):
             _path = fu.checkSource(_filePath)
             Execute.openWith([_path])
         else:
             _path = fu.checkSource(_filePath, "file", False)
             if _path is not None:
                 isOpened = False
                 mtype = fu.getMimeType(_path)
                 if mtype[0] is not None:
                     if mtype[0].split("/")[0] == "text":
                         TextDetails.TextDetails(_path,
                                                 _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif mtype[0].split("/")[0] == "audio":
                         if Taggers.getTagger(True) is not None:
                             MusicDetails.MusicDetails(
                                 _path, _isOpenDetailsOnNewWindow)
                             isOpened = True
                     elif mtype[0].split("/")[0] == "image":
                         ImageDetails.ImageDetails(
                             _path, "file", _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path,
                                                 _isOpenDetailsOnNewWindow)
                         isOpened = True
                 else:
                     if fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path,
                                                 _isOpenDetailsOnNewWindow)
                         isOpened = True
                 if isOpened is False:
                     if uni.getBoolValue("isOpenWithDefaultApplication"):
                         Execute.openWith([_path])
                     else:
                         Dialogs.showError(
                             translate("Details", "File Is Not Supported"),
                             str(
                                 translate(
                                     "Details",
                                     "\"%s\" couldn't opened. This file is not supported."
                                 )) % Organizer.getLink(str(_path)))
             elif fu.isDir(_filePath):
                 if uni.getBoolValue("isOpenWithDefaultApplication"):
                     Execute.openWith([_filePath])
                 else:
                     Dialogs.showError(
                         translate("Details",
                                   "Directories Is Not Supported"),
                         str(
                             translate(
                                 "Details",
                                 "\"%s\" couldn't opened. Directories is not supported to show details."
                             )) % Organizer.getLink(str(_filePath)))
             else:
                 Dialogs.showError(
                     translate("Details", "File Is Not Exist"),
                     str(
                         translate(
                             "Details",
                             "\"%s\" couldn't opened. This file is not exist."
                         )) % Organizer.getLink(str(_filePath)))
     except:
         answer = Dialogs.askSpecial(
             translate("Details", "File Couldn't Opened"),
             str(
                 translate(
                     "Details",
                     "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us."
                 )) % Organizer.getLink(str(_filePath)),
             translate("QuickMake", "Report This Bug"),
             translate("QuickMake", "OK"), None)
         if answer == translate("QuickMake", "Report This Bug"):
             ReportBug.ReportBug()
Ejemplo n.º 8
0
                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()

    if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
        answer = Dialogs.askSpecial(translate("Install", "Are You Want To Run As Root?"), translate("Install",
                                                                                                    "Hamsi Manager Installer is running with user privileges.<br>Do you want to run Hamsi Manager installer with root rights?<br><b>Note: </b>The other users on your system has to inherit these permissions and install the program to a location other than their /home directories."),
                                    translate("Install", "Yes"), translate("Install", "No (Continue as is)"), None)
        if answer == translate("Install", "Yes"):
            NewApp = Execute.executeAsRootWithThread([], "HamsiManagerInstaller")
            sys.exit()
    try:
        MainWidget = Main()
        MainWidget.setWindowTitle(translate("Install", "Hamsi Manager Installer") + " " + uni.version)
        MainWidget.setGeometry(300, 300, 650, 350)
        MainWidget.show()
        uni.isStartingSuccessfully = True
    except:
        from Core import ReportBug

        ReportBug.ReportBug()
    sys.exit(HamsiManagerApp.exec_())
Ejemplo n.º 9
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()
Ejemplo n.º 10
0
                    fu.writeToFile(
                        fu.joinPath(fu.userDirectoryPath, ".local",
                                    "applications", "HamsiManager.desktop"),
                        fileContent)
                self.isInstallFinished = True
                self.close()
            except:
                from Core import ReportBug

                ReportBug.ReportBug()

    if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
        answer = Dialogs.askSpecial(
            translate("Install", "Are You Want To Run As Root?"),
            translate(
                "Install",
                "Hamsi Manager Installer is running with user privileges.<br>Do you want to run Hamsi Manager installer with root rights?<br><b>Note: </b>The other users on your system has to inherit these permissions and install the program to a location other than their /home directories."
            ), translate("Install", "Yes"),
            translate("Install", "No (Continue as is)"), None)
        if answer == translate("Install", "Yes"):
            NewApp = Execute.executeAsRootWithThread([],
                                                     "HamsiManagerInstaller")
            sys.exit()
    try:
        MainWidget = Main()
        MainWidget.setWindowTitle(
            translate("Install", "Hamsi Manager Installer") + " " +
            uni.version)
        MainWidget.setGeometry(300, 300, 650, 350)
        MainWidget.show()
        uni.isStartingSuccessfully = True
Ejemplo n.º 11
0
 def __init__(self):
     if len(QuickMakeParameters) > 1 or (len(QuickMakeParameters) == 1 and (
                 QuickMakeParameters[0] == "plugins" or QuickMakeParameters[0] == "configurator")):
         answer = None
         makeThisAction = None
         actionName = None
         isShowQuickMakeWindow = True
         tempWindow = MMainWindow()
         self.quickMakeWindow = QuickMakeWindow()
         setMainWindow(self.quickMakeWindow)
         isShowEmendWidgets = False
         isCorrectCommand = True
         if QuickMakeParameters[0] == "configurator":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.configurator
             actionName = translate("QuickMake", "Hamsi Manager Configurator")
         elif QuickMakeParameters[0] == "plugins":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.plugins
             actionName = translate("QuickMake", "My Plugins")
         elif QuickMakeParameters[0] == "pack":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.pack
             actionName = translate("QuickMake", "Pack It Now")
         elif QuickMakeParameters[0] == "hash":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.hash
             actionName = translate("QuickMake", "Get Hash Digest")
         elif QuickMakeParameters[0] == "checkIcon":
             makeThisAction = self.quickMakeWindow.checkIcon
             actionName = translate("QuickMake", "Check Directory Icon Now")
         elif QuickMakeParameters[0] == "clearEmptyDirectories":
             makeThisAction = self.quickMakeWindow.clearEmptyDirectories
             actionName = translate("QuickMake", "Clear Empty Directories Now")
         elif QuickMakeParameters[0] == "clearUnneededs":
             makeThisAction = self.quickMakeWindow.clearUnneededs
             actionName = translate("QuickMake", "Clear Unneededs Now")
         elif QuickMakeParameters[0] == "clearIgnoreds":
             makeThisAction = self.quickMakeWindow.clearIgnoreds
             actionName = translate("QuickMake", "Clear Ignoreds Now")
         elif QuickMakeParameters[0] == "emendFile":
             isShowEmendWidgets = True
             makeThisAction = self.quickMakeWindow.emendFile
             actionName = translate("QuickMake", "Auto Emend Now")
         elif QuickMakeParameters[0] == "emendDirectory":
             isShowEmendWidgets = True
             makeThisAction = self.quickMakeWindow.emendDirectory
             actionName = translate("QuickMake", "Auto Emend Now")
         elif QuickMakeParameters[0] == "emendDirectoryWithContents":
             isShowEmendWidgets = True
             makeThisAction = self.quickMakeWindow.emendDirectoryWithContents
             actionName = translate("QuickMake", "Auto Emend Now (With Contents)")
         elif QuickMakeParameters[0] == "copyPath":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.copyPath
             actionName = translate("QuickMake", "Copy Path To Clipboard")
         elif QuickMakeParameters[0] == "fileTree":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.fileTree
             actionName = translate("QuickMake", "Build File Tree")
         elif QuickMakeParameters[0] == "removeOnlySubFiles":
             makeThisAction = self.quickMakeWindow.removeOnlySubFiles
             actionName = translate("QuickMake", "Remove Sub Files")
         elif QuickMakeParameters[0] == "clear":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.clear
             actionName = translate("QuickMake", "Clear It Now")
         elif QuickMakeParameters[0] == "textCorrector":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.textCorrector
             actionName = translate("QuickMake", "Text Corrector")
         elif QuickMakeParameters[0] == "search":
             isShowQuickMakeWindow = False
             makeThisAction = self.quickMakeWindow.search
             actionName = translate("QuickMake", "Search")
         else:
             isCorrectCommand = False
         if isCorrectCommand:
             if isShowQuickMakeWindow:
                 if uni.getBoolValue("isShowQuickMakeWindow"):
                     self.quickMakeWindow.createWindow(actionName, makeThisAction, isShowEmendWidgets)
                     self.quickMakeWindow.show()
                 else:
                     makeThisAction()
             else:
                 makeThisAction()
         else:
             answer = Dialogs.askSpecial(translate("QuickMake", "Incorrect Command"),
                                         translate("QuickMake",
                                                   "Your action unable to process.Please try again or report this bug."),
                                         translate("QuickMake", "Report This Bug"), translate("QuickMake", "Close"))
     else:
         answer = Dialogs.askSpecial(translate("QuickMake", "Missing Command"),
                                     translate("QuickMake",
                                               "Your action unable to process.Please try again or report this bug."),
                                     translate("QuickMake", "Report This Bug"), translate("QuickMake", "Close"))
     if answer == translate("QuickMake", "Report This Bug"):
         ReportBug.ReportBug(True)
Ejemplo n.º 12
0
                    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()

    if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
        answer = Dialogs.askSpecial(translate("Uninstall", "Are You Want To Run As Root?"), translate("Uninstall",
                                                                                                      "Hamsi Manager Uninstaller is running with user privileges.<br>Do you want to run Hamsi Manager Uninstaller with root rights?"),
                                    translate("Uninstall", "Yes"), translate("Uninstall", "No (Continue as is)"), None)
        if answer == translate("Uninstall", "Yes"):
            NewApp = Execute.executeAsRootWithThread([], "HamsiManagerUninstaller")
            sys.exit()
    try:
        MainWidget = Main()
        MainWidget.setWindowTitle(translate("Uninstall", "Hamsi Manager Uninstaller") + " " + uni.version)
        MainWidget.setGeometry(300, 300, 650, 350)
        MainWidget.show()
        uni.isStartingSuccessfully = True
    except:
        from Core import ReportBug

        ReportBug.ReportBug()
    sys.exit(HamsiManagerApp.exec_())