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


Python PyMcaGui.PyMcaFileDialogs类代码示例

本文整理汇总了Python中PyMca5.PyMcaGui.PyMcaFileDialogs的典型用法代码示例。如果您正苦于以下问题:Python PyMcaFileDialogs类的具体用法?Python PyMcaFileDialogs怎么用?Python PyMcaFileDialogs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _getFileList

    def _getFileList(self, fileTypeList, message=None, getfilter=None):
        if message is None:
            message = "Please select a file"
        if getfilter is None:
            getfilter = False
        wdir = PyMcaDirs.inputDir
        filterused = None
        if getfilter:
            filelist, filterused = PyMcaFileDialogs.getFileList(self.parent,
                            filetypelist=fileTypeList,
                            mode="OPEN",
                            message=message,
                            currentdir=wdir,
                            getfilter=True,
                            single=False,
                            native=True)
        else:
            filelist = PyMcaFileDialogs.getFileList(self.parent,
                            filetypelist=fileTypeList,
                            mode="OPEN",
                            message=message,
                            currentdir=wdir,
                            getfilter=False,
                            single=False,
                            native=True)
        if not(len(filelist)):
            return []
        PyMcaDirs.inputDir = os.path.dirname(filelist[0])
        if PyMcaDirs.outputDir is None:
            PyMcaDirs.outputDir = os.path.dirname(filelist[0])

        if getfilter:
            return filelist, filterused
        else:
            return filelist
开发者ID:marcus-oscarsson,项目名称:pymca,代码行数:35,代码来源:StackSelector.py

示例2: loadButtonClicked

 def loadButtonClicked(self):
     if self.inputDir is None:
         if self.inputDir is not None:
             self.inputDir = self.outputDir
         else:
             self.inputDir = PyMcaDirs.inputDir
     wdir = self.inputDir
     if not os.path.exists(wdir):
         wdir = os.getcwd()
     filename = PyMcaFileDialogs.getFileList(self,
                         filetypelist=["Energy table files (*.csv)"],
                         mode="OPEN",
                         message="Choose energy table file",
                         currentdir=wdir,
                         single=True)
     if len(filename):
         filename = qt.safe_str(filename[0])
         if len(filename):
             try:
                 self.loadEnergyTableParameters(filename)
                 self.inputDir = os.path.dirname(filename)
                 PyMcaDirs.inputDir = self.inputDir
             except:
                 msg = qt.QMessageBox(self)
                 msg.setIcon(qt.QMessageBox.Critical)
                 msg.setText("Error loading energy table: %s" % (sys.exc_info()[1]))
                 msg.exec_()
开发者ID:dnaudet,项目名称:pymca,代码行数:27,代码来源:EnergyTable.py

示例3: browseFitConfiguration

 def browseFitConfiguration(self):
     if self._inputDir is None:
         self._inputDir = PyMcaDirs.inputDir
     elif os.path.exists(self._inputDir):
         PyMcaDirs.inputDir = self._inputDir
     filetypes  = ["Configuration Files (*.cfg)"]
     if self._inputDir is None:
         self._inputDir = PyMcaDirs.inputDir
     elif os.path.exists(self._inputDir):
         PyMcaDirs.inputDir = self._inputDir
     message = "Select a Simple Fit Configuration File"
     mode = "OPEN"
     getfilter = False
     currentfilter = None #self._lastInputFileFilter
     fileList = PyMcaFileDialogs.getFileList(self,
                                              filetypelist=filetypes,
                                              message=message,
                                              mode=mode,
                                              getfilter=getfilter,
                                              single=True,
                                              currentfilter=currentfilter)
     if not len(fileList):
         return
     self._inputDir = os.path.dirname(fileList[0])
     self.setFitConfigurationFile(fileList[0])
     self.raise_()
开发者ID:dnaudet,项目名称:pymca,代码行数:26,代码来源:SimpleFitBatchGui.py

示例4: _getOutputTiffFilename

 def _getOutputTiffFilename(self):
     fileTypes = "TIFF Files (*.tif *.tiff *.TIF *.TIFF)"
     message = "Enter output filename"
     wdir = PyMcaDirs.outputDir
     filename = PyMcaFileDialogs.getFileList(self,
                                     message=message,
                                     mode="SAVE",
                                     currentdir=wdir,
                                     filetypelist=[fileTypes],
                                     getfilter=False,
                                     single=True)
     if len(filename):
         filename = filename[0]
     if len(filename):
         try:
             fname = qt.safe_str(filename)
             if fname.endswith('.tif') or\
                fname.endswith('.tiff') or\
                fname.endswith('.TIF') or\
                fname.endswith('.TIFF'):
                 return fname
             else:
                 return fname + ".tif"
         except UnicodeEncodeError:
             msg = qt.QMessageBox(self)
             msg.setWindowTitle("Encoding error")
             msg.setIcon(qt.QMessageBox.Critical)
             msg.setText("Please use ASCII characters in file name and path")
             msg.exec_()
     return ""
