Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-10-16 23:09:44 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-10-16 23:09:44 (GMT)
commit535b67ea41bbe150888f19ac89a7bde99cd86bb6 (patch)
treec15feb940f95064422ebbfaff3b6ee95b34b7743
parent87458b63f5f2b38b5ac0e114f4c140e61ddd91f2 (diff)
alt+q shutdown the emulator
-rw-r--r--Makefile.am5
-rw-r--r--shell/data/kbdconfig1
-rwxr-xr-xsugar-emulator-shutdown24
-rw-r--r--sugar/__uninstalled__.py.in1
-rw-r--r--sugar/emulator.py3
5 files changed, 32 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 3ae1ba5..dc2e465 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,8 +5,9 @@ ACLOCAL_AMFLAGS = -I m4
dbusconfdir = $(pkgdatadir)
dbusconf_DATA = dbus-installed.conf
-bin_SCRIPTS = \
- sugar-emulator
+bin_SCRIPTS = \
+ sugar-emulator \
+ sugar-emulator-shutdown
install-data-local:
$(top_srcdir)/sugar/setup.py \
diff --git a/shell/data/kbdconfig b/shell/data/kbdconfig
index f834087..967361a 100644
--- a/shell/data/kbdconfig
+++ b/shell/data/kbdconfig
@@ -7,3 +7,4 @@
<Alt>c=close
F12=!sugar-log-viewer
+<Alt>q=!sugar-emulator-shutdown
diff --git a/sugar-emulator-shutdown b/sugar-emulator-shutdown
new file mode 100755
index 0000000..c608d97
--- /dev/null
+++ b/sugar-emulator-shutdown
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import os
+import signal
+
+if os.environ.has_key('SUGAR_XEPHYR_PID'):
+ pid = int(os.environ['SUGAR_XEPHYR_PID'])
+ os.kill(pid, signal.SIGTERM)
diff --git a/sugar/__uninstalled__.py.in b/sugar/__uninstalled__.py.in
index d6391a9..7593387 100644
--- a/sugar/__uninstalled__.py.in
+++ b/sugar/__uninstalled__.py.in
@@ -17,5 +17,6 @@ sugar_python_path.append(os.path.join(sugar_source_dir, 'activities'))
sugar_python_path.append(os.path.join(sugar_source_dir, 'services'))
sugar_bin_path = []
+sugar_bin_path.append(os.path.join(sugar_source_dir))
sugar_bin_path.append(os.path.join(sugar_source_dir, 'shell'))
sugar_bin_path.append(os.path.join(sugar_source_dir, 'services/presence'))
diff --git a/sugar/emulator.py b/sugar/emulator.py
index f1f0b3d..638029e 100644
--- a/sugar/emulator.py
+++ b/sugar/emulator.py
@@ -60,6 +60,7 @@ class Process:
flags = gobject.SPAWN_SEARCH_PATH
result = gobject.spawn_async(args, flags=flags,
standard_output=standard_output)
+ self.pid = result[0]
self._stdout = result[2]
class MatchboxProcess(Process):
@@ -92,6 +93,8 @@ class XephyrProcess(Process):
def start(self):
Process.start(self)
os.environ['DISPLAY'] = ":%d" % (self._display)
+ os.environ['SUGAR_XEPHYR_PID'] = '%d' % self.pid
+
class XnestProcess(Process):
def __init__(self):