def launch(bundle, activity_id=None, object_id=None, uri=None, color=None, invited=False, alert_window=None): bundle_id = bundle.get_bundle_id() if activity_id is None or not activity_id: activity_id = activityfactory.create_activity_id() logging.debug('launch bundle_id=%s activity_id=%s object_id=%s uri=%s', bundle.get_bundle_id(), activity_id, object_id, uri) if isinstance(bundle, ContentBundle): # Content bundles are a special case: we treat them as launching # Browse with a specific URI. uri = bundle.get_start_uri() activities = _get_activities_for_mime('text/html') if len(activities) == 0: logging.error("No browser available for content bundle") return bundle = activities[0] logging.debug('Launching content bundle with uri %s', uri) shell_model = shell.get_model() activity = shell_model.get_activity_by_id(activity_id) if activity is not None: logging.debug('re-launch %r', activity.get_window()) activity.get_window().activate(Gtk.get_current_event_time()) return if not shell_model.can_launch_activity(): if alert_window is None: from jarabe.desktop import homewindow alert_window = homewindow.get_instance() if alert_window is not None: alerts.show_max_open_activities_alert(alert_window) return if not shell_model.can_launch_activity_instance(bundle): if alert_window is None: from jarabe.desktop import homewindow alert_window = homewindow.get_instance() if alert_window is not None: alerts.show_multiple_instance_alert( alert_window, shell_model.get_name_from_bundle_id(bundle_id)) return if color is None: color = profile.get_color() launcher.add_launcher(activity_id, bundle.get_icon(), color) activity_handle = ActivityHandle(activity_id=activity_id, object_id=object_id, uri=uri, invited=invited) activityfactory.create(bundle, activity_handle)
def launch(bundle, activity_id=None, object_id=None, uri=None, color=None, invited=False, alert_window=None): bundle_id = bundle.get_bundle_id() if activity_id is None or not activity_id: activity_id = activityfactory.create_activity_id() logging.debug('launch bundle_id=%s activity_id=%s object_id=%s uri=%s', bundle.get_bundle_id(), activity_id, object_id, uri) if isinstance(bundle, ContentBundle): # Content bundles are a special case: we treat them as launching # Browse with a specific URI. uri = bundle.get_start_uri() activities = _get_activities_for_mime('text/html') if len(activities) == 0: logging.error("No browser available for content bundle") return bundle = activities[0] logging.debug('Launching content bundle with uri %s', uri) shell_model = shell.get_model() activity = shell_model.get_activity_by_id(activity_id) if activity is not None: logging.debug('re-launch %r', activity.get_window()) activity.get_window().activate(Gtk.get_current_event_time()) return if not shell_model.can_launch_activity(): if alert_window is None: from jarabe.desktop import homewindow alert_window = homewindow.get_instance() if alert_window is not None: alerts.show_max_open_activities_alert(alert_window) return if not shell_model.can_launch_activity_instance(bundle): if alert_window is None: from jarabe.desktop import homewindow alert_window = homewindow.get_instance() if alert_window is not None: alerts.show_multiple_instance_alert( alert_window, shell_model.get_name_from_bundle_id(bundle_id)) return if color is None: client = GConf.Client.get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) launcher.add_launcher(activity_id, bundle.get_icon(), color) activity_handle = ActivityHandle(activity_id=activity_id, object_id=object_id, uri=uri, invited=invited) activityfactory.create(bundle, activity_handle)
def _add_pathway_button_cb(self, widget, data=None): # get the instance of the home box home_window = homewindow.get_instance() self.home_box = home_window.get_home_box() logging.debug('GLYCOGEN: got home_box') # add the pathway view to it self.home_box._pathway_view = PathwayView() logging.debug('GLYCOGEN: made a PathwayView') # add the extra int to the homebox module to refer to the pathway view homebox._PATHWAY_VIEW = self.model._PATHWAY_VIEW # not a typo, I am adding it to the module # replace the default function with an overriden one self.home_box._set_view = types.MethodType(self.model.new_homebox_set_view, self.home_box) logging.debug('GLYCOGEN: replaced function _set_view()') # disable the 'add' button as it shouldn't be needed any more self.button_add_pathway_view.set_sensitive(False) # enable the 'show' button since it is meaningful now # self.button_show_pathway_view.set_sensitive(True) # add a toolbar icon for the pathway view logging.debug('GLYCOGEN: trying to add pathway button') self.add_pathway_button() logging.debug('GLYCOGEN: finished adding pathway button')
def _add_pathway_button_cb(self, widget, data=None): # get the instance of the home box home_window = homewindow.get_instance() self.home_box = home_window.get_home_box() logging.debug('GLYCOGEN: got home_box') # add the pathway view to it self.home_box._pathway_view = PathwayView() logging.debug('GLYCOGEN: made a PathwayView') # add the extra int to the homebox module to refer to the pathway view homebox._PATHWAY_VIEW = self.model._PATHWAY_VIEW # not a typo, I am adding it to the module # replace the default function with an overriden one self.home_box._set_view = types.MethodType( self.model.new_homebox_set_view, self.home_box) logging.debug('GLYCOGEN: replaced function _set_view()') # disable the 'add' button as it shouldn't be needed any more self.button_add_pathway_view.set_sensitive(False) # enable the 'show' button since it is meaningful now # self.button_show_pathway_view.set_sensitive(True) # add a toolbar icon for the pathway view logging.debug('GLYCOGEN: trying to add pathway button') self.add_pathway_button() logging.debug('GLYCOGEN: finished adding pathway button')
def _begin_desktop_startup(): global _starting_desktop _starting_desktop = True UIService() session_manager = get_session_manager() session_manager.start() # open homewindow before window_manager to let desktop appear fast home_window = homewindow.get_instance() home_window.show()
def show_software_updates_cb(): logging.debug('STARTUP: show_software_updates_cb') if os.path.isfile(os.path.expanduser('~/.sugar-update')): home_window = homewindow.get_instance() home_window.get_home_box().show_software_updates_alert()