make sugar shell easier to profile startup times
This commit is contained in:
parent
655d7f4174
commit
b24a28a77d
@ -69,17 +69,6 @@ def _setup_translations():
|
|||||||
gettext.bindtextdomain(domain, env.get_locale_path())
|
gettext.bindtextdomain(domain, env.get_locale_path())
|
||||||
gettext.textdomain(domain)
|
gettext.textdomain(domain)
|
||||||
|
|
||||||
_save_session_info()
|
|
||||||
_start_matchbox()
|
|
||||||
_setup_translations()
|
|
||||||
|
|
||||||
# Do initial setup if needed
|
|
||||||
if not profile.is_valid():
|
|
||||||
win = intro.IntroWindow()
|
|
||||||
win.show_all()
|
|
||||||
gtk.main()
|
|
||||||
profile.update()
|
|
||||||
|
|
||||||
def check_gabble(bus_name):
|
def check_gabble(bus_name):
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus
|
||||||
@ -92,34 +81,55 @@ def check_gabble(bus_name):
|
|||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if os.environ.has_key("TP_DEBUG"):
|
def main()
|
||||||
# Allow the user time to start up telepathy connection managers
|
_save_session_info()
|
||||||
# using the Sugar DBus bus address
|
_start_matchbox()
|
||||||
import time
|
_setup_translations()
|
||||||
from telepathy.client import ManagerRegistry
|
|
||||||
|
|
||||||
registry = ManagerRegistry()
|
# Do initial setup if needed
|
||||||
registry.LoadManagers()
|
if not profile.is_valid():
|
||||||
try:
|
win = intro.IntroWindow()
|
||||||
gabble = registry.services["gabble"]
|
win.show_all()
|
||||||
except KeyError:
|
gtk.main()
|
||||||
raise RuntimeError("Gabble connection manager not found!")
|
profile.update()
|
||||||
|
|
||||||
while not check_gabble(gabble['busname']):
|
if os.environ.has_key("TP_DEBUG"):
|
||||||
print "Waiting for gabble on: DBUS_SESSION_BUS_ADDRESS=%s" % os.environ["DBUS_SESSION_BUS_ADDRESS"]
|
# Allow the user time to start up telepathy connection managers
|
||||||
|
# using the Sugar DBus bus address
|
||||||
|
import time
|
||||||
|
from telepathy.client import ManagerRegistry
|
||||||
|
|
||||||
|
registry = ManagerRegistry()
|
||||||
|
registry.LoadManagers()
|
||||||
try:
|
try:
|
||||||
time.sleep(5)
|
gabble = registry.services["gabble"]
|
||||||
except KeyboardInterrupt:
|
except KeyError:
|
||||||
print "Got Ctrl+C, continuing..."
|
raise RuntimeError("Gabble connection manager not found!")
|
||||||
break
|
|
||||||
|
|
||||||
model = ShellModel()
|
while not check_gabble(gabble['busname']):
|
||||||
shell = Shell(model)
|
print "Waiting for gabble on: DBUS_SESSION_BUS_ADDRESS=%s" % os.environ["DBUS_SESSION_BUS_ADDRESS"]
|
||||||
service = ShellService(shell)
|
try:
|
||||||
|
time.sleep(5)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print "Got Ctrl+C, continuing..."
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
model = ShellModel()
|
||||||
gtk.main()
|
shell = Shell(model)
|
||||||
except KeyboardInterrupt:
|
service = ShellService(shell)
|
||||||
print 'Ctrl+C pressed, exiting...'
|
|
||||||
|
|
||||||
os.remove(dsba_file)
|
if name == '__main__':
|
||||||
|
# running the gtk.main outside of the main() function allows us to
|
||||||
|
# profile startup times. To profile startup times replace the following
|
||||||
|
# call to main with:
|
||||||
|
# import cProfile
|
||||||
|
# cProfile.run('main()', '/home/olpc/sugar-startup.stats')
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
try:
|
||||||
|
gtk.main()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print 'Ctrl+C pressed, exiting...'
|
||||||
|
|
||||||
|
os.remove(dsba_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user