Ejemplo n.º 1
0
 def __init__(self, radios):
     """
         Init helper
         @param radios as Radios
     """
     OverlayHelper.__init__(self)
     self.__radios = radios
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param show_overlay as bool
     """
     if self._lock_overlay or self._show_overlay == show_overlay:
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         # Play button
         self.__play_button = Gtk.Button.new_from_icon_name(
             "media-playback-start-symbolic",
             Gtk.IconSize.INVALID)
         self.__play_button.set_tooltip_text(_("Play"))
         self.__play_button.get_image().set_pixel_size(self._pixel_size +
                                                       20)
         self.__play_button.set_property("has-tooltip", True)
         self._big_grid.set_margin_bottom(10)
         self._big_grid.set_margin_start(10)
         self.__play_button.connect("realize", on_realize)
         self.__play_button.connect("clicked", self.__on_play_clicked)
         self.__play_button.show()
         self._big_grid.add(self.__play_button)
         self.__play_button.get_style_context().add_class(
             "overlay-button-rounded")
     else:
         self.__play_button.destroy()
         self.__play_button = None
Ejemplo n.º 3
0
 def __init__(self, item_ids):
     """
         Init widget
         @param decade as [int]
     """
     OverlayHelper.__init__(self)
     decade_str = "%s - %s" % (item_ids[0], item_ids[-1])
     RoundedAlbumsWidget.__init__(self, item_ids, decade_str, decade_str)
Ejemplo n.º 4
0
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param set as bool
     """
     if self._lock_overlay or\
             self._show_overlay == show_overlay or\
             (App().player.is_locked and show_overlay):
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         # Play button
         self.__play_button = Gtk.Button.new_from_icon_name(
             "media-playback-start-symbolic", Gtk.IconSize.INVALID)
         self.__play_button.set_margin_start(6)
         self.__play_button.set_margin_bottom(6)
         self.__play_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__play_button.set_property("has-tooltip", True)
         self.__play_button.set_tooltip_text(_("Play"))
         self.__play_button.set_hexpand(True)
         self.__play_button.set_property("valign", Gtk.Align.END)
         self.__play_button.set_property("halign", Gtk.Align.START)
         self.__play_button.connect("realize", self._on_realize)
         self.__play_button.connect("clicked", self.__on_play_clicked)
         self.__play_button.get_image().set_pixel_size(
             OverlayHelper._pixel_size + 20)
         # Edit button
         self.__artwork_button = Gtk.Button.new_from_icon_name(
             "document-properties-symbolic", Gtk.IconSize.INVALID)
         self.__artwork_button.get_image().set_pixel_size(
             OverlayHelper._pixel_size)
         self.__artwork_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__artwork_button.set_property("has-tooltip", True)
         self.__artwork_button.set_tooltip_text(_("Modify radio"))
         self.__artwork_button.connect("realize", self._on_realize)
         self.__artwork_button.connect("clicked", self.__on_edit_clicked)
         self.__overlay_grid = Gtk.Grid()
         self.__overlay_grid.set_margin_bottom(6)
         self.__overlay_grid.set_margin_end(6)
         self.__overlay_grid.set_property("halign", Gtk.Align.END)
         self.__overlay_grid.set_property("valign", Gtk.Align.END)
         self.__overlay_grid.add(self.__artwork_button)
         self._overlay.add_overlay(self.__overlay_grid)
         self._overlay.add_overlay(self.__play_button)
         self._overlay.show_all()
         self.__play_button.get_style_context().add_class("rounded-icon")
         self.__artwork_button.get_style_context().add_class(
             "overlay-button")
         self.__overlay_grid.get_style_context().add_class(
             "squared-icon-small")
     else:
         self.__play_button.destroy()
         self.__play_button = None
         self.__artwork_button.destroy()
         self.__artwork_button = None
         self.__overlay_grid.destroy()
         self.__overlay_grid = None
