2006-07-12 13:20:41 +02:00
|
|
|
import os
|
2006-07-12 14:02:29 +02:00
|
|
|
import gtk
|
2006-08-12 01:29:55 +02:00
|
|
|
|
2006-09-15 13:23:21 +02:00
|
|
|
from view.Shell import Shell
|
2006-09-15 12:52:37 +02:00
|
|
|
from model.ShellModel import ShellModel
|
2006-09-04 21:49:58 +02:00
|
|
|
from sugar import env
|
|
|
|
from sugar import logger
|
2006-08-20 12:10:12 +02:00
|
|
|
|
2006-09-10 02:35:53 +02:00
|
|
|
from sugar.session.Process import Process
|
|
|
|
from sugar.session.DbusProcess import DbusProcess
|
|
|
|
from sugar.session.MatchboxProcess import MatchboxProcess
|
2006-07-19 20:58:29 +02:00
|
|
|
|
2006-09-15 13:23:21 +02:00
|
|
|
from view.FirstTimeDialog import FirstTimeDialog
|
2006-09-10 02:35:53 +02:00
|
|
|
import conf
|
2006-07-12 13:20:41 +02:00
|
|
|
|
2006-09-08 05:28:01 +02:00
|
|
|
class DBusMonitorProcess(Process):
|
|
|
|
def __init__(self):
|
|
|
|
Process.__init__(self, "dbus-monitor --session")
|
|
|
|
|
|
|
|
def get_name(self):
|
|
|
|
return 'dbus-monitor'
|
|
|
|
|
2006-07-12 13:20:41 +02:00
|
|
|
class Session:
|
|
|
|
"""Takes care of running the shell and all the sugar processes"""
|
2006-09-04 21:49:58 +02:00
|
|
|
|
|
|
|
def _check_profile(self):
|
|
|
|
profile = conf.get_profile()
|
|
|
|
|
|
|
|
if profile.get_nick_name() == None:
|
|
|
|
dialog = FirstTimeDialog()
|
|
|
|
dialog.run()
|
|
|
|
profile.save()
|
|
|
|
|
|
|
|
env.setup_user(profile)
|
|
|
|
|
2006-07-12 13:20:41 +02:00
|
|
|
def start(self):
|
|
|
|
"""Start the session"""
|
2006-09-04 21:49:58 +02:00
|
|
|
process = MatchboxProcess()
|
2006-08-23 11:52:18 +02:00
|
|
|
process.start()
|
|
|
|
|
2006-09-04 21:49:58 +02:00
|
|
|
self._check_profile()
|
|
|
|
|
|
|
|
process = DbusProcess()
|
2006-07-12 13:20:41 +02:00
|
|
|
process.start()
|
2006-07-23 06:56:40 +02:00
|
|
|
|
2006-09-08 18:03:40 +02:00
|
|
|
if os.environ.has_key('SUGAR_DBUS_MONITOR'):
|
2006-09-08 05:28:01 +02:00
|
|
|
dbm = DBusMonitorProcess()
|
|
|
|
dbm.start()
|
|
|
|
|
2006-09-15 12:40:22 +02:00
|
|
|
model = ShellModel()
|
|
|
|
shell = Shell(model)
|
2006-07-12 13:20:41 +02:00
|
|
|
|
2006-08-17 18:02:29 +02:00
|
|
|
from sugar import TracebackUtils
|
|
|
|
tbh = TracebackUtils.TracebackHelper()
|
2006-07-12 13:20:41 +02:00
|
|
|
try:
|
|
|
|
gtk.main()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print 'Ctrl+C pressed, exiting...'
|
2006-08-17 18:02:29 +02:00
|
|
|
del tbh
|