Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-04-30 20:10:12 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-04-30 20:10:12 (GMT)
commit1f32b8eb0361a639745130c213ecaa06693f5ee1 (patch)
treeed5d31dba7ce19c78147fb40f235b4758dd860bb
parent138d3ef2f86ea0c8ed1ea7b12ff6ceecc1a6576c (diff)
Use the binaries available in the system, or check platform
First try to use /usr/bin/x11vnc, if is not available, check platform and use the right binary Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rwxr-xr-xvnclauncher.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/vnclauncher.py b/vnclauncher.py
index f5367a3..4772934 100755
--- a/vnclauncher.py
+++ b/vnclauncher.py
@@ -29,11 +29,14 @@ from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.palette import Palette
from sugar.graphics.roundbox import CanvasRoundBox
import ConfigParser
+import os
import os.path
import vte
import pango
import commands
import sys
+import platform
+import logging
class VncLauncherActivity(activity.Activity):
def _ipaddr_(self,button):
@@ -108,8 +111,21 @@ class VncLauncherActivity(activity.Activity):
def connectVNC(self,button):
self._vte.grab_focus()
- cmd = "/home/olpc/Activities/VncLauncher.activity/x11vnc"
- self._vte.fork_command(cmd)
+ # check if x11vnc is installed
+ cmd = '/usr/bin/x11vnc'
+ if os.path.isfile(cmd) and os.access(cmd, os.X_OK):
+ logging.error('Using x11vnc installed in the system')
+ else:
+ # check platform
+ if platform.machine().startswith('arm'):
+ path = os.path.join(activity.get_bundle_path(),
+ 'bin/arm')
+ else:
+ path = os.path.join(activity.get_bundle_path(),
+ 'bin/i586')
+ cmd = os.path.join(path, 'x11vnc')
+ logging.error('Using %s', cmd)
+ self._vte.fork_command(cmd)
def __key_press_cb(self, window, event):
return False