Ejemplo n.º 5
0
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param show_overlay as bool
     """
     if self._lock_overlay or\
             self._show_overlay == show_overlay or\
             App().player.is_locked:
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         # Play button
         self.__play_button = Gtk.Button.new_from_icon_name(
             "media-playback-start-symbolic",
             Gtk.IconSize.INVALID)
         self.__play_button.set_tooltip_text(_("Play"))
         self.__play_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__play_button.get_image().set_pixel_size(
             AlbumsDecadeWidget._pixel_size + 20)
         self.__play_button.set_property("has-tooltip", True)
         self.__play_button.set_hexpand(True)
         self.__play_button.set_property("valign", Gtk.Align.CENTER)
         self.__play_button.set_property("halign", Gtk.Align.CENTER)
         self.__play_button.connect("realize", self._on_realize)
         self.__play_button.connect("clicked", self.__on_play_clicked)
         # Open button
         self.__open_button = Gtk.Button.new_from_icon_name(
             "folder-open-symbolic",
             Gtk.IconSize.INVALID)
         self.__open_button.get_image().set_pixel_size(
             AlbumsDecadeWidget._pixel_size)
         self.__open_button.set_property("has-tooltip", True)
         self.__open_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__open_button.set_tooltip_text(_("Open"))
         self.__open_button.connect("realize", self._on_realize)
         self.__open_button.connect("clicked", self.__on_open_clicked)
         self.__overlay_grid = Gtk.Grid()
         self.__overlay_grid.set_property("halign", Gtk.Align.CENTER)
         self.__overlay_grid.set_property("valign", Gtk.Align.END)
         self.__overlay_grid.set_margin_bottom(10)
         self.__overlay_grid.add(self.__open_button)
         self._overlay.add_overlay(self.__overlay_grid)
         self._overlay.add_overlay(self.__play_button)
         self._overlay.show_all()
         self.__play_button.get_style_context().add_class("rounded-icon")
         self.__open_button.get_style_context().add_class("overlay-button")
         self.__overlay_grid.get_style_context().add_class(
             "squared-icon-small")
     else:
         self.__play_button.destroy()
         self.__play_button = None
         self.__open_button.destroy()
         self.__open_button = None
         self.__overlay_grid.destroy()
         self.__overlay_grid = None
Ejemplo n.º 6
0
 def __init__(self, view_type=ViewType.DEFAULT):
     """
         Init helper
         @param view_type as ViewType
     """
     OverlayHelper.__init__(self)
     if view_type & ViewType.SMALL:
         self.__play_pixel_size = -1
     elif view_type & ViewType.MEDIUM:
         self.__play_pixel_size = self._pixel_size
     elif not view_type & ViewType.ALBUM:
         self.__play_pixel_size = self._pixel_size + 20
     else:
         self.__play_pixel_size = self._pixel_size
Ejemplo n.º 7
0
 def __init__(self, radio_id, radios):
     """
         Init radio widget
         @param radio_id as int
         @param label_height as int
         @param radios as Radios
     """
     Gtk.FlowBoxChild.__init__(self)
     OverlayHelper.__init__(self)
     self._widget = None
     self.__art_size = 120\
         if App().window.is_adaptive\
         else ArtSize.BIG
     self.set_size_request(self.__art_size,
                           self.__art_size + self.LABEL_HEIGHT)
     self.__radio_id = radio_id
     self.__radios = radios
 def __init__(self, playlist_id, obj):
     """
         Init widget
         @param playlist_id as playlist_id
         @param obj as Track/Album
     """
     OverlayHelper.__init__(self)
     name = sortname = App().playlists.get_name(playlist_id)
     RoundedAlbumsWidget.__init__(self, playlist_id, name, sortname)
     self.__track_ids = []
     self.__obj = obj
     if obj is not None:
         if isinstance(obj, Album) or\
                 isinstance(obj, Disc):
             self.__add = not App().playlists.exists_album(playlist_id, obj)
         else:
             self.__add = not App().playlists.exists_track(
                 playlist_id, obj.uri)
Ejemplo n.º 9
0
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param show_overlay as bool
     """
     if self._lock_overlay or self._show_overlay == show_overlay:
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         if self.__play_pixel_size > 0:
             # Play button
             self.__play_button = Gtk.Button.new_from_icon_name(
                 "media-playback-start-symbolic", Gtk.IconSize.INVALID)
             self.__play_button.get_image().set_pixel_size(
                 self.__play_pixel_size)
             self.__play_button.set_property("has-tooltip", True)
             self.__play_button.set_tooltip_text(_("Play"))
             self.__play_button.connect("realize", on_realize)
             self.__play_button.connect("clicked", self.__on_play_clicked)
             self.__play_button.show()
             self._big_grid.add(self.__play_button)
             self.__play_button.get_style_context().add_class(
                 "overlay-button-rounded")
         # Action button
         self.__action_button = Gtk.Button.new()
         self.__action_button.set_property("has-tooltip", True)
         self.__action_button.connect("realize", on_realize)
         self.__action_button.connect("clicked", self.__on_action_clicked)
         self.__action_button.set_image(Gtk.Image())
         self.__action_button.get_image().set_pixel_size(self._pixel_size)
         self._show_append(self._album.id not in App().player.album_ids)
         self.__action_button.show()
         self._small_grid.add(self.__action_button)
         self.__action_button.get_style_context().add_class(
             "overlay-button")
     else:
         if self.__play_pixel_size > 0:
             self.__play_button.destroy()
             self.__play_button = None
         self.__action_button.destroy()
         self.__action_button = None
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param show_overlay as bool
     """
     if self._lock_overlay or\
             self._show_overlay == show_overlay or\
             App().player.is_locked:
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         # Play button
         if self.__obj is None:
             self.__play_button = Gtk.Button.new_from_icon_name(
                 "media-playback-start-symbolic", Gtk.IconSize.INVALID)
             self.__play_button.set_tooltip_text(_("Play"))
         elif self.__add:
             # Special case, we are in add to playlist mode
             self.__play_button = Gtk.Button.new_from_icon_name(
                 "list-add-symbolic", Gtk.IconSize.INVALID)
             self.__play_button.set_tooltip_text(_("Add"))
         else:
             # Special case, we are in remove from playlist mode
             self.__play_button = Gtk.Button.new_from_icon_name(
                 "list-remove-symbolic", Gtk.IconSize.INVALID)
             self.__play_button.set_tooltip_text(_("Remove"))
         self.__play_button.set_property("has-tooltip", True)
         self.__play_button.set_hexpand(True)
         self.__play_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__play_button.set_property("valign", Gtk.Align.CENTER)
         self.__play_button.set_property("halign", Gtk.Align.CENTER)
         self.__play_button.connect("realize", self._on_realize)
         self.__play_button.connect("clicked", self.__on_play_clicked)
         self.__play_button.get_image().set_pixel_size(
             PlaylistRoundedWidget._pixel_size + 20)
         # Open button
         self.__open_button = Gtk.Button.new_from_icon_name(
             "folder-open-symbolic", Gtk.IconSize.INVALID)
         self.__open_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__open_button.set_property("has-tooltip", True)
         self.__open_button.set_tooltip_text(_("Open"))
         self.__open_button.connect("realize", self._on_realize)
         self.__open_button.connect("clicked", self.__on_open_clicked)
         self.__open_button.get_image().set_pixel_size(
             PlaylistRoundedWidget._pixel_size)
         # Edit button
         self.__edit_button = Gtk.Button.new_from_icon_name(
             "document-properties-symbolic", Gtk.IconSize.INVALID)
         self.__edit_button.set_relief(Gtk.ReliefStyle.NONE)
         self.__edit_button.set_property("has-tooltip", True)
         self.__edit_button.set_tooltip_text(_("Modify playlist"))
         self.__edit_button.connect("realize", self._on_realize)
         self.__edit_button.connect("clicked", self.__on_edit_clicked)
         self.__edit_button.get_image().set_pixel_size(
             PlaylistRoundedWidget._pixel_size)
         self._overlay.add_overlay(self.__play_button)
         self.__overlay_grid = Gtk.Grid()
         self.__overlay_grid.set_property("valign", Gtk.Align.END)
         self.__overlay_grid.set_margin_bottom(10)
         self.__overlay_grid.set_property("halign", Gtk.Align.CENTER)
         self.__overlay_grid.add(self.__open_button)
         self.__overlay_grid.add(self.__edit_button)
         self._overlay.add_overlay(self.__overlay_grid)
         self._overlay.show_all()
         self.__play_button.get_style_context().add_class("rounded-icon")
         self.__open_button.get_style_context().add_class("overlay-button")
         self.__edit_button.get_style_context().add_class("overlay-button")
         self.__overlay_grid.get_style_context().add_class(
             "squared-icon-small")
     else:
         self.__overlay_grid.destroy()
         self.__play_button.destroy()
         self.__play_button = None
         self.__open_button.destroy()
         self.__open_button = None
         self.__edit_button.destroy()
         self.__edit_button = None
         self.__overlay_grid.destroy()
         self.__overlay_grid = None
Ejemplo n.º 11
0
 def _show_overlay_func(self, show_overlay):
     """
         Set overlay
         @param show_overlay as bool
     """
     if self._lock_overlay or self._show_overlay == show_overlay:
         return
     OverlayHelper._show_overlay_func(self, show_overlay)
     if show_overlay:
         # Play button
         if self._obj is None:
             self.__play_button = Gtk.Button.new_from_icon_name(
                 "media-playback-start-symbolic",
                 Gtk.IconSize.INVALID)
             self.__play_button.set_tooltip_text(_("Play"))
             self._big_grid.set_margin_bottom(10)
             self._big_grid.set_margin_start(10)
         else:
             self._big_grid.set_property("valign", Gtk.Align.CENTER)
             self._big_grid.set_property("halign", Gtk.Align.CENTER)
             if self._add:
                 # Special case, we are in add to playlist mode
                 self.__play_button = Gtk.Button.new_from_icon_name(
                     "list-add-symbolic",
                     Gtk.IconSize.INVALID)
                 self.__play_button.set_tooltip_text(_("Add"))
             else:
                 # Special case, we are in remove from playlist mode
                 self.__play_button = Gtk.Button.new_from_icon_name(
                     "list-remove-symbolic",
                     Gtk.IconSize.INVALID)
                 self.__play_button.set_tooltip_text(_("Remove"))
         self.__play_button.set_property("has-tooltip", True)
         self.__play_button.connect("realize", on_realize)
         self.__play_button.connect("button-release-event",
                                    self.__on_play_button_release_event)
         self.__play_button.get_image().set_pixel_size(self._pixel_size +
                                                       20)
         self.__play_button.show()
         # Edit button
         self.__edit_button = Gtk.Button.new_from_icon_name(
             "document-properties-symbolic",
             Gtk.IconSize.INVALID)
         self.__edit_button.set_property("has-tooltip", True)
         self.__edit_button.set_tooltip_text(_("Modify playlist"))
         self.__edit_button.connect("realize", on_realize)
         self.__edit_button.connect("button-release-event",
                                    self.__on_edit_button_release_event)
         self.__edit_button.get_image().set_pixel_size(self._pixel_size)
         self.__edit_button.show()
         self._big_grid.add(self.__play_button)
         self._small_grid.set_margin_bottom(10)
         self._small_grid.set_margin_end(25)
         self._small_grid.add(self.__edit_button)
         self.__play_button.get_style_context().add_class(
             "overlay-button-rounded")
         self.__edit_button.get_style_context().add_class("overlay-button")
         self._small_grid.get_style_context().add_class(
             "squared-icon-small")
     else:
         self.__play_button.destroy()
         self.__play_button = None
         self.__edit_button.destroy()
         self.__edit_button = None
Ejemplo n.º 12
0
 def __init__(self):
     """
         Init helper
     """
     OverlayHelper.__init__(self)