It requires a small patch to main.py in the main Sugar directory (/usr/share/sugar/shell/main.py), and adding a file to the same directory.  It launches sugarbot by simulating a click on the sugarbot icon in the frame.
Will put the code up on SVN later, it's Pizza time now!
Important Code:
# ========================================================= 
# The magnitude of this hack compares favorably with the
# current national debt.
boxChildren = self.shell.get_frame()._bottom_panel._bg.get_children()
tray = [k for k in boxChildren if isinstance(k,ActivitiesTray)]
if tray:
  children = tray[0]._tray.get_children()
else:
  return
activities = [k for k in children if isinstance(k, ActivityButton)]
sbList = [k for k in activities if k._activity_info.name=="sugarbot"]
# ========================================================  
if len(sbList) > 0:   sbList[0].emit('clicked') 
main.py patch:
model = ShellModel()
shell = Shell(model)
service = ShellService(shell)
if os.environ.has_key("SUGARBOT_EMULATOR"):
  from sugarbotlauncher import SugarbotLauncher
  sbLauncher = SugarbotLauncher(model,shell,service)
try:
  gtk.main()
except KeyboardInterrupt:
  print 'Ctrl+C pressed, exiting...'
 

No comments:
Post a Comment