Remove invalidation logic which is not necessary with the new cache.

This commit is contained in:
Marco Pesenti Gritti 2007-08-26 14:30:02 +02:00
parent 98157bbccb
commit 5f773b21af
2 changed files with 0 additions and 32 deletions

View File

@ -279,9 +279,6 @@ class _IconBuffer(object):
return surface return surface
def invalidate(self):
self._surface = None
def get_cache_size(self): def get_cache_size(self):
return self._cache_size return self._cache_size
@ -314,29 +311,23 @@ class Icon(gtk.Image):
def _sync_image_properties(self): def _sync_image_properties(self):
if self._buffer.icon_name != self.props.icon_name: if self._buffer.icon_name != self.props.icon_name:
self._buffer.icon_name = self.props.icon_name self._buffer.icon_name = self.props.icon_name
self._buffer.invalidate()
if self._buffer.file_name != self.props.file: if self._buffer.file_name != self.props.file:
self._buffer.file_name = self.props.file self._buffer.file_name = self.props.file
self._buffer.invalidate()
width, height = gtk.icon_size_lookup(self.props.icon_size) width, height = gtk.icon_size_lookup(self.props.icon_size)
if self._buffer.width != width and self._buffer.height != height: if self._buffer.width != width and self._buffer.height != height:
self._buffer.width = width self._buffer.width = width
self._buffer.height = height self._buffer.height = height
self._buffer.invalidate()
def _icon_size_changed_cb(self, image, pspec): def _icon_size_changed_cb(self, image, pspec):
self._buffer.icon_size = self.props.icon_size self._buffer.icon_size = self.props.icon_size
self._buffer.invalidate()
def _icon_name_changed_cb(self, image, pspec): def _icon_name_changed_cb(self, image, pspec):
self._buffer.icon_name = self.props.icon_name self._buffer.icon_name = self.props.icon_name
self._buffer.invalidate()
def _file_changed_cb(self, image, pspec): def _file_changed_cb(self, image, pspec):
self._buffer.file_name = self.props.file self._buffer.file_name = self.props.file
self._buffer.invalidate()
def _update_buffer_size(self): def _update_buffer_size(self):
width, height = gtk.icon_size_lookup(self.props.icon_size) width, height = gtk.icon_size_lookup(self.props.icon_size)
@ -344,8 +335,6 @@ class Icon(gtk.Image):
self._buffer.width = width self._buffer.width = width
self._buffer.height = height self._buffer.height = height
self._buffer.invalidate()
def do_expose_event(self, event): def do_expose_event(self, event):
self._sync_image_properties() self._sync_image_properties()
@ -365,13 +354,10 @@ class Icon(gtk.Image):
self.props.stroke_color = value.get_stroke_color() self.props.stroke_color = value.get_stroke_color()
elif pspec.name == 'fill-color': elif pspec.name == 'fill-color':
self._buffer.fill_color = value self._buffer.fill_color = value
self._buffer.invalidate()
elif pspec.name == 'stroke-color': elif pspec.name == 'stroke-color':
self._buffer.fill_color = value self._buffer.fill_color = value
self._buffer.invalidate()
elif pspec.name == 'badge-name': elif pspec.name == 'badge-name':
self._buffer.badge_name = value self._buffer.badge_name = value
self._buffer.invalidate()
else: else:
gtk.Image.do_set_property(self, pspec, value) gtk.Image.do_set_property(self, pspec, value)
@ -419,31 +405,25 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'file-name': if pspec.name == 'file-name':
self._buffer.file_name = value self._buffer.file_name = value
self._buffer.invalidate()
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'icon-name': elif pspec.name == 'icon-name':
self._buffer.icon_name = value self._buffer.icon_name = value
self._buffer.invalidate()
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'xo-color': elif pspec.name == 'xo-color':
self.props.fill_color = value.get_fill_color() self.props.fill_color = value.get_fill_color()
self.props.stroke_color = value.get_stroke_color() self.props.stroke_color = value.get_stroke_color()
elif pspec.name == 'fill-color': elif pspec.name == 'fill-color':
self._buffer.fill_color = value self._buffer.fill_color = value
self._buffer.invalidate()
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'stroke-color': elif pspec.name == 'stroke-color':
self._buffer.stroke_color = value self._buffer.stroke_color = value
self._buffer.invalidate()
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'size': elif pspec.name == 'size':
self._buffer.width = value self._buffer.width = value
self._buffer.height = value self._buffer.height = value
self._buffer.invalidate()
self.emit_request_changed() self.emit_request_changed()
elif pspec.name == 'scale': elif pspec.name == 'scale':
self._buffer.scale = value self._buffer.scale = value
self._buffer.invalidate()
self.emit_request_changed() self.emit_request_changed()
elif pspec.name == 'cache-size': elif pspec.name == 'cache-size':
self._buffer.cache_size = value self._buffer.cache_size = value

View File

@ -43,18 +43,6 @@ class IconButton(CanvasIcon, hippo.CanvasItem):
self.props.box_height = style.GRID_CELL_SIZE self.props.box_height = style.GRID_CELL_SIZE
self.props.size = style.STANDARD_ICON_SIZE self.props.size = style.STANDARD_ICON_SIZE
def do_button_press_event(self, event):
if self._active:
self.emit_activated()
return True
def prelight(self, enter):
if enter:
if self.props.active:
self.props.background_color = 0x000000FF
else:
self.props.background_color = 0x00000000
def _icon_clicked_cb(self, button): def _icon_clicked_cb(self, button):
if self._palette: if self._palette:
self._palette.popdown(True) self._palette.popdown(True)