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


Python QFileInfo.path方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QFileInfo.path方法的典型用法代码示例。如果您正苦于以下问题:Python QFileInfo.path方法的具体用法?Python QFileInfo.path怎么用?Python QFileInfo.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.QFileInfo的用法示例。


在下文中一共展示了QFileInfo.path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: outputFiles

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import path [as 别名]
    def outputFiles(self, map, fileName):
        result = []

        # Extract file name without extension and path
        fileInfo = QFileInfo(fileName)
        base = fileInfo.completeBaseName() + "_"
        path = fileInfo.path()

        # Loop layers to calculate the path for the exported file
        for layer in map.layers():
            if layer.layerType() != Layer.TileLayerType:
                continue

            # Get the output file name for this layer
            layerName = layer.name()
            layerFileName = base + layerName + ".csv"
            layerFilePath = QDir(path).filePath(layerFileName)

            result.append(layerFilePath)

        # If there was only one tile layer, there's no need to change the name
        # (also keeps behavior backwards compatible)
        if len(result) == 1:
            result[0] = fileName

        return result
开发者ID:theall,项目名称:Python-Tiled,代码行数:28,代码来源:csvplugin.py

示例2: open

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import path [as 别名]
 def open(self, t_filename=None):
     settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "pySPM", "pySPM")
     if t_filename is None:
         home = QDir.cleanPath(os.getenv("HOMEPATH"))
         path = settings.value("lastPath", home)
         self.filename = QFileDialog.getOpenFileName(None, "Choose measurement file", path, "*.ita")
     else:
         self.filename = t_filename
     
     check_file = QFileInfo(self.filename)
     self.setWindowTitle(check_file.fileName())
     if not check_file.exists() or  not check_file.isFile():
         return
     
     settings.setValue("lastPath", check_file.path())
     self.ita = pySPM.ITA(self.filename)
     self.t, self.S = self.ita.getSpectrum(time=True)
     self.sf, self.k0 = self.ita.get_mass_cal()
     self.mass = pySPM.utils.time2mass(self.t, self.sf, self.k0)
     self.spec = self.ax.plot(self.mass, self.S)[0]
     SatLevel = self.ita.size['pixels']['x']*self.ita.size['pixels']['y']*self.ita.Nscan
     self.sat_level = self.ax.axhline(SatLevel, color='r')
     if 'pySPM' in self.ita.root.goto("MassScale"):
         self.MassCal = []
         N = self.ita.root.goto("MassScale/pySPM/N").get_ulong()
         for i in range(N):
             elt = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/elt").value.decode('utf8')
             mass = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/mass").get_double()
             time = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/time").get_double()
             self.MassCal.append(dict(elt=elt, mass=mass, time=time))
     else:
         self.MassCal = []
         for x in self.ita.root.goto("MassScale/calib"):
             if x.name == 'assign':
                 self.MassCal.append({'elt':x.get_string()})
             if x.name == 'mcp':
                 mcp = struct.unpack("<10d", x.value)
                 self.MassCal[-1]['time'] = mcp[0]
                 self.MassCal[-1]['mass']  =  mcp[1]
     self.DoMassCal()                    
开发者ID:scholi,项目名称:pySPM,代码行数:42,代码来源:spectra.py


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