[hamster-applet] remove_child turned out to be no good.
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] remove_child turned out to be no good.
- Date: Sat, 10 Apr 2010 19:21:40 +0000 (UTC)
commit 659d06d79db6d049170a2f7e8bc5d006c39179b2
Author: Toms Bauģis <toms baugis gmail com>
Date: Sat Apr 10 20:21:14 2010 +0100
remove_child turned out to be no good.
src/hamster/graphics.py | 16 ----------------
src/hamster/widgets/dayline.py | 4 +++-
2 files changed, 3 insertions(+), 17 deletions(-)
---
diff --git a/src/hamster/graphics.py b/src/hamster/graphics.py
index c0e2b12..10bb1eb 100644
--- a/src/hamster/graphics.py
+++ b/src/hamster/graphics.py
@@ -382,13 +382,6 @@ class Sprite(gtk.Object):
self.sprites = sorted(self.sprites, key=lambda sprite:sprite.z_order)
- def remove_child(self, *sprites):
- """Add child sprite. Child will be nested within parent"""
- for sprite in sprites:
- if sprite in self.sprites:
- self.sprites.remove(sprite)
- sprite.parent = None
-
self.sprites = sorted(self.sprites, key=lambda sprite:sprite.z_order)
def _draw(self, context, opacity = 1):
@@ -642,15 +635,6 @@ class Scene(gtk.DrawingArea):
self.sprites = sorted(self.sprites, key=lambda sprite:sprite.z_order)
- def remove_child(self, *sprites):
- """Add child sprite. Child will be nested within parent"""
- for sprite in sprites:
- if sprite in self.sprites:
- self.sprites.remove(sprite)
- sprite.parent = None
-
- self.sprites = sorted(self.sprites, key=lambda sprite:sprite.z_order)
-
def clear(self):
"""Remove all sprites from scene"""
self.sprites = []
diff --git a/src/hamster/widgets/dayline.py b/src/hamster/widgets/dayline.py
index 1fe2e9e..0f94096 100644
--- a/src/hamster/widgets/dayline.py
+++ b/src/hamster/widgets/dayline.py
@@ -118,7 +118,9 @@ class DayLine(graphics.Scene):
def set_facts(self, facts, highlight):
- self.remove_child(*self.fact_bars)
+ for bar in self.fact_bars:
+ self.sprites.remove(bar)
+
self.fact_bars = []
for fact in facts:
fact_bar = graphics.Rectangle(0, 0, fill = "#aaa", stroke="#aaa") # dimensions will depend on screen situation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]