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


Python Organizer.emend方法代码示例

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


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

示例1: emendDirectoryWithContents

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [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: changeFile

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def changeFile(self, _filePath, _isNew=False):
     self.fileValues = fu.readTextFile(_filePath, uni.MySettings["fileSystemEncoding"])
     self.setWindowTitle(str(fu.getBaseName(self.fileValues["path"])))
     if self.pnlClearable is not None:
         clearAllChildren(self.pnlClearable, True)
     self.pnlClearable = MWidget()
     self.vblMain.insertWidget(0, self.pnlClearable, 20)
     vblClearable = MVBoxLayout(self.pnlClearable)
     self.infoLabels["path"] = MLabel(self.labels[0])
     self.infoLabels["content"] = MLabel(self.labels[1])
     dirPath = fu.getDirName(self.fileValues["path"])
     baseName = fu.getBaseName(self.fileValues["path"])
     self.infoValues["path"] = MLineEdit(str(fu.joinPath(dirPath, Organizer.emend(baseName, "file"))))
     self.infoValues["content"] = MPlainTextEdit(
         str(Organizer.emend(self.fileValues["content"], "text", False, True)))
     self.infoValues["content"].setLineWrapMode(MPlainTextEdit.NoWrap)
     self.sourceCharSet = MComboBox()
     self.sourceCharSet.addItems(uni.getCharSets())
     self.sourceCharSet.setCurrentIndex(self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"]))
     MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"), self.sourceCharSetChanged)
     HBOXs = []
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["path"])
     HBOXs[-1].addWidget(self.infoValues["path"])
     HBOXs[-1].addWidget(self.sourceCharSet)
     for hbox in HBOXs:
         vblClearable.addLayout(hbox)
     vblClearable.addWidget(self.infoLabels["content"])
     vblClearable.addWidget(self.infoValues["content"])
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:31,代码来源:TextDetails.py

示例3: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
    def refreshTable(self, _path):
        self.values = []
        fileAndDirectoryNames = fu.readDirectory(_path, "fileAndDirectory",
                                                 uni.getBoolValue("isShowHiddensInFolderTable"))
        allItemNumber = len(fileAndDirectoryNames)
        uni.startThreadAction()
        baseNameOfDirectory = fu.getBaseName(_path)
        rowNo = 0
        self.setRowCount(allItemNumber)
        for baseName in fileAndDirectoryNames:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(fu.joinPath(_path, baseName), False, True):
                        details = fu.getExtendedDetails(fu.joinPath(_path, baseName))
                        content = {}
                        content["path"] = fu.joinPath(_path, baseName)
                        content["baseNameOfDirectory"] = baseNameOfDirectory
                        content["baseName"] = baseName
                        content.update(details)
                        self.values.append(content)

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

                        newBaseName = Organizer.emend(content["baseName"], fu.getObjectType(self.values[rowNo]["path"]))
                        self.createItem(rowNo, "baseName", newBaseName, content["baseName"])

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

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

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

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

                        if not uni.isWindows:
                            self.createItem(rowNo, "accessRights", content["accessRights"])

                            self.createItem(rowNo, "userIDOfOwner", content["userIDOfOwner"])

                            self.createItem(rowNo, "groupIDOfOwner", content["groupIDOfOwner"])

                            self.createItem(rowNo, "numberOfHardLinks", content["numberOfHardLinks"])

                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:62,代码来源:FolderTable.py

示例4: correctTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def correctTable(self):
     for rowNo in range(self.rowCount()):
         for coloumKey in self.getWritableColumnKeys():
             coloumNo = self.getColumnNoFromKey(coloumKey)
             if self.isChangeableItem(rowNo, coloumKey):
                 if coloumKey == "baseNameOfDirectory":
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()), "directory")
                 else:
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()), "file")
                 self.item(rowNo, coloumNo).setText(str(newString))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:12,代码来源:SubFolderTable.py

示例5: correctTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def correctTable(self):
     for rowNo in range(self.rowCount()):
         for coloumKey in self.getWritableColumnKeys():
             coloumNo = self.getColumnNoFromKey(coloumKey)
             if self.isChangeableItem(rowNo, coloumKey):
                 newString = None
                 if coloumKey == "correctedArtist":
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()))
                 self.item(rowNo, coloumNo).setText(str(newString))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:11,代码来源:AmarokArtistTable.py

