Example #1
0
    def _fake_info(self, info, typ, name):
        new_data = {
            'fake':
            True,
            'tab_type':
            typ,
            'id':
            u'%s-%s' % (info.id, typ),
            'name':
            name,
            'device_name':
            info.name,
            'icon':
            imagepool.get_surface(
                resources.path('images/icon-device-%s.png' % typ)),
            'active_icon':
            imagepool.get_surface(
                resources.path('images/icon-device-%s_active.png' % typ))
        }

        # hack to create a DeviceInfo without dealing with __init__
        di = messages.DeviceInfo.__new__(messages.DeviceInfo)
        di.__dict__ = info.__dict__.copy()
        di.__dict__.update(new_data)
        return di
Example #2
0
class GuideSidebarExpander(widgetset.CustomButton):
    SIDEBAR_BG = imagepool.get_surface(
        resources.path('images/guide-sidebar.png'))
    SIDEBAR_ARROW_OPEN = imagepool.get_surface(
        resources.path('images/guide-sidebar-arrow-open.png'))
    SIDEBAR_ARROW_CLOSE = imagepool.get_surface(
        resources.path('images/guide-sidebar-arrow-close.png'))

    def __init__(self):
        widgetset.CustomButton.__init__(self)
        self.expanded = True

    def size_request(self, layout):
        return 8, -1

    def set_expanded(self, value):
        if value != self.expanded:
            self.expanded = value
            self.queue_redraw()

    def draw(self, context, layout):
        self.SIDEBAR_BG.draw(context, 0, 0, 8, context.height)
        if self.expanded:
            image = self.SIDEBAR_ARROW_CLOSE
        else:
            image = self.SIDEBAR_ARROW_OPEN
        vpos = int((context.height - image.height) / 2)
        hpos = int((8 - image.width) / 2)
        image.draw(context, hpos, vpos, image.width, image.height)
Example #3
0
    def _set_from_info(self, guide_info):
        if guide_info is None:
            return

        # XXX This code is a bit ugly, because we want to use pretty defaults for
        # the Miro Guide, but still allow themes to override

        if guide_info.default and guide_info.url in _guide_url_to_title_map:
            self.name = _guide_url_to_title_map[guide_info.url]
        else:
            self.name = guide_info.name

        if guide_info.default and guide_info.url in _guide_url_to_icon_map:
            # one of our default guides
            icon_name = _guide_url_to_icon_map[guide_info.url]
            if icon_name != self.icon_name:
                self.icon_name = _guide_url_to_icon_map[guide_info.url]
                self.icon = widgetutil.make_surface(self.icon_name)
                del self.active_icon
        elif guide_info.faviconIsDefault:
            # theme guide that should use default favicon
            pass
        else:
            # theme guide with a favicon
            surface = imagepool.get_surface(guide_info.favicon)
            if surface.width != 23 or surface.height != 23:
                self.icon = imagepool.get_surface(guide_info.favicon,
                                                  size=(23, 23))
            else:
                self.icon = surface
            del self.active_icon
Example #4
0
 def init_info(self, info):
     if info is self.info:
         return
     fallback, fallback_active = self.default_icon_path()
     if info.favicon:
         thumb_path = info.favicon
     else:
         thumb_path = fallback
     # we don't use the ImagePool because 'favicon.ico' is a name with too
     # many hits (#16573).
     try:
         image = widgetset.Image(thumb_path)
         if image.width > 16 or image.height > 16:
             image = imagepool.resize_image(image, 16, 16)
         info.icon = widgetset.ImageSurface(image)
         if not info.favicon:
             info.active_icon = imagepool.get_surface(fallback_active,
                                                      size=(16, 16))
     except ValueError:
         # 16842 - if we ever get sent an invalid icon - don't crash with
         # ValueError.
         info.icon = imagepool.get_surface(fallback, size=(16, 16))
         info.active_icon = imagepool.get_surface(fallback_active,
                                                  size=(16, 16))
     info.unwatched = info.available = 0
     info.type = self.type
