def willDownload(self, _request):
        try:
            defaultFileName = str(MFileInfo(str(trStr(_request.url()))).fileName())
            fileDialogTitle = translate("UpdateControl", "You Can Click Cancel To Update Without Saving The Package.")
            if self.isNotInstall:
                fileDialogTitle = translate("UpdateControl", "Save New Version Of Hamsi Manager")
            fileName = Dialogs.getSaveFileName(fileDialogTitle,
                                               fu.joinPath(fu.getDirName(fu.HamsiManagerDirectory), defaultFileName))
            if self.isNotInstall is False or fileName is not None:
                if fileName is None:
                    import random

                    fileName = fu.joinPath(fu.getTempDir(), defaultFileName[:-7] + "-" + str(
                        random.randrange(0, 1000000)) + defaultFileName[-7:])
                self.pbtnDownloadAndInstall.setEnabled(False)
                newRequest = _request
                newRequest.setAttribute(MNetworkRequest.User, trQVariant(fileName))
                networkManager = self.wvWeb.page().networkAccessManager()
                reply = networkManager.get(newRequest)
                self.isFileExist = True
                self.connect(reply, SIGNAL("downloadProgress(qint64,qint64)"), self.downloading)
                self.connect(reply, SIGNAL("finished()"), self.downloaded)
                self.connect(reply, SIGNAL("error(QNetworkReply::NetworkError)"), self.errorOccurred)
        except:
            ReportBug.ReportBug()
 def destinationClicked(self):
     imagePath = Dialogs.getSaveFileName(translate("ImageDetails", "Save As"),
                                         self.lePathOfDestination.text(), str(
             translate("ImageDetails", "Images (*.%s)") % uni.getStringFromList(uni.getListValue("imageExtensions"),
                                                                                " *.")), 0)
     if imagePath is not None:
         self.lePathOfDestination.setText(imagePath)
Beispiel #3
0
 def destinationClicked(self):
     imagePath = Dialogs.getSaveFileName(
         translate("ImageDetails", "Save As"),
         self.lePathOfDestination.text(),
         str(
             translate("ImageDetails", "Images (*.%s)") %
             uni.getStringFromList(uni.getListValue("imageExtensions"),
                                   " *.")), 0)
     if imagePath is not None:
         self.lePathOfDestination.setText(imagePath)
 def saveAsImage(self):
     try:
         if self.lstwImages.currentRow() != -1:
             imagePath = Dialogs.getSaveFileName(translate("MusicDetails", "Save As"),
                                                 fu.getDirName(self.musicValues["path"]),
                                                 str(translate("MusicDetails", "Images (*.%s)")) % (str(
                                                     self.musicValues["images"][self.lstwImages.currentRow()][
                                                         2]).split("/")[1]), 0)
             if imagePath is not None:
                 sourceFile = fu.joinPath(fu.getTempDir(), "HamsiManager-image-file." +
                                          self.musicValues["images"][self.lstwImages.currentRow()][2].split("/")[1])
                 fu.writeToBinaryFile(sourceFile, self.musicValues["images"][self.lstwImages.currentRow()][3])
                 fu.moveOrChange(sourceFile, imagePath)
     except:
         ReportBug.ReportBug()
Beispiel #5
0
 def saveAsImage(self):
     try:
         if self.lstwImages.currentRow() != -1:
             imagePath = Dialogs.getSaveFileName(
                 translate("MusicDetails", "Save As"),
                 fu.getDirName(self.musicValues["path"]),
                 str(translate("MusicDetails", "Images (*.%s)")) %
                 (str(self.musicValues["images"][
                     self.lstwImages.currentRow()][2]).split("/")[1]), 0)
             if imagePath is not None:
                 sourceFile = fu.joinPath(
                     fu.getTempDir(),
                     "HamsiManager-image-file." + self.musicValues["images"]
                     [self.lstwImages.currentRow()][2].split("/")[1])
                 fu.writeToBinaryFile(
                     sourceFile, self.musicValues["images"][
                         self.lstwImages.currentRow()][3])
                 fu.moveOrChange(sourceFile, imagePath)
     except:
         ReportBug.ReportBug()
