Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--i18n.py2
-rw-r--r--utilities.py6
-rw-r--r--viewer.py150
-rwxr-xr-xvncviewerbin0 -> 622744 bytes
-rwxr-xr-xx11vncbin0 -> 1402876 bytes
5 files changed, 157 insertions, 1 deletions
diff --git a/i18n.py b/i18n.py
index b438938..8f9e96a 100644
--- a/i18n.py
+++ b/i18n.py
@@ -15,6 +15,8 @@ from gettext import gettext as _
# UI Buttons
START = _('Start')
STOP = _('Stop')
+CONNECT = _('Connect')
+DISCONNECT = _('Disconnect')
# Process
IPS = _('IPs')
diff --git a/utilities.py b/utilities.py
index 1953a3d..5ac8ad2 100644
--- a/utilities.py
+++ b/utilities.py
@@ -107,7 +107,11 @@ class Utilities():
os.system("kill -9 " + pid)
def startProgram(self, programName, args=[]):
- cmd = [programName]
+ fname = "/usr/bin/" + programName
+ if not os.path.isfile(fname):
+ fname = programName
+
+ cmd = [fname]
if len(args) > 0:
for arg in args:
diff --git a/viewer.py b/viewer.py
new file mode 100644
index 0000000..874dfe0
--- /dev/null
+++ b/viewer.py
@@ -0,0 +1,150 @@
+import gtk
+import pango
+
+from utilities import Utilities
+import i18n
+
+class ViewerProcess():
+ """Viewer process component
+ """
+
+ # utilities
+ _utilities = None
+
+ # process details
+ _programName = "vncviewer"
+ _args = []
+
+ def __init__(self):
+ """Constructor
+ """
+ self._utilities = Utilities()
+
+ def getStatus(self):
+ """get current status of the vnc process
+ """
+ st = self._utilities.checkProgramStatus(self._programName)
+
+ return st[0]
+
+ def changeStatus(self):
+ """change current status of the vnc proces
+ """
+ if self.getStatus():
+ self._utilities.endProgram(self._programName)
+ else:
+ self._utilities.startProgram(self._programName,self._args)
+
+ def getProcessInfo(self):
+ return self._utilities.getNetworkProcessInfo(self._programName)
+
+
+class ViewerUI():
+ """Viewer UI component for Classroom Kit Activity
+ """
+ # Constants
+ _greenColor = '#00E500'
+ _redColor = '#FF0000'
+
+ # UI elements
+ _box = None
+ _button = None
+ _label = None
+ _toolbar = None
+ _boxAlign = None
+
+ # activity, process
+ _activity = None
+ _process = None
+
+ def __init__(self, activity, process):
+ """Constructor
+ """
+ self._activity = activity
+ self._process = process
+
+ 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, 50)
+ 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
+ """
+ self._process.changeStatus()
+ self.showStatus()
+
+ def setLabelTXT(self, txt):
+ """Change label text
+ """
+ self._label.set_label(txt)
+
+ def showStatus(self):
+ """Show VNC status
+ """
+ state = self._process.getStatus()
+
+ if not state:
+ self.setButtonBG(self._greenColor)
+ self.setButtonLabel(i18n.CONNECT)
+ self.setLabelTXT("")
+ else:
+ self.setButtonBG(self._redColor)
+ self.setButtonLabel(i18n.DISCONNECT)
+ self.setLabelTXT(self._process.getProcessInfo())
+
+class Viewer():
+ """Viewer component for Classroom Kit Activity
+ """
+ _activity = None
+ _process = None
+ _ui = None
+
+ def __init__(self,activity):
+ """Constructor
+ """
+ self._activity = activity
+ self._process = ViewerProcess()
+ self._ui = ViewerUI(self._activity, self._process)
+
+ def loadUI(self):
+ """Load UI
+ """
+ self._ui.loadUI()
+
+ def showStatus(self):
+ """Show Viewer status
+ """
+ self._ui.showStatus()
diff --git a/vncviewer b/vncviewer
new file mode 100755
index 0000000..bcbc643
--- /dev/null
+++ b/vncviewer
Binary files differ
diff --git a/x11vnc b/x11vnc
new file mode 100755
index 0000000..f37061a
--- /dev/null
+++ b/x11vnc
Binary files differ