开发者ID:aaron-parsons,项目名称:pymca,代码行数:30,代码来源:QStackWidget.py

示例5: saveSignal

 def saveSignal(self):
     fileList = PyMcaFileDialogs.getFileList(self,
                                             filetypelist=['cfg file (*.cfg)'],
                                             mode="SAVE",
                                             single=True,
                                             getfilter=False)
     if len(fileList):
         self.saveConfiguration(fileList[0])
开发者ID:vasole,项目名称:pymca,代码行数:8,代码来源:XASSelfattenuationWindow.py

示例6: browseConfigurationFile

 def browseConfigurationFile(self):
     f = PyMcaFileDialogs.getFileList(parent=self,
                                  filetypelist=["Configuration files (*.cfg)"],
                                  message="Open a fit configuration file",
                                  mode="OPEN",
                                  single=True)
     if len(f):
         self._configLine.setText(f[0])
开发者ID:maurov,项目名称:pymca,代码行数:8,代码来源:FastXRFLinearFitWindow.py

示例7: saveImage

 def saveImage(self):
     filelist = PyMcaFileDialogs.getFileList(
         parent=self,
         filetypelist=["Image files (*.png)"],
         message="Please give output file name",
         mode="SAVE",
         getfilter=False)
     if len(filelist):
         self.glWidget.saveImage(filelist[0])
开发者ID:PiRK,项目名称:pymca,代码行数:9,代码来源:SceneGLWindow.py

示例8: load

 def load(self):
     fileList = PyMcaFileDialogs.getFileList(parent=self,
                                             filetypelist=["Fit files (*.cfg)"],
                                             message="Select a fit configuration file",
                                             mode="OPEN",
                                             getfilter=False,
                                             single=True)
     if len(fileList):
         d = ConfigDict.ConfigDict()
         d.read(fileList[0])
         self.setParameters(d)
开发者ID:maurov,项目名称:pymca,代码行数:11,代码来源:StrategyHandler.py

示例9: browseFile

 def browseFile(self):
     filelist = PyMcaFileDialogs.getFileList(self,
                             filetypelist=['HDF5 files (*.h5)'],
                             message="Please enter output file",
                             mode="SAVE",
                             single=True)
     if len(filelist):
         name = filelist[0]
         if not name.endswith('.h5'):
             name = name + ".h5"
         self.fileName.setText(name)
开发者ID:dnaudet,项目名称:pymca,代码行数:11,代码来源:FFTAlignmentWindow.py

示例10: getObject3DInstance

def getObject3DInstance(config=None):
    #for the time being a former configuration
    #for serializing purposes is not implemented

    #I do the import here for the case PyMca is not installed
    #because the modules could be instanstiated without using
    #this method
    try:
        from PyMca5.PyMcaIO import EDFStack
        from PyMca5.PyMcaIO import TiffStack
    except ImportError:
        import EDFStack
        import TiffStack

    fileTypeList = ['EDF Z Stack (*edf *ccd)',
                    'EDF X Stack (*edf *ccd)',
                    'TIFF Stack (*tif *tiff)']
    old = PyMcaFileDialogs.PyMcaDirs.nativeFileDialogs * 1
    PyMcaFileDialogs.PyMcaDirs.nativeFileDialogs = False
    fileList, filterUsed = PyMcaFileDialogs.getFileList(
        parent=None,
        filetypelist=fileTypeList,
        message="Please select the object file(s)",
        mode="OPEN",
        getfilter=True)
    PyMcaFileDialogs.PyMcaDirs.nativeFileDialogs = old
    if not len(fileList):
        return None
    if filterUsed == fileTypeList[0]:
        fileindex = 2
    else:
        fileindex = 1
    #file index is irrelevant in case of an actual 3D stack.
    filename = fileList[0]
    legend = os.path.basename(filename)
    if filterUsed == fileTypeList[2]:
        #TIFF
        stack = TiffStack.TiffStack(dtype=numpy.float32, imagestack=False)
        stack.loadFileList(fileList, fileindex=1)
    elif len(fileList) == 1:
        stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
        stack.loadIndexedStack(filename, fileindex=fileindex)
    else:
        stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
        stack.loadFileList(fileList, fileindex=fileindex)
    if stack is None:
        raise IOError("Problem reading stack.")
    object3D = Object3DStack(name=legend)
    object3D.setStack(stack)
    return object3D
开发者ID:PiRK,项目名称:pymca,代码行数:50,代码来源:Object3DStack.py

示例11: saveParameters

 def saveParameters(self, fname=None):
     if fname is None:
         fname = PyMcaFileDialogs.getFileList(self,
                                      filetypelist=["Configuration (*.ini)",
                                                    "Configuration (*.cfg)"],
                                      message="Please enter output file name",
                                      mode="SAVE",
                                      getfilter=False,
                                      single=True)
         if len(fname):
             fname = fname[0]
         else:
             return
     ddict = ConfigDict.ConfigDict()
     ddict["XASParameters"] = self.getParameters()
     ddict.write(fname)
开发者ID:maurov,项目名称:pymca,代码行数:16,代码来源:XASParameters.py