Beispiel #6
0
    def willDownload(self, _request):
        try:
            defaultFileName = str(
                MFileInfo(str(trStr(_request.url()))).fileName())
            fileDialogTitle = translate(
                "UpdateControl",
                "You Can Click Cancel To Update Without Saving The Package.")
            if self.isNotInstall:
                fileDialogTitle = translate(
                    "UpdateControl", "Save New Version Of Hamsi Manager")
            fileName = Dialogs.getSaveFileName(
                fileDialogTitle,
                fu.joinPath(fu.getDirName(fu.HamsiManagerDirectory),
                            defaultFileName))
            if self.isNotInstall is False or fileName is not None:
                if fileName is None:
                    import random

                    fileName = fu.joinPath(
                        fu.getTempDir(), defaultFileName[:-7] + "-" +
                        str(random.randrange(0, 1000000)) +
                        defaultFileName[-7:])
                self.pbtnDownloadAndInstall.setEnabled(False)
                newRequest = _request
                newRequest.setAttribute(MNetworkRequest.User,
                                        trQVariant(fileName))
                networkManager = self.wvWeb.page().networkAccessManager()
                reply = networkManager.get(newRequest)
                self.isFileExist = True
                self.connect(reply, SIGNAL("downloadProgress(qint64,qint64)"),
                             self.downloading)
                self.connect(reply, SIGNAL("finished()"), self.downloaded)
                self.connect(reply,
                             SIGNAL("error(QNetworkReply::NetworkError)"),
                             self.errorOccurred)
        except:
            ReportBug.ReportBug()
