当前位置: 首页>>代码示例>>Python>>正文


Python InfosPopover.show方法代码示例

本文整理汇总了Python中lollypop.pop_infos.InfosPopover.show方法的典型用法代码示例。如果您正苦于以下问题:Python InfosPopover.show方法的具体用法?Python InfosPopover.show怎么用?Python InfosPopover.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lollypop.pop_infos.InfosPopover的用法示例。


在下文中一共展示了InfosPopover.show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_lastfm_btn_clicked

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
 def _on_lastfm_btn_clicked(self, button):
     if Lp.lastfm is not None:
         if Lp.player.current_track.aartist_id == Type.COMPILATIONS:
             artist = Lp.player.current_track.artist
         else:
             artist = Lp.player.current_track.aartist
         popover = InfosPopover(artist, Lp.player.current_track.title)
         popover.set_relative_to(button)
         popover.populate()
         popover.show()
开发者ID:yoseforb,项目名称:lollypop,代码行数:12,代码来源:toolbar_playback.py

示例2: _on_label_button_release

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
 def _on_label_button_release(self, eventbox, event):
     """
         On clicked label, show artist informations in a popover
         @param eventbox as Gtk.EventBox
         @param event as Gdk.Event
     """
     if InfosPopover.should_be_shown() and self._artist_id != Type.COMPILATIONS:
         pop = InfosPopover(self._artist_id, False)
         pop.set_relative_to(eventbox)
         pop.show()
开发者ID:goncalor,项目名称:lollypop,代码行数:12,代码来源:view_artist.py

示例3: _on_label_button_release

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
 def _on_label_button_release(self, eventbox, event):
     """
         On clicked label, show artist informations in a popover
         @param eventbox as Gtk.EventBox
         @param event as Gdk.Event
     """
     if (Lp.lastfm is not None or self.Wikipedia is not None) and\
             self._album.artist_id != Type.COMPILATIONS:
         popover = InfosPopover(self._album.artist_name)
         popover.set_relative_to(eventbox)
         popover.populate()
         popover.show()
开发者ID:gigitux,项目名称:lollypop,代码行数:14,代码来源:widgets_album.py

示例4: _on_infos_btn_clicked

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
 def _on_infos_btn_clicked(self, button):
     """
         Show current artist informations
         @param button as Gtk.Button
     """
     if InfosPopover.should_be_shown():
         artist_id = Lp.player.current_track.aartist_id
         if artist_id == Type.COMPILATIONS:
             artist = Lp.player.current_track.artist
         else:
             artist = Lp.player.current_track.aartist
         popover = InfosPopover(artist, Lp.player.current_track.id)
         popover.set_relative_to(button)
         popover.populate()
         popover.show()
开发者ID:serkanalgur,项目名称:lollypop,代码行数:17,代码来源:toolbar_playback.py

示例5: ArtistView

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
class ArtistView(ArtistAlbumsView):
    """
        Show artist albums and tracks
    """

    def __init__(self, artist_id, genre_id):
        """
            Init ArtistView
            @param artist id as int (Current if None)
            @param genre id as int
        """
        ArtistAlbumsView.__init__(self, artist_id, genre_id)
        self._artist_id = artist_id
        self._genre_id = genre_id
        self._signal_id = None

        self._popover = InfosPopover(artist_id, False)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ArtistView.ui')
        builder.connect_signals(self)
        self.attach(builder.get_object('ArtistView'), 0, 0, 1, 1)
        builder.get_object('artist').set_label(
                                            Lp.artists.get_name(artist_id))

#######################
# PRIVATE             #
#######################
    def _on_label_realize(self, eventbox):
        """
            Change pointer on label
            @param eventbox as Gtk.EventBox
        """
        if InfosPopover.should_be_shown() and\
                self._artist_id != Type.COMPILATIONS:
            eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND1))

    def _on_label_button_release(self, eventbox, event):
        """
            On clicked label, show artist informations in a popover
            @param eventbox as Gtk.EventBox
            @param event as Gdk.Event
        """
        if InfosPopover.should_be_shown() and\
                self._artist_id != Type.COMPILATIONS:
            self._popover.set_relative_to(eventbox)
            self._popover.show()
