本文整理汇总了Python中FileUtils.joinPath方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.joinPath方法的具体用法?Python FileUtils.joinPath怎么用?Python FileUtils.joinPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.joinPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uninstallPlugin
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def uninstallPlugin(self, _pluginName, _isQuiet=False):
isUninstalled = False
pluginModule = __import__("MyPlugins." + _pluginName, globals(), locals(),
["pluginName", "pluginFiles", "pluginDirectory", "uninstallThisPlugin",
"setupDirectory", "pluginVersion"], 0)
if pluginModule.uninstallThisPlugin is None:
if pluginModule.pluginDirectory == "":
for pluginFile in pluginModule.pluginFiles:
if fu.isFile(fu.joinPath(pluginModule.setupDirectory, pluginFile)):
fu.removeFileOrDir(fu.joinPath(pluginModule.setupDirectory, pluginFile))
isUninstalled = True
else:
if fu.isDir(fu.joinPath(pluginModule.setupDirectory, pluginModule.pluginDirectory)):
fu.removeFileOrDir(fu.joinPath(pluginModule.setupDirectory, pluginModule.pluginDirectory))
isUninstalled = True
else:
isUninstalled = pluginModule.uninstallThisPlugin()
if isUninstalled:
Settings.setUniversalSetting(str(pluginModule.pluginName), str(""))
if _isQuiet is False:
Dialogs.show(translate("MyPlugins", "Plug-in Uninstallation Is Complete"),
str(translate("MyPlugins", "\"%s\" is uninstalled on your system.")) % (
pluginModule.pluginName))
elif isUninstalled == "AlreadyUninstalled":
if _isQuiet is False:
Dialogs.show(translate("MyPlugins", "Plug-in Already Uninstalled"),
str(translate("MyPlugins", "\"%s\" already uninstalled on your system.")) % (
pluginModule.pluginName))
else:
if _isQuiet is False:
Dialogs.showError(translate("MyPlugins", "Plug-in Uninstallation Failed"),
str(translate("MyPlugins", "\"%s\" failed to uninstall on your system.")) % (
pluginModule.pluginName))
示例2: willDownload
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def willDownload(self, _request):
try:
defaultFileName = str(MFileInfo(str(trStr(_request.url()))).fileName())
fileDialogTitle = translate("UpdateControl", "You Can Click Cancel To Update Without Saving The Package.")
if self.isNotInstall:
fileDialogTitle = translate("UpdateControl", "Save New Version Of Hamsi Manager")
fileName = Dialogs.getSaveFileName(fileDialogTitle,
fu.joinPath(fu.getDirName(fu.HamsiManagerDirectory), defaultFileName))
if self.isNotInstall is False or fileName is not None:
if fileName is None:
import random
fileName = fu.joinPath(fu.getTempDir(), defaultFileName[:-7] + "-" + str(
random.randrange(0, 1000000)) + defaultFileName[-7:])
self.pbtnDownloadAndInstall.setEnabled(False)
newRequest = _request
newRequest.setAttribute(MNetworkRequest.User, trQVariant(fileName))
networkManager = self.wvWeb.page().networkAccessManager()
reply = networkManager.get(newRequest)
self.isFileExist = True
self.connect(reply, SIGNAL("downloadProgress(qint64,qint64)"), self.downloading)
self.connect(reply, SIGNAL("finished()"), self.downloaded)
self.connect(reply, SIGNAL("error(QNetworkReply::NetworkError)"), self.errorOccurred)
except:
ReportBug.ReportBug()
示例3: save
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def save(self):
try:
codes = Scripts.getScript(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName))
Scripts.saveScript(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName),
str(self.sciCommand.text()))
except:
ReportBug.ReportBug()
示例4: emendDirectoryWithContents
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [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()
示例5: refreshTable
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [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
示例6: getInstalledThemes
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def getInstalledThemes():
themes = []
for name in fu.readDirectoryAll(fu.joinPath(fu.HamsiManagerDirectory, "Themes")):
try:
if (name[:1] != "." and name[:2] != "__" and name[-2:] != "__" and
fu.isDir(fu.joinPath(fu.HamsiManagerDirectory, "Themes", name))):
themes.append(name)
except: pass
return themes
示例7: getMyPluginsNames
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def getMyPluginsNames():
plugins = []
for name in fu.readDirectoryAll(fu.joinPath(fu.HamsiManagerDirectory, "MyPlugins")):
try:
if (name[:1] != "." and name[:2] != "__" and name[-2:] != "__" and
fu.isDir(fu.joinPath(fu.HamsiManagerDirectory, "MyPlugins", name))):
plugins.append(name)
except: pass
return plugins
示例8: checkSettings
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def checkSettings():
if fu.isDir(fu.pathOfSettingsDirectory) is False:
fu.makeDirs(fu.pathOfSettingsDirectory)
reFillSettings()
reFillDatabases()
else:
if fu.isFile(fu.joinPath(fu.pathOfSettingsDirectory, "database.sqlite")) is False:
reFillDatabases()
if fu.isFile(fu.joinPath(fu.pathOfSettingsDirectory, uni.fileOfSettings)) is False:
reFillSettings()
checkDatabases()
示例9: getTaggersMachineNames
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def getTaggersMachineNames():
taggers = []
for name in fu.readDirectoryAll(fu.joinPath(fu.HamsiManagerDirectory, "Taggers")):
try:
moduleName = name.split(".")[0]
moduleNameExt = name.split(".")[1]
if taggers.count(moduleName) == 0:
if (name[:1] != "." and moduleName != "__init__" and ["py", "pyc", "pyd"].count(moduleNameExt) == 1 and
fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Taggers", name))):
taggers.append(moduleName)
except: pass
return taggers
示例10: getInstalledLanguagesCodes
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def getInstalledLanguagesCodes():
global installedLanguagesCodes
if installedLanguagesCodes is None:
languages = []
for name in fu.readDirectoryAll(fu.joinPath(fu.HamsiManagerDirectory, "Languages")):
if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", name)) and name[-3:] == ".qm":
langCode = name[-8:-3]
if languages.count(langCode) == 0:
languages.append(langCode)
if languages.count("en_GB") == 0:
languages.append("en_GB")
installedLanguagesCodes = languages
return installedLanguagesCodes
示例11: getInstalledLanguagesNames
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def getInstalledLanguagesNames():
global installedLanguagesNames
if installedLanguagesNames is None:
languages = []
for name in fu.readDirectoryAll(fu.joinPath(fu.HamsiManagerDirectory, "Languages")):
if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "Languages", name)) and name[-3:] == ".qm":
langCode = name[-8:-3]
if languages.count(str(MQtCore.QLocale.languageToString(MQtCore.QLocale(langCode).language()))) == 0:
languages.append(str(MQtCore.QLocale.languageToString(MQtCore.QLocale(langCode).language())))
if languages.count("English") == 0:
languages.append("English")
installedLanguagesNames = languages
return installedLanguagesNames
示例12: installKDE4Language
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def installKDE4Language(_language="tr_TR"):
if uni.isAvailableKDE4():
KDELocalateDir = fu.joinPath(uni.getKDE4HomePath(), "share", "locale", str(_language[:2]), "LC_MESSAGES")
if uni.isRunningAsRoot():
KDELocalateDir = fu.joinPath("/usr", "share", "locale", str(_language[:2]), "LC_MESSAGES")
KDELocalateDir = str(KDELocalateDir)
langFile = fu.joinPath(fu.HamsiManagerDirectory, "Languages", "DontTranslate", str(_language),
"HamsiManager.mo")
if fu.isFile(fu.joinPath(KDELocalateDir, "HamsiManager.mo")) is False:
if fu.isFile(langFile):
if fu.isDir(KDELocalateDir) is False:
fu.makeDirs(KDELocalateDir)
fu.copyFileOrDir(langFile, fu.joinPath(KDELocalateDir, "HamsiManager.mo"))
return True
return False
示例13: changeFile
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [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"])
示例14: checkSize
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def checkSize():
setRecordType(1)
if fu.isFile(fu.recordFilePath):
if fu.getSize(fu.recordFilePath) > (int(uni.MySettings["maxRecordFileSize"]) * 1024):
fu.moveFileOrDir(fu.recordFilePath,
fu.joinPath(fu.oldRecordsDirectoryPath, str(time.strftime("%Y%m%d_%H%M%S")) + ".txt"))
restoreRecordType()
示例15: fillMySettings
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import joinPath [as 别名]
def fillMySettings(_setAgain=False, _isCheckUpdate=True):
global MySettings, isShowVerifySettings, changedDefaultValuesKeys, newSettingsKeys, tableType
from Core import Settings
sets = Settings.setting()
currentSettingVersion = trStr(sets.value("settingsVersion"))
defaultValues = Settings.getDefaultValues()
valueTypesAndValues = Settings.getValueTypesAndValues()
for keyValue in Settings.getKeysOfSettings():
value = trStr(sets.value(keyValue, trQVariant(defaultValues[keyValue])))
if keyValue not in MySettings.keys() or _setAgain:
MySettings[keyValue] = str(
Settings.emendValue(keyValue, value, defaultValues[keyValue], valueTypesAndValues[keyValue]))
for keyValue in sets.allKeys():
keyValue = str(keyValue)
if keyValue not in MySettings.keys():
value = trStr(sets.value(keyValue, trQVariant("")))
MySettings[keyValue] = str(Settings.emendValue(keyValue, value, "", "str"))
newSettingVersion = str(MySettings["settingsVersion"])
if _isCheckUpdate:
if str(currentSettingVersion) is not "" and newSettingVersion != currentSettingVersion:
newSettingsKeys, changedDefaultValuesKeys = Settings.updateOldSettings(currentSettingVersion,
newSettingVersion)
isShowVerifySettings = True
fu.fileSystemEncoding = MySettings["fileSystemEncoding"]
fu.themePath = fu.joinPath(fu.HamsiManagerDirectory, "Themes", MySettings["themeName"])
if tableType is None:
tableType = MySettings["tableType"]
if tableType not in getTableTypesNames():
tableType = "1"
if getBoolValue("isInstalledKDE4Language") is False:
from Core import MyConfigure
MyConfigure.installKDE4Languages()