Beispiel #7
0
 def exportValues(self,
                  _actionType="return",
                  _formatType="html",
                  _extInfo="no"):
     info = ""
     if _formatType == "html":
         if _extInfo == "no":
             pass
         elif _extInfo == "title":
             info += " \n<h3>%s : </h3>" % (str(
                 translate("Tables", "Table Contents")))
         info += " \n<table border=1> \n<tr> \n<td>*</td> \n"
         for columnNo in range(self.columnCount()):
             if self.isColumnHidden(columnNo) is False:
                 info += "<td><b>"
                 info += str(self.tableColumns[columnNo])
                 info += "</b></td> \n"
         info += "</tr> \n"
         for rowNo in range(self.rowCount()):
             if self.isRowHidden(rowNo) is False:
                 info += " \n<tr> \n<td>" + str(rowNo + 1) + "</td> \n"
                 for columnNo in range(self.columnCount()):
                     if self.isColumnHidden(columnNo) is False:
                         info += "<td>"
                         info += str(str(self.item(rowNo, columnNo).text()))
                         info += "</td> \n"
                 info += "</tr> \n"
         info += "</table> \n"
     elif _formatType == "plainText":
         if _extInfo == "no":
             pass
         elif _extInfo == "title":
             info += " %s : \n" % (str(translate("Tables",
                                                 "Table Contents")))
         info += "*\t"
         for columnNo in range(self.columnCount()):
             if self.isColumnHidden(columnNo) is False:
                 info += str(self.tableColumns[columnNo])
                 info += "\t"
         info += "\n"
         for rowNo in range(self.rowCount()):
             info += str(rowNo + 1) + "\t"
             if self.isRowHidden(rowNo) is False:
                 for columnNo in range(self.columnCount()):
                     if self.isColumnHidden(columnNo) is False:
                         info += str(str(self.item(rowNo, columnNo).text()))
                         info += "\t"
                 info += "\n"
     if _actionType == "return":
         return info
     elif _actionType == "file":
         fileExt = None
         formatTypeName = None
         if _formatType == "html":
             if _extInfo != "no":
                 strHeader = (
                     "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \n"
                     +
                     "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \n"
                     +
                     "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"tr\" lang=\"tr\" dir=\"ltr\"> \n"
                     +
                     "<head> \n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> \n</head> \n<body> \n"
                 )
                 strFooter = " \n</body> \n</html>"
                 info = strHeader + info + strFooter
             formatTypeName = translate("Tables", "HTML")
             fileExt = "html"
         elif _formatType == "plainText":
             formatTypeName = translate("Tables", "Plain Text")
             fileExt = "txt"
         filePath = Dialogs.getSaveFileName(
             translate("Tables", "Save As"),
             fu.joinPath(
                 fu.userDirectoryPath,
                 fu.getBaseName(self.currentDirectoryPath) + "." + fileExt),
             formatTypeName + " (*." + fileExt + ")", 2)
         if filePath is not None:
             if _formatType == "html" and filePath[-5:] != ".html":
                 filePath += ".html"
             elif _formatType == "plainText" and filePath[-4:] != ".txt":
                 filePath += ".txt"
             fu.writeToFile(filePath, info)
             Dialogs.show(
                 translate("Tables", "Table Exported"),
                 str(
                     translate(
                         "Tables",
                         "Table contents are exported to file: \"%s\".")) %
                 Organizer.getLink(filePath))
     elif _actionType == "dialog":
         dDialog = MDialog(getMainWindow())
         if isActivePyKDE4:
             dDialog.setButtons(MDialog.NoDefault)
         dDialog.setWindowTitle(translate("Tables", "Table Contents"))
         mainPanel = MWidget(dDialog)
         vblMain = MVBoxLayout(mainPanel)
         if _formatType == "html":
             QtWebKit = getMyObject("QtWebKit")
             wvWeb = QtWebKit.QWebView()
             wvWeb.setHtml(str(info))
             vblMain.addWidget(wvWeb)
         elif _formatType == "plainText":
             teContent = MTextEdit()
             teContent.setPlainText(str(info))
             vblMain.addWidget(teContent)
         pbtnClose = MPushButton(translate("Tables", "OK"))
         MObject.connect(pbtnClose, SIGNAL("clicked()"), dDialog.close)
         vblMain.addWidget(pbtnClose)
         if isActivePyKDE4:
             dDialog.setMainWidget(mainPanel)
         else:
             dDialog.setLayout(vblMain)
         dDialog.setMinimumWidth(600)
         dDialog.setMinimumHeight(400)
         dDialog.show()
     elif _actionType == "clipboard":
         MApplication.clipboard().setText(str(info))
