本文整理汇总了Python中FileUtils.getRealDirName方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.getRealDirName方法的具体用法?Python FileUtils.getRealDirName怎么用?Python FileUtils.getRealDirName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.getRealDirName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeRefresh
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getRealDirName [as 别名]
def makeRefresh(self, _newDirectoryPath="", _isOnlyBrowser=False):
try:
if _newDirectoryPath != "" and _newDirectoryPath is not True and _newDirectoryPath is not False:
self.goTo(_newDirectoryPath, False)
else:
sourcePath = fu.checkSource(str(self.currentDirectory), "directory")
if sourcePath is not None:
if self.currentDirectory != str(sourcePath):
self.goTo(sourcePath, False)
else:
self.makeRefreshOnlyFileList()
self.makeRefreshOnlyFileListByTree()
if _isOnlyBrowser is False:
self.showInTable()
else:
self.goTo(fu.getRealDirName(str(self.currentDirectory)), False)
except:
ReportBug.ReportBug()
示例2: __init__
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getRealDirName [as 别名]
def __init__(self, _parent):
self.bookmarks = Bookmarks(self)
self.history = []
self.future = []
getMainWindow().DirOperator = None
getMainWindow().Browser = None
getMainWindow().Places = None
getMainWindow().TreeBrowser = None
toolsFull = None
if isActivePyKDE4:
self.dirModelMain = MDirModel()
self.dirLister = MDirLister()
self.dirLister.setAutoUpdate(True)
self.dirModelMain.setDirLister(self.dirLister)
self.dirModel = MDirSortFilterProxyModel()
self.dirModel.setSourceModel(self.dirModelMain)
self.fpmPlacesModel = MFilePlacesModel()
self.fpvPlaces = MFilePlacesView()
self.fpvPlaces.setModel(self.fpmPlacesModel)
self.dirModelForNavigator = MDirSortFilterProxyModel()
self.dirModelForNavigator.setSourceModel(self.dirModelMain)
self.dirModelForTree = QDirModel()
self.dirModelForTree.setFilter(MDir.AllDirs | MDir.Drives | MDir.Readable | MDir.NoDotAndDotDot)
self.dirModelForTree.sort(0)
else:
self.dirModel = MDirModel()
self.dirModel.setFilter(MDir.AllEntries | MDir.Readable | MDir.NoDotAndDotDot)
self.dirModel.sort(0)
self.dirModelForTree = MDirModel()
self.dirModelForTree.setFilter(MDir.AllDirs | MDir.Drives | MDir.Readable | MDir.NoDotAndDotDot)
self.dirModelForTree.sort(0)
self.dirModelForNavigator = MDirModel()
self.dirModelForNavigator.setFilter(MDir.AllEntries | MDir.Readable)
self.dirModelForNavigator.sort(0)
self.trvFileManager = MTreeView()
self.lstvFileManager = MListView()
self.trvFileManager.setModel(self.dirModelForTree)
self.lstvFileManager.setModel(self.dirModel)
self.currentDirectory = str(fu.getRealDirName(uni.MySettings["lastDirectory"]))
if fu.isDir(str(self.currentDirectory)) is False:
self.currentDirectory = MDir.homePath()
MObject.connect(self.trvFileManager, SIGNAL("clicked(QModelIndex)"), self.setMyCurrentIndexByTree)
MObject.connect(self.lstvFileManager, SIGNAL("doubleClicked(QModelIndex)"), self.setMyCurrentIndex)
tools = MToolBar(_parent)
actAddBookmark = MAction(MIcon("Images:addBookmark.png"), "", tools)
actAddBookmark.setToolTip(translate("FileManager", "Add To Bookmarks"))
self.actBack = MAction(MIcon("Images:back.png"), "", tools)
self.actBack.setToolTip(translate("FileManager", "Back"))
self.actForward = MAction(MIcon("Images:forward.png"), "", tools)
self.actForward.setToolTip(translate("FileManager", "Forward"))
self.actUp = MAction(MIcon("Images:up.png"), "", tools)
self.actUp.setToolTip(translate("FileManager", "Up"))
actRefresh = MAction(MIcon("Images:refresh.png"), "", tools)
actRefresh.setToolTip(translate("FileManager", "Refresh"))
actHome = MAction(MIcon("Images:home.png"), "", tools)
actHome.setToolTip(translate("FileManager", "Home"))
MObject.connect(self.actBack, SIGNAL("triggered(bool)"), self.goBack)
MObject.connect(self.actForward, SIGNAL("triggered(bool)"), self.goForward)
MObject.connect(self.actUp, SIGNAL("triggered(bool)"), self.goUp)
MObject.connect(actRefresh, SIGNAL("triggered(bool)"), self.makeRefresh)
MObject.connect(actHome, SIGNAL("triggered(bool)"), self.goHome)
MObject.connect(actAddBookmark, SIGNAL("triggered(bool)"), self.bookmarks.addBookmark)
self.bookmarksMenu = BookmarksMenu(self)
if isActivePyKDE4:
toolsFull = MToolBar(_parent)
toolsFull.addAction(self.bookmarksMenu.menuAction())
self.isGoToFromDirOperator = False
self.dirOperator = MDirOperator(MUrl(self.currentDirectory), _parent)
self.dirOperator.setDirLister(self.dirLister)
kconf = MGlobal.config()
kconfGroup = MConfigGroup(kconf, "DirectoryOperator")
self.dirOperator.readConfig(kconfGroup)
self.dirOperator.setViewConfig(kconfGroup)
self.dirOperator.setView(MFile.Default)
self.actCollection = self.dirOperator.actionCollection()
self.actCollection.readSettings(kconfGroup)
self.actCollection.associateWidget(toolsFull)
getMainWindow().DirOperator = MDockWidget(translate("FileManager", "Directory Operator"))
getMainWindow().DirOperator.setObjectName("Directory Operator")
getMainWindow().DirOperator.setWidget(self.dirOperator)
getMainWindow().DirOperator.setAllowedAreas(Mt.AllDockWidgetAreas)
getMainWindow().DirOperator.setFeatures(MDockWidget.AllDockWidgetFeatures)
_parent.addDockWidget(Mt.LeftDockWidgetArea, getMainWindow().DirOperator)
MObject.connect(self.dirOperator, SIGNAL("urlEntered(KUrl)"), self.dirOperatorUrlChanged)
self.isGoToFromDirOperator = True
self.filePlacesModel = MFilePlacesModel()
self.urlNavigator = MUrlNavigator(self.filePlacesModel, MUrl(self.currentDirectory), self.lstvFileManager)
self.isGoToFromUrlNavigator = True
MObject.connect(self.urlNavigator, SIGNAL("urlChanged(KUrl)"), self.urlNavigatorUrlChanged)
MObject.connect(self.fpvPlaces, SIGNAL("urlChanged(KUrl)"), self.setPlacesUrlChanged)
self.leNavigator = MLineEdit()
cmpCompleter = MCompleter()
cmpCompleter.setModel(self.dirModelForNavigator)
cmpCompleter.setCaseSensitivity(Mt.CaseInsensitive)
self.leNavigator.setCompleter(cmpCompleter)
MObject.connect(self.leNavigator, SIGNAL("returnPressed()"), self.leNavigatorPressed)
tools.addAction(self.actBack)
#.........这里部分代码省略.........
示例3: organizeWithHamsiManager
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getRealDirName [as 别名]
def organizeWithHamsiManager(self, _oldPath):
uni.setMySetting("lastDirectory", fu.getRealDirName(_oldPath, True))
CommandLineOptions.isQuickMake = False
self.close()