alt+q shutdown the emulator

This commit is contained in:
Marco Pesenti Gritti 2006-10-17 01:09:44 +02:00
parent 87458b63f5
commit 535b67ea41
5 changed files with 32 additions and 2 deletions

View File

@ -5,8 +5,9 @@ ACLOCAL_AMFLAGS = -I m4
dbusconfdir = $(pkgdatadir) dbusconfdir = $(pkgdatadir)
dbusconf_DATA = dbus-installed.conf dbusconf_DATA = dbus-installed.conf
bin_SCRIPTS = \ bin_SCRIPTS = \
sugar-emulator sugar-emulator \
sugar-emulator-shutdown
install-data-local: install-data-local:
$(top_srcdir)/sugar/setup.py \ $(top_srcdir)/sugar/setup.py \

View File

@ -7,3 +7,4 @@
<Alt>c=close <Alt>c=close
F12=!sugar-log-viewer F12=!sugar-log-viewer
<Alt>q=!sugar-emulator-shutdown

24
sugar-emulator-shutdown Executable file
View File

@ -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)

View File

@ -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_python_path.append(os.path.join(sugar_source_dir, 'services'))
sugar_bin_path = [] 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, 'shell'))
sugar_bin_path.append(os.path.join(sugar_source_dir, 'services/presence')) sugar_bin_path.append(os.path.join(sugar_source_dir, 'services/presence'))

View File

@ -60,6 +60,7 @@ class Process:
flags = gobject.SPAWN_SEARCH_PATH flags = gobject.SPAWN_SEARCH_PATH
result = gobject.spawn_async(args, flags=flags, result = gobject.spawn_async(args, flags=flags,
standard_output=standard_output) standard_output=standard_output)
self.pid = result[0]
self._stdout = result[2] self._stdout = result[2]
class MatchboxProcess(Process): class MatchboxProcess(Process):
@ -92,6 +93,8 @@ class XephyrProcess(Process):
def start(self): def start(self):
Process.start(self) Process.start(self)
os.environ['DISPLAY'] = ":%d" % (self._display) os.environ['DISPLAY'] = ":%d" % (self._display)
os.environ['SUGAR_XEPHYR_PID'] = '%d' % self.pid
class XnestProcess(Process): class XnestProcess(Process):
def __init__(self): def __init__(self):