Beispiel #8
0
def clickedAnAction(_action):
    try:
        actionName = _action.objectName()
        if actionName == "Open State":
            f = Dialogs.getOpenFileName(translate("MenuBar", "Open State Of Hamsi Manager"),
                                        fu.userDirectoryPath,
                                        translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.openStateOfSettings(f)
        elif actionName == "Save State":
            f = Dialogs.getSaveFileName(translate("MenuBar", "Save State Of Hamsi Manager"),
                                        fu.joinPath(fu.userDirectoryPath, "HamsiManager.desktop"),
                                        translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.saveStateOfSettings(f)
                Dialogs.show(translate("MenuBar", "Current State Saved"),
                             translate("MenuBar",
                                       "Current state saved with preferences.<br>You can continue where you left off."))
        elif actionName == "With This Profile (My Settings)":
            if Execute.executeAsRootWithThread(["--sDirectoryPath", fu.pathOfSettingsDirectory], "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
                                  translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "With Root Profile (Own Settings)":
            if Execute.executeAsRootWithThread([], "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
                                  translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "Quit":
            getMainWindow().close()
        elif actionName == "HTML Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "html", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "html", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "html", "title")
        elif actionName == "Text Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "plainText", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "plainText", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "plainText", "title")
        elif actionName == "HTML Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "html", "fileTree",
                               "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "html", "fileTree",
                               "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "html", "fileTree",
                               "title")
        elif actionName == "Text Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "plainText", "fileTree",
                               "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "plainText", "fileTree",
                               "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "plainText",
                               "fileTree", "title")
        elif actionName == "About QT":
            if isActivePyKDE4:
                QMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
            else:
                MMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
        elif actionName == "Options":
            from Options import OptionsForm

            OptionsForm.OptionsForm(getMainWindow())
        elif actionName == "My Plugins":
            import MyPlugins

            MyPlugins.MyPlugins()
        elif actionName == "Reconfigure":
            from Tools import Configurator

            Configurator.Configurator("configurePage")
        elif actionName == "My Plugins (System)":
            Execute.execute(["--qm", "--plugins", "--runAsRoot"], "HamsiManager")
        elif actionName == "Reconfigure (System)":
            Execute.execute(["--qm", "--configurator", "--runAsRoot"], "HamsiManager")
        elif actionName == "Update":
            from Core import UpdateControl

            UpdateControl.UpdateControl(getMainWindow())
        elif actionName == "Report Bug":
            ReportBug.ReportBug(True)
        elif actionName == "Suggest Idea":
            from Core import SuggestIdea

            SuggestIdea.SuggestIdea()
        elif actionName == "About Hamsi Manager":
            if isActivePyKDE4 is False:
                MMessageBox.about(getMainWindow(), translate("MenuBar", "About Hamsi Manager"),
                                  uni.aboutOfHamsiManager)
        elif actionName == translate("ToolsBar", "Check Icon"):
            getMainWindow().setEnabled(False)
            fu.checkIcon(getMainWindow().FileManager.getCurrentDirectoryPath())
            Dialogs.show(translate("ToolsBar", "Directory Icon Checked"),
                         translate("ToolsBar",
                                   "Current directory icon checked.<br>The default action based on the data is executed."))
            getMainWindow().setEnabled(True)
        elif actionName == "Clear Empty Directories":
            if getMainTable().checkUnSavedValues() is False:
                _action.setChecked(False)
                return False
            answer = Dialogs.ask(translate("ToolsBar", "Empty Directories Will Be Removed"),
                                 str(translate("ToolsBar",
                                               "Are you sure you want to remove empty directories based on the criteria you set in \"%s\"?")) % Organizer.getLink(
                                     getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                currentDirPath = getMainWindow().FileManager.getCurrentDirectoryPath()
                if fu.isWritableFileOrDir(currentDirPath):
                    fu.checkEmptyDirectories(currentDirPath, True, True, True, True)
                    Dialogs.show(translate("ToolsBar", "Directory Cleaned"),
                                 translate("ToolsBar",
                                           "The current directory is cleaned based on the criteria you set."))
                getMainWindow().setEnabled(True)
                getMainWindow().FileManager.makeRefresh()
        elif actionName == "Pack":
            from Tools import Packager

            Packager.Packager(getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Hash":
            from Tools import Hasher

            Hasher.Hasher(getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Clear":
            from Tools import Cleaner

            Cleaner.Cleaner(getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Text Corrector":
            from Tools import TextCorrector

            TextCorrector.TextCorrector(getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "File Tree":
            from Tools import FileTreeBuilder

            FileTreeBuilder.FileTreeBuilder(getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Search":
            from Tools import Searcher

            Searcher.Searcher([getMainWindow().FileManager.getCurrentDirectoryPath()])
        elif actionName == "Script Manager":
            from Tools import ScriptManager

            if ScriptManager.ScriptManager.checkScriptManager():
                ScriptManager.ScriptManager(getMainWindow())
        elif actionName == "Show Last Actions":
            from Core import RecordsForm

            RecordsForm.RecordsForm(getMainWindow())
        elif actionName == "Remove Sub Files":
            answer = Dialogs.ask(translate("ToolsBar", "All Files Will Be Removed"),
                                 str(translate("ToolsBar",
                                               "Are you sure you want to remove only all files in \"%s\"?<br>Note:Do not will remove directory and subfolders.")) % Organizer.getLink(
                                     getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                fu.removeOnlySubFiles(getMainWindow().FileManager.getCurrentDirectoryPath())
                getMainWindow().setEnabled(True)
                Dialogs.show(translate("ToolsBar", "Removed Only All Files"),
                             str(translate("ToolsBar",
                                           "Removed only all files in \"%s\".<br>Note:Do not removed directory and subfolders.")) % Organizer.getLink(
                                 getMainWindow().FileManager.getCurrentDirectoryPath()))
        elif actionName == "Amarok Embedded Database Configurator":
            import Amarok

            if Amarok.checkAmarok():
                Amarok.openEmbeddedDBConfigurator()
        elif _action.parent().objectName() == "Table Types":
            changeTableType(_action)
        elif _action.parent().objectName() == "File Renamer Types":
            changeReNamerType(_action)
        elif _action.parent().objectName() == "Scripts":
            from Core import Scripts

            Scripts.runScriptFile(fu.joinPath(Scripts.pathOfScripsDirectory, actionName))
        Records.saveAllRecords()
    except:
        ReportBug.ReportBug()
Beispiel #9
0
def clickedAnAction(_action):
    try:
        actionName = _action.objectName()
        if actionName == "Open State":
            f = Dialogs.getOpenFileName(
                translate("MenuBar", "Open State Of Hamsi Manager"),
                fu.userDirectoryPath,
                translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.openStateOfSettings(f)
        elif actionName == "Save State":
            f = Dialogs.getSaveFileName(
                translate("MenuBar", "Save State Of Hamsi Manager"),
                fu.joinPath(fu.userDirectoryPath, "HamsiManager.desktop"),
                translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.saveStateOfSettings(f)
                Dialogs.show(
                    translate("MenuBar", "Current State Saved"),
                    translate(
                        "MenuBar",
                        "Current state saved with preferences.<br>You can continue where you left off."
                    ))
        elif actionName == "With This Profile (My Settings)":
            if Execute.executeAsRootWithThread(
                ["--sDirectoryPath", fu.pathOfSettingsDirectory],
                    "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(
                    translate("MenuBar", "Can Not Run As Root"),
                    translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "With Root Profile (Own Settings)":
            if Execute.executeAsRootWithThread([], "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(
                    translate("MenuBar", "Can Not Run As Root"),
                    translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "Quit":
            getMainWindow().close()
        elif actionName == "HTML Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "html", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "html", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "html", "title")
        elif actionName == "Text Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "plainText", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "plainText", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "plainText", "title")
        elif actionName == "HTML Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "file", "html", "fileTree", "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "dialog", "html", "fileTree", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "clipboard", "html", "fileTree", "title")
        elif actionName == "Text Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "file", "plainText", "fileTree", "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "dialog", "plainText", "fileTree", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "clipboard", "plainText", "fileTree",
                               "title")
        elif actionName == "About QT":
            if isActivePyKDE4:
                QMessageBox.aboutQt(getMainWindow(),
                                    translate("MenuBar", "About QT"))
            else:
                MMessageBox.aboutQt(getMainWindow(),
                                    translate("MenuBar", "About QT"))
        elif actionName == "Options":
            from Options import OptionsForm

            OptionsForm.OptionsForm(getMainWindow())
        elif actionName == "My Plugins":
            import MyPlugins

            MyPlugins.MyPlugins()
        elif actionName == "Reconfigure":
            from Tools import Configurator

            Configurator.Configurator("configurePage")
        elif actionName == "My Plugins (System)":
            Execute.execute(["--qm", "--plugins", "--runAsRoot"],
                            "HamsiManager")
        elif actionName == "Reconfigure (System)":
            Execute.execute(["--qm", "--configurator", "--runAsRoot"],
                            "HamsiManager")
        elif actionName == "Update":
            from Core import UpdateControl

            UpdateControl.UpdateControl(getMainWindow())
        elif actionName == "Report Bug":
            ReportBug.ReportBug(True)
        elif actionName == "Suggest Idea":
            from Core import SuggestIdea

            SuggestIdea.SuggestIdea()
        elif actionName == "About Hamsi Manager":
            if isActivePyKDE4 is False:
                MMessageBox.about(getMainWindow(),
                                  translate("MenuBar", "About Hamsi Manager"),
                                  uni.aboutOfHamsiManager)
        elif actionName == translate("ToolsBar", "Check Icon"):
            getMainWindow().setEnabled(False)
            fu.checkIcon(getMainWindow().FileManager.getCurrentDirectoryPath())
            Dialogs.show(
                translate("ToolsBar", "Directory Icon Checked"),
                translate(
                    "ToolsBar",
                    "Current directory icon checked.<br>The default action based on the data is executed."
                ))
            getMainWindow().setEnabled(True)
        elif actionName == "Clear Empty Directories":
            if getMainTable().checkUnSavedValues() is False:
                _action.setChecked(False)
                return False
            answer = Dialogs.ask(
                translate("ToolsBar", "Empty Directories Will Be Removed"),
                str(
                    translate(
                        "ToolsBar",
                        "Are you sure you want to remove empty directories based on the criteria you set in \"%s\"?"
                    )) % Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                currentDirPath = getMainWindow(
                ).FileManager.getCurrentDirectoryPath()
                if fu.isWritableFileOrDir(currentDirPath):
                    fu.checkEmptyDirectories(currentDirPath, True, True, True,
                                             True)
                    Dialogs.show(
                        translate("ToolsBar", "Directory Cleaned"),
                        translate(
                            "ToolsBar",
                            "The current directory is cleaned based on the criteria you set."
                        ))
                getMainWindow().setEnabled(True)
                getMainWindow().FileManager.makeRefresh()
        elif actionName == "Pack":
            from Tools import Packager

            Packager.Packager(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Hash":
            from Tools import Hasher

            Hasher.Hasher(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Clear":
            from Tools import Cleaner

            Cleaner.Cleaner(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Text Corrector":
            from Tools import TextCorrector

            TextCorrector.TextCorrector(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "File Tree":
            from Tools import FileTreeBuilder

            FileTreeBuilder.FileTreeBuilder(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Search":
            from Tools import Searcher

            Searcher.Searcher(
                [getMainWindow().FileManager.getCurrentDirectoryPath()])
        elif actionName == "Script Manager":
            from Tools import ScriptManager

            if ScriptManager.ScriptManager.checkScriptManager():
                ScriptManager.ScriptManager(getMainWindow())
        elif actionName == "Show Last Actions":
            from Core import RecordsForm

            RecordsForm.RecordsForm(getMainWindow())
        elif actionName == "Remove Sub Files":
            answer = Dialogs.ask(
                translate("ToolsBar", "All Files Will Be Removed"),
                str(
                    translate(
                        "ToolsBar",
                        "Are you sure you want to remove only all files in \"%s\"?<br>Note:Do not will remove directory and subfolders."
                    )) % Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                fu.removeOnlySubFiles(
                    getMainWindow().FileManager.getCurrentDirectoryPath())
                getMainWindow().setEnabled(True)
                Dialogs.show(
                    translate("ToolsBar", "Removed Only All Files"),
                    str(
                        translate(
                            "ToolsBar",
                            "Removed only all files in \"%s\".<br>Note:Do not removed directory and subfolders."
                        )) %
                    Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
        elif actionName == "Amarok Embedded Database Configurator":
            import Amarok

            if Amarok.checkAmarok():
                Amarok.openEmbeddedDBConfigurator()
        elif _action.parent().objectName() == "Table Types":
            changeTableType(_action)
        elif _action.parent().objectName() == "File Renamer Types":
            changeReNamerType(_action)
        elif _action.parent().objectName() == "Scripts":
            from Core import Scripts

            Scripts.runScriptFile(
                fu.joinPath(Scripts.pathOfScripsDirectory, actionName))
        Records.saveAllRecords()
    except:
        ReportBug.ReportBug()