Example #5
0
 def init_info(self, info):
     if info is self.info:
         return
     fallback, fallback_active = self.default_icon_path()
     if info.favicon:
         thumb_path = info.favicon
     else:
         thumb_path = fallback
     # we don't use the ImagePool because 'favicon.ico' is a name with too
     # many hits (#16573).
     try:
         image = widgetset.Image(thumb_path)
         if image.width > 16 or image.height > 16:
             image = imagepool.resize_image(image, 16, 16)
         info.icon = widgetset.ImageSurface(image)
         if not info.favicon:
             info.active_icon = imagepool.get_surface(fallback_active,
                                                      size=(16, 16))
     except ValueError:
         # 16842 - if we ever get sent an invalid icon - don't crash with
         # ValueError.
         info.icon = imagepool.get_surface(fallback, size=(16, 16))
         info.active_icon = imagepool.get_surface(fallback_active,
                                                  size=(16, 16))
     info.unwatched = info.available = 0
     info.type = self.type
Example #6
0
 def init_info(self, info):
     info.type = u'sharing'
     info.unwatched = info.available = 0
     active = None
     if info.is_folder and info.playlist_id is None:
         thumb_path = resources.path('images/sharing.png')
     # Checking the name instead of a supposedly unique id is ok for now
     # because
     elif info.playlist_id == u'video':
         thumb_path = resources.path('images/icon-video.png')
         active = resources.path('images/icon-video_active.png')
         info.name = _('Video')
     elif info.playlist_id == u'audio':
         thumb_path = resources.path('images/icon-audio.png')
         active = resources.path('images/icon-audio_active.png')
         info.name = _('Music')
     elif info.playlist_id == u'playlist':
         thumb_path = resources.path('images/icon-playlist.png')
         active = resources.path('images/icon-playlist_active.png')
         info.name = _('Playlists')
     elif info.playlist_id == u'podcast':
         thumb_path = resources.path('images/icon-podcast.png')
         active = resources.path('images/icon-podcast_active.png')
         info.name = _('Podcasts')
     else:
         if info.podcast:
             thumb_path = resources.path('images/icon-podcast-small.png')
             active = resources.path('images/icon-podcast-small_active.png')
         else:
             thumb_path = resources.path('images/icon-playlist-small.png')
             active = resources.path('images/icon-playlist-small_active.png')
     info.icon = imagepool.get_surface(thumb_path)
     if active:
         info.active_icon = imagepool.get_surface(active)
Example #7
0
 def init_info(self, info):
     info.type = u'sharing'
     info.unwatched = info.available = 0
     active = None
     if info.is_folder and info.playlist_id is None:
         thumb_path = resources.path('images/sharing.png')
     # Checking the name instead of a supposedly unique id is ok for now
     # because
     elif info.playlist_id == u'video':
         thumb_path = resources.path('images/icon-video.png')
         active = resources.path('images/icon-video_active.png')
         info.name = _('Video')
     elif info.playlist_id == u'audio':
         thumb_path = resources.path('images/icon-audio.png')
         active = resources.path('images/icon-audio_active.png')
         info.name = _('Music')
     elif info.playlist_id == u'playlist':
         thumb_path = resources.path('images/icon-playlist.png')
         active = resources.path('images/icon-playlist_active.png')
         info.name = _('Playlists')
     elif info.playlist_id == u'podcast':
         thumb_path = resources.path('images/icon-podcast.png')
         active = resources.path('images/icon-podcast_active.png')
         info.name = _('Podcasts')
     else:
         if info.podcast:
             thumb_path = resources.path('images/icon-podcast-small.png')
             active = resources.path('images/icon-podcast-small_active.png')
         else:
             thumb_path = resources.path('images/icon-playlist-small.png')
             active = resources.path('images/icon-playlist-small_active.png')
     info.icon = imagepool.get_surface(thumb_path)
     if active:
         info.active_icon = imagepool.get_surface(active)
Example #8
0
    def _set_from_info(self, guide_info):
        if guide_info is None:
            return

        # XXX This code is a bit ugly, because we want to use pretty defaults for
        # the Miro Guide, but still allow themes to override

        if guide_info.default and guide_info.url in _guide_url_to_title_map:
            self.name = _guide_url_to_title_map[guide_info.url]
        else:
            self.name = guide_info.name

        if guide_info.default and guide_info.url in _guide_url_to_icon_map:
            # one of our default guides
            self.icon_name = _guide_url_to_icon_map[guide_info.url]
            self.icon = widgetutil.make_surface(self.icon_name)
        elif guide_info.faviconIsDefault:
            # theme guide that should use default favicon
            self.icon = widgetutil.make_surface(self.icon_name)
        else:
            # theme guide with a favicon
            surface = imagepool.get_surface(guide_info.favicon)
            if surface.width != 23 or surface.height != 23:
                self.icon = imagepool.get_surface(guide_info.favicon,
                                                  size=(23, 23))
            else:
                self.icon = surface
