[hamster-applet] check that sprite is visible, not only clickable
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] check that sprite is visible, not only clickable
- Date: Tue, 13 Jul 2010 15:09:30 +0000 (UTC)
commit d9a95150ba71dbf92f5016e6871fecd81f375543
Author: Toms Bauģis <toms baugis gmail com>
Date: Tue Jul 13 16:06:46 2010 +0100
check that sprite is visible, not only clickable
src/hamster/graphics.py | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/hamster/graphics.py b/src/hamster/graphics.py
index fb7d8a2..bf28ad6 100644
--- a/src/hamster/graphics.py
+++ b/src/hamster/graphics.py
@@ -155,6 +155,13 @@ class Graphics(object):
self._add_instruction(self._set_source_surface, image, x, y)
@staticmethod
+ def _set_source_pixbuf(context, pixbuf, x, y):
+ context.set_source_pixbuf(pixbuf, x, y)
+ def set_source_pixbuf(self, pixbuf, x = 0, y = 0):
+ self._add_instruction(self._set_source_pixbuf, pixbuf, x, y)
+
+
+ @staticmethod
def _move_to(context, x, y): context.move_to(x, y)
def move_to(self, x, y):
"""change current position"""
@@ -378,7 +385,7 @@ class Graphics(object):
while self.__path_instructions:
instruction, args = self.__path_instructions.popleft()
- if instruction in (self._set_source_surface, self._paint):
+ if instruction in (self._set_source_surface, self._set_source_pixbuf, self._paint):
self.__instructions.append((None, None, None, instruction, args))
elif instruction == self._show_layout:
@@ -991,7 +998,7 @@ class Scene(gtk.DrawingArea):
#check if we have a mouse over
over = None
for sprite in self.all_sprites():
- if sprite.interactive and self._check_hit(sprite, mouse_x, mouse_y):
+ if sprite.interactive and sprite.visible and self._check_hit(sprite, mouse_x, mouse_y):
over = sprite
if over:
@@ -1061,7 +1068,7 @@ class Scene(gtk.DrawingArea):
over = None
for sprite in self.all_sprites():
- if sprite.interactive and self._check_hit(sprite, event.x, event.y):
+ if sprite.interactive and sprite.visible and self._check_hit(sprite, event.x, event.y):
over = sprite # last one will take precedence
self._drag_sprite = over
self._button_press_time = dt.datetime.now()
@@ -1081,7 +1088,7 @@ class Scene(gtk.DrawingArea):
if click:
target = None
for sprite in self.all_sprites():
- if sprite.interactive and self._check_hit(sprite, event.x, event.y):
+ if sprite.interactive and sprite.visible and self._check_hit(sprite, event.x, event.y):
target = sprite
if target:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]