Example #1
0
 def update_cb(self):
     """Callback: managed color updated.
     """
     self._drag_insertion_index = None
     ColorAdjusterWidget.update_cb(self)
     if self.manage_current_index and not self._button_down:
         self.match_managed_color()
Example #2
0
 def __init__(self):
     ColorAdjusterWidget.__init__(self)
     # Sizing
     s = self._SWATCH_SIZE_NOMINAL
     self.set_size_request(s, s)
     self.connect("size-allocate", self._size_alloc_cb)
     #: Highlight the currently matched color
     self.show_matched_color = False
     #: User can click on empty slots
     self.can_select_empty = False
     # Current index
     self.connect("button-press-event", self._button_press_cb)
     self.connect_after("button-release-event", self._button_release_cb)
     # Dragging
     self._drag_insertion_index = None
     self.connect("motion-notify-event", self._motion_notify_cb)
     self.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
     # Tooltips
     self._tooltip_index = None
     self.set_has_tooltip(True)
     # Cached layout details
     self._rows = None
     self._columns = None
     self._last_palette_columns = None
     self._swatch_size = self._SWATCH_SIZE_NOMINAL
Example #3
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     #w = PRIMARY_ADJUSTERS_MIN_WIDTH
     #h = PRIMARY_ADJUSTERS_MIN_HEIGHT
     #self.set_size_request(w, h)
     self.__cube = cube
     self.connect('button-press-event', self.stop_fallthrough)
Example #4
0
 def __init__(self):
     ColorAdjusterWidget.__init__(self)
     # Sizing
     s = self._SWATCH_SIZE_NOMINAL
     self.set_size_request(s, s)
     self.connect("size-allocate", self._size_alloc_cb)
     # Current index
     self._current_index = None
     self._current_index_approx = False
     self._button_down = None
     self.connect("button-press-event", self._button_press_cb)
     self.connect_after("button-release-event", self._button_release_cb)
     self.current_index_observers = []
     self.current_index_observers.append(self._current_index_changed_cb)
     # Dragging
     self._drag_insertion_index = None
     self.connect("motion-notify-event", self._motion_notify_cb)
     self.add_events(gdk.POINTER_MOTION_MASK)
     # Palette to display
     self._palette = None
     self.palette_observers = []
     self.palette_observers.append(self._palette_changed_cb)
     self.set_palette(Palette())
     # Tooltips
     self_tooltip_index = None
     self.set_has_tooltip(True)
     # Cached layout details
     self._rows = None
     self._columns = None
     self._swatch_size = self._SWATCH_SIZE_NOMINAL
Example #5
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     #w = PRIMARY_ADJUSTERS_MIN_WIDTH
     #h = PRIMARY_ADJUSTERS_MIN_HEIGHT
     #self.set_size_request(w, h)
     self.__cube = cube
     self.connect('button-press-event', self.stop_fallthrough)
Example #6
0
 def set_color_at_position(self, x, y, color):
     i = self.get_index_at_pos(x, y)
     mgr = self.get_color_manager()
     if i is None:
         mgr.palette.append(color)
     else:
         mgr.palette[i] = color
     ColorAdjusterWidget.set_color_at_position(self, x, y, color)
Example #7
0
 def set_color_manager(self, mgr):
     ColorAdjusterWidget.set_color_manager(self, mgr)
     # Could be smarter about these: probably no need to redraw on
     # every little change.
     mgr.palette.info_changed += self._palette_changed_cb
     mgr.palette.match_changed += self._palette_changed_cb
     mgr.palette.sequence_changed += self._palette_changed_cb
     mgr.palette.color_changed += self._palette_changed_cb
Example #8
0
 def set_color_at_position(self, x, y, color):
     i = self.get_index_at_pos(x, y)
     if i is None:
         self._palette.append(color)
     else:
         self._palette[i] = color
     self._call_palette_observers()
     ColorAdjusterWidget.set_color_at_position(self, x, y, color)
Example #9
0
 def set_color_at_position(self, x, y, color):
     i = self.get_index_at_pos(x, y)
     mgr = self.get_color_manager()
     if i is None:
         mgr.palette.append(color)
     else:
         mgr.palette[i] = color
     ColorAdjusterWidget.set_color_at_position(self, x, y, color)
Example #10
0
 def set_color_manager(self, mgr):
     ColorAdjusterWidget.set_color_manager(self, mgr)
     # Could be smarter about these: probably no need to redraw on
     # every little change.
     mgr.palette.info_changed += self._palette_changed_cb
     mgr.palette.match_changed += self._palette_changed_cb
     mgr.palette.sequence_changed += self._palette_changed_cb
     mgr.palette.color_changed += self._palette_changed_cb
Example #11
0
 def __init__(self):
     ColorAdjusterWidget.__init__(self)
     self._sizes = set()
     s = self._SWATCH_SIZE_NOMINAL
     self.set_size_request(s, s)
     self.connect("size-allocate", self._size_alloc_cb)
     self.connect("button-press-event", self._button_press_cb)
     self.connect_after("button-release-event", self._button_release_cb)
     self.current_index_observers = []
     self.current_index_observers.append(self._current_index_changed_cb)
     self.palette_observers = []
     self.palette_observers.append(self._palette_changed_cb)
     self.set_palette(Palette())
     self.connect("motion-notify-event", self._motion_notify_cb)
     self.add_events(gdk.POINTER_MOTION_MASK)
     self.set_has_tooltip(True)
Example #12
0
 def __init__(self):
     ColorAdjusterWidget.__init__(self)
     # Sizing
     s = self._SWATCH_SIZE_NOMINAL
     self.set_size_request(s, s)
     self.connect("size-allocate", self._size_alloc_cb)
     #: Highlight the currently matched color
     self.show_matched_color = False
     #: User can click on empty slots
     self.can_select_empty = False
     # Current index
     self.connect("button-press-event", self._button_press_cb)
     self.connect_after("button-release-event", self._button_release_cb)
     # Dragging
     self._drag_insertion_index = None
     self.connect("motion-notify-event", self._motion_notify_cb)
     self.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
     # Tooltips
     self._tooltip_index = None
     self.set_has_tooltip(True)
     # Cached layout details
     self._rows = None
     self._columns = None
     self._swatch_size = self._SWATCH_SIZE_NOMINAL
Example #13
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     w = PRIMARY_ADJUSTERS_MIN_WIDTH
     h = PRIMARY_ADJUSTERS_MIN_HEIGHT
     self.set_size_request(w, h)
     self.__cube = cube
Example #14
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     self.__cube = cube
     self.connect('button-press-event', self.stop_fallthrough)
Example #15
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     w = PRIMARY_ADJUSTERS_MIN_WIDTH
     h = PRIMARY_ADJUSTERS_MIN_HEIGHT
     self.set_size_request(w, h)
     self.__cube = cube
Example #16
0
 def __init__(self, cube):
     ColorAdjusterWidget.__init__(self)
     self.__cube = cube
     self.connect('button-press-event', self.stop_fallthrough)