Example #9
0
 def __init__(self):
     widgetset.DrawingArea.__init__(self)
     self.video_icon = imagepool.get_surface(resources.path('images/mini-icon-video.png'))
     self.audio_icon = imagepool.get_surface(resources.path('images/mini-icon-audio.png'))
     self.reset()
     app.playback_manager.connect('selecting-file', self.handle_selecting)
     app.playback_manager.connect('will-play', self.handle_play)
     app.playback_manager.connect('will-stop', self.handle_stop)
Example #10
0
File: style.py Project: codito/miro
 def __init__(self):
     ListViewRenderer.__init__(self)
     self.button = {}
     for button in self.BUTTONS:
         path = resources.path('images/%s-button.png' % button)
         self.button[button] = imagepool.get_surface(path)
     path = resources.path('images/download-arrow.png')
     self.download_icon = imagepool.get_surface(path)
Example #11
0
 def __init__(self):
     ListViewRenderer.__init__(self)
     self.button = {}
     for button in self.BUTTONS:
         path = resources.path('images/%s-button.png' % button)
         self.button[button] = imagepool.get_surface(path)
     path = resources.path('images/download-arrow.png')
     self.download_icon = imagepool.get_surface(path)
Example #12
0
 def __init__(self):
     widgetset.DragableCustomButton.__init__(self)
     self.value = False
     self.background = imagepool.get_surface(
         resources.path('images/connect-toggle-bg.png'))
     self.on = imagepool.get_surface(
         resources.path('images/connect-toggle-on.png'))
     self.off = imagepool.get_surface(
         resources.path('images/connect-toggle-off.png'))
Example #13
0
 def __init__(self):
     widgetset.DragableCustomButton.__init__(self)
     self.value = False
     self.background = imagepool.get_surface(
         resources.path('images/connect-toggle-bg.png'))
     self.on = imagepool.get_surface(
         resources.path('images/connect-toggle-on.png'))
     self.off = imagepool.get_surface(
         resources.path('images/connect-toggle-off.png'))
Example #14
0
 def init_playlist_info(self, info):
     info.type = u'sharing-playlist'
     if info.podcast:
         thumb_path = resources.path('images/icon-podcast-small.png')
         active = resources.path('images/icon-podcast-small_active.png')
     else:
         thumb_path = resources.path('images/icon-playlist-small.png')
         active = resources.path('images/icon-playlist-small_active.png')
     info.icon = imagepool.get_surface(thumb_path)
     info.active_icon = imagepool.get_surface(active)
Example #15
0
 def init_playlist_info(self, info):
     info.type = u'sharing-playlist'
     if info.podcast:
         thumb_path = resources.path('images/icon-podcast-small.png')
         active = resources.path('images/icon-podcast-small_active.png')
     else:
         thumb_path = resources.path('images/icon-playlist-small.png')
         active = resources.path('images/icon-playlist-small_active.png')
     info.icon = imagepool.get_surface(thumb_path)
     info.active_icon = imagepool.get_surface(active)
Example #16
0
 def init_info(self, info):
     if info.favicon:
         thumb_path = info.favicon
     else:
         thumb_path = resources.path("images/icon-site.png")
     surface = imagepool.get_surface(thumb_path)
     if surface.width > 16 or surface.height > 16:
         info.icon = imagepool.get_surface(thumb_path, size=(16, 16))
     else:
         info.icon = imagepool.get_surface(thumb_path)
     info.unwatched = info.available = 0
Example #17
0
 def __init__(self):
     widgetset.CustomButton.__init__(self)
     self.set_can_focus(False)
     self.video_icon = imagepool.get_surface(resources.path('images/mini-icon-video.png'))
     self.audio_icon = imagepool.get_surface(resources.path('images/mini-icon-audio.png'))
     self.reset()
     app.playback_manager.connect('selecting-file', self.on_info_change)
     app.playback_manager.connect('playing-info-changed',
             self.on_info_change)
     app.playback_manager.connect('will-play', self.handle_play)
     app.playback_manager.connect('will-stop', self.handle_stop)
