Exemplo n.º 1
0
 def _on_infobox_clicked(self, eventbox, event):
     """
         Pop albums from current artistleft click
         Show playlist menu on right
         @param eventbox as Gtk.EventBox
         @param event as Gdk.Event
     """
     if Lp().player.current_track.id == Type.EXTERNALS:
         expopover = ExternalsPopover()
         expopover.set_relative_to(eventbox)
         expopover.populate()
         expopover.show()
     elif Lp().player.current_track.id is not None:
         if event.button == 1:
             if Lp().player.current_track.id == Type.RADIOS:
                 if self._pop_tunein is None:
                     self._pop_tunein = TuneinPopover()
                     self._pop_tunein.populate()
                     self._pop_tunein.set_relative_to(self._infobox)
                 self._pop_tunein.show()
             else:
                 if self._pop_infos is None:
                     self._pop_infos = InfosPopover()
                     self._pop_infos.set_relative_to(self._infobox)
                 self._pop_infos.show()
         elif Lp().player.current_track.id >= 0:
             menu = PopToolbarMenu(Lp().player.current_track.id)
             popover = TrackMenuPopover(
                         Lp().player.current_track.id,
                         PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self._infobox)
             popover.show()
         return True
Exemplo n.º 2
0
 def _show_track_menu(self):
     """
         Show current track menu
     """
     self._timeout_id = None
     if Lp().player.current_track.id >= 0:
         popover = TrackMenuPopover(
                     Lp().player.current_track.id,
                     PopToolbarMenu(Lp().player.current_track.id))
         popover.set_relative_to(self._infobox)
         popover.show()
Exemplo n.º 3
0
 def __on_info_long(self, args):
     """
         Show current track menu
         @param args as []
     """
     if Lp().player.current_track.id >= 0:
         from lollypop.pop_menu import PlaylistsMenu
         from lollypop.pop_menu import TrackMenuPopover
         popover = TrackMenuPopover(
                     Lp().player.current_track,
                     PlaylistsMenu(Lp().player.current_track))
         popover.set_relative_to(self._infobox)
         popover.show()
Exemplo n.º 4
0
 def __popup_menu(self, eventbox, xcoordinate=None, ycoordinate=None):
     """
         Popup menu for track
         @param eventbox as Gtk.EventBox
         @param xcoordinate as int (or None)
         @param ycoordinate as int (or None)
     """
     from lollypop.pop_menu import TrackMenuPopover, RemoveMenuPopover
     if self.get_state_flags() & Gtk.StateFlags.SELECTED:
         # Get all selected rows
         rows = [self]
         r = self.previous_row
         while r is not None:
             if r.get_state_flags() & Gtk.StateFlags.SELECTED:
                 rows.append(r)
             r = r.previous_row
         r = self.next_row
         while r is not None:
             if r.get_state_flags() & Gtk.StateFlags.SELECTED:
                 rows.append(r)
             r = r.next_row
         popover = RemoveMenuPopover(rows)
     else:
         popover = TrackMenuPopover(self._track, self._get_menu())
     if xcoordinate is not None and ycoordinate is not None:
         rect = eventbox.get_allocation()
         rect.x = xcoordinate
         rect.y = ycoordinate
         rect.width = rect.height = 1
     popover.set_relative_to(eventbox)
     popover.set_pointing_to(rect)
     popover.connect("closed", self.__on_closed)
     self.get_style_context().add_class("track-menu-selected")
     popover.popup()
Exemplo n.º 5
0
 def __on_button_press_event(self, widget, event):
     """
         Show current track menu
         @param widget as Gtk.Widget
         @param event as Gdk.Event
     """
     if event.button == 1:
         if App().player.current_track.id == Type.RADIOS:
             from lollypop.pop_tunein import TuneinPopover
             popover = TuneinPopover()
             popover.populate()
         elif App().player.current_track.id is not None:
             from lollypop.pop_information import InformationPopover
             popover = InformationPopover()
             popover.populate()
         popover.set_relative_to(self._infobox)
         popover.popup()
     else:
         from lollypop.pop_menu import ToolbarMenu
         menu = ToolbarMenu(App().player.current_track)
         if App().player.current_track.id >= 0:
             from lollypop.pop_menu import TrackMenuPopover
             popover = TrackMenuPopover(App().player.current_track, menu)
             popover.set_relative_to(self._infobox)
         elif App().player.current_track.id == Type.RADIOS:
             popover = Popover.new_from_model(self._infobox, menu)
         popover.popup()
     return True
