当前位置: 首页>>代码示例>>Python>>正文


Python Organizer.getLink方法代码示例

本文整理汇总了Python中Core.Organizer.getLink方法的典型用法代码示例。如果您正苦于以下问题:Python Organizer.getLink方法的具体用法?Python Organizer.getLink怎么用?Python Organizer.getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.Organizer的用法示例。


在下文中一共展示了Organizer.getLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: emendDirectoryWithContents

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def emendDirectoryWithContents(self):
     try:
         _path = self.checkSource(str(QuickMakeParameters[1]), "directory")
         if _path is not None:
             if uni.getBoolValue("isShowQuickMakeWindow"):
                 newEmendedName = str(self.leNewValue.text())
             else:
                 newEmendedName = Organizer.emend(_path, fu.getObjectType(_path))
             fu.activateSmartCheckIcon()
             oldFileName = _path
             newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
             if newDirName != oldFileName:
                 fileAndDirectoryNames = fu.readDirectory(newDirName, "fileAndDirectory")
                 for fileAndDirs in fileAndDirectoryNames:
                     objectType = fu.getObjectType(fu.joinPath(newDirName, fileAndDirs))
                     fu.moveOrChange(fu.joinPath(newDirName, fileAndDirs),
                                     fu.joinPath(newDirName, Organizer.emend(fileAndDirs, objectType)), objectType)
                 if uni.isActiveDirectoryCover and uni.getBoolValue(
                     "isActiveAutoMakeIconToDirectory") and uni.getBoolValue(
                     "isAutoMakeIconToDirectoryWhenFileMove"):
                     fu.checkIcon(newDirName)
                 if fu.isDir(newDirName):
                     fu.completeSmartCheckIcon()
                 Dialogs.show(translate("QuickMake", "Directory And Contents Emended"),
                              str(translate("QuickMake",
                                            "\"%s\" is emended based on the criteria you set.This directory is \"%s\" now.")) %
                              (Organizer.getLink(_path), Organizer.getLink(newDirName)))
         self.close()
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:32,代码来源:QuickMake.py

示例2: readMusicFile

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
def readMusicFile(_filePath, _isAlertWhenNotAvailable=True):
    _directoryPath = fu.getDirName(_filePath)
    isCanNoncompatible = False
    if fu.isReadableFileOrDir(_filePath):
        tagger = Taggers.getTagger()
        try:
            tagger.loadFile(_filePath)
        except:
            Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                              str(translate("FileUtils/Musics",
                                            "\"%s\" : this file has the incorrect tag so can't read tags.")
                              ) % Organizer.getLink(_filePath))
        if tagger.isAvailableFile() is False:
            isCanNoncompatible = True
        content = {}
        content["path"] = _filePath
        content["baseNameOfDirectory"] = fu.getBaseName(_directoryPath)
        content["baseName"] = fu.getBaseName(_filePath)
        content["artist"] = tagger.getArtist()
        content["title"] = tagger.getTitle()
        content["album"] = tagger.getAlbum()
        content["albumArtist"] = tagger.getAlbumArtist()
        content["trackNum"] = tagger.getTrackNum()
        content["year"] = tagger.getYear()
        content["genre"] = tagger.getGenre()
        content["firstComment"] = tagger.getFirstComment()
        content["firstLyrics"] = tagger.getFirstLyrics()
        content["images"] = tagger.getImages()
        if isCanNoncompatible and _isAlertWhenNotAvailable:
            Dialogs.show(translate("FileUtils/Musics", "Possible ID3 Mismatch"),
                         translate("FileUtils/Musics",
                                   "Some of the files presented in the table may not support ID3 technology.<br>Please check the files and make sure they support ID3 information before proceeding."))
        return content
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:35,代码来源:Musics.py

