Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
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
parent6cf90d45e9d18d95d788b17afb8ddb07b1b1df16 (diff)
UI for broadcast
-rw-r--r--activity/classroomkit.svg28
-rw-r--r--broadcast.py96
-rw-r--r--classroomkit.py45
3 files changed, 148 insertions, 21 deletions
diff --git a/activity/classroomkit.svg b/activity/classroomkit.svg
index 8be2df6..1857c74 100644
--- a/activity/classroomkit.svg
+++ b/activity/classroomkit.svg
@@ -17,8 +17,8 @@
height="48pt"
id="svg611"
sodipodi:version="0.32"
- inkscape:version="0.48.2 r9819"
- sodipodi:docname="classroomkit.svg">
+ inkscape:version="0.48.1 r9760"
+ sodipodi:docname="gdm-xnest.svg">
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
@@ -27,12 +27,12 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
- inkscape:cx="49.345371"
- inkscape:cy="23.599878"
- inkscape:window-width="1366"
+ inkscape:cx="34.067272"
+ inkscape:cy="23.953431"
+ inkscape:window-width="1360"
inkscape:window-height="715"
inkscape:window-x="0"
- inkscape:window-y="31"
+ inkscape:window-y="26"
showguides="true"
inkscape:guide-bbox="true"
showgrid="false"
@@ -169,7 +169,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -202,18 +202,4 @@
style="font-size:12;fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:0.59370529999999999"
id="path994"
sodipodi:nodetypes="ccccccc" />
- <text
- xml:space="preserve"
- style="font-size:2.29039741px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
- x="22.186474"
- y="48.785305"
- id="text3014"
- sodipodi:linespacing="125%"
- transform="matrix(1.2099748,-0.12102819,0.10342769,0.81611809,0,0)"
- inkscape:transform-center-x="3.3351735"
- inkscape:transform-center-y="-0.34976374"><tspan
- sodipodi:role="line"
- id="tspan3016"
- x="22.186474"
- y="48.785305">ClassroomKit</tspan></text>
</svg>
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("")
+
diff --git a/classroomkit.py b/classroomkit.py
index 88d601e..6c9fa2b 100644
--- a/classroomkit.py
+++ b/classroomkit.py
@@ -23,7 +23,52 @@ import os
import socket
import commands
+from broadcast import Broadcast
+
class ClassroomKitActivity(activity.Activity):
"""Classroom Kit Activity
"""
+
+ # Broadcast Component
+ _broadcast = None
+
+ # UI
+ _toolbar = None
+
+ def __init__(self, handle):
+ """Constructor
+ """
+
+ # initialize activity
+ activity.Activity.__init__(self, handle)
+
+ # debug msg
+ logging.debug("Starting Classroom Kit Activity")
+
+ # UI
+ self.loadUI()
+
+ # create broadcast component
+ self._broadcast = Broadcast(self)
+ self._broadcast.loadUI();
+
+ # Show UI
+ self.showUI()
+
+ # Show status
+ self._broadcast.showStatus()
+
+ def loadUI(self):
+ """Create and show UI
+ """
+
+ # Toolbar
+ toolbox = ActivityToolbox(self)
+ self._toolbar = toolbox.get_activity_toolbar()
+ self.set_toolbox(toolbox)
+
+ def showUI(self):
+ """Show UI elements
+ """
+ self.show_all()