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


Python api.HasTraits类代码示例

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


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

示例1: __init__

    def __init__(self, parent=None, manage_overlay=True, **traits):
        HasTraits.__init__(self, **traits)
        self.master_src # instantiates default master_src and blender
        self.func_man
        from xipy.vis.mayavi_widgets.overlay_blending import ImageBlendingComponent
        from xipy.vis.mayavi_widgets.overlay_thresholding_surface import OverlayThresholdingSurfaceComponent
        from xipy.vis.mayavi_widgets.cortical_surface import CorticalSurfaceComponent
        from xipy.vis.mayavi_widgets.translated_planes import TranslatedPlanes

        # set up components
        self.vis_helpers.append(
            ImageBlendingComponent(self, manage_overlay)
            )
        self.vis_helpers.append(
            TranslatedPlanes(self)
            )
        self.vis_helpers.append(
            OverlayThresholdingSurfaceComponent(self)
            )

        self.vis_helpers.append(
            CorticalSurfaceComponent(self)
            )
                        
        
        anat_alpha = np.ones(256)
        anat_alpha[:5] = 0
        self.blender.set(main_alpha=anat_alpha, trait_notify_change=False)
        self.__reposition_planes_after_interaction = False
开发者ID:cindeem,项目名称:xipy,代码行数:29,代码来源:ortho_viewer_3d.py

示例2: __init__

 def __init__(self, source, **traits):
     HasTraits.__init__(self, **traits)
     nTs = self.time.shape[0]
     if isinstance(source, HasTraits):
         self.traited = True
         self.tracking = source.traits(track=True).keys()
         for attr in self.tracking:
             shape = (nTs,)
             if type(getattr(source, attr)) is _numpy.ndarray:
                 shape += getattr(source, attr).shape
             self.data[attr] = _numpy.zeros(shape, "d")
     else:
         if type(source) is type([]):
             self.tracking = source
             for var in source:
                 self.data[var] = _numpy.zeros((nTs,), "d")
             self._update = _copy(source)
         elif type(source) is type({}):
             self.tracking = source.keys()
             for var in self.tracking:
                 shape = (nTs,) + tuple(source[var])
                 self.data[var] = _numpy.zeros(shape, "d")
             self._update = _copy(self.tracking)
         else:
             raise TypeError, self.__class__.__doc__
     self.source = source
开发者ID:jdmonaco,项目名称:grid-remapping-model,代码行数:26,代码来源:timeseries.py

示例3: handle_arguments

  def handle_arguments(self,*args,**kwargs): 
    HasTraits.__init__(self)		#magic by fnoble
    for a in args:
      if isinstance(a,Frame):
        self.parent=a
    for k,v in kwargs.items():
      if k == 'frame':
        self.parent=v
      elif k == 'T':
         if isinstance(v,Expression):
           self.T=v
         else:
           self.T=self.parent.variables.new_expression(v)
      elif len(self.trait_get(k))>0:
         #self.trait_set({k:v})
         self.__setattr__(k,v)
      elif len(self.actor.trait_get(k))>0:
         self.actor.__setattr__(k,v)
      elif len(self.properties.trait_get(k))>0:
         self.properties.__setattr__(k,v)
      elif len(self.source.trait_get(k))>0:
         self.source.__setattr__(k,v)
      else :
         print "unknown argument", k , v

    if not(self.parent):
      self.parent = WorldFrame()
开发者ID:jgillis,项目名称:Plot-o-matic,代码行数:27,代码来源:Primitives.py

示例4: __init__

    def __init__(self, fgcolor=(0.0, 0.0, 0.0), bgcolor=(1.0, 1.0, 1.0),
                 **traits):
        HasTraits.__init__(self, **traits)
        scene = self.scene.scene

        scene.foreground = fgcolor
        scene.background = bgcolor
开发者ID:snilek,项目名称:sfepy,代码行数:7,代码来源:viewer.py

示例5: _showerror_fired

 def _showerror_fired(self,evt):
     if self.tmodel.lastfitfailure:
         ex = self.tmodel.lastfitfailure
         dialog = HasTraits(s=ex.__class__.__name__+': '+str(ex))
         view = View(Item('s',style='custom',show_label=False),
                     resizable=True,buttons=['OK'],title='Fitting error message')
         dialog.edit_traits(view=view)
开发者ID:keflavich,项目名称:astropy-fitgui,代码行数:7,代码来源:fitgui.py

示例6: __init__

 def __init__(self, pos_data, **traits):
     """Required first argument is the 4-column data array from a Pos.p file
     """
     HasTraits.__init__(self, **traits)
     if not (pos_data[:,-1] == -99).all():
         valid = (pos_data[:,-1] != -99).nonzero()[0]
         pos_data = pos_data[valid]
     self.t, self.x, self.y, self.angle = pos_data.T
开发者ID:jdmonaco,项目名称:vmo-feedback-model,代码行数:8,代码来源:circle_track.py

示例7: __init__

 def __init__(self, condition, avg_beams, stats_results, **traits):
     HasTraits.__init__(self, **traits)
     self._avg_dict = {}
     self.stats_results = stats_results
     
     for c, b in zip(condition, avg_beams):
         self._avg_beams.append(str(c))
         self._avg_dict[str(c)] = b
