Add a fullscreen option to the emulator

This commit is contained in:
Marco Pesenti Gritti 2006-10-16 17:22:05 +02:00
parent f98956acda
commit 781988589a
2 changed files with 21 additions and 8 deletions

View File

@ -34,11 +34,17 @@ env.setup_system()
from sugar.emulator import Emulator
emulator = Emulator()
program = 'sugar-shell'
fullscreen = False
for i in range(1, len(sys.argv)):
if sys.argv[i] == '-fullscreen':
fullscreen = True
else:
program = sys.argv[i]
emulator = Emulator(fullscreen)
emulator.start()
program = 'sugar-shell'
if len(sys.argv) > 1:
program = sys.argv[1]
os.execlp('dbus-launch', 'dbus-launch', '--exit-with-session',
'--config-file=%s' % env.get_dbus_config(), program)

View File

@ -77,9 +77,13 @@ class MatchboxProcess(Process):
return 'Matchbox'
class XephyrProcess(Process):
def __init__(self):
def __init__(self, fullscreen):
self._display = get_display_number()
cmd = 'Xephyr :%d -ac -screen 800x600' % (self._display)
cmd = 'Xephyr :%d -ac ' % (self._display)
if fullscreen:
cmd += '-fullscreen '
else:
cmd += '-screen 800x600 '
Process.__init__(self, cmd)
def get_name(self):
@ -102,11 +106,14 @@ class XnestProcess(Process):
Process.start(self)
os.environ['DISPLAY'] = ":%d" % (self._display)
class Emulator:
class Emulator(object):
"""The OLPC emulator"""
def __init__(self, fullscreen):
self._fullscreen = fullscreen
def start(self):
try:
process = XephyrProcess()
process = XephyrProcess(self._fullscreen)
process.start()
except:
try: