当前位置: 首页>>代码示例>>Python>>正文


Python QDir.toNativeSeparators方法代码示例

本文整理汇总了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
开发者ID:ShareByLink,项目名称:iqbox-ftp,代码行数:10,代码来源:watchers.py

示例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)
开发者ID:ShareByLink,项目名称:iqbox-ftp,代码行数:15,代码来源:views.py

示例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
开发者ID:nichollyn,项目名称:libspark,代码行数:51,代码来源:pluginview.py

示例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
开发者ID:nichollyn,项目名称:libspark,代码行数:22,代码来源:pluginspec.py


注:本文中的PySide.QtCore.QDir.toNativeSeparators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。