本文整理汇总了Python中FileUtils.getFileTree方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.getFileTree方法的具体用法?Python FileUtils.getFileTree怎么用?Python FileUtils.getFileTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.getFileTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setSourceToSearch
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getFileTree [as 别名]
def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False):
try:
if self.sourceToSearch is None or _isReload:
sourceToSearch = ""
self.isMultipleSource = False
pathToSearchs = str(self.lePathToSeach.text())
if fu.isExist(pathToSearchs) is False and pathToSearchs.find(";") != -1:
self.isMultipleSource = True
for pathToSearch in uni.getListFromListString(pathToSearchs, ";"):
if pathToSearch in self.sourceToSearchCache and _isLoadFromCache:
sourceToSearch += self.sourceToSearchCache[pathToSearch]
else:
pathToSearch = fu.checkSource(pathToSearch)
if pathToSearch is not None:
if fu.isReadableFileOrDir(pathToSearch):
if fu.isFile(pathToSearch) and fu.isBinary(pathToSearch) is False:
sts = fu.readFromFile(pathToSearch) + "\n"
sourceToSearch += sts
self.sourceToSearchCache[pathToSearch] = sts
elif fu.isDir(pathToSearch):
sts = fu.getFileTree(pathToSearch, -1, "return", "plainText", "fileList") + "\n"
sourceToSearch += sts
self.sourceToSearchCache[pathToSearch] = sts
self.sourceToSearch = sourceToSearch
if sourceToSearch != "":
return True
return False
else:
return True
except:
ReportBug.ReportBug()
示例2: build
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getFileTree [as 别名]
def build(self):
try:
uni.isCanBeShowOnMainWindow = False
outputTarget = "file"
outputType = "html"
contentType = "fileTree"
if self.cbOutputTarget.currentIndex() == 1:
outputTarget = "dialog"
elif self.cbOutputTarget.currentIndex() == 2:
outputTarget = "clipboard"
if self.cbOutputType.currentIndex() == 1:
outputType = "plainText"
if self.cbContentType.currentIndex() == 1:
contentType = "fileList"
fu.getFileTree(str(self.lePath.text()),
self.cbSubDirectoryDeep.currentText(),
outputTarget, outputType, contentType, "title")
if self.cbOutputTarget.currentIndex() == 2:
Dialogs.show(translate("FileTreeBuilder", "Builded File Tree"),
translate("FileTreeBuilder", "File tree copied to clipboard."))
uni.isCanBeShowOnMainWindow = True
except:
ReportBug.ReportBug()
示例3: clickedAnAction
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getFileTree [as 别名]
def clickedAnAction(_action):
try:
actionName = _action.objectName()
if actionName == "Open State":
f = Dialogs.getOpenFileName(translate("MenuBar", "Open State Of Hamsi Manager"),
fu.userDirectoryPath,
translate("MenuBar", "Application Runner") + " (*.desktop)")
if f is not None:
Settings.openStateOfSettings(f)
elif actionName == "Save State":
f = Dialogs.getSaveFileName(translate("MenuBar", "Save State Of Hamsi Manager"),
fu.joinPath(fu.userDirectoryPath, "HamsiManager.desktop"),
translate("MenuBar", "Application Runner") + " (*.desktop)")
if f is not None:
Settings.saveStateOfSettings(f)
Dialogs.show(translate("MenuBar", "Current State Saved"),
translate("MenuBar",
"Current state saved with preferences.<br>You can continue where you left off."))
elif actionName == "With This Profile (My Settings)":
if Execute.executeAsRootWithThread(["--sDirectoryPath", fu.pathOfSettingsDirectory], "HamsiManager"):
getMainWindow().close()
else:
Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
translate("MenuBar", "Hamsi Manager can not run as root."))
elif actionName == "With Root Profile (Own Settings)":
if Execute.executeAsRootWithThread([], "HamsiManager"):
getMainWindow().close()
else:
Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
translate("MenuBar", "Hamsi Manager can not run as root."))
elif actionName == "Quit":
getMainWindow().close()
elif actionName == "HTML Format":
if _action.parent().objectName() == "Export To File":
getMainTable().exportValues("file", "html", "title")
elif _action.parent().objectName() == "Show In New Window":
getMainTable().exportValues("dialog", "html", "title")
elif _action.parent().objectName() == "Copy To Clipboard":
getMainTable().exportValues("clipboard", "html", "title")
elif actionName == "Text Format":
if _action.parent().objectName() == "Export To File":
getMainTable().exportValues("file", "plainText", "title")
elif _action.parent().objectName() == "Show In New Window":
getMainTable().exportValues("dialog", "plainText", "title")
elif _action.parent().objectName() == "Copy To Clipboard":
getMainTable().exportValues("clipboard", "plainText", "title")
elif actionName == "HTML Format (File Tree)":
if _action.parent().objectName() == "Export To File":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "html", "fileTree",
"title")
elif _action.parent().objectName() == "Show In New Window":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "html", "fileTree",
"title")
elif _action.parent().objectName() == "Copy To Clipboard":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "html", "fileTree",
"title")
elif actionName == "Text Format (File Tree)":
if _action.parent().objectName() == "Export To File":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "plainText", "fileTree",
"title")
elif _action.parent().objectName() == "Show In New Window":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "plainText", "fileTree",
"title")
elif _action.parent().objectName() == "Copy To Clipboard":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "plainText",
"fileTree", "title")
elif actionName == "About QT":
if isActivePyKDE4:
QMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
else:
MMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
elif actionName == "Options":
from Options import OptionsForm
OptionsForm.OptionsForm(getMainWindow())
elif actionName == "My Plugins":
import MyPlugins
MyPlugins.MyPlugins()
elif actionName == "Reconfigure":
from Tools import Configurator
Configurator.Configurator("configurePage")
elif actionName == "My Plugins (System)":
Execute.execute(["--qm", "--plugins", "--runAsRoot"], "HamsiManager")
elif actionName == "Reconfigure (System)":
Execute.execute(["--qm", "--configurator", "--runAsRoot"], "HamsiManager")
elif actionName == "Update":
from Core import UpdateControl
UpdateControl.UpdateControl(getMainWindow())
elif actionName == "Report Bug":
ReportBug.ReportBug(True)
elif actionName == "Suggest Idea":
from Core import SuggestIdea
SuggestIdea.SuggestIdea()
elif actionName == "About Hamsi Manager":
if isActivePyKDE4 is False:
MMessageBox.about(getMainWindow(), translate("MenuBar", "About Hamsi Manager"),
#.........这里部分代码省略.........