Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/addons/bubblemessagewimg.py
diff options
context:
space:
mode:
authorVincent Vinet <vince.vinet@gmail.com>2009-12-07 20:50:52 (GMT)
committer Vincent Vinet <vince.vinet@gmail.com>2009-12-07 20:52:25 (GMT)
commit034e36d4983da0c2d44c56d4efd9af922b2cab4e (patch)
tree8fc4726e09ac60cbfd64b0ee068f451144cecf3b /addons/bubblemessagewimg.py
parent7e65bdb14c2b3a9e04762755a19fcdc9922291fc (diff)
pass the overlayer as a keyword argument for do, enter_editmode and subscribe, remove object store references
Diffstat (limited to 'addons/bubblemessagewimg.py')
-rw-r--r--addons/bubblemessagewimg.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/addons/bubblemessagewimg.py b/addons/bubblemessagewimg.py
index 9fe9512..974dd19 100644
--- a/addons/bubblemessagewimg.py
+++ b/addons/bubblemessagewimg.py
@@ -13,10 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-from sugar.tutorius.actions import Action, DragWrapper
-from sugar.tutorius.properties import TStringProperty, TResourceProperty, TArrayProperty
-from sugar.tutorius import overlayer
-from sugar.tutorius.services import ObjectStore
+from ..actions import Action, DragWrapper
+from ..properties import TStringProperty, TResourceProperty, TArrayProperty
+from ..overlayer import TextBubbleWImg
class BubbleMessageWImg(Action):
message = TStringProperty("Message")
@@ -43,24 +42,25 @@ class BubbleMessageWImg(Action):
self._bubble = None
self._speaker = None
- def do(self, **kwargs):
+ def do(self, overlayer=None, **kwargs):
"""
Show the dialog
+ @param overlayer Overlayer to draw on
"""
- # get or inject overlayer
- self.overlay = ObjectStore().activity._overlayer
+ if overlayer is None:
+ raise TypeError("Missing overlayer")
+
+ self.overlay = overlayer
# FIXME: subwindows, are left to overlap this. This behaviour is
# undesirable. subwindows (i.e. child of top level windows) should be
# handled either by rendering over them, or by finding different way to
# draw the overlay.
- if not self.overlay:
- self.overlay = ObjectStore().activity._overlayer
if not self._bubble:
x, y = self.position
# TODO: tails are relative to tailpos. They should be relative to
# the speaking widget. Same of the bubble position.
- self._bubble = overlayer.TextBubbleWImg(text=self.message,
+ self._bubble = TextBubbleWImg(text=self.message,
tailpos=self.tail_pos,imagepath=self.imgpath.default)
self._bubble.show()
self.overlay.put(self._bubble, x, y)
@@ -75,16 +75,19 @@ class BubbleMessageWImg(Action):
self._bubble.destroy()
self._bubble = None
- def enter_editmode(self, *args):
+ def enter_editmode(self, overlayer=None, *args, **kwargs):
"""
Enters edit mode. The action should display itself in some way,
without affecting the currently running application.
+ @param overlay Overlayer to draw on
"""
- if not self.overlay:
- self.overlay = ObjectStore().activity._overlayer
+ if overlayer is None:
+ raise TypeError("Missing overlayer")
+
+ self.overlay = overlayer
assert not self._drag, "bubble action set to editmode twice"
x, y = self.position
- self._bubble = overlayer.TextBubbleWImg(text=self.message,
+ self._bubble = TextBubbleWImg(text=self.message,
tailpos=self.tail_pos,imagepath=self.imgpath)
self.overlay.put(self._bubble, x, y)
self._bubble.show()