开发者ID:kenden,项目名称:lollypop,代码行数:48,代码来源:view_artist.py

示例6: ToolbarInfos

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
class ToolbarInfos(Gtk.Bin):
    """
        Informations toolbar
    """

    def __init__(self):
        """
            Init toolbar
        """
        Gtk.Bin.__init__(self)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ToolbarInfos.ui')
        builder.connect_signals(self)

        self._pop_tunein = None
        self._pop_infos = None

        self._infobox = builder.get_object('infos')
        self._infobox.set_property('has-tooltip', True)
        self.add(self._infobox)

        self._title_label = builder.get_object('title')
        self._artist_label = builder.get_object('artist')
        self._cover = builder.get_object('cover')

        Lp.art.connect('cover-changed', self._update_cover)
        Lp.art.connect('logo-changed', self._update_logo)

    def on_current_changed(self, player):
        """
            Update toolbar on current changed
            @param player as Player
        """
        art = None

        if player.current_track.artist == '':
            self._artist_label.hide()
        else:
            self._artist_label.show()
            self._artist_label.set_text(player.current_track.artist)
        if player.current_track.title == '':
            self._title_label.hide()
        else:
            self._title_label.show()
            self._title_label.set_text(player.current_track.title)

        if player.current_track.id == Type.RADIOS:
            art = Lp.art.get_radio(player.current_track.artist,
                                   ArtSize.SMALL*self.get_scale_factor())
        elif player.current_track.id == Type.EXTERNALS:
            art = Lp.art.get_cover_for_uri(
                    player.current_track.uri,
                    ArtSize.SMALL*self.get_scale_factor(),
                    False)
        else:
            art = Lp.art.get_album(player.current_track.album,
                                   ArtSize.SMALL*self.get_scale_factor())
        if art is not None:
            self._cover.set_from_surface(art)
            del art
            self._cover.set_tooltip_text(player.current_track.album.name)
            self._cover.show()
        else:
            self._cover.hide()

    def on_status_changed(self, player):
        """
            Update infos on status changed
            @param player as Player
        """
        pass