Exemplo n.º 6
0
 def __popup_menu(self, widget, xcoordinate=None, ycoordinate=None):
     """
         Popup menu for track
         @param widget as Gtk.Button
         @param xcoordinate as int (or None)
         @param ycoordinate as int (or None)
     """
     popover = TrackMenuPopover(self._track, TrackMenu(self._track))
     if xcoordinate is not None and ycoordinate is not None:
         rect = widget.get_allocation()
         rect.x = xcoordinate
         rect.y = ycoordinate
         rect.width = rect.height = 1
     popover.set_relative_to(widget)
     popover.set_pointing_to(rect)
     popover.connect("closed", self.__on_closed)
     self.get_style_context().add_class("track-menu-selected")
     popover.show()
Exemplo n.º 7
0
 def _on_infobox_clicked(self, eventbox, event):
     """
         Pop albums from current artistleft click
         Show playlist menu on right
         @param eventbox as Gtk.EventBox
         @param event as Gdk.Event
     """
     if Lp().player.current_track.id == Type.EXTERNALS:
         expopover = ExternalsPopover()
         expopover.set_relative_to(eventbox)
         expopover.populate()
         expopover.show()
     elif Lp().player.current_track.id is not None:
         if event.button == 1:
             if Lp().player.current_track.id == Type.RADIOS:
                 if self._pop_tunein is None:
                     self._pop_tunein = TuneinPopover()
                     self._pop_tunein.populate()
                     self._pop_tunein.set_relative_to(self._infobox)
                 self._pop_tunein.show()
             else:
                 if self._pop_infos is None:
                     self._pop_infos = InfosPopover()
                     self._pop_infos.set_relative_to(self._infobox)
                 self._pop_infos.show()
         elif Lp().player.current_track.id >= 0:
             popover = TrackMenuPopover(
                 Lp().player.current_track.id,
                 PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self._infobox)
             popover.show()
         return True
Exemplo n.º 8
0
 def _popup_menu(self, widget, xcoordinate=None, ycoordinate=None):
     """
         Popup menu for track
         @param widget as Gtk.Button
         @param xcoordinate as int (or None)
         @param ycoordinate as int (or None)
     """
     popover = TrackMenuPopover(self._track.id, TrackMenu(self._track.id))
     popover.set_relative_to(widget)
     if xcoordinate is not None and ycoordinate is not None:
         rect = widget.get_allocation()
         rect.x = xcoordinate
         rect.y = ycoordinate
         rect.width = rect.height = 1
         popover.set_pointing_to(rect)
     popover.connect('closed', self._on_closed)
     self.get_style_context().add_class('track-menu-selected')
     popover.show()
Exemplo n.º 9
0
 def _show_track_menu(self):
     """
         Show current track menu
     """
     self._timeout_id = None
     if Lp().player.current_track.id >= 0:
         popover = TrackMenuPopover(
             Lp().player.current_track.id,
             PopToolbarMenu(Lp().player.current_track.id))
         popover.set_relative_to(self._infobox)
         popover.show()
Exemplo n.º 10
0
 def _on_button_press(self, button, event):
     """
         Show track menu
         @param button as Gtk.Button
         @param event as Gdk.Event
     """
     if Lp().player.current_track.id is not None:
         if event.button != 1 and Lp().player.current_track.id >= 0:
             popover = TrackMenuPopover(
                 Lp().player.current_track,
                 PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self)
             press_rect = Gdk.Rectangle()
             press_rect.x = event.x
             press_rect.y = event.y
             press_rect.width = press_rect.height = 1
             popover.set_pointing_to(press_rect)
             popover.show()
     return True
