Exemple #1
0
 def _on_item_activated(self, flowbox, album_widget):
     """
         Show Context view for activated album
         @param flowbox as Gtk.Flowbox
         @param album_widget as AlbumSimpleWidget
     """
     if FlowBoxView._on_item_activated(self, flowbox, album_widget):
         return
     if album_widget.artwork is None:
         return
     # If widget top not on screen, popover will fail to show
     # FIXME: Report a bug and check always true
     (x, y) = album_widget.translate_coordinates(self._scrolled, 0, 0)
     if y < 0:
         y = album_widget.translate_coordinates(self._box, 0, 0)[1]
         self._scrolled.get_allocation().height + y
         self._scrolled.get_vadjustment().set_value(y)
     from lollypop.pop_album import AlbumPopover
     popover = AlbumPopover(album_widget.album, ArtSize.NONE)
     popover.set_relative_to(album_widget.artwork)
     popover.set_position(Gtk.PositionType.BOTTOM)
     album_widget.show_overlay(False)
     album_widget.lock_overlay(True)
     popover.connect("closed", self.__on_album_popover_closed, album_widget)
     popover.popup()
     album_widget.artwork.set_opacity(0.9)
Exemple #2
0
 def __on_album_activated(self, flowbox, album_widget):
     """
         Show Context view for activated album
         @param flowbox as Gtk.Flowbox
         @param album_widget as AlbumSimpleWidget
     """
     # Here some code for touch screens
     # If mouse pointer activate Gtk.FlowBoxChild, overlay is on,
     # as enter notify event enabled it
     # Else, we are in touch screen, first time show overlay, next time
     # show popover
     if not album_widget.is_overlay:
         album_widget.show_overlay(True)
         return
     cover = album_widget.get_cover()
     if cover is None:
         return
     # If widget top not on screen, popover will fail to show
     # FIXME: Report a bug and check always true
     (x, y) = album_widget.translate_coordinates(self._scrolled, 0, 0)
     if y < 0:
         y = album_widget.translate_coordinates(self._box, 0, 0)[1]
         self._scrolled.get_allocation().height + y
         self._scrolled.get_vadjustment().set_value(y)
     allocation = self.get_allocation()
     (x, top_height) = album_widget.translate_coordinates(self, 0, 0)
     bottom_height = allocation.height -\
         album_widget.get_allocation().height -\
         top_height
     if bottom_height > top_height:
         height = bottom_height
     else:
         height = top_height
     popover = AlbumPopover(album_widget.id,
                            self.__genre_ids,
                            self.__artist_ids,
                            allocation.width,
                            height,
                            ArtSize.NONE)
     popover.set_relative_to(cover)
     popover.set_position(Gtk.PositionType.BOTTOM)
     album_widget.show_overlay(False)
     album_widget.lock_overlay(True)
     popover.connect("closed", self.__on_album_popover_closed, album_widget)
     popover.show()
     self.__current = album_widget
     cover.set_opacity(0.9)
Exemple #3
0
 def _on_album_activated(self, flowbox, album_widget):
     """
         Show Context view for activated album
         @param flowbox as Gtk.Flowbox
         @param album_widget as AlbumSimpleWidget
     """
     cover = album_widget.get_cover()
     if cover is None:
         return
     # If widget top not on screen, popover will fail to show
     # FIXME: Report a bug and check always true
     (x, y) = album_widget.translate_coordinates(self._scrolled, 0, 0)
     if y < 0:
         y = album_widget.translate_coordinates(self._albumbox, 0, 0)[1]
         self._scrolled.get_allocation().height + y
         self._scrolled.get_vadjustment().set_value(y)
     if self._press_rect is not None:
         pop_menu = AlbumMenu(Album(album_widget.get_id()))
         popover = Gtk.Popover.new_from_model(cover, pop_menu)
         popover.set_position(Gtk.PositionType.BOTTOM)
         popover.set_pointing_to(self._press_rect)
     else:
         allocation = self.get_allocation()
         (x, top_height) = album_widget.translate_coordinates(self, 0, 0)
         bottom_height = allocation.height -\
             album_widget.get_allocation().height -\
             top_height
         if bottom_height > top_height:
             height = bottom_height
         else:
             height = top_height
         popover = AlbumPopover(album_widget.get_id(),
                                self._genre_ids,
                                self._artist_ids,
                                allocation.width,
                                height,
                                False)
         popover.set_relative_to(cover)
         popover.set_position(Gtk.PositionType.BOTTOM)
     album_widget.show_overlay(False)
     album_widget.lock_overlay(True)
     popover.connect('closed', self._on_popover_closed, album_widget)
     popover.show()
     cover.set_opacity(0.9)