Esempio n. 1
0
 def clr_picker(clr, cache=False):
     if cache:
         clr_picker = ColorPicker(concise=True, value=to_hex(self.colormap[clr][0:3]), 
                 disabled=False, layout=Layout(width="30px"))
     else:
         clr_picker = ColorPicker(concise=True, value=to_hex(self.colormap[clr][0:3]), 
                 disabled=False, layout=Layout(width="25px", margin="0 0 0 8px"))
     clr_picker.observing = True
     def handle_color_picker(change):
         self.colormap[clr] = to_rgba(change.new, 1)
         self.model.plot.colormap = ListedColormap(self.colormap)
         self.model.plot.backend.plot._update_image()
     clr_picker.observe(handle_color_picker, names='value')
     self.colorpickers[clr] = clr_picker
     return clr_picker
Esempio n. 2
0
        def clr_picker(enum_color, cache=False, miss_acc=False):
            '''

            '''
            def handle_color_picker(change):
                print(enum_color, change)
                self.colormap[enum_color] = to_rgba(change.new, 1)
                self.model.plot.colormap = ListedColormap(self.colormap)
                self.model.plot.backend.plot.update_image()
            

            if cache:
                clr_picker = ColorPicker(concise=True, value=to_hex(self.colormap[enum_color][0:3]), 
                        disabled=False, layout=Layout(width="30px"))
            else:
                clr_picker = ColorPicker(concise=True, value=to_hex(self.colormap[enum_color][0:3]), 
                        disabled=False, layout=Layout(width="25px", margin="0 4px 0 4px"))
            
            clr_picker.observe(handle_color_picker, names='value')
            self.colorpickers[enum_color] = clr_picker

            clr_picker.observing = True
            return clr_picker