本文整理匯總了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