示例6: createWindow

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
    def createWindow(self, _actionName, _makeThisAction, _isShowEmendWidgets):
        from Options import OptionsForm

        newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
        wOptionsPanel = OptionsForm.OptionsForm(None, QuickMakeParameters[0], None, newOrChangedKeys)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setButtons(MyDialog.NoDefault)
        elif MyDialogType == "MMainWindow":
            self.setObjectName("Packager")
            setMainWindow(self)
        self.setWindowTitle(_actionName)
        pnlMain = MWidget(self)
        vblMain = MVBoxLayout(pnlMain)
        pnlInfo = MWidget()
        vblInfo = MVBoxLayout(pnlInfo)
        vblInfo.addStretch(3)
        if _isShowEmendWidgets:
            lblOldValue = MLabel(translate("QuickMake", "Old Value : "))
            lblNewValue = MLabel(translate("QuickMake", "New Value : "))
            leOldValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leOldValue.setEnabled(False)
            self.leNewValue = MLineEdit(str(Organizer.emend(fu.getRealPath(QuickMakeParameters[1]),
                                                            fu.getObjectType(fu.getRealPath(QuickMakeParameters[1])))))
            vblInfo.addWidget(lblOldValue)
            vblInfo.addWidget(leOldValue)
            vblInfo.addWidget(lblNewValue)
            vblInfo.addWidget(self.leNewValue)
        else:
            lblValue = MLabel(translate("QuickMake", "Value : "))
            leValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leValue.setEnabled(False)
            vblInfo.addWidget(lblValue)
            vblInfo.addWidget(leValue)
        vblInfo.addStretch(3)
        pbtnApply = MPushButton(_actionName)
        pbtnClose = MPushButton(translate("QuickMake", "Cancel"))
        MObject.connect(pbtnApply, SIGNAL("clicked()"), _makeThisAction)
        MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
        tabwTabs = MTabWidget()
        tabwTabs.addTab(pnlInfo, translate("QuickMake", "Quick Make"))
        tabwTabs.addTab(wOptionsPanel, translate("QuickMake", "Quick Make Options"))
        vblMain.addWidget(tabwTabs)
        hblBox = MHBoxLayout()
        hblBox.addWidget(pbtnClose, 2)
        hblBox.addWidget(pbtnApply, 3)
        vblInfo.addLayout(hblBox)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setMainWidget(pnlMain)
            else:
                self.setLayout(vblMain)
        elif MyDialogType == "MMainWindow":
            self.setCentralWidget(pnlMain)
            moveToCenter(self)
        self.setMinimumSize(450, 350)
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:58,代码来源:QuickMake.py

示例7: sourceCharSetChanged

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def sourceCharSetChanged(self):
     try:
         self.fileValues = fu.readTextFile(self.fileValues["path"], str(self.sourceCharSet.currentText()))
         self.infoValues["content"].setPlainText(
             str(Organizer.emend(self.fileValues["content"], "text", False, True)))
     except:
         Dialogs.showError(translate("TextDetails", "Incorrect File Encoding"),
                           str(translate("TextDetails",
                                         "File can not decode by \"%s\" codec.<br>Please select another file encoding type.")
                           ) % str(self.sourceCharSet.currentText()))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:12,代码来源:TextDetails.py

示例8: fillValues

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def fillValues(self):
     filePath = str(self.leFilePath.text())
     if fu.isFile(filePath) and fu.isReadableFileOrDir(filePath):
         self.fileValues = fu.readTextFile(filePath, str(self.sourceCharSet.currentText()))
         self.pteFileContent.setPlainText(str(Organizer.emend(self.fileValues["content"], "text", False, True)))
         self.isChangeSourceCharSetChanged = True
         self.pbtnSave.setEnabled(True)
     else:
         self.isChangeSourceCharSetChanged = False
         self.pbtnSave.setEnabled(False)
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:12,代码来源:TextCorrector.py