Example #18
0
    def set_image(self, image_name):
        path = resources.path('images/%s.png' % image_name)
        self.image = imagepool.get_surface(path)
        pressed_path = resources.path('images/%s_active.png' % image_name)
        self.pressed_image = imagepool.get_surface(pressed_path)

        disabled_path = resources.path('images/%s_disabled.png' % image_name)
        if os.path.exists(disabled_path):
            self.disabled_image = imagepool.get_surface(disabled_path)
        else:
            self.disabled_image = None
Example #19
0
    def set_image(self, image_name):
        path = resources.path('images/%s.png' % image_name)
        self.image = imagepool.get_surface(path)
        pressed_path = resources.path('images/%s_active.png' % image_name)
        self.pressed_image = imagepool.get_surface(pressed_path)

        disabled_path = resources.path('images/%s_disabled.png' % image_name)
        if os.path.exists(disabled_path):
            self.disabled_image = imagepool.get_surface(disabled_path)
        else:
            self.disabled_image = None
Example #20
0
 def __init__(self):
     widgetset.CustomButton.__init__(self)
     self.set_can_focus(False)
     self.video_icon = imagepool.get_surface(resources.path('images/mini-icon-video.png'))
     self.audio_icon = imagepool.get_surface(resources.path('images/mini-icon-audio.png'))
     self.reset()
     app.playback_manager.connect('selecting-file', self.on_info_change)
     app.playback_manager.connect('playing-info-changed',
             self.on_info_change)
     app.playback_manager.connect('will-play', self.handle_play)
     app.playback_manager.connect('will-stop', self.handle_stop)
Example #21
0
 def init_info(self, info):
     if info is self.info:
         return
     info.type = self.type
     info.icon = imagepool.get_surface(info.tab_icon, size=(16, 16))
     active_path = info.tab_icon.replace('.png', '_active.png')
     if os.path.exists(active_path):
         info.active_icon = imagepool.get_surface(active_path,
                                                  size=(16, 16))
     if info.is_updating:
         self.start_updating(info.id)
     else:
         self.stop_updating(info.id)
Example #22
0
 def init_info(self, info):
     if info is self.info:
         return
     info.type = self.type
     info.icon = imagepool.get_surface(info.tab_icon, size=(16, 16))
     active_path = info.tab_icon.replace('.png', '_active.png')
     if os.path.exists(active_path):
         info.active_icon = imagepool.get_surface(active_path,
                                                  size=(16, 16))
     if info.is_updating:
         self.start_updating(info.id)
     else:
         self.stop_updating(info.id)
Example #23
0
 def init_info(self, info):
     if info is self.info:
         return
     if info.is_folder:
         info.icon = imagepool.get_surface(
             resources.path('images/icon-folder.png'))
     else:
         info.icon = imagepool.get_surface(
             resources.path('images/icon-playlist-small.png'))
         info.active_icon = imagepool.get_surface(
             resources.path('images/icon-playlist-small_active.png'))
     info.type = self.type
     info.unwatched = info.available = 0
Example #24
0
 def init_info(self, info):
     if info is self.info:
         return
     if info.is_folder:
         info.icon = imagepool.get_surface(
             resources.path('images/icon-folder.png'))
     else:
         info.icon = imagepool.get_surface(
             resources.path('images/icon-playlist-small.png'))
         info.active_icon = imagepool.get_surface(
             resources.path('images/icon-playlist-small_active.png'))
     info.type = self.type
     info.unwatched = info.available = 0
Example #25
0
 def _draw_thumbnail(self, context, x, y, width, height):
     fraction = 1.0
     if not self.data.state == 'running':
         fraction = 0.4
     icon = imagepool.get_surface(self.data.item_thumbnail, (width, height))
     widgetutil.draw_rounded_icon(context, icon, x, y, width, height, fraction=fraction)
     self.THUMB_OVERLAY.draw(context, x, y, width, height, fraction=fraction)
Example #26
0
 def init_info(self, info):
     if info.is_folder:
         thumb_path = resources.path("images/icon-folder.png")
     else:
         thumb_path = resources.path("images/icon-playlist.png")
     info.icon = imagepool.get_surface(thumb_path)
     info.unwatched = info.available = 0
Example #27
0
 def init_info(self, info):
     info.unwatched = info.available = 0
     if not getattr(info, "fake", False):
         thumb_path = resources.path("images/phone.png")
         info.icon = imagepool.get_surface(thumb_path)
         if getattr(info, "is_updating", False):
             self.start_updating(info.id)
         else:
             self.stop_updating(info.id)
