From 1f32b8eb0361a639745130c213ecaa06693f5ee1 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Tue, 30 Apr 2013 20:10:12 +0000 Subject: 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 --- 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 -- cgit v0.9.1