def _notify_visible_cb(self, embed, param): self._embed.disconnect(self._vis_sid) if self._embed.type == Browser.TYPE_POPUP or self._embed.is_chrome: logging.debug('Show the popup') self._embed.show() self._dialog.set_transient_for(self._parent_window) self._dialog.show() else: logging.debug('Open a new activity for the popup') self._dialog.remove(self._embed) self._dialog.destroy() self._dialog = None # FIXME We need a better way to handle this. # It seem like a pretty special case though, I doubt # other activities will need something similar. from webactivity import WebActivity from sugar.activity import activityfactory from sugar.activity.activityhandle import ActivityHandle handle = ActivityHandle(activityfactory.create_activity_id()) activity = WebActivity(handle, self._embed) activity.show() self.emit('popup-created')
def launch(bundle, activity_id=None, object_id=None, uri=None, color=None, invited=False): 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) 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 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 __realize_cb(self, window): wm.set_bundle_id(window.window, _BUNDLE_ID) activity_id = activityfactory.create_activity_id() wm.set_activity_id(window.window, str(activity_id)) self.disconnect(self._realized_sid) self._realized_sid = None
def _resume(self, journal_entry): if not journal_entry['activity_id']: journal_entry['activity_id'] = activityfactory.create_activity_id() misc.resume(journal_entry, self._activity_info.get_bundle_id())