Beispiel #1
0
 def _add_row(self, sender, message, icon_name, icon_color):
     self._store.append((get_icon_file_name(icon_name),
                         XoColor(icon_color),
                         sender,
                         message,
                         get_icon_file_name('list-remove'),
                         XoColor('#FFFFFF,#000000')))
Beispiel #2
0
 def _add_row(self, sender, message, icon_name, icon_color):
     self._store.append((get_icon_file_name(icon_name),
                         XoColor(icon_color),
                         sender,
                         message,
                         get_icon_file_name('list-remove'),
                         XoColor('#FFFFFF,#000000')))
Beispiel #3
0
def _get_icon_for_mime(mime_type):
    generic_types = mime.get_all_generic_types()
    for generic_type in generic_types:
        if mime_type in generic_type.mime_types:
            file_name = get_icon_file_name(generic_type.icon)
            if file_name is not None:
                return file_name

    icons = Gio.content_type_get_icon(mime_type)
    logging.debug('icons for this file: %r', icons.props.names)
    for icon_name in icons.props.names:
        file_name = get_icon_file_name(icon_name)
        if file_name is not None:
            return file_name
Beispiel #4
0
def _get_icon_for_mime(mime_type):
    generic_types = mime.get_all_generic_types()
    for generic_type in generic_types:
        if mime_type in generic_type.mime_types:
            file_name = get_icon_file_name(generic_type.icon)
            if file_name is not None:
                return file_name

    icons = Gio.content_type_get_icon(mime_type)
    logging.debug('icons for this file: %r', icons.props.names)
    for icon_name in icons.props.names:
        file_name = get_icon_file_name(icon_name)
        if file_name is not None:
            return file_name
Beispiel #5
0
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
Beispiel #6
0
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
Beispiel #7
0
    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        self._ds_object = datastore.create()

        file_transfer.connect('notify::state', self.__notify_state_cb)
        file_transfer.connect('notify::transferred-bytes',
                              self.__notify_transferred_bytes_cb)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-from-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        icon_color = file_transfer.buddy.props.color
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon,
                               Gtk.CornerType.TOP_LEFT)
Beispiel #8
0
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 = get_bundle_instance(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
Beispiel #9
0
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:
        if bundle_id == PROJECT_BUNDLE_ID:
            file_name = \
                '/home/broot/sugar-build/build' + \
                '/out/install/share/icons/sugar/' + \
                'scalable/mimetypes/project-box.svg'
            return file_name

        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 = get_bundle_instance(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
Beispiel #10
0
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:
        if bundle_id == PROJECT_BUNDLE_ID:
            file_name = \
                '/home/broot/sugar-build/build' + \
                '/out/install/share/icons/sugar/' + \
                'scalable/mimetypes/project-box.svg'
            return file_name

        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 = get_bundle_instance(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
Beispiel #11
0
 def _load_mode(self, mode):
     if mode == _MODE_HELP:
         self._webview.load_uri(self._help_url)
     else:
         # Loading any content for the social help page can take a
         # very long time (eg. the site is behind a redirector).
         # Loading the animation forces webkit to re-render the
         # page instead of keeping the previous page (so the user
         # sees that it is loading)
         path = get_icon_file_name(_LOADING_ICON)
         if path:
             self._webview.load_uri('file://' + path)
             # Social help is loaded after the icon is loaded
         else:
             self._webview.load_uri(self._social_help_url)
Beispiel #12
0
 def _load_mode(self, mode):
     if mode == _MODE_HELP:
         self._webview.load_uri(self._help_url)
     else:
         # Loading any content for the social help page can take a
         # very long time (eg. the site is behind a redirector).
         # Loading the animation forces webkit to re-render the
         # page instead of keeping the previous page (so the user
         # sees that it is loading)
         path = get_icon_file_name(_LOADING_ICON)
         if path:
             self._webview.load_uri('file://' + path)
             # Social help is loaded after the icon is loaded
         else:
             self._webview.load_uri(self._social_help_url)
Beispiel #13
0
    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-to-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        icon_color = profile.get_color()
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon, Gtk.CornerType.TOP_LEFT)
    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append("application-octet-stream")
        for icon_name in icons:
            icon_name = "transfer-to-%s" % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        icon_color = profile.get_color()
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon, Gtk.CornerType.TOP_LEFT)
Beispiel #15
0
    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-to-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        client = GConf.Client.get_default()
        icon_color = XoColor(client.get_string('/desktop/sugar/user/color'))
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon, Gtk.CornerType.TOP_LEFT)
Beispiel #16
0
    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-to-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        client = GConf.Client.get_default()
        icon_color = XoColor(client.get_string('/desktop/sugar/user/color'))
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon,
                               Gtk.CornerType.TOP_LEFT)