Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave <drykod@gmail.com>2009-11-05 20:45:04 (GMT)
committer dave <drykod@gmail.com>2009-11-05 20:45:04 (GMT)
commit9ed09e3dc78a7e8cc5b24b793413f8af77eeb74a (patch)
tree07cefe7c146dd632a933d2119fe861f3d440a690
parentee1c56be61da79fccf7994578fd7ea2cf051f8a6 (diff)
update message button next event
-rw-r--r--addons/messagebuttonnext.py74
1 files changed, 70 insertions, 4 deletions
diff --git a/addons/messagebuttonnext.py b/addons/messagebuttonnext.py
index b18119b..74ce1bb 100644
--- a/addons/messagebuttonnext.py
+++ b/addons/messagebuttonnext.py
@@ -20,19 +20,25 @@ from sugar.tutorius.filters import EventFilter
from sugar.tutorius.properties import TStringProperty, TArrayProperty
from sugar.tutorius import overlayer
+from sugar import profile
+
+xo_line_color_profile = profile.get_color().get_stroke_color()
+xo_fill_color_profile = profile.get_color().get_fill_color()
+
class MessageButtonNext(EventFilter):
"""
MessageButtonNext
"""
+ # set message
message = TStringProperty("Message")
- # Create the position as an array of fixed-size 2
+ # create the position as an array of fixed-size 2
position = TArrayProperty((0,0), 2, 2)
- # Padding
+ # set padding
padding = 40
- def __init__(self, message=None, position=None):
+ def __init__(self, message=None, position=None, center_pos=False):
"""Constructor.
@param message message to display
@@ -70,7 +76,7 @@ class MessageButtonNext(EventFilter):
btntext = "NEXT"
- self.msgnext = overlayer.MsgNext(text=self.message,btntext=btntext)
+ self.msgnext = MsgNext(text=self.message,btntext=btntext)
self.msgnext._btnnext.connect("clicked", self.btnnext_clicked)
# add space around minimum need size
@@ -103,3 +109,63 @@ __event__ = {
"mandatory_props" : ["message"]
}
+class MsgNext(gtk.EventBox):
+ """
+ Create an EventBox
+ """
+ def __init__(self, text, btntext):
+ """
+ Creates an Event Box
+ """
+ gtk.EventBox.__init__(self)
+
+ self.message = text
+ self.btnmessage = btntext
+
+ self.set_visible_window(True)
+
+ # create a vbox
+ self.box = gtk.VBox()
+
+ # create a label (set message to display)
+ self._label = gtk.Label()
+ self._text = "<b>%s</b>" % self.message
+ self._label.set_markup(self._text)
+ self._label.set_line_wrap(True)
+
+ self._colortext = gtk.gdk.color_parse("white")
+ self._label.modify_fg(gtk.STATE_NORMAL, self._colortext)
+ self._label.modify_fg(gtk.STATE_PRELIGHT, self._colortext)
+ self._label.modify_fg(gtk.STATE_ACTIVE, self._colortext)
+ self._label.modify_fg(gtk.STATE_INSENSITIVE, self._colortext)
+
+ self._label.show()
+
+ # create a hbox (holding button)
+ self._hbox = gtk.HBox()
+
+ # create a button inside hbox
+ self._btnnext = gtk.Button(self.btnmessage)
+
+ self._colorbtn = gtk.gdk.color_parse(xo_fill_color_profile)
+
+ self._btnnext.modify_bg(gtk.STATE_NORMAL, self._colorbtn)
+ self._btnnext.modify_bg(gtk.STATE_PRELIGHT, self._colorbtn)
+ self._btnnext.modify_bg(gtk.STATE_ACTIVE, self._colorbtn)
+
+ self._btnnext.show()
+
+ self._hbox.pack_end(self._btnnext, expand=False)
+
+ self._hbox.show()
+
+ self.box.pack_start(self._label, expand=True)
+ self.box.pack_start(self._hbox, expand=True)
+
+ self.box.show()
+
+ self.add(self.box)
+
+ self._colormsgnext = gtk.gdk.color_parse(xo_fill_color_profile)
+ self.modify_bg(gtk.STATE_NORMAL, self._colormsgnext)
+