示例3: addImage

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def addImage(self):
     try:
         if self.isActiveAddImage is False:
             self.isActiveAddImage = True
             self.pbtnAddImage.setText(translate("MusicDetails", "OK"))
             self.pbtnSelectImage.show()
             self.leImagePath.show()
             self.lblImagePath.show()
             self.lblImageType.show()
             self.cbImageType.show()
             self.pbtnCancelAddImage.show()
             self.pbtnDeleteImage.hide()
             self.pbtnSaveAsImage.hide()
         else:
             if fu.isFile(self.leImagePath.text()):
                 imageType = Taggers.getTagger().getImageTypesNo()[self.cbImageType.currentIndex()]
                 description = str(imageType)
                 Musics.writeMusicFile(self.musicValues, None, True, imageType, str(self.leImagePath.text()),
                                       description)
                 self.changeFile(self.musicFile)
                 self.cancelAddImage()
             else:
                 Dialogs.showError(translate("MusicDetails", "Image Does Not Exist"),
                                   str(translate("MusicDetails", "\"%s\" does not exist.")
                                   ) % Organizer.getLink(str(self.leImagePath.text())))
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:29,代码来源:MusicDetails.py

示例4: __init__

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
     global currentDialogs
     _filePath = fu.checkSource(_filePath, "file")
     if _filePath is not None:
         if _isOpenDetailsOnNewWindow is False:
             isHasOpenedDialog = False
             for dialog in currentDialogs:
                 if dialog.isVisible():
                     isHasOpenedDialog = True
                     dialog.changeFile(_filePath)
                     dialog.activateWindow()
                     dialog.raise_()
                     break
             if isHasOpenedDialog is False:
                 _isOpenDetailsOnNewWindow = True
         if _isOpenDetailsOnNewWindow:
             currentDialogs.append(self)
             MDialog.__init__(self, MApplication.activeWindow())
             if isActivePyKDE4:
                 self.setButtons(MDialog.NoDefault)
             self.charSet = MComboBox()
             self.charSet.addItems(uni.getCharSets())
             self.charSet.setCurrentIndex(self.charSet.findText(uni.MySettings["fileSystemEncoding"]))
             self.infoLabels = {}
             self.infoValues = {}
             self.fileValues = {}
             pbtnClose = MPushButton(translate("TextDetails", "Close"))
             pbtnSave = MPushButton(translate("TextDetails", "Save Changes"))
             pbtnSave.setIcon(MIcon("Images:save.png"))
             MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
             MObject.connect(pbtnSave, SIGNAL("clicked()"), self.save)
             self.labels = [translate("TextDetails", "File Path : "),
                            translate("TextDetails", "Content : ")]
             self.pnlMain = MWidget()
             self.vblMain = MVBoxLayout(self.pnlMain)
             self.pnlClearable = None
             self.changeFile(_filePath, True)
             HBOXs, VBOXs = [], []
             VBOXs.append(MVBoxLayout())
             HBOXs.append(MHBoxLayout())
             HBOXs[-1].addWidget(self.charSet, 1)
             HBOXs[-1].addWidget(pbtnSave, 4)
             VBOXs[0].addLayout(HBOXs[-1])
             VBOXs[0].addWidget(pbtnClose)
             self.vblMain.addLayout(VBOXs[0], 1)
             if isActivePyKDE4:
                 self.setMainWidget(self.pnlMain)
             else:
                 self.setLayout(self.vblMain)
             self.show()
             self.setMinimumWidth(700)
             self.setMinimumHeight(500)
     else:
         Dialogs.showError(translate("TextDetails", "File Does Not Exist"),
                           str(translate("TextDetails",
                                         "\"%s\" does not exist.<br>Table will be refreshed automatically!<br>Please retry.")
                           ) % Organizer.getLink(str(_filePath)))
         if hasattr(getMainWindow(),
                    "FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:61,代码来源:TextDetails.py

示例5: emendDirectory

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def emendDirectory(self):
     try:
         _path = self.checkSource(str(QuickMakeParameters[1]), "directory")
         if _path is not None:
             if uni.getBoolValue("isShowQuickMakeWindow"):
                 newEmendedName = str(self.leNewValue.text())
             else:
                 newEmendedName = Organizer.emend(_path, fu.getObjectType(_path))
             oldFileName = _path
             newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
             if newDirName != oldFileName:
                 Dialogs.show(translate("QuickMake", "Directory Emended"),
                              str(translate("QuickMake",
                                            "\"%s\" is emended based on the criteria you set.This directory is \"%s\" now.")) %
                              (Organizer.getLink(_path), Organizer.getLink(newDirName)))
         self.close()
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:20,代码来源:QuickMake.py

示例6: cellDoubleClickedTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def cellDoubleClickedTable(self, _row, _column):
     try:
         if uni.getBoolValue("isRunOnDoubleClick"):
             self.showTableDetails(_row, _column)
     except:
         Dialogs.showError(translate("SubFolderTable", "Cannot Open File"),
                           str(translate("SubFolderTable",
                                         "\"%s\" : cannot be opened. Please make sure that you selected a text file.")
                           ) % Organizer.getLink(self.values[_row]["path"]))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:11,代码来源:SubFolderTable.py

示例7: Clear

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def Clear(self):
     try:
         uni.isCanBeShowOnMainWindow = False
         answer = Dialogs.ask(translate("Cleaner", "Your Files Will Be Removed"),
                              str(translate("Cleaner",
                                            "The files in the \"%s\" folder will be cleared according to the criteria you set.<br>" +
                                            "This action will delete the files completely, without any chance to recover.<br>" +
                                            "Are you sure you want to perform the action?")) % Organizer.getLink(
                                  Organizer.getLink(str(self.lePathOfProject.text()))))
         if answer == Dialogs.Yes:
             if fu.isWritableFileOrDir(str(self.lePathOfProject.text())):
                 if fu.clearCleaningDirectory(str(self.lePathOfProject.text()), True, True):
                     Dialogs.show(translate("Cleaner", "Directory Is Cleared"),
                                  str(translate("Cleaner",
                                                "This directory is cleared : \"%s\"")) % Organizer.getLink(
                                      str(self.lePathOfProject.text())))
         uni.isCanBeShowOnMainWindow = True
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:21,代码来源:Cleaner.py

示例8: save

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
    def save(self):
        try:
            filePath = str(self.leFilePath.text())
            if self.fileValues is not None:
                from Core import Records

                Records.setTitle(translate("TextCorrector", "Text File"))
                newFileValues = {}
                newFileValues["path"] = filePath
                newFileValues["content"] = str(self.pteFileContent.toPlainText())
                newPath = fu.writeTextFile(self.fileValues, newFileValues, str(self.charSet.currentText()))
                if newPath != self.fileValues["path"]:
                    self.changeFile(newPath)
                if hasattr(getMainWindow(),
                           "FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
                Records.saveAllRecords()
            else:
                Dialogs.showError(translate("TextCorrector", "File Does Not Exist"),
                                  str(translate("TextDetails",
                                                "\"%s\" does not exist.<br>Please select an exist file and try again.")
                                  ) % Organizer.getLink(str(filePath)))
        except:
            ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:25,代码来源:TextCorrector.py

示例9: triggered

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def triggered(self, _action):
     try:
         if _action.objectName() == "Edit Bookmarks":
             getMainWindow().FileManager.bookmarks.makeRefresh()
             getMainWindow().FileManager.bookmarks.show()
             return
         for info in BookmarksOfDirectories.fetchAll():
             if info[1] == str(_action.objectName()):
                 if fu.isDir(str(info[2])):
                     getMainWindow().FileManager.goTo(str(info[2]))
                     return
                 else:
                     answer = Dialogs.ask(translate("BookmarksMenu", "Cannot Find Folder"),
                                 str(translate("BookmarksMenu",
                                     "\"%s\" cannot be found.<br>Delete this folder from the bookmarks?")) %
                                 Organizer.getLink(info[1]))
                     if answer == Dialogs.Yes:
                         BookmarksOfDirectories.delete(str(info[0]))
                         self.makeRefresh()
                         getMainWindow().FileManager.bookmarks.makeRefresh()
         getMainWindow().FileManager.makeRefreshOnlyFileList()
         getMainWindow().FileManager.makeRefreshOnlyFileListByTree()
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:26,代码来源:FileManager.py

示例10: writeContents

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]

#.........这里部分代码省略.........
                                changingTag["firstComment"] = value
                                Records.add(str(translate("MusicTable", "Comment")),
                                            str(self.values[rowNo]["firstComment"]), value)
                                self.changedValueNumber += 1
                            if self.isChangeableItem(rowNo, "firstLyrics", self.values[rowNo]["firstLyrics"],
                                                     True, isCheckLike):
                                value = str(self.item(rowNo, 10).text())
                                tagger.setFirstLyrics(value)
                                changingTag["firstLyrics"] = value
                                Records.add(str(translate("MusicTable", "Lyrics")),
                                            str(self.values[rowNo]["firstLyrics"]), value)
                                self.changedValueNumber += 1
                            if len(changingTag) > 1:
                                changingTags.append(changingTag)
                            tagger.update()
                            if self.isChangeableItem(rowNo, "baseNameOfDirectory", baseNameOfDirectory):
                                baseNameOfDirectory = str(self.item(rowNo, 0).text())
                                self.changedValueNumber += 1
                                isMovedToNewDirectory = True
                                currentDirectoryPath = fu.getDirName(
                                    self.values[rowNo]["path"])
                                newDirectoryPath = fu.joinPath(
                                    fu.getDirName(fu.getDirName(self.values[rowNo]["path"])),
                                    baseNameOfDirectory)
                                self.setNewDirectory(newDirectoryPath)
                                if rowNo > 0:
                                    if str(self.item(rowNo - 1, 0).text()) != baseNameOfDirectory:
                                        isNewDirectoriesSame = False
                            if self.isChangeableItem(rowNo, "baseName", baseName, False):
                                baseName = str(self.item(rowNo, 1).text())
                                self.changedValueNumber += 1
                            newFilePath = fu.joinPath(
                                fu.getDirName(fu.getDirName(self.values[rowNo]["path"])),
                                baseNameOfDirectory, baseName)
                            oldFilePath = fu.getRealPath(self.values[rowNo]["path"])
                            newFilePath = fu.getRealPath(newFilePath)
                            if oldFilePath != newFilePath:
                                oldAndNewPaths = {}
                                oldAndNewPaths["oldPath"] = oldFilePath
                                oldAndNewPaths["newPath"] = fu.moveOrChange(oldFilePath, newFilePath, "file")
                                if oldFilePath != oldAndNewPaths["newPath"]:
                                    oldAndNewPathValues.append(oldAndNewPaths)
                                    oldDirName = fu.getDirName(oldFilePath)
                                    if uni.getBoolValue("isClearEmptyDirectoriesWhenFileMove"):
                                        fu.checkEmptyDirectories(oldDirName, True, True,
                                                                 uni.getBoolValue("isAutoCleanSubFolderWhenFileMove"))
                except:
                    ReportBug.ReportBug()
            else:
                allItemNumber = rowNo + 1
            Dialogs.showState(translate("FileUtils/Musics", "Writing Music Tags And Informations"), rowNo + 1, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        if self.rowCount() == len(oldAndNewPathValues) and isMovedToNewDirectory and isNewDirectoriesSame:
            otherFileNames = fu.readDirectory(currentDirectoryPath, "fileAndDirectory", True)
            if len(otherFileNames) > 0:
                answer = Dialogs.ask(translate("FileUtils/Musics", "There Are More Files"),
                                     str(translate("FileUtils/Musics",
                                                   "\"%s\" : there are more files in this directory.<br>Are you want to move all found files into new directory?<br>New Directory : \"%s\"")) % (
                                         Organizer.getLink(currentDirectoryPath), Organizer.getLink(newDirectoryPath)))
                if answer == Dialogs.Yes:
                    uni.startThreadAction()
                    allItemNumber = len(otherFileNames)
                    for rowNo, fileName in enumerate(otherFileNames):
                        isContinueThreadAction = uni.isContinueThreadAction()
                        if isContinueThreadAction:
                            try:
                                oldFilePath = fu.getRealPath(fu.joinPath(currentDirectoryPath, fileName))
                                newFilePath = fu.getRealPath(fu.joinPath(newDirectoryPath, fileName))
                                if oldFilePath != newFilePath:
                                    oldAndNewPaths = {}
                                    oldAndNewPaths["oldPath"] = oldFilePath
                                    oldAndNewPaths["newPath"] = fu.moveOrChange(oldFilePath, newFilePath,
                                                                                fu.getObjectType(oldFilePath))
                                    if oldFilePath != oldAndNewPaths["newPath"]:
                                        oldAndNewPathValues.append(oldAndNewPaths)
                            except:
                                ReportBug.ReportBug()
                        else:
                            allItemNumber = rowNo + 1
                        Dialogs.showState(translate("FileUtils/Covers", "Writing Directory And File Informations"),
                                          rowNo + 1, allItemNumber, True)
                        if isContinueThreadAction is False:
                            break
                    uni.finishThreadAction()
                    if uni.getBoolValue("isClearEmptyDirectoriesWhenFileMove"):
                        fu.checkEmptyDirectories(currentDirectoryPath, True, True,
                                                 uni.getBoolValue("isAutoCleanSubFolderWhenFileMove"))
                    if (uni.isActiveDirectoryCover and uni.getBoolValue("isActiveAutoMakeIconToDirectory") and
                            uni.getBoolValue("isAutoMakeIconToDirectoryWhenFileMove")):
                        fu.checkIcon(newDirectoryPath)
        if uni.isActiveAmarok and uni.getBoolValue("isMusicTableValuesChangeInAmarokDB"):
            import Amarok
            from Amarok import Operations

            Operations.changeTags(changingTags)
            if len(oldAndNewPathValues) > 0:
                Operations.changePaths(oldAndNewPathValues, "file")
        return True
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:104,代码来源:MusicTable.py

示例11: checkSource

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
 def checkSource(self, _oldPath, _objectType="fileAndDirectory", _isCheckWritable=True):
     _path = fu.checkSource(_oldPath, _objectType, False)
     if _path is None:
         if _objectType == "file":
             answer = Dialogs.ask(translate("QuickMake", "Cannot Find File"),
                                  str(translate("FileUtils",
                                                "\"%s\" : cannot find a file with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
                                      _oldPath))
             if answer == Dialogs.Yes:
                 self.organizeWithHamsiManager(_oldPath)
             return None
         elif _objectType == "directory":
             answer = Dialogs.ask(translate("QuickMake", "Cannot Find Directory"),
                                  str(translate("FileUtils",
                                                "\"%s\" : cannot find a folder with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
                                      _oldPath))
             if answer == Dialogs.Yes:
                 self.organizeWithHamsiManager(_oldPath)
             return None
         else:
             answer = Dialogs.ask(translate("QuickMake", "Cannot Find File Or Directory"),
                                  str(translate("FileUtils",
                                                "\"%s\" : cannot find a file or directory with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
                                      _oldPath))
             if answer == Dialogs.Yes:
                 self.organizeWithHamsiManager(_oldPath)
             return None
     if _isCheckWritable:
         if fu.isWritableFileOrDir(_oldPath) is False:
             return None
     return _path
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:33,代码来源:QuickMake.py

示例12: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
    def refreshTable(self, _path):
        self.values = []
        self.setColumnWidth(6, 70)
        self.setColumnWidth(7, 40)
        musicFileNames = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                  int(uni.MySettings["subDirectoryDeep"]), "music",
                                                                  uni.getBoolValue(
                                                                      "isShowHiddensInSubFolderMusicTable"))
        isCanNoncompatible = False
        allItemNumber = len(musicFileNames)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for filePath in musicFileNames:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(filePath, False, True):
                        tagger = Taggers.getTagger()
                        try:
                            tagger.loadFile(filePath)
                        except:
                            Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                                              str(translate("FileUtils/Musics",
                                                            "\"%s\" : this file has the incorrect tag so can't read tags.")
                                              ) % Organizer.getLink(filePath))
                        if tagger.isAvailableFile() is False:
                            isCanNoncompatible = True
                        details = fu.getDetails(filePath)
                        content = {}
                        content["path"] = filePath
                        content["baseNameOfDirectory"] = str(
                            str(fu.getBaseName(_path)) + str(fu.getDirName(filePath)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(filePath)
                        content["artist"] = tagger.getArtist()
                        content["title"] = tagger.getTitle()
                        content["album"] = tagger.getAlbum()
                        content["albumArtist"] = tagger.getAlbumArtist()
                        content["trackNum"] = tagger.getTrackNum()
                        content["year"] = tagger.getYear()
                        content["genre"] = tagger.getGenre()
                        content["firstComment"] = tagger.getFirstComment()
                        content["firstLyrics"] = tagger.getFirstLyrics()
                        if tagger.isSupportInfo:
                            content["length"] = tagger.getLength()
                            content["bitrate"] = tagger.getBitrate()
                            content["sampleRate"] = tagger.getSampleRate()
                            content["mode"] = tagger.getMode()
                        content["size"] = details[stat.ST_SIZE]
                        content["lastAccessed"] = details[stat.ST_ATIME]
                        content["lastModified"] = details[stat.ST_MTIME]
                        content["lastMetadataChanged"] = details[stat.ST_CTIME]
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(self.values[rowNo]["baseNameOfDirectory"], "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        self.values[rowNo]["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "file")
                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                        newArtist = Organizer.emend(self.values[rowNo]["artist"])
                        self.createItem(rowNo, "artist", newArtist, self.values[rowNo]["artist"])

                        newTitle = Organizer.emend(self.values[rowNo]["title"])
                        self.createItem(rowNo, "title", newTitle, self.values[rowNo]["title"])

                        newAlbum = Organizer.emend(self.values[rowNo]["album"])
                        self.createItem(rowNo, "album", newAlbum, self.values[rowNo]["album"])

                        newAlbumArtist = Organizer.emend(self.values[rowNo]["albumArtist"])
                        self.createItem(rowNo, "albumArtist", newAlbumArtist, self.values[rowNo]["albumArtist"])

                        newTrackNum = str(self.values[rowNo]["trackNum"])
                        self.createItem(rowNo, "trackNum", newTrackNum, self.values[rowNo]["trackNum"])

                        newYear = Organizer.emend(self.values[rowNo]["year"])
                        self.createItem(rowNo, "year", newYear, self.values[rowNo]["year"])

                        newGenre = Organizer.emend(self.values[rowNo]["genre"])
                        self.createItem(rowNo, "genre", newGenre, self.values[rowNo]["genre"])

                        newFirstComment = Organizer.emend(self.values[rowNo]["firstComment"])
                        self.createItem(rowNo, "firstComment", newFirstComment, self.values[rowNo]["firstComment"])

                        newFirstLyrics = Organizer.emend(self.values[rowNo]["firstLyrics"])
                        self.createItem(rowNo, "firstLyrics", newFirstLyrics, self.values[rowNo]["firstLyrics"])

                        if tagger.isSupportInfo:
                            self.createItem(rowNo, "length", content["length"])
                            self.createItem(rowNo, "bitrate", content["bitrate"])
                            self.createItem(rowNo, "sampleRate", content["sampleRate"])
                            self.createItem(rowNo, "mode", content["mode"])

                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                        self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))

                        self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))

#.........这里部分代码省略.........
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:103,代码来源:SubFolderMusicTable.py

示例13: clickedAnAction

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]

