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


Python FileDialog.wildcard方法代码示例

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


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

示例1: _on_add_tubes

# 需要导入模块: from pyface.api import FileDialog [as 别名]
# 或者: from pyface.api.FileDialog import wildcard [as 别名]
 def _on_add_tubes(self):
     """
     Handle "Add tubes..." button.  Add tubes to the experiment.
     """
     
     # TODO - adding a set of files, then a condition, then another
     # set doesn't work.
     
     file_dialog = FileDialog()
     file_dialog.wildcard = "Flow cytometry files (*.fcs)|*.fcs|"
     file_dialog.action = 'open files'
     file_dialog.open()
     
     if file_dialog.return_code != PyfaceOK:
         return
     
     for path in file_dialog.paths:
         try:
             tube_meta = fcsparser.parse(path, 
                                         meta_data_only = True, 
                                         reformat_meta = True)
             tube_channels = tube_meta["_channels_"].set_index("$PnN")
         except Exception as e:
             raise RuntimeError("FCS reader threw an error on tube {0}: {1}"\
                                .format(path, e.value))
             
         tube = Tube()
         
         for trait_name, trait in self.model.tube_traits.items():
             # TODO - do we still need to check for transient?
             tube.add_trait(trait_name, trait)
             
             # this magic makes sure the trait is actually defined
             # in tube.__dict__, so it shows up in trait_names etc.
             tube.trait_set(**{trait_name : trait.default_value})
             if trait.condition:
                 tube.on_trait_change(self._try_multiedit, trait_name)
             
         tube.trait_set(Source = tube_meta['$SRC'],
                        _file = path,
                        _parent = self.model)
         
         if 'TUBE NAME' in tube_meta:
             tube.Tube = tube_meta['TUBE NAME']
         elif '$SMNO' in tube_meta:
             tube.Tube = tube_meta['$SMNO']
         
         self.model.tubes.append(tube)
开发者ID:jonesr18,项目名称:cytoflow,代码行数:50,代码来源:import_dialog.py

示例2: click

# 需要导入模块: from pyface.api import FileDialog [as 别名]
# 或者: from pyface.api.FileDialog import wildcard [as 别名]
    def click ( self ):
        """ Handles the user left clicking on the feature image.
        """
        # Create the file dialog:
        fd = FileDialog()

        # Set up the default path based on the current value (if any):
        default_path = getattr( self.dock_control.object, self.name, None )
        if default_path is not None:
            fd.default_path = default_path

        # Set up the appropriate extension filters (if any):
        if len( self.extensions ) > 0:
            fd.wildcard = '\n'.join([ FileDialog.create_wildcard('', '*' + ext)
                                      for ext in self.extensions ])

        # Display the file dialog, and if successful, set the new file name:
        if fd.open() == OK:
            self.drop( fd.path )
开发者ID:enthought,项目名称:etsdevtools,代码行数:21,代码来源:drop_file_feature.py

示例3: _on_add_tubes

# 需要导入模块: from pyface.api import FileDialog [as 别名]
# 或者: from pyface.api.FileDialog import wildcard [as 别名]
 def _on_add_tubes(self):
     """
     Handle "Add tubes..." button.  Add tubes to the experiment.
     """
     
     # TODO - adding a set of files, then a condition, then another
     # set doesn't work.
     
     file_dialog = FileDialog()
     file_dialog.wildcard = "Flow cytometry files (*.fcs)|*.fcs|"
     file_dialog.action = 'open files'
     file_dialog.open()
     
     if file_dialog.return_code != PyfaceOK:
         return
     
     for path in file_dialog.paths:
         fcs = FCMeasurement(ID='new tube', datafile = path)
         
         tube = Tube()
         
         for trait_name, trait in self.model.tube_traits.items():
             # TODO - do we still need to check for transient?
             tube.add_trait(trait_name, trait)
             
             # this magic makes sure the trait is actually defined
             # in tube.__dict__, so it shows up in trait_names etc.
             tube.trait_set(**{trait_name : trait.default_value})
             if trait.condition:
                 tube.on_trait_change(self._try_multiedit, trait_name)
             
         tube.trait_set(Source = fcs.meta['$SRC'],
                        _file = path,
                        _parent = self.model)
         
         if 'TUBE NAME' in fcs.meta:
             tube.Tube = fcs.meta['TUBE NAME']
         elif '$SMNO' in fcs.meta:
             tube.Tube = fcs.meta['$SMNO']
         
         self.model.tubes.append(tube)
开发者ID:Weiss-Lab,项目名称:cytoflow,代码行数:43,代码来源:import_dialog.py

示例4: _on_add_tubes

# 需要导入模块: from pyface.api import FileDialog [as 别名]
# 或者: from pyface.api.FileDialog import wildcard [as 别名]
    def _on_add_tubes(self):
        """
        Handle "Add tubes..." button.  Add tubes to the experiment.
        """

        # TODO - adding a set of files, then a condition, then another
        # set doesn't work.

        file_dialog = FileDialog()
        file_dialog.wildcard = "Flow cytometry files (*.fcs)|*.fcs|"
        file_dialog.action = "open files"
        file_dialog.open()

        if file_dialog.return_code != PyfaceOK:
            return

        for path in file_dialog.paths:
            try:
                tube_meta = fcsparser.parse(path, meta_data_only=True, reformat_meta=True)
                # tube_channels = tube_meta["_channels_"].set_index("$PnN")
            except Exception as e:
                raise RuntimeError("FCS reader threw an error on tube {0}: {1}".format(path, e.value))

            # if we're the first tube loaded, create a dummy experiment
            if not self.model.dummy_experiment:
                self.model.dummy_experiment = ImportOp(tubes=[CytoflowTube(file=path)], coarse_events=1).apply()

            # check the next tube against the dummy experiment
            try:
                check_tube(path, self.model.dummy_experiment)
            except util.CytoflowError as e:
                error(None, e.__str__(), "Error importing tube")
                return

            tube = Tube()

            for trait_name, trait in self.model.tube_traits.items():
                # TODO - do we still need to check for transient?
                tube.add_trait(trait_name, trait)

                # this magic makes sure the trait is actually defined
                # in tube.__dict__, so it shows up in trait_names etc.
                tube.trait_set(**{trait_name: trait.default_value})
                if trait.condition:
                    tube.on_trait_change(self._try_multiedit, trait_name)

            tube.trait_set(file=path, parent=self.model)

            if "$SRC" in tube_meta:
                self._add_metadata("$SRC", "$SRC", Str(condition=False))
                tube.trait_set(**{"$SRC": tube_meta["$SRC"]})

            if "TUBE NAME" in tube_meta:
                self._add_metadata("TUBE NAME", "TUBE NAME", Str(condition=False))
                tube.trait_set(**{"TUBE NAME": tube_meta["TUBE NAME"]})

            if "$SMNO" in tube_meta:
                self._add_metadata("$SMNO", "$SMNO", Str(condition=False))
                tube.trait_set(**{"$SMNO": tube_meta["SMNO"]})

            self.model.tubes.append(tube)
            self.btn_add_cond.setEnabled(True)
开发者ID:gjvargas,项目名称:cytoflow,代码行数:64,代码来源:import_dialog.py


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