本文整理汇总了Python中PyQt5.QtCore.QFileInfo.isRelative方法的典型用法代码示例。如果您正苦于以下问题:Python QFileInfo.isRelative方法的具体用法?Python QFileInfo.isRelative怎么用?Python QFileInfo.isRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QFileInfo
的用法示例。
在下文中一共展示了QFileInfo.isRelative方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import isRelative [as 别名]
def __init__(self, pluginManager, pluginFileNames, parent=None):
"""
Constructor
@param pluginManager reference to the plugin manager object
@param pluginFileNames list of plugin files suggested for
installation (list of strings)
@param parent parent of this dialog (QWidget)
"""
super(PluginInstallWidget, self).__init__(parent)
self.setupUi(self)
if pluginManager is None:
# started as external plugin installer
from .PluginManager import PluginManager
self.__pluginManager = PluginManager(doLoadPlugins=False)
self.__external = True
else:
self.__pluginManager = pluginManager
self.__external = False
self.__backButton = self.buttonBox.addButton(
self.tr("< Back"), QDialogButtonBox.ActionRole)
self.__nextButton = self.buttonBox.addButton(
self.tr("Next >"), QDialogButtonBox.ActionRole)
self.__finishButton = self.buttonBox.addButton(
self.tr("Install"), QDialogButtonBox.ActionRole)
self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close)
self.__cancelButton = self.buttonBox.button(QDialogButtonBox.Cancel)
userDir = self.__pluginManager.getPluginDir("user")
if userDir is not None:
self.destinationCombo.addItem(
self.tr("User plugins directory"),
userDir)
globalDir = self.__pluginManager.getPluginDir("global")
if globalDir is not None and os.access(globalDir, os.W_OK):
self.destinationCombo.addItem(
self.tr("Global plugins directory"),
globalDir)
self.__installedDirs = []
self.__installedFiles = []
self.__restartNeeded = False
downloadDir = QDir(Preferences.getPluginManager("DownloadPath"))
for pluginFileName in pluginFileNames:
fi = QFileInfo(pluginFileName)
if fi.isRelative():
pluginFileName = QFileInfo(
downloadDir, fi.fileName()).absoluteFilePath()
self.archivesList.addItem(pluginFileName)
self.archivesList.sortItems()
self.__currentIndex = 0
self.__selectPage()
示例2: _fileinfo_from_user
# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import isRelative [as 别名]
def _fileinfo_from_user(self, user_path):
""" Convert the name of a file or directory specified by the user to a
QFileInfo instance. A user path may be relative to the name of the
project and may contain environment variables.
"""
fi = QFileInfo(self.expandvars(user_path.strip()))
if fi.isRelative() and self._name is not None:
fi = QFileInfo(self._name.canonicalPath() + '/' + fi.filePath())
return fi