Exemplo n.º 11
0
 def __on_button_press(self, widget, event):
     """
         Store pressed button
         @param widget as Gtk.ListBox
         @param event as Gdk.EventButton
     """
     rect = widget.get_allocation()
     rect.x = event.x
     rect.y = event.y
     rect.width = rect.height = 1
     row = widget.get_row_at_y(event.y)
     # Internal track/album
     if event.button != 1 and row.id is not None:
         if row.is_track:
             track = Track(row.id)
             popover = TrackMenuPopover(track, TrackMenu(track))
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
Exemplo n.º 12
0
 def __show_track_menu(self):
     """
         Show current track menu
     """
     self.__timeout_id = None
     if Lp().player.current_track.id >= 0:
         from lollypop.pop_menu import PopToolbarMenu
         from lollypop.pop_menu import TrackMenuPopover
         popover = TrackMenuPopover(
             Lp().player.current_track,
             PopToolbarMenu(Lp().player.current_track.id))
         popover.set_relative_to(self._infobox)
         popover.show()
Exemplo n.º 13
0
 def __on_info_long(self, args):
     """
         Show current track menu
         @param args as []
     """
     if Lp().player.current_track.id >= 0:
         from lollypop.pop_menu import PlaylistsMenu
         from lollypop.pop_menu import TrackMenuPopover
         popover = TrackMenuPopover(
                     Lp().player.current_track,
                     PlaylistsMenu(Lp().player.current_track))
         popover.set_relative_to(self._infobox)
         popover.show()
Exemplo n.º 14
0
 def _on_button_press(self, button, event):
     """
         Show track menu
         @param button as Gtk.Button
         @param event as Gdk.Event
     """
     if Lp().player.current_track.id is not None:
         if event.button != 1 and Lp().player.current_track.id >= 0:
             popover = TrackMenuPopover(Lp().player.current_track.id, PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self)
             press_rect = Gdk.Rectangle()
             press_rect.x = event.x
             press_rect.y = event.y
             press_rect.width = press_rect.height = 1
             popover.set_pointing_to(press_rect)
             popover.show()
     return True
Exemplo n.º 15
0
 def __popup_menu(self):
     """
         Show contextual menu
     """
     if App().window.is_adaptive or not self._artwork.get_visible():
         return
     from lollypop.menu_toolbar import ToolbarMenu
     menu = ToolbarMenu(App().player.current_track)
     if App().player.current_track.id >= 0:
         from lollypop.pop_menu import TrackMenuPopover
         popover = TrackMenuPopover(App().player.current_track, menu)
         popover.set_relative_to(self._infobox)
     elif App().player.current_track.id == Type.RADIOS:
         popover = Popover.new_from_model(self._infobox, menu)
     popover.popup()
Exemplo n.º 16
0
 def _on_button_press(self, button, event):
     """
         Show track menu
         @param button as Gtk.Button
         @param event as Gdk.Event
     """
     # Remove this the day X11 is dead!
     allocation = self.get_allocation()
     if allocation.height < WindowSize.SMALL - 50:
         return
     if Lp().player.current_track.id is not None:
         if event.button != 1 and Lp().player.current_track.id >= 0:
             popover = TrackMenuPopover(
                 Lp().player.current_track.id,
                 PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self)
             press_rect = Gdk.Rectangle()
             press_rect.x = event.x
             press_rect.y = event.y
             press_rect.width = press_rect.height = 1
             popover.set_pointing_to(press_rect)
             popover.show()
     return True
Exemplo n.º 17
0
    def __popup_menu(self, widget, xcoordinate=None, ycoordinate=None):
        """
            Popup menu for track
            @param widget as Gtk.Widget
            @param xcoordinate as int (or None)
            @param ycoordinate as int (or None)
        """
        def on_closed(widget):
            self.get_style_context().remove_class("track-menu-selected")
            self.set_indicator()
            # Event happens before Gio.Menu activation
            GLib.idle_add(self._check_track)

        from lollypop.pop_menu import TrackMenuPopover, RemoveMenuPopover
        if self.get_state_flags() & Gtk.StateFlags.SELECTED:
            # Get all selected rows
            rows = [self]
            r = self.previous_row
            while r is not None:
                if r.get_state_flags() & Gtk.StateFlags.SELECTED:
                    rows.append(r)
                r = r.previous_row
            r = self.next_row
            while r is not None:
                if r.get_state_flags() & Gtk.StateFlags.SELECTED:
                    rows.append(r)
                r = r.next_row
            popover = RemoveMenuPopover(rows)
        else:
            popover = TrackMenuPopover(self._track, self._get_menu())
        if xcoordinate is not None and ycoordinate is not None:
            rect = widget.get_allocation()
            rect.x = xcoordinate
            rect.y = ycoordinate
            rect.width = rect.height = 1
            popover.set_pointing_to(rect)
        popover.set_relative_to(widget)
        popover.connect("closed", on_closed)
        self.get_style_context().add_class("track-menu-selected")
        popover.popup()