示例9: emendDirectory

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [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

示例10: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
    def refreshTable(self, _path):
        self.values = []
        uni.startThreadAction()
        Dialogs.showState(translate("AmarokArtistTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                artistValues = Operations.getAllArtistsValues(uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(translate("AmarokArtistTable", "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if artistValues is not None:
                        allItemNumber = len(artistValues)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for musicFileRow in artistValues:
                            isContinueThreadAction = uni.isContinueThreadAction()
                            if isContinueThreadAction:
                                try:
                                    content = {}
                                    content["id"] = musicFileRow["id"]
                                    content["currentArtist"] = musicFileRow["name"]
                                    content["correctedArtist"] = musicFileRow["name"]
                                    self.values.append(content)

                                    currentName = content["currentArtist"]
                                    self.createItem(rowNo, "currentArtist", currentName, currentName, True)

                                    newName = Organizer.emend(content["correctedArtist"])
                                    isReadOnlyNewName = (content["correctedArtist"].strip() == "")
                                    self.createItem(rowNo, "correctedArtist", newName, content["currentArtist"],
                                                    isReadOnlyNewName)
                                    rowNo += 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:45,代码来源:AmarokArtistTable.py

示例11: changeArtist

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
 def changeArtist(self, _artistId, _isNew=False):
     self.artistId = _artistId
     self.songTableContentValues = None
     uni.startThreadAction()
     Dialogs.showState(translate("AmarokArtistDetails", "Getting Values From Amarok"), 0, 1)
     if Amarok.checkAmarok():
         isContinueThreadAction = uni.isContinueThreadAction()
         if isContinueThreadAction:
             self.artistName = Commands.getArtistName(self.artistId)
             self.songTableContentValues = Operations.getAllMusicFileValuesWithNames("", self.artistId)
             Dialogs.showState(translate("MusicDetails", "Values Are Being Processed"), 1, 1)
     uni.finishThreadAction()
     if self.songTableContentValues is None:
         self.close()
     self.setWindowTitle(str(self.artistName))
     if self.pnlClearable is not None:
         clearAllChildren(self.pnlClearable, True)
     self.pnlClearable = MWidget()
     self.vblMain.insertWidget(0, self.pnlClearable, 20)
     vblClearable = MVBoxLayout(self.pnlClearable)
     self.infoLabels["currentArtist"] = MLabel(self.labels[0])
     self.infoLabels["correctedArtist"] = MLabel(self.labels[1])
     self.infoValues["currentArtist"] = MLineEdit(str(self.artistName))
     self.infoValues["correctedArtist"] = MLineEdit(str(Organizer.emend(self.artistName)))
     self.twSongs = MTableWidget()
     self.twSongs.clear()
     self.twSongs.setColumnCount(len(self.songTableColumns))
     self.twSongs.setHorizontalHeaderLabels(self.songTableColumns)
     self.twSongs.setRowCount(len(self.songTableContentValues))
     for rowNo in range(self.twSongs.rowCount()):
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["filePath"]))
         self.twSongs.setItem(rowNo, 0, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["artist"]))
         self.twSongs.setItem(rowNo, 1, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["title"]))
         self.twSongs.setItem(rowNo, 2, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["album"]))
         self.twSongs.setItem(rowNo, 3, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["albumArtist"]))
         self.twSongs.setItem(rowNo, 4, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["trackNumber"]))
         self.twSongs.setItem(rowNo, 5, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["year"]))
         self.twSongs.setItem(rowNo, 6, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["genre"]))
         self.twSongs.setItem(rowNo, 7, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["comment"]))
         self.twSongs.setItem(rowNo, 8, item)
         for x in range(self.twSongs.columnCount()):
             self.twSongs.item(rowNo, x).setFlags(Mt.ItemIsSelectable | Mt.ItemIsEnabled)
     HBOXs = []
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["currentArtist"])
     HBOXs[-1].addWidget(self.infoValues["currentArtist"])
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["correctedArtist"])
     HBOXs[-1].addWidget(self.infoValues["correctedArtist"])
     vblInfos = MVBoxLayout()
     for hbox in HBOXs:
         vblInfos.addLayout(hbox)
     vblInfos.addWidget(self.twSongs)
     vblClearable.addLayout(vblInfos)
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:64,代码来源:AmarokArtistDetails.py