#######################
# PRIVATE             #
#######################
    def _update_cover(self, art, album_id):
        """
            Update cover for album_id
            @param art as Art
            @param album id as int
        """
        if Lp.player.current_track.album.id == album_id:
            pixbuf = Lp.art.get_album(Lp.player.current_track.album,
                                      ArtSize.SMALL)
            self._cover.set_from_surface(pixbuf)
            del pixbuf

    def _update_logo(self, art, name):
        """
            Update logo for name
            @param art as Art
            @param name as str
        """
        if Lp.player.current_track.artist == name:
            pixbuf = Lp.art.get_radio(name, ArtSize.SMALL)
            self._cover.set_from_surface(pixbuf)
            del pixbuf

    def _on_infobox_clicked(self, eventbox, event):
        """
#.........这里部分代码省略.........
开发者ID:kenden,项目名称:lollypop,代码行数:103,代码来源:toolbar_infos.py

示例7: ToolbarInfos

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
class ToolbarInfos(Gtk.Bin):
    """
        Informations toolbar
    """

    def __init__(self):
        """
            Init toolbar
        """
        Gtk.Bin.__init__(self)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ToolbarInfos.ui')
        builder.connect_signals(self)

        self._pop_tunein = None
        self._pop_infos = None
        self._cover_size = ArtSize.SMALL

        self._infobox = builder.get_object('infos')
        self._infobox.set_property('has-tooltip', True)
        self.add(self._infobox)

        self._title_label = builder.get_object('title')
        self._artist_label = builder.get_object('artist')
        self._cover_frame = builder.get_object('frame')
        self._cover = builder.get_object('cover')

        Lp().art.connect('album-artwork-changed', self._update_cover)
        Lp().art.connect('radio-artwork-changed', self._update_logo)

    def on_current_changed(self, player):
        """
            Update toolbar on current changed
            @param player as Player
        """
        art = None

        if player.current_track.artist == '':
            self._artist_label.hide()
        else:
            self._artist_label.show()
            self._artist_label.set_text(player.current_track.artist)
        if player.current_track.title == '':
            self._title_label.hide()
        else:
            self._title_label.show()
            self._title_label.set_text(player.current_track.title)

        if player.current_track.id == Type.RADIOS:
            art = Lp().art.get_radio_artwork(
                                   player.current_track.artist,
                                   self._cover_size*self.get_scale_factor())
        elif player.current_track.id == Type.EXTERNALS:
            art = Lp().art.get_album_artwork2(
                    player.current_track.uri,
                    self._cover_size*self.get_scale_factor())
        elif player.current_track.id is not None:
            art = Lp().art.get_album_artwork(
                                   player.current_track.album,
                                   self._cover_size*self.get_scale_factor())
        if art is not None:
            self._cover.set_from_surface(art)
            del art
            self._cover.set_tooltip_text(player.current_track.album.name)
            self._cover_frame.show()
        else:
            self._cover_frame.hide()

    def on_status_changed(self, player):
        """
            Update infos on status changed
            @param player as Player
        """
        pass

#######################
# PRIVATE             #
#######################
    def _update_cover(self, art, album_id):
        """
            Update cover for album_id
            @param art as Art
            @param album id as int
        """
        if Lp().player.current_track.album.id == album_id:
            surface = Lp().art.get_album_artwork(
                                       Lp().player.current_track.album,
                                       self._cover_size)
            self._cover.set_from_surface(surface)
            del surface

    def _update_logo(self, art, name):
        """
            Update logo for name
            @param art as Art
            @param name as str
        """
        if Lp().player.current_track.artist == name:
            pixbuf = Lp().art.get_radio_artwork(name, self._cover_size)
            self._cover.set_from_surface(pixbuf)
#.........这里部分代码省略.........
开发者ID:oleastre,项目名称:lollypop,代码行数:103,代码来源:toolbar_infos.py

示例8: ArtistView

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
class ArtistView(View):
    """
        Show artist albums and tracks
    """

    def __init__(self, artist_id, genre_id):
        """
            Init ArtistView
            @param artist id as int
            @param genre id as int
        """
        View.__init__(self)
        self._artist_id = artist_id
        self._genre_id = genre_id
        self._signal_id = None

        self._artist_name = Lp.artists.get_name(artist_id)
        if Lp.lastfm is not None:
            self._popover = InfosPopover(self._artist_name)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ArtistView.ui')
        builder.connect_signals(self)
        self.attach(builder.get_object('ArtistView'), 0, 0, 1, 1)
        builder.get_object('artist').set_label(self._artist_name)

        self._pop_allowed = True

        self._albumbox = Gtk.Grid()
        self._albumbox.set_row_spacing(20)
        self._albumbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self._albumbox.show()

        self._scrolledWindow.set_property('expand', True)
        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self.add(self._scrolledWindow)

    def populate(self):
        """
            Populate the view
            @thread safe
        """
        albums = self._get_albums()
        GLib.idle_add(self._add_albums, albums, self._genre_id)


#######################
# PRIVATE             #
#######################
    def _get_albums(self):
        """
            Get albums
            @return album ids as [int]
            @thread safe
        """
        sql = Lp.db.get_cursor()
        if self._artist_id == Type.COMPILATIONS:
            albums = Lp.albums.get_compilations(self._genre_id,
                                                sql)
        elif self._genre_id == Type.ALL:
            albums = Lp.albums.get_ids(self._artist_id,
                                       None,
                                       sql)
        else:
            albums = Lp.albums.get_ids(self._artist_id,
                                       self._genre_id,
                                       sql)
        sql.close()
        return albums

    def _get_children(self):
        """
            Return view children
            @return [AlbumWidget]
        """
        return self._albumbox.get_children()

    def _add_albums(self, albums, genre_id):
        """
            Pop an album and add it to the view,
            repeat operation until album list is empty
            @param [album ids as int]
            @param genre id as int
        """
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        if albums and not self._stop:
            widget = AlbumDetailedWidget(albums.pop(0),
                                         genre_id,
                                         self._pop_allowed,
                                         False,
                                         size_group)
            widget.show()
            start_new_thread(widget.populate, ())
            self._albumbox.add(widget)
            GLib.idle_add(self._add_albums, albums, genre_id)
        else:
            self._stop = False

    def _on_label_realize(self, eventbox):
        """