#.........这里部分代码省略.........

            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":
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:70,代码来源:__init__.py

示例14: __init__

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]
    def __init__(self, _artistId, _isOpenDetailsOnNewWindow=True):
        global currentDialogs
        if Commands.getArtistName(_artistId) is not None:
            if _isOpenDetailsOnNewWindow is False:
                isHasOpenedDialog = False
                for dialog in currentDialogs:
                    if dialog.isVisible():
                        isHasOpenedDialog = True
                        dialog.changeArtist(_artistId)
                        dialog.activateWindow()
                        dialog.raise_()
                        break
                if isHasOpenedDialog is False:
                    _isOpenDetailsOnNewWindow = True
            if _isOpenDetailsOnNewWindow:
                currentDialogs.append(self)
                MDialog.__init__(self, MApplication.activeWindow())
                if isActivePyKDE4:
                    self.setButtons(MDialog.NoDefault)
                self.infoLabels = {}
                self.infoValues = {}
                self.artistValues = {}
                self.pbtnClose = MPushButton(translate("AmarokArtistDetails", "Close"))
                self.pbtnSave = MPushButton(translate("AmarokArtistDetails", "Save Changes"))
                self.pbtnSave.setIcon(MIcon("Images:save.png"))
                MObject.connect(self.pbtnClose, SIGNAL("clicked()"), self.close)
                MObject.connect(self.pbtnSave, SIGNAL("clicked()"), self.save)
                self.labels = [translate("AmarokArtistDetails", "Current Artist: "),
                               translate("AmarokArtistDetails", "Corrected Artist: ")]
                self.songTableColumns = [translate("AmarokArtistDetails", "File Path"),
                                         translate("AmarokArtistDetails", "Artist"),
                                         translate("AmarokArtistDetails", "Title"),
                                         translate("AmarokArtistDetails", "Album"),
                                         translate("AmarokArtistDetails", "Album Artist"),
                                         translate("AmarokArtistDetails", "Track No"),
                                         translate("AmarokArtistDetails", "Year"),
                                         translate("AmarokArtistDetails", "Genre"),
                                         translate("AmarokArtistDetails", "Comment")]
                self.pnlMain = MWidget()
                self.vblMain = MVBoxLayout(self.pnlMain)
                self.pnlClearable = None
                self.changeArtist(_artistId, True)

                buttonHBOXs = MHBoxLayout()
                buttonHBOXs.addWidget(self.pbtnSave)
                buttonHBOXs.addWidget(self.pbtnClose)
                self.vblMain.addLayout(buttonHBOXs)
                if isActivePyKDE4:
                    self.setMainWidget(self.pnlMain)
                else:
                    self.setLayout(self.vblMain)
                self.show()
                self.setMinimumWidth(700)
                self.setMinimumHeight(500)
        else:
            Dialogs.showError(translate("AmarokArtistDetails", "Artist Does Not Exist"),
                              str(translate("AmarokArtistDetails",
                                            "\"%s\" does not exist in \"id\" column of \"artist\" table.<br>Table will be refreshed automatically!<br>Please retry.")
                              ) % Organizer.getLink(str(_artistId)))
            if hasattr(getMainWindow(),
                       "FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:63,代码来源:AmarokArtistDetails.py

示例15: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getLink [as 别名]

#.........这里部分代码省略.........
                                            content["baseNameOfDirectory"] = ""
                                            content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                                            content["artist"] = musicFileRow["artist"]
                                            content["title"] = musicFileRow["title"]
                                            content["album"] = musicFileRow["album"]
                                            content["albumArtist"] = musicFileRow["albumArtist"]
                                            content["trackNum"] = musicFileRow["trackNumber"]
                                            content["year"] = musicFileRow["year"]
                                            content["genre"] = musicFileRow["genre"]
                                            content["firstComment"] = musicFileRow["comment"]
                                            content["firstLyrics"] = musicFileRow["lyrics"]
                                            tagger = Taggers.getTagger()
                                            if tagger.isSupportInfo:
                                                try:
                                                    tagger.loadFile(musicFileRow["filePath"])
                                                except:
                                                    content["length"] = ""
                                                    content["bitrate"] = ""
                                                    content["sampleRate"] = ""
                                                    content["mode"] = ""
                                                else:
                                                    content["length"] = tagger.getLength()
                                                    content["bitrate"] = tagger.getBitrate()
                                                    content["sampleRate"] = tagger.getSampleRate()
                                                    content["mode"] = tagger.getMode()
                                        else:
                                            tagger = Taggers.getTagger()
                                            try:
                                                tagger.loadFile(musicFileRow["filePath"])
                                            except:
                                                Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                                                                  str(translate("FileUtils/Musics",
                                                                                "\"%s\" : this file has the incorrect tag so can't read tags.")
                                                                  ) % Organizer.getLink(musicFileRow["filePath"]))
                                            content["path"] = musicFileRow["filePath"]
                                            content["baseNameOfDirectory"] = ""
                                            content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                                            content["artist"] = tagger.getArtist()
                                            content["title"] = tagger.getTitle()
                                            content["album"] = tagger.getAlbum()
                                            content["albumArtist"] = tagger.getAlbumArtist()
                                            content["trackNum"] = tagger.getTrackNum()
                                            content["year"] = tagger.getYear()
                                            content["genre"] = tagger.getGenre()
                                            content["firstComment"] = tagger.getFirstComment()
                                            content["firstLyrics"] = tagger.getFirstLyrics()
                                            if tagger.isSupportInfo:
                                                content["length"] = tagger.getLength()
                                                content["bitrate"] = tagger.getBitrate()
                                                content["sampleRate"] = tagger.getSampleRate()
                                                content["mode"] = tagger.getMode()
                                        content["size"] = details[stat.ST_SIZE]
                                        content["lastAccessed"] = details[stat.ST_ATIME]
                                        content["lastModified"] = details[stat.ST_MTIME]
                                        content["lastMetadataChanged"] = details[stat.ST_CTIME]
                                        self.values.append(content)
                                        newBaseNameOfDirectory = Organizer.emend(
                                            self.values[rowNo]["baseNameOfDirectory"], "directory")
                                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                                        self.values[rowNo]["baseNameOfDirectory"])

                                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "file")
                                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                                        newArtist = Organizer.emend(self.values[rowNo]["artist"])
                                        self.createItem(rowNo, "artist", newArtist, self.values[rowNo]["artist"])
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:70,代码来源:AmarokCopyTable.py


注:本文中的Core.Organizer.getLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。