Example #28
0
 def init_info(self, info):
     info.type = u'device'
     info.unwatched = info.available = 0
     if not getattr(info, 'fake', False):
         if getattr(info.info, 'generic', False):
             info.icon = imagepool.get_surface(resources.path(
                 'images/icon-device-hd.png'))
             info.active_icon = imagepool.get_surface(
                 resources.path('images/icon-device-hd_active.png'))
         else:
             info.icon = imagepool.get_surface(
                 resources.path('images/icon-device.png'))
             info.active_icon = imagepool.get_surface(
                 resources.path('images/icon-device_active.png'))
         if getattr(info, 'is_updating', False):
             self.tablist.start_updating(info.id)
         else:
             self.tablist.stop_updating(info.id)
Example #29
0
 def init_info(self, info):
     info.type = u'device'
     info.unwatched = info.available = 0
     if not getattr(info, 'fake', False):
         if getattr(info.info, 'generic', False):
             info.icon = imagepool.get_surface(
                 resources.path('images/icon-device-hd.png'))
             info.active_icon = imagepool.get_surface(
                 resources.path('images/icon-device-hd_active.png'))
         else:
             info.icon = imagepool.get_surface(
                 resources.path('images/icon-device.png'))
             info.active_icon = imagepool.get_surface(
                 resources.path('images/icon-device_active.png'))
         if getattr(info, 'is_updating', False):
             self.tablist.start_updating(info.id)
         else:
             self.tablist.stop_updating(info.id)
Example #30
0
    def _fake_info(self, info, typ, name):
        new_data = {
            'fake': True,
            'tab_type': typ,
            'id': u'%s-%s' % (info.id, typ),
            'name': name,
            'device_name': info.name,
            'icon': imagepool.get_surface(
                resources.path('images/icon-device-%s.png' % typ)),
            'active_icon': imagepool.get_surface(
                resources.path('images/icon-device-%s_active.png' % typ))
            }

        # hack to create a DeviceInfo without dealing with __init__
        di = messages.DeviceInfo.__new__(messages.DeviceInfo)
        di.__dict__ = info.__dict__.copy()
        di.__dict__.update(new_data)
        return di
Example #31
0
File: style.py Project: codito/miro
    def render(self, context, layout_manager, selected, hotspot, hover):
        album_art = imagepool.get_surface(self.get_image_path(),
                size=self.IMAGE_SIZE)
        artist = self.get_artist()
        album = self.get_album()

        if self.group_info is None:
            # we can't render if group_info isn't set
            logging.warn("group_info is None in MultiRowAlbumRenderer")
            return
        if context.height == 0:
            # not sure how this would happen, but we need to avoid
            # divide-by-zero errors if it does
            logging.warn("row height is 0 in MultiRowAlbumRenderer")
            return

        if not album:
            # if we don't have an album name, then try to render the artist
            # name.  If not, just leave ourselves blank.
            self.clear_cell(context)
            if artist:
                self.render_text(context, layout_manager, artist, True)
                self.draw_bottom_line(context)
            return

        current_row, total_rows = self.group_info

        # calculate how many rows we need to display the image
        total_image_height = (album_art.height + self.IMAGE_MARGIN_TOP +
                self.IMAGE_MARGIN_BOTTOM)
        image_row_count = math.ceil(float(total_image_height) /
                context.height)

        # render the current cell
        if total_rows < image_row_count:
            # we don't have enough room to draw the image, just try to draw
            # the text
            image_row_count = 0
        if current_row < image_row_count:
            # draw image cells
            self.render_image(context, album_art, current_row)
        else:
            # draw text and empty cells
            self.clear_cell(context)

            if current_row == image_row_count:
                self.render_text(context, layout_manager, album, True)
            elif current_row == image_row_count + 1:
                self.render_text(context, layout_manager, artist, False)

        # draw track number
        self.render_track_number(context, layout_manager, current_row)
        # render line below the album
        if current_row == total_rows - 1:
            self.draw_bottom_line(context)
Example #32
0
    def make_album_art(self, context):
        """Make an image to draw as album art.

        Returns ImageSurface to draw or None if we don't have anything
        """
        if self.get_total_rows() < 6:
            # don't draw album art if we have less than 6 items in the group
            return None

        album_art_path = self.get_image_path()
        if album_art_path is None:
            return None
        return imagepool.get_surface(album_art_path,
                size=(self.album_art_size, self.album_art_size))
