def get_icon_name(metadata): file_name = None bundle_id = metadata.get('activity', '') if not bundle_id: bundle_id = metadata.get('bundle_id', '') if bundle_id: activity_info = bundleregistry.get_registry().get_bundle(bundle_id) if activity_info: file_name = activity_info.get_icon() if file_name is None and is_activity_bundle(metadata): file_path = model.get_file(metadata['uid']) if file_path is not None and os.path.exists(file_path): try: bundle = ActivityBundle(file_path) file_name = bundle.get_icon() except Exception: logging.exception('Could not read bundle') if file_name is None: file_name = _get_icon_for_mime(metadata.get('mime_type', '')) if file_name is None: file_name = get_icon_file_name('application-octet-stream') return file_name
def __init__(self, window_xid, bundle_path, document_path, title): gtk.Window.__init__(self) logging.debug('ViewSource paths: %r %r' % (bundle_path, document_path)) self.set_decorated(False) self.set_position(gtk.WIN_POS_CENTER_ALWAYS) self.set_border_width(style.LINE_WIDTH) width = gtk.gdk.screen_width() - style.GRID_CELL_SIZE * 2 height = gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 2 self.set_size_request(width, height) self._parent_window_xid = window_xid self.connect('realize', self.__realize_cb) self.connect('destroy', self.__destroy_cb, document_path) self.connect('key-press-event', self.__key_press_event_cb) vbox = gtk.VBox() self.add(vbox) vbox.show() toolbar = Toolbar(title, bundle_path, document_path) vbox.pack_start(toolbar, expand=False) toolbar.connect('stop-clicked', self.__stop_clicked_cb) toolbar.connect('source-selected', self.__source_selected_cb) toolbar.show() pane = gtk.HPaned() vbox.pack_start(pane) pane.show() self._selected_file = None file_name = '' activity_bundle = ActivityBundle(bundle_path) command = activity_bundle.get_command() if len(command.split(' ')) > 1: name = command.split(' ')[1].split('.')[0] file_name = name + '.py' path = os.path.join(activity_bundle.get_path(), file_name) self._selected_file = path self._file_viewer = FileViewer(bundle_path, file_name) self._file_viewer.connect('file-selected', self.__file_selected_cb) pane.add1(self._file_viewer) self._file_viewer.show() self._source_display = SourceDisplay() pane.add2(self._source_display) self._source_display.show() self._source_display.file_path = self._selected_file if document_path is not None: self._select_source(document_path) logging.debug('@@@@@ %s' % document_path)
def _load_bundle(object): logging.debug('have to load bundle to activity parameters') jobject = ds.get(object['uid']) bundle = ActivityBundle(jobject.get_file_path()) object['bundle_id'] = bundle.get_bundle_id() object['activity_version'] = bundle.get_activity_version() return bundle
def _create_activity_icon(metadata): if metadata.get('icon-color', ''): color = XoColor(metadata['icon-color']) else: color = profile.get_color() from sugar.activity.activity import get_bundle_path bundle = ActivityBundle(get_bundle_path()) icon = Icon(file=bundle.get_icon(), xo_color=color) return icon
def _create_activity_icon(metadata): if metadata.get('icon-color', ''): color = XoColor(metadata['icon-color']) else: color = XoColor() from sugar.activity.activity import get_bundle_path bundle = ActivityBundle(get_bundle_path()) icon = Icon(file=bundle.get_icon(), xo_color=color) return icon
def _create_activity_icon(metadata): if metadata is not None and metadata.get('icon-color'): color = XoColor(metadata['icon-color']) else: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) from sugar.activity.activity import get_bundle_path bundle = ActivityBundle(get_bundle_path()) icon = Icon(file=bundle.get_icon(), xo_color=color) return icon
def _create_activity_icon(metadata): if metadata.get('icon-color', ''): color = XoColor(metadata['icon-color']) else: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) from sugar.activity.activity import get_bundle_path bundle = ActivityBundle(get_bundle_path()) icon = Icon(file=bundle.get_icon(), xo_color=color) return icon
def _create_entry_icon(self): bundle_id = self._activity.metadata.get('activity', '') if not bundle_id: bundle_id = self._activity.metadata.get('bundle_id', '') if bundle_id == '': file_name = _get_icon_name(self._activity.metadata) else: activity_bundle = ActivityBundle(self._bundle_path) file_name = activity_bundle.get_icon() entry_icon = CanvasIcon(file_name=file_name) if self._activity.metadata.has_key('icon-color') and \ self._activity.metadata['icon-color']: entry_icon.props.xo_color = XoColor( \ self._activity.metadata['icon-color']) return entry_icon
def get_bundle(metadata): try: if is_activity_bundle(metadata): file_path = model.get_file(metadata['uid']) if not os.path.exists(file_path): logging.warning('Invalid path: %r', file_path) return None return ActivityBundle(file_path) elif is_content_bundle(metadata): file_path = model.get_file(metadata['uid']) if not os.path.exists(file_path): logging.warning('Invalid path: %r', file_path) return None return ContentBundle(file_path) elif is_journal_bundle(metadata): file_path = model.get_file(metadata['uid']) if not os.path.exists(file_path): logging.warning('Invalid path: %r', file_path) return None return JournalEntryBundle(file_path) else: return None except Exception: logging.exception('Incorrect bundle') return None
def __init__(self, title, bundle_path, document_path): gtk.Toolbar.__init__(self) self._add_separator() activity_bundle = ActivityBundle(bundle_path) file_name = activity_bundle.get_icon() if document_path is not None and os.path.exists(document_path): document_button = DocumentButton(file_name, document_path, title) document_button.connect('toggled', self.__button_toggled_cb, document_path) self.insert(document_button, -1) document_button.show() self._add_separator() if bundle_path is not None and os.path.exists(bundle_path): activity_button = RadioToolButton() icon = Icon(file=file_name, icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) activity_button.set_icon_widget(icon) icon.show() if document_path is not None: activity_button.props.group = document_button activity_button.props.tooltip = _('Activity Bundle Source') activity_button.connect('toggled', self.__button_toggled_cb, bundle_path) self.insert(activity_button, -1) activity_button.show() self._add_separator() text = _('View source: %r') % title label = gtk.Label() label.set_markup('<b>%s</b>' % text) label.set_alignment(0, 0.5) self._add_widget(label) self._add_separator(True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', self.__stop_clicked_cb) stop.show() self.insert(stop, -1) stop.show()
def install_activity(xofile, row, progress_function): """Install an downloaded activity""" # Show "Installing..." message progress_function(row, 150) # Install the .xo try: bundle = ActivityBundle(xofile) bundle.install() except: print 'fallo install' # Remove the .xo os.remove(xofile) # Show "Installed..." message progress_function(row, 200) _logger.info(_("Activity installed!"))
def _scan_directory(path): if not os.path.isdir(path): return for f in os.listdir(path): if not f.endswith('.activity'): continue try: bundle_dir = os.path.join(path, f) bundle = ActivityBundle(bundle_dir) _bundles[bundle.get_bundle_id()] = bundle for i in (bundle.get_mime_types() or []): _bundles_by_mime[i] = _bundles_by_mime.get(i, []) _bundles_by_mime[i].append(bundle) except Exception, e: logging.error('Error while processing installed activity ' \ 'bundle: %s, %s, %s' % (f, e.__class__, e))
def update(self): self.bundle = bundle = ActivityBundle(self.source_dir) self.version = bundle.get_activity_version() self.activity_name = bundle.get_bundle_name() self.bundle_id = bundle.get_bundle_id() self.bundle_name = reduce(operator.add, self.activity_name.split()) self.bundle_root_dir = self.bundle_name + '.activity' self.tar_root_dir = '%s-%s' % (self.bundle_name, self.version) if self.dist_name: self.xo_name = self.tar_name = self.dist_name else: self.xo_name = '%s-%s.xo' % (self.bundle_name, self.version) self.tar_name = '%s-%s.tar.bz2' % (self.bundle_name, self.version)
def _main(): """Launch this activity from the command line.""" from sugar.activity import activityfactory from sugar.activity.registry import ActivityInfo from sugar.bundle.activitybundle import ActivityBundle import os ab = ActivityBundle(os.path.dirname(__file__) or '.') ai = ActivityInfo(name=ab.get_name(), icon=None, bundle_id=ab.get_bundle_id(), version=ab.get_activity_version(), path=ab.get_path(), show_launcher=ab.get_show_launcher(), command=ab.get_command(), favorite=True, installation_time=ab.get_installation_time(), position_x=0, position_y=0) env = activityfactory.get_environment(ai) cmd_args = activityfactory.get_command(ai) os.execvpe(cmd_args[0], cmd_args, env)
def _add_bundle(self, bundle_path, install_mime_type=False): logging.debug('STARTUP: Adding bundle %r', bundle_path) try: bundle = ActivityBundle(bundle_path) if install_mime_type: bundle.install_mime_type(bundle_path) except MalformedBundleException: logging.exception('Error loading bundle %r', bundle_path) return None bundle_id = bundle.get_bundle_id() installed = self.get_bundle(bundle_id) if installed is not None: if NormalizedVersion(installed.get_activity_version()) >= \ NormalizedVersion(bundle.get_activity_version()): logging.debug('Skip old version for %s', bundle_id) return None else: logging.debug('Upgrade %s', bundle_id) self.remove_bundle(installed.get_path()) self._bundles.append(bundle) return bundle
""" if this were to work properly we should set go equal to object Macro go_cmd = 'run -d -b %s %s'%(os.path.join(db.pydebug_path,'bin','start_debug.py'),child_path) _logger.debug('defining go: %s'%go_cmd) ip.user_ns['go'] = go_cmd """ _logger.debug('pydebug home: %s'%db.debugger_home) os.environ['PYDEBUG_HOME'] = pydebug_home os.chdir(child_path) os.environ['SUGAR_BUNDLE_PATH'] = child_path _logger.debug('sugar_bundle_path set to %s'%child_path) #set up python module search path sys.path.insert(0,child_path) bundle_info = ActivityBundle(child_path) bundle_id = bundle_info.get_bundle_id() #following two statements eliminate differences between sugar 0.82 and 0.84 bundle_info.path = child_path bundle_info.bundle_id = bundle_id bundle_name = bundle_info.get_name() os.environ['SUGAR_BUNDLE_NAME'] = bundle_name os.environ['SUGAR_BUNDLE_ID'] = bundle_id if version and version >= 0.839: #do 0.84 stuff cmd_args = activityfactory.get_command(bundle_info) else: from sugar.activity.registry import get_registry
def resume(metadata, bundle_id=None): registry = bundleregistry.get_registry() if is_activity_bundle(metadata) and bundle_id is None: logging.debug('Creating activity bundle') file_path = model.get_file(metadata['uid']) bundle = ActivityBundle(file_path) if not registry.is_installed(bundle): logging.debug('Installing activity bundle') try: registry.install(bundle) except AlreadyInstalledException: _downgrade_option_alert(bundle) return else: logging.debug('Upgrading activity bundle') registry.upgrade(bundle) _launch_bundle(bundle) elif is_content_bundle(metadata) and bundle_id is None: logging.debug('Creating content bundle') file_path = model.get_file(metadata['uid']) bundle = ContentBundle(file_path) if not bundle.is_installed(): logging.debug('Installing content bundle') bundle.install() activities = _get_activities_for_mime('text/html') if len(activities) == 0: logging.warning('No activity can open HTML content bundles') return uri = bundle.get_start_uri() logging.debug('activityfactory.creating with uri %s', uri) activity_bundle = registry.get_bundle(activities[0].get_bundle_id()) launch(activity_bundle, uri=uri) else: activity_id = metadata.get('activity_id', '') if bundle_id is None: activities = get_activities(metadata) if not activities: logging.warning('No activity can open this object, %s.', metadata.get('mime_type', None)) return bundle_id = activities[0].get_bundle_id() bundle = registry.get_bundle(bundle_id) if metadata.get('mountpoint', '/') == '/': object_id = metadata['uid'] else: object_id = model.copy(metadata, '/') launch(bundle, activity_id=activity_id, object_id=object_id, color=get_icon_color(metadata))
def main(): parser = OptionParser() parser.add_option("-b", "--bundle-id", dest="bundle_id", help="identifier of the activity bundle") parser.add_option("-a", "--activity-id", dest="activity_id", help="identifier of the activity instance") parser.add_option("-o", "--object-id", dest="object_id", help="identifier of the associated datastore object") parser.add_option("-u", "--uri", dest="uri", help="URI to load") parser.add_option('-s', '--single-process', dest='single_process', action='store_true', help='start all the instances in the same process') (options, args) = parser.parse_args() logger.start() if 'SUGAR_BUNDLE_PATH' not in os.environ: print 'SUGAR_BUNDLE_PATH is not defined in the environment.' sys.exit(1) if len(args) == 0: print 'A python class must be specified as first argument.' sys.exit(1) bundle_path = os.environ['SUGAR_BUNDLE_PATH'] sys.path.append(bundle_path) bundle = ActivityBundle(bundle_path) os.environ['SUGAR_BUNDLE_ID'] = bundle.get_bundle_id() os.environ['SUGAR_BUNDLE_NAME'] = bundle.get_name() os.environ['SUGAR_BUNDLE_VERSION'] = str(bundle.get_activity_version()) gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path()) # This code can be removed when we grow an xsettings daemon (the GTK+ # init routines will then automatically figure out the font settings) settings = gtk.settings_get_default() settings.set_property('gtk-font-name', '%s %f' % (style.FONT_FACE, style.FONT_SIZE)) locale_path = None if 'SUGAR_LOCALEDIR' in os.environ: locale_path = os.environ['SUGAR_LOCALEDIR'] gettext.bindtextdomain(bundle.get_bundle_id(), locale_path) gettext.bindtextdomain('sugar-toolkit', sugar.locale_path) gettext.textdomain(bundle.get_bundle_id()) splitted_module = args[0].rsplit('.', 1) module_name = splitted_module[0] class_name = splitted_module[1] module = __import__(module_name) for comp in module_name.split('.')[1:]: module = getattr(module, comp) activity_constructor = getattr(module, class_name) activity_handle = activityhandle.ActivityHandle( activity_id=options.activity_id, object_id=options.object_id, uri=options.uri) if options.single_process is True: sessionbus = dbus.SessionBus() service_name = get_single_process_name(options.bundle_id) service_path = get_single_process_path(options.bundle_id) bus_object = sessionbus.get_object( 'org.freedesktop.DBus', '/org/freedesktop/DBus') try: name = bus_object.GetNameOwner( service_name, dbus_interface='org.freedesktop.DBus') except dbus.DBusException: name = None if not name: SingleProcess(service_name, activity_constructor) else: single_process = sessionbus.get_object(service_name, service_path) single_process.create(activity_handle.get_dict()) print 'Created %s in a single process.' % service_name sys.exit(0) if hasattr(module, 'start'): module.start() create_activity_instance(activity_constructor, activity_handle) #let the IPython PyInputhook call gtk #gtk.main() from IPython.lib.inputhook import InputHookManager ihm = InputHookManager() ihm.enable_gtk()
name = bus_object.GetNameOwner(service_name, dbus_interface='org.freedesktop.DBus') except dbus.DBusException: name = None if not name: service = SingleProcess(service_name, constructor) else: single_process = bus.get_object(service_name, service_path) single_process.create(handle.get_dict()) print 'Created %s in a single process.' % service_name sys.exit(0) if hasattr(module, 'start'): module.start() bundle = ActivityBundle(bundle_path) os.environ['SUGAR_BUNDLE_ID'] = bundle.get_bundle_id() os.environ['SUGAR_BUNDLE_NAME'] = bundle.get_name() gettext.bindtextdomain(bundle.get_bundle_id(), bundle.get_locale_path()) gettext.textdomain(bundle.get_bundle_id()) gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path()) create_activity_instance(constructor, handle) gtk.main()
def __init__(self, window_xid, bundle_path, document_path, sugar_toolkit_path, title): gtk.Window.__init__(self) _logger.debug('ViewSource paths: %r %r %r', bundle_path, document_path, sugar_toolkit_path) self.set_decorated(False) self.set_position(gtk.WIN_POS_CENTER_ALWAYS) self.set_border_width(style.LINE_WIDTH) width = gtk.gdk.screen_width() - style.GRID_CELL_SIZE * 2 height = gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 2 self.set_size_request(width, height) self._parent_window_xid = window_xid self._sugar_toolkit_path = sugar_toolkit_path self.connect('realize', self.__realize_cb) self.connect('destroy', self.__destroy_cb, document_path) self.connect('key-press-event', self.__key_press_event_cb) vbox = gtk.VBox() self.add(vbox) vbox.show() toolbar = Toolbar(title, bundle_path, document_path, sugar_toolkit_path) vbox.pack_start(toolbar, expand=False) toolbar.connect('stop-clicked', self.__stop_clicked_cb) toolbar.connect('source-selected', self.__source_selected_cb) toolbar.show() pane = gtk.HPaned() vbox.pack_start(pane) pane.show() self._selected_bundle_file = None self._selected_sugar_file = None file_name = '' activity_bundle = ActivityBundle(bundle_path) command = activity_bundle.get_command() if len(command.split(' ')) > 1: name = command.split(' ')[1].split('.')[-1] tmppath = command.split(' ')[1].replace('.', '/') file_name = tmppath[0:-(len(name) + 1)] + '.py' path = os.path.join(activity_bundle.get_path(), file_name) self._selected_bundle_file = path # Split the tree pane into two vertical panes, one of which # will be hidden tree_panes = gtk.VPaned() tree_panes.show() self._bundle_source_viewer = FileViewer(bundle_path, file_name) self._bundle_source_viewer.connect('file-selected', self.__file_selected_cb) tree_panes.add1(self._bundle_source_viewer) self._bundle_source_viewer.show() file_name = 'env.py' self._selected_sugar_file = os.path.join(sugar_toolkit_path, file_name) self._sugar_source_viewer = FileViewer(sugar_toolkit_path, file_name) self._sugar_source_viewer.connect('file-selected', self.__file_selected_cb) tree_panes.add2(self._sugar_source_viewer) self._sugar_source_viewer.hide() pane.add1(tree_panes) self._source_display = SourceDisplay() pane.add2(self._source_display) self._source_display.show() self._source_display.file_path = self._selected_bundle_file if document_path is not None: self._select_source(document_path)
def main(): parser = OptionParser() parser.add_option("-b", "--bundle-id", dest="bundle_id", help="identifier of the activity bundle") parser.add_option("-a", "--activity-id", dest="activity_id", help="identifier of the activity instance") parser.add_option("-o", "--object-id", dest="object_id", help="identifier of the associated datastore object") parser.add_option("-u", "--uri", dest="uri", help="URI to load") parser.add_option('-s', '--single-process', dest='single_process', action='store_true', help='start all the instances in the same process') (options, args) = parser.parse_args() logger.start() if 'SUGAR_BUNDLE_PATH' not in os.environ: print 'SUGAR_BUNDLE_PATH is not defined in the environment.' sys.exit(1) if len(args) == 0: print 'A python class must be specified as first argument.' sys.exit(1) bundle_path = os.environ['SUGAR_BUNDLE_PATH'] sys.path.append(bundle_path) bundle = ActivityBundle(bundle_path) os.environ['SUGAR_BUNDLE_ID'] = bundle.get_bundle_id() os.environ['SUGAR_BUNDLE_NAME'] = bundle.get_name() os.environ['SUGAR_BUNDLE_VERSION'] = str(bundle.get_activity_version()) gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path()) # This code can be removed when we grow an xsettings daemon (the GTK+ # init routines will then automatically figure out the font settings) settings = gtk.settings_get_default() settings.set_property('gtk-font-name', '%s %f' % (style.FONT_FACE, style.FONT_SIZE)) locale_path = None if 'SUGAR_LOCALEDIR' in os.environ: locale_path = os.environ['SUGAR_LOCALEDIR'] gettext.bindtextdomain(bundle.get_bundle_id(), locale_path) gettext.bindtextdomain('sugar-toolkit', sugar.locale_path) gettext.textdomain(bundle.get_bundle_id()) splitted_module = args[0].rsplit('.', 1) module_name = splitted_module[0] class_name = splitted_module[1] module = __import__(module_name) for comp in module_name.split('.')[1:]: module = getattr(module, comp) activity_constructor = getattr(module, class_name) activity_handle = activityhandle.ActivityHandle( activity_id=options.activity_id, object_id=options.object_id, uri=options.uri) if options.single_process is True: sessionbus = dbus.SessionBus() service_name = get_single_process_name(options.bundle_id) service_path = get_single_process_path(options.bundle_id) bus_object = sessionbus.get_object( 'org.freedesktop.DBus', '/org/freedesktop/DBus') try: name = bus_object.GetNameOwner( service_name, dbus_interface='org.freedesktop.DBus') except dbus.DBusException: name = None if not name: SingleProcess(service_name, activity_constructor) else: single_process = sessionbus.get_object(service_name, service_path) single_process.create(activity_handle.get_dict()) print 'Created %s in a single process.' % service_name sys.exit(0) if hasattr(module, 'start'): module.start() create_activity_instance(activity_constructor, activity_handle) gtk.main()
def __init__(self, title, bundle_path, document_path, sugar_toolkit_path): gtk.Toolbar.__init__(self) document_button = None self.bundle_path = bundle_path self.sugar_toolkit_path = sugar_toolkit_path self._add_separator() activity_bundle = ActivityBundle(bundle_path) file_name = activity_bundle.get_icon() if document_path is not None and os.path.exists(document_path): document_button = DocumentButton(file_name, document_path, title) document_button.connect('toggled', self.__button_toggled_cb, document_path) self.insert(document_button, -1) document_button.show() self._add_separator() if bundle_path is not None and os.path.exists(bundle_path): activity_button = DocumentButton(file_name, bundle_path, title, bundle=True) icon = Icon(file=file_name, icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) activity_button.set_icon_widget(icon) icon.show() if document_button is not None: activity_button.props.group = document_button activity_button.props.tooltip = _('Activity Bundle Source') activity_button.connect('toggled', self.__button_toggled_cb, bundle_path) self.insert(activity_button, -1) activity_button.show() self._add_separator() if sugar_toolkit_path is not None: sugar_button = RadioToolButton() icon = Icon(icon_name='computer-xo', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) sugar_button.set_icon_widget(icon) icon.show() if document_button is not None: sugar_button.props.group = document_button else: sugar_button.props.group = activity_button sugar_button.props.tooltip = _('Sugar Toolkit Source') sugar_button.connect('toggled', self.__button_toggled_cb, sugar_toolkit_path) self.insert(sugar_button, -1) sugar_button.show() self._add_separator() self.activity_title_text = _('View source: %s') % title self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit' self.label = gtk.Label() self.label.set_markup('<b>%s</b>' % self.activity_title_text) self.label.set_alignment(0, 0.5) self._add_widget(self.label) self._add_separator(True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', self.__stop_clicked_cb) self.insert(stop, -1) stop.show()
print('child path starting activity: %s' % child_path) go_cmd = 'run -d -b %s %s' % (os.path.join(db.pydebug_path, 'bin', 'start_debug.py'), child_path) _logger.debug('defining go: %s' % go_cmd) ip.user_ns['go'] = go_cmd _logger.debug('pydebug home: %s' % db.debugger_home) path = child_path pydebug_home = db.debugger_home os.environ['PYDEBUG_HOME'] = pydebug_home os.chdir(path) os.environ['SUGAR_BUNDLE_PATH'] = path _logger.debug('sugar_bundle_path set to %s' % path) #set up module search path sys.path.insert(0, path) activity = ActivityBundle(path) cmd_args = activityfactory.get_command(activity) _logger.debug('command args:%r' % cmd_args) bundle_name = activity.get_name() bundle_id = activity.get_bundle_id() #need to get activity root, but activity bases off of HOME which some applications need to change #following will not work if storage system changes with new OS #required because debugger needs to be able to change home so that foreign apps will work activity_root = os.path.join('/home/olpc/.sugar/default/', bundle_id) os.environ['SUGAR_ACTIVITY_ROOT'] = activity_root _logger.debug('sugar_activity_root set to %s' % activity_root) #following is useful for its side-effects info = activityfactory.get_environment(activity)