Don't clear the current buffer on cleanup

This commit is contained in:
Dan Williams 2007-01-15 09:53:41 -05:00
parent c30451b19e
commit 9c75c80d7f

View File

@ -154,7 +154,9 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
self.connect('button-press-event', self._button_press_event_cb) self.connect('button-press-event', self._button_press_event_cb)
def _clear_buffers(self): def _clear_buffers(self):
cur_buf_key = self._get_current_buffer_key()
for key in self._buffers.keys(): for key in self._buffers.keys():
if key != cur_buf_key:
del self._buffers[key] del self._buffers[key]
self._buffers = {} self._buffers = {}
@ -177,6 +179,9 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
elif pspec.name == 'cache': elif pspec.name == 'cache':
self._cache = value self._cache = value
def _get_current_buffer_key(self):
return (self._icon_name, self._color, self._size)
def do_get_property(self, pspec): def do_get_property(self, pspec):
if pspec.name == 'size': if pspec.name == 'size':
return self._size return self._size
@ -188,8 +193,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
return self._cache return self._cache
def _get_buffer(self, cr, handle): def _get_buffer(self, cr, handle):
key = (self._icon_name, self._color, self._size) key = self._get_current_buffer_key()
buf = None buf = None
if self._buffers.has_key(key): if self._buffers.has_key(key):
buf = self._buffers[key] buf = self._buffers[key]