Example #33
0
    def _fake_info(self, info, name):
        new_data = {
            "fake": True,
            "tab_type": name.lower(),
            "id": "%s-%s" % (info.id, name.lower()),
            "name": name,
            "icon": imagepool.get_surface(resources.path("images/icon-%s.png" % name.lower())),
        }

        # hack to create a DeviceInfo without dealing with __init__
        di = messages.DeviceInfo.__new__(messages.DeviceInfo)
        di.__dict__ = info.__dict__.copy()
        di.__dict__.update(new_data)
        return di
Example #34
0
    def setup_icons(self, width, height):
        """Create icons that will fill our allocated area correctly. """
        if (width, height) == self.setup_size:
            return

        icon_width = int(height / 2.0)
        icon_height = int((icon_width / self.ICON_PROPORTIONS) + 0.5)
        # FIXME: by the time min_width is set below, it doesn't matter --Kaz
        self.width = self.min_width = icon_width
        self.height = icon_height
        icon_dimensions = (icon_width, icon_height)
        for state in StateCircleRenderer.ICON_STATES:
            path = resources.path('images/status-icon-%s.png' % state)
            self.icon[state] = imagepool.get_surface(path, icon_dimensions)
        self.setup_size = (width, height)
Example #35
0
    def _fake_info(self, info, name):
        new_data = {
            'fake': True,
            'tab_type': name.lower(),
            'id': '%s-%s' % (info.id, name.lower()),
            'name': name,
            'icon': imagepool.get_surface(
                resources.path('images/icon-%s.png' % name.lower()))
            }

        # hack to create a DeviceInfo without dealing with __init__
        di = messages.DeviceInfo.__new__(messages.DeviceInfo)
        di.__dict__ = info.__dict__.copy()
        di.__dict__.update(new_data)
        return di
Example #36
0
    def make_album_art(self, context):
        """Make an image to draw as album art.

        Returns ImageSurface to draw or None if we don't have anything
        """
        if self.get_total_rows() < 6:
            # don't draw album art if we have less than 6 items in the group
            return None

        album_art_path = self.get_image_path()
        if album_art_path is None:
            return None
        return imagepool.get_surface(album_art_path,
                                     size=(self.album_art_size,
                                           self.album_art_size))
Example #37
0
 def __init__(self):
     widgetset.InfoListRenderer.__init__(self)
     self.want_hover = True
     self.icon = {}
     # TODO: to support scaling, we need not to check min_height until after
     # the renderer first gets its layout_manager
     #        self.icon_height = int(self.height * 9.0 / 14.0)
     self.icon_height = 9
     self.icon_width = self.icon_height
     for state in RatingRenderer.ICON_STATES:
         path = resources.path('images/star-%s.png' % state)
         self.icon[state] = imagepool.get_surface(
             path, (self.icon_width, self.icon_height))
     self.min_width = self.width = int(self.icon_width * self.ICON_COUNT)
     self.hover = None
Example #38
0
File: style.py Project: codito/miro
    def __init__(self):
        widgetset.InfoListRenderer.__init__(self)
        self.want_hover = True
        self.icon = {}
        # TODO: to support scaling, we need not to check min_height until after
        # the renderer first gets its layout_manager
#        self.icon_height = int(self.height * 9.0 / 14.0)
        self.icon_height = 9
        self.icon_width = self.icon_height
        for state in RatingRenderer.ICON_STATES:
            path = resources.path('images/star-%s.png' % state)
            self.icon[state] = imagepool.get_surface(path,
                               (self.icon_width, self.icon_height))
        self.min_width = self.width = int(self.icon_width * self.ICON_COUNT)
        self.hover = None
Example #39
0
File: style.py Project: kmshi/miro
    def setup_icons(self, width, height):
        """Create icons that will fill our allocated area correctly. """
        if (width, height) == self.setup_size:
            return

        icon_width = int(height / 2.0)
        icon_height = int((icon_width / self.ICON_PROPORTIONS) + 0.5)
        # FIXME: by the time min_width is set below, it doesn't matter --Kaz
        self.width = self.min_width = icon_width
        self.height = icon_height
        icon_dimensions = (icon_width, icon_height)
        for state in StateCircleRenderer.ICON_STATES:
            path = resources.path('images/status-icon-%s.png' % state)
            self.icon[state] = imagepool.get_surface(path, icon_dimensions)
        self.setup_size = (width, height)
