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


Python VPlotContainer.remove方法代码示例

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


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

示例1: UserInterface

# 需要导入模块: from chaco.api import VPlotContainer [as 别名]
# 或者: from chaco.api.VPlotContainer import remove [as 别名]

#.........这里部分代码省略.........
    @on_trait_change('cpanel.right_arrow', post_init=True)
    def _right_arrow_fired(self):
        '''Right arrow/key pressed. Sends request to load next image.'''
        self.process.jobqueue.put(['updatecache', ['right']])
        return
    
    @on_trait_change('cpanel.generate', post_init=True)
    def _generate_fired(self):
        '''Generate pressed. Sends request to create specified RR plot.'''
        self.process.jobqueue.put(['plotrr', [self.cpanel.rrchoice]])
        time.sleep(0.5)
        self.updateRRPanel(self.cpanel.rrchoice)
        return
    
    @on_trait_change('cpanel.dirpath', post_init=True)
    def _dirpath_changed(self):
        '''A directory has been chosen. Sends request to start load thread.'''
        self.process.jobqueue.put(['startload', [self.cpanel.dirpath]])
        return
    
    @on_trait_change('process.pic', post_init=True)
    def _pic_changed(self):
        '''Updates the index and metadata when the current image changes.'''
        pic =  self.process.pic
        self.cpanel.index = pic.n + 1
        self.mdpanel.name = pic.name
        if pic.metadata:
            for key in pic.metadata.keys():
                setattr(self.mdpanel, key, pic.metadata[key])
        else:
            for key in self.mdpanel.editable_traits():
                if key != 'name':
                    setattr(self.mdpanel, key, '')
        
        self.imagepanel.invalidate_and_redraw()
        return

    @on_trait_change('process.display.filenum', post_init=True)
    def _filenum_changed(self):
        '''Handles interactions with the RR plots. When a point is hovered
        over, its filename is displayed in the control panel.
        '''
        #print 'filenum changed'
        n = self.process.display.filenum
        if n == -1:
            self.cpanel.message = ''
        else:
            name = self.process.datalist[n].name
            self.cpanel.message = '%d: %s' % (n+1, name)
        return

    @on_trait_change('cpanel.colormap', post_init=True)
    def _colormap_changed(self):
        '''A new colormap has been selected. Sends request to update cmap.'''
        self.process.jobqueue.put(['updatecmap', [self.cpanel.colormap]])
        return

    def createImagePanel(self):
        '''Creates the image panel and fills it with the associated plots. 
        The plots included are the image plot, histogram, and 1D plot. Data
        can be set for these plots without changing the Plot objects.
        '''
        cont = VPlotContainer(stack_order = 'top_to_bottom',
                                bgcolor = 'transparent',
                                use_backbuffer=True)

        imageplot = getattr(self.process, 'imageplot')
        colorbar = getattr(self.process.display, 'colorbar')
        histogram = getattr(self.process, 'histogram')
        plot1d = getattr(self.process, 'plot1d')

        imgcont = HPlotContainer(imageplot, colorbar, bgcolor = 'transparent',
                                    spacing = 20.0)
        cont.add(imgcont)
        cont.add(histogram)
        cont.add(plot1d)
        
        self.imagepanel = cont
        self.imagepanel.get_preferred_size()
        self.imagepanel.invalidate_draw()
        return
    
    def updateRRPanel(self, choice):
        '''Fills the rrpanel with new RR plots.

        choice -- the name of the RR to check for
        '''
        rrplots = getattr(self.process, 'rrplots')
        
        try:
            if rrplots[choice] not in self.rrpanel._components:
                self.rrpanel.add(rrplots[choice])
        except KeyError: 
            return

        if len(self.rrpanel._components) > 3:
            self.rrpanel.remove(self.rrpanel._components[0])

        self.rrpanel.invalidate_and_redraw()
        return
开发者ID:ericdill,项目名称:pyxda,代码行数:104,代码来源:userinterface.py


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