开发者ID:christandiono,项目名称:nutmeg-py,代码行数:8,代码来源:stats_ui.py

示例8: __init__

 def __init__(self, *args, **kw):
     HasTraits.__init__(self, *args, **kw)
     numpoints = 200
     plotdata = ArrayPlotData(x=sort(random(numpoints)), y=random(numpoints))
     plot = Plot(plotdata)
     plot.plot(("x", "y"), type="scatter")
     plot.tools.append(PanTool(plot))
     plot.overlays.append(ZoomTool(plot))
     self.plot = plot
开发者ID:brycehendrix,项目名称:chaco,代码行数:9,代码来源:aspect_ratio.py

示例9: __init__

    def __init__(self, **traits):
        HasTraits.__init__(self, **traits)
        self.engine_view = EngineView(engine=self.scene.engine)

        # Hook up the current_selection to change when the one in the engine
        # changes.  This is probably unnecessary in Traits3 since you can show
        # the UI of a sub-object in T3.
        self.scene.engine.on_trait_change(self._selection_change,
                                          'current_selection')
开发者ID:axelvonderheide,项目名称:scratch,代码行数:9,代码来源:mesh_actors.py

示例10: __init__

 def __init__ ( self, object, name, index, trait, value ):
     HasTraits.__init__( self )
     self.inited = False
     self.object = object
     self.name   = name
     self.index  = index
     if trait is not None:
         self.add_trait( 'value', trait )
         self.value  = value
     self.inited = True
开发者ID:gkliska,项目名称:razvoj,代码行数:10,代码来源:list_editor.py

示例11: __init__

 def __init__(self, *args, **kw):
     HasTraits.__init__(self, *args, **kw)
     # Create the data and the PlotData object
     x = linspace(-14, 14, 100)
     y = sin(x) * x**3
     plotdata = ArrayPlotData(x = x, y = y)
     # Create the scatter plot
     plot = Plot(plotdata)
     plot.plot(("x", "y"), type=self.plot_type, color="blue")
     plot.tools.append(PanTool(plot))
     plot.tools.append(ZoomTool(plot))
     self.plot = plot
开发者ID:brycehendrix,项目名称:chaco,代码行数:12,代码来源:connected_widgets.py

示例12: __init__

    def __init__(self, **traits):
        HasTraits.__init__(self, **traits)
        
        try:
            if not path.exists(self.datadir):
                makedirs(self.datadir)
        except OSError:
            self.out('Reverting to base directory:\n%s'%ANA_DIR, error=True)
            self.datadir = ANA_DIR
        finally:
            self.datadir = path.abspath(self.datadir)

        self.out('%s initialized:\n%s'%(self.__class__.__name__, str(self)))
开发者ID:jdmonaco,项目名称:grid-remapping-model,代码行数:13,代码来源:analysis.py

示例13: __init__

 def __init__(self, pmap, **traits):
     HasTraits.__init__(self, **traits)
     try:
         self.PMap = pmap
     except TraitError:
         self.out('PlaceMap subclass instance required', error=True)
         return
     self.fdata = self.PMap.get_field_data()
     self.udata = self.PMap.get_unit_data()
     self.add_trait('unit', Range(low=0, high=self.PMap.num_maps-1))
     self._update_unit_values()
     self.out('Bringing up place-map visualization...')
     self.view()
     self.out('Done!')
开发者ID:jdmonaco,项目名称:grid-remapping-model,代码行数:14,代码来源:placemap_viewer.py

示例14: __init__

 def __init__(self, eval=None, label='Value',
              trait=None, min=0.0, max=1.0,
              initial=None, **traits):
     HasTraits.__init__(self, **traits)
     if trait is None:
         if min > max:
             min, max = max, min
         if initial is None:
             initial = min
         elif not (min <= initial <= max):
             initial = [min, max][
                 abs(initial - min) >
                 abs(initial - max)]
         trait = Range(min, max, value=initial)
     self.add_trait(label, trait)
开发者ID:rayyeh,项目名称:python-ray,代码行数:15,代码来源:object_trait_attrs.py

示例15: __init__

 def __init__(self, *l, **kw):
     # TODO: implement aspect ratio maintaining
     HasTraits.__init__(self, *l, **kw)
     #self.plotdata = ArrayPlotData(x=self.pointsx, y=self.pointsy)
     plot = Plot(self.plotdata)
     plot.plot(("x", "y"))
     plot.plot(("x", "y"), type='scatter')
     
     plot.tools.append(PanTool(plot, drag_button='left'))
     plot.tools.append(ZoomTool(plot, tool_mode='box'))
     plot.tools.append(DragZoom(plot, tool_mode='box', drag_button='right'))
     plot.tools.append(CustomSaveTool(plot))#, filename='/home/pankaj/Desktop/file.png'))
     plot.tools.append(TraitsTool(plot))
     self.plot = plot
     self.set_plotdata()
开发者ID:ArtemyVI,项目名称:pyavl,代码行数:15,代码来源:output_viewer.py


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