Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/broadcast.py
diff options
context:
space:
mode:
authorAriel Calzada <ariel@activitycentral.com>2012-01-24 12:29:23 (GMT)
committer Ariel Calzada <ariel@activitycentral.com>2012-01-24 12:29:23 (GMT)
commitcef3889dbfc9a09e696b9e47e600e48b03ede5e7 (patch)
tree1a6bd863f52fdc8b3069f45205eecb473bd2a3da /broadcast.py
parent6cf90d45e9d18d95d788b17afb8ddb07b1b1df16 (diff)
UI for broadcast
Diffstat (limited to 'broadcast.py')
-rw-r--r--broadcast.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/broadcast.py b/broadcast.py
new file mode 100644
index 0000000..696778f
--- /dev/null
+++ b/broadcast.py
@@ -0,0 +1,96 @@
+from gettext import gettext as _
+import gtk
+
+class Broadcast():
+ """Broadcast component for Classroom Kit Activity
+ """
+
+ # Constants
+ _greenColor = '#00E500'
+ _redColor = '#FF0000'
+
+ # I18N
+ _START = _('Start')
+ _STOP = _('Stop')
+
+ # UI elements
+ _box = None
+ _button = None
+ _label = None
+ _toolbar = None
+ _boxAlign = None
+
+ def __init__(self, activity):
+ """Constructor
+ """
+
+ self._activity = activity
+
+ def loadUI(self):
+ """Create and show UI
+ """
+
+ # Box
+ self._box = gtk.VBox()
+
+ # Label
+ self._label = gtk.Label()
+
+ # Button
+ self._button = gtk.Button()
+ self._button.set_size_request(200, 100)
+ self._button.connect("clicked", self.buttonClicked)
+
+ # Add button to box
+ self._box.pack_start(self._button)
+
+ # Add label to box
+ self._box.pack_start(self._label, padding=20)
+
+ # Box Align (xalign, yalign, xscale, yscale)
+ self._boxAlign = gtk.Alignment(0.5, 0.5, 0, 0)
+ self._boxAlign.add(self._box)
+
+ # Set canvas with box alignment
+ self._activity.set_canvas(self._boxAlign)
+
+ def setButtonBG(self, color):
+ """Change button bg color
+ """
+
+ self._button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
+
+ def setButtonLabel(self, txt):
+ """Change button label
+ """
+
+ self._button.set_label(txt)
+
+ def buttonClicked(self, widget, data=None):
+ """Button clicked event handler
+ """
+
+ pass
+
+ def setLabelTXT(self, txt):
+ """Change label text
+ """
+
+ self._label.set_label(txt)
+
+
+ def showStatus(self):
+ """Show VNC status
+ """
+
+ state = "off"
+
+ if state == "off":
+ self.setButtonBG(self._greenColor)
+ self.setButtonLabel(self._START)
+ self.setLabelTXT("")
+ else:
+ self.setButtonBG(self._redColor)
+ self.setButtonLabel(self._STOP)
+ self.setLabelTXT("")
+