示例12: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
    def refreshTable(self, _path):
        self.values = []
        uni.startThreadAction()
        import Amarok

        Dialogs.showState(translate("AmarokMusicTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                from Amarok import Operations

                directoriesAndValues = Operations.getDirectoriesAndValues(uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(translate("AmarokMusicTable", "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if directoriesAndValues is not None:
                        allItemNumber = len(directoriesAndValues)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for dirPath, dirRow in directoriesAndValues.items():
                            isContinueThreadAction = uni.isContinueThreadAction()
                            if isContinueThreadAction:
                                try:
                                    if fu.isReadableFileOrDir(dirPath, False, True) and fu.isReadableFileOrDir(
                                        fu.joinPath(dirPath, ".directory"), False, True):
                                        content = {}
                                        content["path"] = dirPath
                                        content["pathOfParentDirectory"] = fu.getDirName(dirPath)
                                        content["baseName"] = fu.getBaseName(dirPath)
                                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(dirPath)
                                        if currentCover is None:
                                            currentCover = ""
                                        content["currentCover"] = (currentCover)
                                        content["sourceCover"] = (dirRow["coverPath"][0].replace(dirPath, "."))
                                        content["destinationCover"] = ("./" + Organizer.getIconName(
                                            dirRow["artist"][0],
                                            dirRow["album"][0],
                                            dirRow["genre"][0],
                                            dirRow["year"][0]))
                                        content["flagColor"] = {}
                                        if isCorrectedFileContent is False:
                                            content["flagColor"]["currentCover"] = 255, 163, 163
                                        if fu.isFile(content["sourceCover"]) is False:
                                            content["flagColor"]["sourceCover"] = 255, 163, 163
                                        self.values.append(content)

                                        newPathOfParentDirectory = Organizer.emend(
                                            self.values[rowNo]["pathOfParentDirectory"], "directory")
                                        self.createItem(rowNo, "pathOfParentDirectory", newPathOfParentDirectory,
                                                        self.values[rowNo]["pathOfParentDirectory"])

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

                                        newCurrentCover = fu.getShortPath(self.values[rowNo]["currentCover"],
                                                                          self.values[rowNo]["path"])
                                        itemCurrentCover = self.createItem(rowNo, "currentCover", newCurrentCover,
                                                                           newCurrentCover, True)
                                        self.setItemColor(itemCurrentCover, rowNo, 2, "currentCover")

                                        newSourceCover = fu.getShortPath(self.values[rowNo]["sourceCover"],
                                                                         self.values[rowNo]["path"])
                                        itemSourceCover = self.createItem(rowNo, "sourceCover", newSourceCover,
                                                                          fu.getShortPath(
                                                                              self.values[rowNo]["currentCover"],
                                                                              self.values[rowNo]["path"]))
                                        self.setItemColor(itemSourceCover, rowNo, 3, "sourceCover")

                                        newDestinationCover = Organizer.emend(
                                            fu.getShortPath(self.values[rowNo]["destinationCover"],
                                                            self.values[rowNo]["path"]), "file")
                                        itemDestinationCover = self.createItem(rowNo, "destinationCover",
                                                                               newDestinationCover,
                                                                               fu.getShortPath(
                                                                                   self.values[rowNo]["currentCover"],
                                                                                   self.values[rowNo]["path"]))
                                        self.setItemColor(itemDestinationCover, rowNo, 4, "destinationCover")
                                        rowNo += 1
                                    else:
                                        allItemNumber -= 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:93,代码来源:AmarokCoverTable.py

示例13: refreshTable

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

#.........这里部分代码省略.........
                                                    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"])

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

示例14: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [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

示例15: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import emend [as 别名]
    def refreshTable(self, _path):
        self.values = []
        allFilesAndDirectories = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                          int(uni.MySettings["CoversSubDirectoryDeep"]),
                                                                          "directory",
                                                                          uni.getBoolValue("isShowHiddensInCoverTable"))
        allItemNumber = len(allFilesAndDirectories)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for dirName in allFilesAndDirectories:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(dirName, False, True) and fu.isReadableFileOrDir(
                        fu.joinPath(dirName, ".directory"), False, True):
                        content = {}
                        content["path"] = dirName
                        content["baseNameOfDirectory"] = str(str(fu.getBaseName(_path)) +
                                                             str(fu.getDirName(dirName)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(dirName)

                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(dirName)
                        selectedName = None
                        if isCorrectedFileContent and currentCover is not None:
                            selectedName = fu.getBaseName(currentCover)
                        sourceCover = fu.getFirstImageInDirectory(dirName, selectedName, False, False)
                        if currentCover is None:
                            currentCover = ""
                        if sourceCover is None:
                            sourceCover = ""
                        else:
                            sourceCover = fu.joinPath(dirName, sourceCover)
                        content["currentCover"] = (currentCover)
                        content["sourceCover"] = (sourceCover)
                        content["destinationCover"] = (sourceCover)
                        content["isCorrectedFileContent"] = (isCorrectedFileContent)
                        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"], "directory")
                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                        newCurrentCover = str(self.values[rowNo]["currentCover"])
                        newCurrentCover = newCurrentCover.replace(self.values[rowNo]["path"], ".")
                        itemCurrentCover = self.createItem(rowNo, "currentCover", newCurrentCover, newCurrentCover,
                                                           True)
                        if self.values[rowNo]["isCorrectedFileContent"] is False:
                            itemCurrentCover.setBackground(MBrush(MColor(255, 163, 163)))

                        newSourceCover = str(self.values[rowNo]["sourceCover"])
                        newSourceCover = newSourceCover.replace(self.values[rowNo]["path"], ".")
                        oldSourceCover = self.values[rowNo]["currentCover"]
                        oldSourceCover = oldSourceCover.replace(self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "sourceCover", newSourceCover, oldSourceCover)

                        newDestinationCover = self.values[rowNo]["destinationCover"]
                        newDestinationCover = newDestinationCover.replace(self.values[rowNo]["path"], ".")
                        newDestinationCover = Organizer.emend(newDestinationCover, "file")
                        oldDestinationCover = self.values[rowNo]["currentCover"]
                        oldDestinationCover = oldDestinationCover.replace(self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "destinationCover", newDestinationCover, oldDestinationCover)
                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:81,代码来源:CoverTable.py


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