Example #1
0
 def _color_click(self, i: int) -> None:
     from bastd.ui.colorpicker import ColorPicker
     ColorPicker(parent=self.root_widget,
                 position=self._color_buttons[i].get_screen_space_center(),
                 offset=(270.0, 0),
                 initial_color=self._colors[i],
                 delegate=self,
                 tag=i)
Example #2
0
 def color_picker_selected_color(self, picker: ColorPicker,
                                 color: Tuple[float, float, float]) -> None:
     """Called when a color is selected in a color picker."""
     if not self._root_widget:
         return
     tag = picker.get_tag()
     if tag == 'color':
         self._set_color(color)
     elif tag == 'highlight':
         self._set_highlight(color)
     else:
         print('color_picker_selected_color got unknown tag ' + str(tag))
     self._update_character()
Example #3
0
 def color_picker_closing(self, picker: ColorPicker) -> None:
     """Called when a color picker is closing."""
     if not self._root_widget:
         return
     tag = picker.get_tag()
     if tag == 'color':
         ba.containerwidget(edit=self._root_widget,
                            selected_child=self._color_button)
     elif tag == 'highlight':
         ba.containerwidget(edit=self._root_widget,
                            selected_child=self._highlight_button)
     else:
         print('color_picker_closing got unknown tag ' + str(tag))
Example #4
0
 def color_picker_selected_color(self, picker: ColorPicker,
                                 color: Sequence[float]) -> None:
     """Called when a color is selected in the color picker."""
     self._colors[picker.get_tag()] = color
     self._update()