當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。