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


Python FileUtils.readFromBinaryFile方法代码示例

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


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

示例1: addImage

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import readFromBinaryFile [as 别名]
 def addImage(self, _imageType, _imagePath, _description):
     self.isSave = True
     imageData = fu.readFromBinaryFile(_imagePath)
     mimeType = fu.getMimeType(_imagePath)[0]
     self.tags.add(id3.APIC(encoding=3, mime=mimeType, type=int(_imageType),
                                        desc=uni.trUnicode(_description), data=imageData))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:8,代码来源:mutagenTagger.py

示例2: install

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import readFromBinaryFile [as 别名]
        def install(self):
            try:
                MApplication.processEvents()
                self.installationDirectory = str(self.leInstallationDirectory.text())
                if len(self.installationDirectory) > 0:
                    if self.installationDirectory[-1] == fu.sep:
                        self.installationDirectory = self.installationDirectory[:-1]
                    if self.installationDirectory == fu.HamsiManagerDirectory:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                          translate("Install",
                                                    "The selected path is Hamsi Manager source directory.<br>Please choose a valid installation path."))
                    elif fu.isFile(self.installationDirectory) is False:
                        isMakeInstall = True
                        if fu.isDir(self.installationDirectory) is False:
                            self.lblActions.setText(translate("Install", "Creating Installation Folder..."))
                            fu.makeDirs(self.installationDirectory)
                        elif len(fu.listDir(self.installationDirectory)) > 0:
                            currenctAnswer = Dialogs.askSpecial(
                                translate("Install", "The Installation Path You Selected Is Not Empty."),
                                translate("Install",
                                          "If the path you selected is an \"Hamsi Manager\" installation path, <b>I recommend you to delete the older files.</b><br>Do you want me to clear the installation path/folder for you?<br><b>Note: </b> Your personal settings are <b>never deleted</b>."),
                                translate("Install", "Yes (Recommended)"),
                                translate("Install", "No (Overwrite)"),
                                translate("Install", "Cancel"))
                            if currenctAnswer == translate("Install", "Yes (Recommended)"):
                                self.lblActions.setText(translate("Install", "Clearing Installation Path..."))
                                try:fu.removeFileOrDir(self.installationDirectory)
                                except:pass
                                fu.makeDirs(self.installationDirectory)
                                isMakeInstall = True
                            elif currenctAnswer == translate("Install", "No (Overwrite)"):
                                isMakeInstall = True
                            else:
                                isMakeInstall = False
                        if isMakeInstall:
                            Settings.setUniversalSetting("pathOfInstallationDirectory", self.installationDirectory)
                            directoriesAndFiles = fu.readDirectoryWithSubDirectories(fu.HamsiManagerDirectory)
                            self.prgbState.setRange(0, len(directoriesAndFiles))
                            self.lblActions.setText(translate("Install", "Copying Files And Folders..."))
                            installFileName = Execute.findExecutableBaseName("HamsiManagerInstaller")
                            for fileNo, fileName in enumerate(directoriesAndFiles):
                                MApplication.processEvents()
                                newFileName = self.installationDirectory + fileName.replace(fu.HamsiManagerDirectory,"")
                                if fu.isDir(fileName) and fileName.find(".svn") == -1:
                                    try: fu.makeDirs(newFileName)
                                    except: pass
                                elif (fu.isFile(fileName) and fu.getBaseName(fileName) != "install.py" and
                                        fu.getBaseName(fileName) != installFileName and fileName.find(".svn") == -1):
                                    try:
                                        fu.copyFileOrDir(fileName, newFileName)
                                    except:
                                        fileContent = fu.readFromBinaryFile(fileName)
                                        fu.writeToBinaryFile(newFileName, fileContent)
                                self.prgbState.setValue(fileNo + 1)
                            self.pageNo += 1
                            MyConfigure.installKDE4Languages()
                        else:
                            self.pageNo -= 1
                    else:
                        self.pageNo -= 1
                        self.lblActions.setText("")
                        Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                          translate("Install",
                                                    "The selected path points to a file not a folder.<br>Please choose a valid installation path."))
                else:
                    self.pageNo -= 1
                    self.lblActions.setText("")
                    Dialogs.showError(translate("Install", "The path you selected is not valid."),
                                      translate("Install",
                                                "The selected path points to a file not a folder.<br>Please choose a valid installation path."))
                self.pageChanged(True)
            except:
                from Core import ReportBug

                ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:79,代码来源:install.py

示例3: addImage

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import readFromBinaryFile [as 别名]
 def addImage(self, _imageType, _imagePath, _description):
     self.isSave = True
     imageData = fu.readFromBinaryFile(_imagePath)
     mimeType = fu.getMimeType(_imagePath)[0]
     self.tag.images.set(int(_imageType), imageData, mimeType, uni.trUnicode(_description))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:7,代码来源:EyeD3Tagger.py

示例4: str

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import readFromBinaryFile [as 别名]
                    currentMainWindow = MyMainWindow.MyMainWindow()
                    uni.printForDevelopers("After MyMainWindow")
                    if str(currentMainWindow.windowTitle()) == "":
                        currentMainWindow.setWindowTitle("Hamsi Manager " + uni.version)
                    if isActivePyKDE4:
                        uni.printForDevelopers("Before MGlobal.config")
                        kconf = MGlobal.config()
                        kconfGroup = MConfigGroup(kconf, "Universals")
                        currentMainWindow.setAutoSaveSettings(kconfGroup)
                        uni.printForDevelopers("After MGlobal.config")
                    else:
                        try:
                            uni.printForDevelopers("Before MainWindow.restoreState")
                            state = MByteArray()
                            state.append(fu.readFromBinaryFile(fu.joinPath(fu.pathOfSettingsDirectory, "LastState")))
                            currentMainWindow.restoreState(state)
                            uni.printForDevelopers("After MainWindow.restoreState")
                        except: pass
                    uni.printForDevelopers("Before Show")
                    if uni.getBoolValue("isMainWindowMaximized"):
                        currentMainWindow.showMaximized()
                    else:
                        geometries = uni.getListValue("MainWindowGeometries")
                        currentMainWindow.setGeometry(int(geometries[0]), int(geometries[1]), int(geometries[2]),
                                                      int(geometries[3]))
                        currentMainWindow.show()
                    uni.printForDevelopers("Before # After Run Processes Step 1")
                    currentMainWindow.doAfterRunProcessesStep1()
                    uni.printForDevelopers("After # After Run Processes Step 1")
                    uni.isStartingSuccessfully = True
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:32,代码来源:HamsiManager.py


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