本文整理汇总了Python中PySide.QtCore.QDir.toNativeSeparators方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.toNativeSeparators方法的具体用法?Python QDir.toNativeSeparators怎么用?Python QDir.toNativeSeparators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QDir
的用法示例。
在下文中一共展示了QDir.toNativeSeparators方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: localFromServer
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import toNativeSeparators [as 别名]
def localFromServer(self, serverpath):
# Removing leading '/' so `os.path.join` doesn't treat
# `localpath` as an absolute path
localpath = serverpath[1:] if serverpath.startswith('/') else serverpath
localpath = QDir.toNativeSeparators(localpath)
localpath = os.path.join(self.localdir, localpath)
return localpath
示例2: onBrowseClicked
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import toNativeSeparators [as 别名]
def onBrowseClicked(self):
"""Slot. Called when the user clicks on the `browseButton` button"""
# Presents the user with a native directory selector window
localdir = QFileDialog.getExistingDirectory()
localdir = QDir.fromNativeSeparators(localdir)
if len(localdir) > 0:
# If `localdir`'s value is good, store it using a `QSettings` object
# and triggers a sync request.
# Careful with '\' separators on Windows.
localdir = QDir.toNativeSeparators(localdir)
get_settings().setValue(SettingsKeys['localdir'], localdir)
self.localdirEdit.setText(localdir)
示例3: parsePluginSpecs
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import toNativeSeparators [as 别名]
def parsePluginSpecs(self, parentItem, plugins):
ret = 0
loadCount = 0
for i in range(len(plugins)):
spec = plugins[i]
if spec.hasError():
ret |= ParsedState.ParsedWithErrors
pluginItem = QTreeWidgetItem([spec.name(), "",
"{0} ({1})".format(spec.version(), spec.compatVersion()),
spec.vendor()])
pluginItem.setToolTip(0, QDir.toNativeSeparators(spec.filePath()))
ok = not spec.hasError()
icon = self.okIcon if ok else self.errorIcon
if ok and spec.state() is not PluginState.Running:
icon = self.notLoadedIcon
pluginItem.setIcon(0, icon)
pluginItem.setData(0, Qt.UserRole, spec)
state = Qt.Unchecked
if spec.isEnabled():
state = Qt.Checked
loadCount += 1
if spec.name() not in self.whitelist:
pluginItem.setData(C_LOAD, Qt.CheckStateRole, state)
else:
pluginItem.setData(C_LOAD, Qt.CheckStateRole, Qt.Checked)
pluginItem.setFlags(Qt.ItemIsSelectable)
pluginItem.setToolTip(C_LOAD, "Load on Startup")
self.specToItem[spec] = pluginItem
if parentItem:
parentItem.addChild(pluginItem)
else:
self.items.append(pluginItem)
if loadCount == len(plugins):
groupState = Qt.Checked
ret |= ParsedState.ParsedAll
elif loadCount == 0:
groupState = Qt.Unchecked
ret |= ParsedState.ParsedNone
else:
groupState = Qt.PartiallyChecked
ret |= ParsedState.ParsedPartial
return ret, groupState
示例4: loadLibrary
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import toNativeSeparators [as 别名]
def loadLibrary(self):
if self.hasError:
return False
if self.state is not PluginState.Resolved:
if self.state is PluginState.Loaded:
return True
self.errorString = QCoreApplication.translate(None, "Loading the library failed because state != Resolved")
self.hasError = True
return False
pluginPath = QDir.toNativeSeparators(self.location)
pluginClass = pluginloader.loadIPlugin(pluginPath, self.name + "." + self.mainClass)
if not pluginClass:
self.hasError = True
self.errorString = QCoreApplication.translate(None,
"Plugin is not valid (does not derive from IPlugin")
return False
self.state = PluginState.Loaded
self.plugin = pluginClass(self.manager)
self.plugin.private.pluginSpec = self.pluginSpec
return True