#.........这里部分代码省略.........
开发者ID:serkanalgur,项目名称:lollypop,代码行数:103,代码来源:view_albums.py

示例9: AlbumDetailedWidget

# 需要导入模块: from lollypop.pop_infos import InfosPopover [as 别名]
# 或者: from lollypop.pop_infos.InfosPopover import show [as 别名]
class AlbumDetailedWidget(AlbumWidget):
    """
        Init detailed album widget
        @param album id as int
        @param genre id as int
        @param parent width as int
        @param pop_allowed as bool if widget can show popovers
        @param scrolled as bool
        @param size group as Gtk.SizeGroup
    """
    def __init__(self, album_id, genre_id, pop_allowed, scrolled, size_group):
        AlbumWidget.__init__(self, album_id)

        self._artist_id = Lp.albums.get_artist_id(album_id)
        self._album_id = album_id
        self._genre_id = genre_id

        builder = Gtk.Builder()
        if scrolled:
            builder.add_from_resource(
                '/org/gnome/Lollypop/AlbumContextWidget.ui')
        else:
            builder.add_from_resource(
                '/org/gnome/Lollypop/AlbumDetailedWidget.ui')
        builder.connect_signals(self)

        if scrolled:
            artist = translate_artist_name(Lp.albums.get_artist_name(album_id))
            builder.get_object('artist').set_text(artist)
            builder.get_object('artist').show()
            if Lp.lastfm is not None:
                self._popover = InfosPopover(artist)

        self._stars = []
        self._stars.append(builder.get_object('star0'))
        self._stars.append(builder.get_object('star1'))
        self._stars.append(builder.get_object('star2'))
        self._stars.append(builder.get_object('star3'))
        self._stars.append(builder.get_object('star4'))
        self._on_leave_notify(None, None)

        grid = builder.get_object('tracks')
        self._discs = Lp.albums.get_discs(album_id, genre_id)
        self._tracks_left = {}
        self._tracks_right = {}
        show_label = len(self._discs) > 1
        i = 0
        for disc in self._discs:
            if show_label:
                label = Gtk.Label()
                label.set_text(_("Disc %s") % disc)
                label.set_property('halign', Gtk.Align.START)
                label.get_style_context().add_class('dim-label')
                if i:
                    label.set_property('margin-top', 30)
                label.show()
                grid.attach(label, 0, i, 2, 1)
                i += 1
                sep = Gtk.Separator()
                sep.show()
                grid.attach(sep, 0, i, 2, 1)
                i += 1
            self._tracks_left[disc] = TracksWidget(pop_allowed)
            self._tracks_right[disc] = TracksWidget(pop_allowed)
            grid.attach(self._tracks_left[disc], 0, i, 1, 1)
            grid.attach(self._tracks_right[disc], 1, i, 1, 1)
            size_group.add_widget(self._tracks_left[disc])
            size_group.add_widget(self._tracks_right[disc])

            self._tracks_left[disc].connect('activated', self._on_activated)
            self._tracks_left[disc].connect('button-press-event',
                                            self._on_button_press_event)
            self._tracks_right[disc].connect('activated', self._on_activated)
            self._tracks_right[disc].connect('button-press-event',
                                             self._on_button_press_event)

            self._tracks_left[disc].show()
            self._tracks_right[disc].show()
            i += 1

        self._cover = builder.get_object('cover')
        self.set_cover()

        self._title_label = Lp.albums.get_name(album_id)
        builder.get_object('title').set_label(self._title_label)
        builder.get_object('year').set_label(Lp.albums.get_year(album_id))
        self.add(builder.get_object('AlbumDetailedWidget'))

        if pop_allowed:
            self._menu = builder.get_object('menu')
            self._eventbox = builder.get_object('eventbox')
            self._eventbox.connect('realize', self._on_eventbox_realize)
            self._eventbox.connect("button-press-event",
                                   self._show_web_art)
            self._menu.connect('clicked',
                               self._pop_menu)
            self._menu.show()
        else:
            self._eventbox = None

#.........这里部分代码省略.........
开发者ID:yoseforb,项目名称:lollypop,代码行数:103,代码来源:widgets_album.py


注:本文中的lollypop.pop_infos.InfosPopover.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。