Example #40
0
 def init_info(self, info):
     info.type = u'sharing'
     info.unwatched = info.available = 0
     info.video_playlist_id = unicode(
         md5(repr((u'video', info.host, info.port, u'video'))).hexdigest())
     info.audio_playlist_id = unicode(
         md5(repr((u'audio', info.host, info.port, u'audio'))).hexdigest())
     if info.is_folder:
         thumb_path = resources.path('images/sharing.png')
     # Checking the name instead of a supposedly unique id is ok for now
     # because
     elif info.playlist_id == u'video':
         thumb_path = resources.path('images/icon-video.png')
         info.name = _('Video')
     elif info.playlist_id == u'audio':
         thumb_path = resources.path('images/icon-audio.png')
         info.name = _('Music')
     else:
         thumb_path = resources.path('images/icon-playlist.png')
     info.icon = imagepool.get_surface(thumb_path)
Example #41
0
 def init_info(self, info):
     info.type = u'sharing'
     info.unwatched = info.available = 0
     info.video_playlist_id = unicode(md5(
                                 repr((u'video',
                                 info.host,
                                 info.port, u'video'))).hexdigest())
     info.audio_playlist_id = unicode(md5(
                                 repr((u'audio',
                                 info.host,
                                 info.port, u'audio'))).hexdigest())
     if info.is_folder:
         thumb_path = resources.path('images/sharing.png')
     # Checking the name instead of a supposedly unique id is ok for now
     # because
     elif info.playlist_id == u'video':
         thumb_path = resources.path('images/icon-video.png')
         info.name = _('Video')
     elif info.playlist_id == u'audio':
         thumb_path = resources.path('images/icon-audio.png')
         info.name = _('Music')
     else:
         thumb_path = resources.path('images/icon-playlist.png')
     info.icon = imagepool.get_surface(thumb_path)
Example #42
0
def make_surface(image_name):
    path = resources.path("images/%s.png" % image_name)
    return imagepool.get_surface(path)
Example #43
0
 def init_share_info(self, info):
     info.type = u'sharing'
     info.icon = imagepool.get_surface(resources.path('images/sharing.png'))
Example #44
0
def _get_image(name):
    path = resources.path(os.path.join('images', '%s.png' % name))
    return imagepool.get_surface(path)
Example #45
0
    def __init__(self):
        widgetset.CustomButton.__init__(self)

        self.image = imagepool.get_surface(
            resources.path('images/connect-help.png'))
        self.text = _("Get Help")
Example #46
0
    def __init__(self):
        widgetset.CustomButton.__init__(self)

        self.image = imagepool.get_surface(
            resources.path('images/connect-appstore.png'))
Example #47
0
    def __init__(self):
        widgetset.CustomButton.__init__(self)

        self.image = imagepool.get_surface(
            resources.path('images/connect-help.png'))
        self.text = _("Get Help")
Example #48
0
    def __init__(self):
        widgetset.CustomButton.__init__(self)

        self.image = imagepool.get_surface(
            resources.path('images/connect-appstore.png'))
Example #49
0
File: style.py Project: codito/miro
 def get_surface(part):
     return imagepool.get_surface(resources.path(
         'images/%s_%s.png' % (name, part)))
Example #50
0
File: style.py Project: codito/miro
 def __init__(self):
     widgetset.InfoListRenderer.__init__(self)
     self.icon = {}
     for state in StateCircleRenderer.ICON_STATES:
         path = resources.path('images/status-icon-%s.png' % state)
         self.icon[state] = imagepool.get_surface(path)
Example #51
0
def _get_image(name):
    path = resources.path(os.path.join('images', '%s.png' % name))
    return imagepool.get_surface(path)
Example #52
0
 def get_surface(part):
     return imagepool.get_surface(
         resources.path('images/%s_%s.png' % (name, part)))
Example #53
0
def make_surface(image_name):
    path = resources.path("images/%s.png" % image_name)
    return imagepool.get_surface(path)
Example #54
0
 def __init__(self):
     widgetset.ItemListRenderer.__init__(self)
     self.icon = {}
     for state in StateCircleRenderer.ICON_STATES:
         path = resources.path('images/status-icon-%s.png' % state)
         self.icon[state] = imagepool.get_surface(path)