示例12: loadParameters

 def loadParameters(self, fname=None):
     if fname is None:
         fname = PyMcaFileDialogs.getFileList(self,
                                      filetypelist=["Configuration (*.ini)",
                                                    "Configuration (*.cfg)",
                                                    "All files (*)"],
                                      message="Please set input file name",
                                      mode="OPEN",
                                      getfilter=False,
                                      single=True)
         if len(fname):
             fname = fname[0]
         else:
             return
     d = ConfigDict.ConfigDict()
     d.read(fname)
     self.setParameters(d["XASParameters"])
开发者ID:maurov,项目名称:pymca,代码行数:17,代码来源:XASParameters.py

示例13: browseOutputDirectory

 def browseOutputDirectory(self):
     if self._outputDir is None:
         self._outputDir = PyMcaDirs.outputDir
     elif os.path.exists(self._outputDir):
         PyMcaDirs.inputDir = self._outputDir
     message = "Select a Simple Fit Configuration File"
     mode = "OPEN"
     fileList = PyMcaFileDialogs.getExistingDirectory(self,
                                              message=message,
                                              mode=mode)
     if not len(fileList):
         return
     if type(fileList) != type([]):
         fileList = [fileList]
     self._outputDir = os.path.dirname(fileList[0])
     self.setOutputDirectory(fileList[0])
     self.raise_()
开发者ID:dnaudet,项目名称:pymca,代码行数:17,代码来源:SimpleFitBatchGui.py

示例14: funevent

 def funevent(self,item):
     item=str(item)
     if item in self.specfit.theorylist:
         self.specfit.settheory(item)
     else:
         filelist = PyMcaFileDialogs.getFileList(self,
                      message="Select python module with your function(s)",
                      filetypelist=["Python Files (*.py)",
                                    "All Files (*)"],
                      mode="OPEN",
                      single=True,
                      getfilter=False)
                             
         if not len(filelist):           
             functionsfile = ""
         else:
             functionsfile = filelist[0]
         if len(functionsfile):
             try:
                 if self.specfit.importfun(functionsfile):
                     qt.QMessageBox.critical(self, "ERROR",
                                             "Function not imported")
                     return
                 else:
                     #empty the ComboBox
                     n=self.guiconfig.FunComBox.count()
                     while(self.guiconfig.FunComBox.count()>1):
                       self.guiconfig.FunComBox.removeItem(1)
                     #and fill it again
                     for key in self.specfit.theorylist:
                         if QTVERSION < '4.0.0':
                             self.guiconfig.FunComBox.insertItem(str(key))
                         else:
                             self.guiconfig.FunComBox.addItem(str(key))
             except:
                 qt.QMessageBox.critical(self, "ERROR",
                                         "Function not imported")
         i=1+self.specfit.theorylist.index(self.specfit.fitconfig['fittheory'])
         if QTVERSION < '4.0.0':
             self.guiconfig.FunComBox.setCurrentItem(i)
         else:
             self.guiconfig.FunComBox.setCurrentIndex(i)
     self.__initialparameters()
     return
开发者ID:vasole,项目名称:pymca,代码行数:44,代码来源:SpecfitGui.py

示例15: browseList

 def browseList(self):
     if self._inputDir is None:
         self._inputDir = PyMcaDirs.inputDir
     elif os.path.exists(self._inputDir):
         PyMcaDirs.inputDir = self._inputDir
     filetypes  = ["Mca Files (*.mca)",
                   "Edf Files (*.edf)"]
     if HDF5SUPPORT:
         filetypes.append("HDF5 Files(*.nxs *.h5 *.hdf)")
     filetypes.append("SPEC Files (*.spec)")
     filetypes.append("SPEC Files (*.dat)")
     filetypes.append("All files (*)")
     message = "Open a set of files"
     mode = "OPEN"
     getfilter = True
     currentfilter = self._lastInputFileFilter
     fileList, fileFilter  = PyMcaFileDialogs.getFileList(self,
                                              filetypelist=filetypes,
                                              message=message,
                                              mode=mode,
                                              getfilter=getfilter,
                                              single=False,
                                              currentfilter=currentfilter)
     if not len(fileList):
         return
     else:
         self._lastInputFileFilter = fileFilter
     self._inputDir = os.path.dirname(fileList[0])
     if (QTVERSION < '4.2.0') or (not len(self._fileList)):
         self.setFileList(fileList)
         self.raise_()
         return
     msg = qt.QMessageBox()
     msg.setWindowTitle("Append or replace")
     msg.setIcon(qt.QMessageBox.Information)
     msg.setText("Do you want to delete current file list?")
     msg.setStandardButtons(qt.QMessageBox.Yes|qt.QMessageBox.No)
     answer=msg.exec_()
     if answer == qt.QMessageBox.Yes:
         append = False
     else:
         append = True
     self.setFileList(fileList, append=append)
     self.raise_()
开发者ID:dnaudet,项目名称:pymca,代码行数:44,代码来源:SimpleFitBatchGui.py


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