def _show_overlay_func(self, set): """ Set overlay @param set as bool """ if self._lock_overlay or\ self._show_overlay == set or\ (set is True and Lp().player.locked): return if set: # Play button self._play_event = Gtk.EventBox() self._play_event.set_property('has-tooltip', True) self._play_event.set_tooltip_text(_("Play")) self._play_event.set_hexpand(True) self._play_event.set_property('valign', Gtk.Align.CENTER) self._play_event.set_property('halign', Gtk.Align.CENTER) self._play_event.connect('realize', self._on_eventbox_realize) self._play_event.connect('button-press-event', self._on_play_press_event) self._play_button = Gtk.Image.new_from_icon_name( 'media-playback-start-symbolic', Gtk.IconSize.DND) self._play_button.set_opacity(0) # Edit button self._artwork_event = Gtk.EventBox() self._artwork_event.set_margin_bottom(5) self._artwork_event.set_margin_end(5) self._artwork_event.set_property('has-tooltip', True) self._artwork_event.set_tooltip_text(_("Modify radio")) self._artwork_event.set_property('halign', Gtk.Align.END) self._artwork_event.connect('realize', self._on_eventbox_realize) self._artwork_event.connect('button-press-event', self._on_edit_press_event) self._artwork_event.set_property('valign', Gtk.Align.END) self._artwork_event.set_property('halign', Gtk.Align.END) self._artwork_button = Gtk.Image.new_from_icon_name( 'document-properties-symbolic', Gtk.IconSize.BUTTON) self._artwork_button.set_opacity(0) self._play_event.add(self._play_button) self._artwork_event.add(self._artwork_button) self._overlay.add_overlay(self._play_event) self._overlay.add_overlay(self._artwork_event) self._overlay.show_all() AlbumWidget._show_overlay_func(self, True) else: AlbumWidget._show_overlay_func(self, False) self._play_event.destroy() self._play_event = None self._play_button.destroy() self._play_button = None self._artwork_event.destroy() self._artwork_event = None self._artwork_button.destroy() self._artwork_button = None
def _show_overlay_func(self, set): """ Set overlay @param set as bool """ if self._lock_overlay or\ self._show_overlay == set: return if set: # Play button self._play_event = Gtk.EventBox() self._play_event.set_property('has-tooltip', True) self._play_event.set_tooltip_text(_("Play")) self._play_event.connect('realize', self._on_eventbox_realize) self._play_event.connect('button-press-event', self._on_play_press_event) self._play_button = Gtk.Image.new_from_icon_name( 'media-playback-start-symbolic', Gtk.IconSize.BUTTON) self._play_button.set_opacity(0) # Play all button self._play_all_event = Gtk.EventBox() self._play_all_event.set_property('has-tooltip', True) self._play_all_event.set_tooltip_text(_("Play albums")) self._play_all_event.set_property('halign', Gtk.Align.END) self._play_all_event.connect('realize', self._on_eventbox_realize) self._play_all_event.connect('button-press-event', self.__on_play_all_press_event) self._play_all_button = Gtk.Image.new() self._play_all_button.set_opacity(0) # Artwork button self._artwork_event = Gtk.EventBox() self._artwork_event.set_property('has-tooltip', True) self._artwork_event.set_tooltip_text(_("Change artwork")) self._artwork_event.set_property('halign', Gtk.Align.END) self._artwork_event.connect('realize', self._on_eventbox_realize) self._artwork_event.connect('button-press-event', self._on_artwork_press_event) self._artwork_button = Gtk.Image.new_from_icon_name( 'image-x-generic-symbolic', Gtk.IconSize.BUTTON) self._artwork_button.set_opacity(0) # Action button self._action_event = Gtk.EventBox() self._action_event.set_property('has-tooltip', True) self._action_event.set_property('halign', Gtk.Align.END) self._action_event.connect('realize', self._on_eventbox_realize) self._action_event.connect('button-press-event', self._on_action_press_event) self._action_button = Gtk.Image.new() self._action_button.set_opacity(0) self.__overlay_grid.set_orientation(self._overlay_orientation) if self._overlay_orientation == Gtk.Orientation.VERTICAL: self._play_event.set_hexpand(False) self._play_event.set_vexpand(True) self._play_event.set_property('halign', Gtk.Align.END) self._play_event.set_property('valign', Gtk.Align.START) self.__overlay_grid.set_property('valign', Gtk.Align.FILL) self.__overlay_grid.set_property('halign', Gtk.Align.END) else: self._play_event.set_hexpand(True) self._play_event.set_vexpand(False) self._play_event.set_property('halign', Gtk.Align.START) self._play_event.set_property('valign', Gtk.Align.END) self.__overlay_grid.set_property('halign', Gtk.Align.FILL) self.__overlay_grid.set_property('valign', Gtk.Align.END) self._play_event.add(self._play_button) self._play_all_event.add(self._play_all_button) self._artwork_event.add(self._artwork_button) self._action_event.add(self._action_button) self.__overlay_grid.add(self._play_event) self.__overlay_grid.add(self._play_all_event) self.__overlay_grid.add(self._action_event) self.__overlay_grid.add(self._artwork_event) self.__overlay_grid.show_all() AlbumWidget._show_overlay_func(self, True) else: AlbumWidget._show_overlay_func(self, False) self._play_event.destroy() self._play_event = None self._play_button.destroy() self._play_button = None self._play_all_event.destroy() self._play_all_event = None self._play_all_button.destroy() self._play_all_button = None self._action_event.destroy() self._action_event = None self._action_button.destroy() self._action_button = None self._artwork_event.destroy() self._artwork_event = None self._artwork_button.destroy() self._artwork_button = None