Exemplo n.º 18
0
 def __on_button_press(self, widget, event):
     """
         Store pressed button
         @param widget as Gtk.ListBox
         @param event as Gdk.EventButton
     """
     rect = widget.get_allocation()
     rect.x = event.x
     rect.y = event.y
     rect.width = rect.height = 1
     row = widget.get_row_at_y(event.y)
     # Internal track/album
     if event.button != 1 and row.id is not None:
         if row.is_track:
             track = Track(row.id)
             popover = TrackMenuPopover(track,
                                        TrackMenu(track))
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
Exemplo n.º 19
0
 def _on_button_press(self, button, event):
     """
         Show track menu
         @param button as Gtk.Button
         @param event as Gdk.Event
     """
     # Remove this the day X11 is dead!
     allocation = self.get_allocation()
     if allocation.height < WindowSize.SMALL - 50:
         return
     if Lp().player.current_track.id is not None:
         if event.button != 1 and Lp().player.current_track.id >= 0:
             popover = TrackMenuPopover(
                         Lp().player.current_track.id,
                         PopToolbarMenu(Lp().player.current_track.id))
             popover.set_relative_to(self)
             press_rect = Gdk.Rectangle()
             press_rect.x = event.x
             press_rect.y = event.y
             press_rect.width = press_rect.height = 1
             popover.set_pointing_to(press_rect)
             popover.show()
     return True
Exemplo n.º 20
0
 def _on_button_release_event(self, button, event):
     """
         Show track menu
         @param button as Gtk.Button
         @param event as Gdk.Event
     """
     height = App().window.get_size()[1]
     if App().player.current_track.id is not None and\
             height > Sizing.MEDIUM:
         if App().player.current_track.id == Type.RADIOS:
             pass
         elif App().player.current_track.id is not None:
             if event.button == 1:
                 App().window.container.show_view(Type.INFO)
             elif App().player.current_track.id >= 0:
                 from lollypop.pop_menu import TrackMenuPopover, ToolbarMenu
                 popover = TrackMenuPopover(
                     App().player.current_track,
                     ToolbarMenu(App().player.current_track))
                 popover.set_relative_to(self)
                 popover.popup()
     return True
Exemplo n.º 21
0
 def _on_button_press(self, widget, event):
     """
         Store pressed button
         @param widget as Gtk.ListBox
         @param event as Gdk.EventButton
     """
     if event.button != 1 and\
        Gtk.get_minor_version() > 16:
         rect = widget.get_allocation()
         rect.x = event.x
         rect.y = event.y
         rect.width = rect.height = 1
         row = widget.get_row_at_y(event.y)
         if row.is_track:
             popover = TrackMenuPopover(row.id, TrackMenu(row.id))
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
         else:
             popover = AlbumPopoverWidget(row.id, None)
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
Exemplo n.º 22
0
 def _on_button_press(self, widget, event):
     """
         Store pressed button
         @param widget as Gtk.ListBox
         @param event as Gdk.EventButton
     """
     if event.button != 1 and Gtk.get_minor_version() > 16:
         rect = widget.get_allocation()
         rect.x = event.x
         rect.y = event.y
         rect.width = rect.height = 1
         row = widget.get_row_at_y(event.y)
         if row.is_track:
             popover = TrackMenuPopover(row.id, TrackMenu(row.id))
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
         else:
             popover = AlbumPopoverWidget(row.id, None)
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
Exemplo n.º 23
0
 def _on_button_press(self, widget, event):
     """
         Store pressed button
         @param widget as Gtk.ListBox
         @param event as Gdk.EventButton
     """
     if event.button != 1:
         rect = widget.get_allocation()
         rect.x = event.x
         rect.y = event.y
         rect.width = rect.height = 1
         row = widget.get_row_at_y(event.y)
         if row.is_track():
             popover = TrackMenuPopover(row.get_id(),
                                        TrackMenu(row.get_id()))
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()
         else:
             popover = AlbumPopover(row.get_id(), [],
                                    row.get_artist_ids())
             popover.set_relative_to(widget)
             popover.set_pointing_to(rect)
             popover.show()