fixup! Port UI to GTK 4
This commit is contained in:
parent
8359143663
commit
15f8f67de9
11 changed files with 642 additions and 145 deletions
|
|
@ -10,7 +10,7 @@ gi.require_version('Adw', '1')
|
|||
from gi.repository import Gio, Gtk, Gdk, GLib, Adw
|
||||
|
||||
from .window import Window
|
||||
from .infodialog import InfoDialog
|
||||
#from .infodialog import InfoDialog
|
||||
|
||||
|
||||
|
||||
|
|
@ -50,10 +50,12 @@ class Application(Gtk.Application):
|
|||
|
||||
|
||||
def on_menu_info(self, action, value):
|
||||
if not self._info_dialog:
|
||||
self._info_dialog = InfoDialog()
|
||||
self._info_dialog.run()
|
||||
self._info_dialog.hide()
|
||||
# FIXME Info dialog
|
||||
#if not self._info_dialog:
|
||||
# self._info_dialog = InfoDialog()
|
||||
#self._info_dialog.run()
|
||||
#self._info_dialog.hide()
|
||||
pass
|
||||
|
||||
|
||||
def on_menu_quit(self, action, value):
|
||||
|
|
@ -97,9 +99,10 @@ class Application(Gtk.Application):
|
|||
|
||||
def _load_appmenu(self):
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(Application.DOMAIN)
|
||||
builder.add_from_resource(self._get_resource_path('ui/gtk.menu.ui'))
|
||||
self.set_app_menu(builder.get_object('app-menu'))
|
||||
# FIXME Handle menu
|
||||
#builder.set_translation_domain(Application.DOMAIN)
|
||||
#builder.add_from_resource(self._get_resource_path('ui/gtk.menu.ui'))
|
||||
#self.set_app_menu(builder.get_object('app-menu'))
|
||||
|
||||
|
||||
def _get_resource_path(self, path):
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
self._icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
|
||||
self._fullscreened = False
|
||||
self._current_size = None
|
||||
self._cover_pixbuf = self._get_default_image()
|
||||
#self._cover_pixbuf = self._get_default_image()
|
||||
|
||||
# Widgets
|
||||
self.cover_stack.set_visible_child(self.cover_scroll)
|
||||
|
|
@ -72,10 +72,11 @@ class CoverPanel(Gtk.Overlay):
|
|||
pass
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def on_cover_box_pressed(self, widget, event):
|
||||
if self._current_album and event.type == Gdk.EventType._2BUTTON_PRESS:
|
||||
self.emit('toggle-fullscreen')
|
||||
# FIXME on_cover_box_pressed()
|
||||
#@Gtk.Template.Callback()
|
||||
#def on_cover_box_pressed(self, widget, event):
|
||||
# if self._current_album and event.type == Gdk.EventType._2BUTTON_PRESS:
|
||||
# self.emit('toggle-fullscreen')
|
||||
|
||||
|
||||
def set_width(self, width):
|
||||
|
|
@ -83,14 +84,15 @@ class CoverPanel(Gtk.Overlay):
|
|||
self.cover_info_scroll.set_max_content_width(width // 2)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def on_songs_start_change(self, widget, event):
|
||||
if self._timer:
|
||||
GObject.source_remove(self._timer)
|
||||
self._timer = None
|
||||
# FIXME on_songs_start_change()
|
||||
#@Gtk.Template.Callback()
|
||||
#def on_songs_start_change(self, widget, event):
|
||||
# if self._timer:
|
||||
# GObject.source_remove(self._timer)
|
||||
# self._timer = None
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_songs_change(self, widget, event):
|
||||
value = int(self.songs_scale.get_value())
|
||||
time = self._current_album.get_length()
|
||||
|
|
@ -170,6 +172,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
else:
|
||||
# Reset image
|
||||
self._cover_pixbuf = self._get_default_image()
|
||||
self._cover_pixbuf = None
|
||||
self._current_size = None
|
||||
self._current_cover_album = album
|
||||
# Show image
|
||||
|
|
@ -228,6 +231,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
"""Diese Methode skaliert das geladene Bild aus dem Pixelpuffer
|
||||
auf die Größe des Fensters unter Beibehalt der Seitenverhältnisse
|
||||
"""
|
||||
# FIXME Get size
|
||||
size_width = self.cover_stack.get_size(Gtk.Orientation.HORIZONTAL)
|
||||
size_height = self.cover_stack.get_size(Gtk.Orientation.HORIZONTAL)
|
||||
# Abort if size is the same
|
||||
|
|
@ -254,5 +258,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
height = int(math.floor(pixbuf.get_height()*ratio))
|
||||
if width <= 0 or height <= 0:
|
||||
return
|
||||
# FIXME Pixelpuffer auf Oberfläche zeichnen
|
||||
#self.cover_image.set_allocation(self.cover_scroll.get_allocation())
|
||||
self.cover_image.set_from_pixbuf(pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.HYPER))
|
||||
self.cover_image.show()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,17 @@ from mcg.utils import GridItem
|
|||
class LibraryPanel(Adw.Bin):
|
||||
__gtype_name__ = 'McgLibraryPanel'
|
||||
__gsignals__ = {
|
||||
'open-standalone': (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
'close-standalone': (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
'update': (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
'play': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
|
||||
'queue': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
|
||||
'queue-multiple': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'item-size-changed': (GObject.SIGNAL_RUN_FIRST, None, (int,)),
|
||||
'sort-order-changed': (GObject.SIGNAL_RUN_FIRST, None, (int,)),
|
||||
'sort-type-changed': (GObject.SIGNAL_RUN_FIRST, None, (Gtk.SortType,)),
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
|
||||
|
||||
'select': (GObject.SIGNAL_RUN_FIRST, None, (bool,)),
|
||||
'toggle-search': (GObject.SIGNAL_RUN_FIRST, None, (bool,)),
|
||||
'update': (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
|
|
@ -33,6 +44,7 @@ class LibraryPanel(Adw.Bin):
|
|||
'sort-type': (GObject.SIGNAL_RUN_FIRST, None, (Gtk.SortType,))
|
||||
}
|
||||
|
||||
|
||||
# Widgets
|
||||
panel_standalone = Gtk.Template.Child()
|
||||
actionbar_revealer = Gtk.Template.Child()
|
||||
|
|
@ -86,27 +98,30 @@ class LibraryPanel(Adw.Bin):
|
|||
self._is_selected = False
|
||||
|
||||
# Widgets
|
||||
self._toolbar = LibraryToolbar(self._item_size)
|
||||
self._toolbar.connect('select', self.on_toolbar_select)
|
||||
self._toolbar.connect('toggle-search', self.on_toolbar_toggle_search)
|
||||
self._toolbar.connect('update', self.on_toolbar_update)
|
||||
self._toolbar.connect('start-scale', self.on_toolbar_scale)
|
||||
self._toolbar.connect('end-scale', self.on_toolbar_scaled)
|
||||
self._toolbar.connect('sort', self.on_toolbar_sort)
|
||||
self._toolbar.connect('sort-type', self.on_toolbar_sort_type)
|
||||
# FIXME Toolbar signals
|
||||
#self._toolbar.connect('select', self.on_toolbar_select)
|
||||
#self._toolbar.connect('toggle-search', self.on_toolbar_toggle_search)
|
||||
#self._toolbar.connect('update', self.on_toolbar_update)
|
||||
#self._toolbar.connect('start-scale', self.on_toolbar_scale)
|
||||
#self._toolbar.connect('end-scale', self.on_toolbar_scaled)
|
||||
#self._toolbar.connect('sort', self.on_toolbar_sort)
|
||||
#self._toolbar.connect('sort-type', self.on_toolbar_sort_type)
|
||||
# Header bar
|
||||
self._headerbar_standalone = AlbumHeaderbar()
|
||||
self._headerbar_standalone.connect('close', self.on_standalone_close_clicked)
|
||||
# Progress Bar
|
||||
self.progress_image.set_from_pixbuf(self._get_default_image())
|
||||
# Library Grid: Model
|
||||
self._library_grid_model = Gio.ListStore()
|
||||
self._library_grid_selection = Gtk.MultiSelection.new(self._library_grid_model)
|
||||
self._library_grid_filter = self._library_grid_selection
|
||||
# Library Grid
|
||||
self.library_grid.set_model(self._library_grid_filter)
|
||||
self.library_grid.set_pixbuf_column(0)
|
||||
self.library_grid.set_text_column(-1)
|
||||
self.library_grid.set_tooltip_column(1)
|
||||
# Toolbar menu
|
||||
self.grid_scale.set_value(self._item_size)
|
||||
self._toolbar_sort_buttons = {
|
||||
SortOrder.ARTIST: self.sort_artist,
|
||||
SortOrder.TITLE: self.sort_title,
|
||||
SortOrder.YEAR: self.sort_year
|
||||
}
|
||||
|
||||
|
||||
def get_headerbar_standalone(self):
|
||||
|
|
@ -121,7 +136,52 @@ class LibraryPanel(Adw.Bin):
|
|||
self._is_selected = selected
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_select_toggled(self, widget):
|
||||
self.emit('select', widget.get_active())
|
||||
|
||||
|
||||
#@Gtk.Template.Callback()
|
||||
def on_search_toggled(self, widget):
|
||||
self.emit('toggle-search', widget.get_active())
|
||||
|
||||
|
||||
#@Gtk.Template.Callback()
|
||||
def on_update_clicked(self, widget):
|
||||
self.emit('update')
|
||||
|
||||
|
||||
# FXME on_grid_scale_changed
|
||||
#@Gtk.Template.Callback()
|
||||
def on_grid_scale_change(self, widget, scroll, value):
|
||||
self.emit('start-scale', value)
|
||||
|
||||
|
||||
# FXME on_grid_scale_changed
|
||||
#@Gtk.Template.Callback()
|
||||
def on_grid_scale_changed(self, widget, event):
|
||||
self.emit('end-scale', self.grid_scale.get_value())
|
||||
self.toolbar_popover.popdown()
|
||||
|
||||
|
||||
#@Gtk.Template.Callback()
|
||||
def on_sort_toggled(self, widget):
|
||||
if widget.get_active():
|
||||
sort = [key for key, value in self._toolbar_sort_buttons.items() if value is widget][0]
|
||||
self.emit('sort', sort)
|
||||
|
||||
|
||||
#@Gtk.Template.Callback()
|
||||
def on_sort_order_toggled(self, button):
|
||||
if button.get_active():
|
||||
sort_type = Gtk.SortType.DESCENDING
|
||||
else:
|
||||
sort_type = Gtk.SortType.ASCENDING
|
||||
self.emit('sort-type', sort_type)
|
||||
|
||||
|
||||
# FIXME on_resize()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_resize(self, widget, event):
|
||||
new_allocation = (widget.get_allocation().width, widget.get_allocation().height)
|
||||
if new_allocation == self._allocation:
|
||||
|
|
@ -169,7 +229,7 @@ class LibraryPanel(Adw.Bin):
|
|||
if size < range.get_lower() or size > range.get_upper():
|
||||
return
|
||||
self._item_size = size
|
||||
GObject.idle_add(self.library_grid.set_item_padding, size / 100)
|
||||
#GObject.idle_add(self.library_grid.set_item_padding, size / 100)
|
||||
GObject.idle_add(self._set_widget_grid_size, self.library_grid, size, True)
|
||||
|
||||
|
||||
|
|
@ -189,23 +249,24 @@ class LibraryPanel(Adw.Bin):
|
|||
|
||||
def on_toolbar_sort_type(self, widget, sort_type):
|
||||
self._sort_type = sort_type
|
||||
self._library_grid_model.set_sort_column_id(2, sort_type)
|
||||
#self._library_grid_model.set_sort_column_id(2, sort_type)
|
||||
self.emit('sort-type-changed', sort_type)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_filter_bar_notify(self, widget, value):
|
||||
if self.toolbar_search_bar.get_active() is not self.filter_bar.get_search_mode():
|
||||
self.toolbar_search_bar.set_active(self.filter_bar.get_search_mode())
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_filter_entry_changed(self, widget):
|
||||
self._filter_string = self.filter_entry.get_text()
|
||||
GObject.idle_add(self._library_grid_filter.refilter)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_library_grid_clicked()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_library_grid_clicked(self, widget, path):
|
||||
# Get selected album
|
||||
path = self._library_grid_filter.convert_path_to_child_path(path)
|
||||
|
|
@ -228,7 +289,8 @@ class LibraryPanel(Adw.Bin):
|
|||
self.standalone_spinner.start()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_library_grid_selection_changed()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_library_grid_selection_changed(self, widget):
|
||||
self._selected_albums = []
|
||||
for path in widget.get_selected_items():
|
||||
|
|
@ -246,30 +308,31 @@ class LibraryPanel(Adw.Bin):
|
|||
return album.filter(self._filter_string)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_cancel_clicked(self, widget):
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_add_clicked(self, widget):
|
||||
ids = [album.get_id() for album in self._selected_albums]
|
||||
self.emit('queue-multiple', ids)
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_standalone_scroll_size_allocate()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_scroll_size_allocate(self, widget, allocation):
|
||||
self._resize_standalone_image()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_play_clicked(self, widget):
|
||||
self.emit('play', self._selected_albums[0].get_id())
|
||||
self._close_standalone()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_queue_clicked(self, widget):
|
||||
self.emit('queue', self._selected_albums[0].get_id())
|
||||
self._close_standalone()
|
||||
|
|
@ -373,6 +436,7 @@ class LibraryPanel(Adw.Bin):
|
|||
|
||||
|
||||
def _set_albums(self, host, albums, size):
|
||||
"""
|
||||
if not self._is_selected and albums != self._albums:
|
||||
GObject.idle_add(
|
||||
self.get_parent().child_set_property,
|
||||
|
|
@ -380,15 +444,16 @@ class LibraryPanel(Adw.Bin):
|
|||
'needs-attention',
|
||||
True
|
||||
)
|
||||
"""
|
||||
self._library_lock.acquire()
|
||||
self._library_stop.clear()
|
||||
self._albums = albums
|
||||
GObject.idle_add(self.stack.set_visible_child, self.progress_box)
|
||||
GObject.idle_add(self.progress_bar.set_fraction, 0.0)
|
||||
GObject.idle_add(self.library_grid.set_item_padding, size / 100)
|
||||
#GObject.idle_add(self.library_grid.set_item_padding, size / 100)
|
||||
self.library_grid.set_model(None)
|
||||
self.library_grid.freeze_child_notify()
|
||||
self._library_grid_model.clear()
|
||||
#self.library_grid.freeze_child_notify()
|
||||
self._library_grid_model.remove_all()
|
||||
|
||||
i = 0
|
||||
n = len(albums)
|
||||
|
|
@ -425,8 +490,8 @@ class LibraryPanel(Adw.Bin):
|
|||
return
|
||||
|
||||
self.library_grid.set_model(self._library_grid_filter)
|
||||
self.library_grid.thaw_child_notify()
|
||||
self.library_grid.set_item_width(-1)
|
||||
#self.library_grid.thaw_child_notify()
|
||||
#self.library_grid.set_item_width(-1)
|
||||
self._library_lock.release()
|
||||
self.stack.set_visible_child(self.scroll)
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@ class PlaylistPanel(Adw.Bin):
|
|||
'remove-album': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'remove-multiple-albums': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'play': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,))
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
|
||||
|
||||
'select': (GObject.SIGNAL_RUN_FIRST, None, (bool,)),
|
||||
'clear-playlist': (GObject.SIGNAL_RUN_FIRST, None, ())
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,9 +69,9 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._is_selected = False
|
||||
|
||||
# Widgets
|
||||
self._toolbar = PlaylistToolbar()
|
||||
self._toolbar.connect('select', self.on_toolbar_select)
|
||||
self._toolbar.connect('clear-playlist', self.on_toolbar_clear)
|
||||
# FIXME Toolbar signals
|
||||
#self._toolbar.connect('select', self.on_toolbar_select)
|
||||
#self._toolbar.connect('clear-playlist', self.on_toolbar_clear)
|
||||
# Header bar
|
||||
self._headerbar_standalone = AlbumHeaderbar()
|
||||
self._headerbar_standalone.connect('close', self.on_headerbar_close_clicked)
|
||||
|
|
@ -106,6 +109,19 @@ class PlaylistPanel(Adw.Bin):
|
|||
self.emit('clear-playlist')
|
||||
|
||||
|
||||
# FIXME on_select_toggled()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_select_toggled(self, widget):
|
||||
self.emit('select', widget.get_active())
|
||||
|
||||
|
||||
# FIXME on_clear_clicked()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_clear_clicked(self, widget):
|
||||
if widget is self.playlist_clear_button:
|
||||
self.emit('clear-playlist')
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def on_playlist_grid_clicked(self, widget, position):
|
||||
# Get selected album
|
||||
|
|
@ -115,7 +131,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._selected_albums = [album]
|
||||
self.emit('albumart', id)
|
||||
|
||||
# Show standalone album
|
||||
# FIXME Show standalone album
|
||||
return
|
||||
if widget.get_selection_mode() == Gtk.SelectionMode.SINGLE:
|
||||
# Set labels
|
||||
self._headerbar_standalone.set_album(album)
|
||||
|
|
@ -128,7 +145,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
self.standalone_spinner.start()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_playlist_grid_selection_changed()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_playlist_grid_selection_changed(self, widget):
|
||||
self._selected_albums = []
|
||||
for path in widget.get_selected_items():
|
||||
|
|
@ -137,18 +155,19 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._selected_albums.append(self._playlist_albums[hash])
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_cancel_clicked(self, widget):
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_remove_clicked(self, widget):
|
||||
self.emit('remove-multiple-albums', self._selected_albums)
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_standalone_scroll_size_allocate()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_scroll_size_allocate(self, widget, allocation):
|
||||
self._resize_standalone_image()
|
||||
|
||||
|
|
@ -157,13 +176,13 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._close_standalone()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_remove_clicked(self, widget):
|
||||
self.emit('remove-album', self._selected_albums[0])
|
||||
self._close_standalone()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_play_clicked(self, widget):
|
||||
self.emit('play', self._selected_albums[0])
|
||||
self._close_standalone()
|
||||
|
|
@ -205,6 +224,7 @@ class PlaylistPanel(Adw.Bin):
|
|||
|
||||
|
||||
def _set_playlist(self, host, playlist, size):
|
||||
"""
|
||||
if not self._is_selected and self._playlist != playlist:
|
||||
GObject.idle_add(
|
||||
self.get_parent().child_set_property,
|
||||
|
|
@ -212,6 +232,7 @@ class PlaylistPanel(Adw.Bin):
|
|||
'needs-attention',
|
||||
True
|
||||
)
|
||||
"""
|
||||
self._playlist_lock.acquire()
|
||||
self._playlist_stop.clear()
|
||||
self._playlist = playlist
|
||||
|
|
@ -219,6 +240,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
for album in playlist:
|
||||
self._playlist_albums[album.get_id()] = album
|
||||
self._playlist_grid_model.remove_all()
|
||||
# FIXME Set item padding dynamically?
|
||||
#GObject.idle_add(self.playlist_grid.set_item_padding, size / 100)
|
||||
|
||||
cache = client.MCGCache(host, size)
|
||||
for album in playlist:
|
||||
|
|
@ -248,8 +271,6 @@ class PlaylistPanel(Adw.Bin):
|
|||
return
|
||||
|
||||
self.playlist_grid.set_model(self._playlist_grid_selection)
|
||||
# TODO why set_columns()?
|
||||
#self.playlist_grid.set_columns(len(playlist))
|
||||
self._playlist_lock.release()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import logging
|
|||
from gi.repository import Gtk, Adw, Gdk, GObject, GLib, Gio
|
||||
|
||||
from . import client
|
||||
from .shortcutsdialog import ShortcutsDialog
|
||||
#from .shortcutsdialog import ShortcutsDialog
|
||||
from .connectionpanel import ConnectionPanel
|
||||
from .serverpanel import ServerPanel
|
||||
from .coverpanel import CoverPanel
|
||||
|
|
@ -64,9 +64,9 @@ class Window(Adw.ApplicationWindow):
|
|||
toolbar_stack = Gtk.Template.Child()
|
||||
# Headerbar
|
||||
headerbar = Gtk.Template.Child()
|
||||
headerbar_title_stack = Gtk.Template.Child()
|
||||
#headerbar_title_stack = Gtk.Template.Child()
|
||||
headerbar_panel_switcher = Gtk.Template.Child()
|
||||
headerbar_connection_label = Gtk.Template.Child()
|
||||
#headerbar_connection_label = Gtk.Template.Child()
|
||||
headerbar_button_connect = Gtk.Template.Child()
|
||||
headerbar_button_playpause = Gtk.Template.Child()
|
||||
headerbar_button_volume = Gtk.Template.Child()
|
||||
|
|
@ -86,12 +86,11 @@ class Window(Adw.ApplicationWindow):
|
|||
self._headerbar_connection_button_active = True
|
||||
self._headerbar_playpause_button_active = True
|
||||
|
||||
# Help/Shortcuts dialog
|
||||
self.set_help_overlay(ShortcutsDialog())
|
||||
# FIXME Help/Shortcuts dialog
|
||||
#self.set_help_overlay(ShortcutsDialog())
|
||||
|
||||
# Login screen
|
||||
self._connection_panel = ConnectionPanel()
|
||||
self._panels.append(self._connection_panel)
|
||||
# Server panel
|
||||
self._server_panel = ServerPanel()
|
||||
self._panels.append(self._server_panel)
|
||||
|
|
@ -100,13 +99,13 @@ class Window(Adw.ApplicationWindow):
|
|||
self._panels.append(self._cover_panel)
|
||||
# Playlist panel
|
||||
self._playlist_panel = PlaylistPanel(self._mcg)
|
||||
self._playlist_panel.connect('open-standalone', self.on_panel_open_standalone)
|
||||
self._playlist_panel.connect('close-standalone', self.on_panel_close_standalone)
|
||||
#self._playlist_panel.connect('open-standalone', self.on_panel_open_standalone)
|
||||
#self._playlist_panel.connect('close-standalone', self.on_panel_close_standalone)
|
||||
self._panels.append(self._playlist_panel)
|
||||
# Library panel
|
||||
self._library_panel = LibraryPanel(self._mcg)
|
||||
self._library_panel.connect('open-standalone', self.on_panel_open_standalone)
|
||||
self._library_panel.connect('close-standalone', self.on_panel_close_standalone)
|
||||
#self._library_panel.connect('open-standalone', self.on_panel_open_standalone)
|
||||
#self._library_panel.connect('close-standalone', self.on_panel_close_standalone)
|
||||
self._panels.append(self._library_panel)
|
||||
# Stack
|
||||
self.content_stack.add_child(self._connection_panel)
|
||||
|
|
@ -115,8 +114,8 @@ class Window(Adw.ApplicationWindow):
|
|||
self.panel_stack.add_titled(self._playlist_panel, 'playlist-panel', locale.gettext("Playlist"))
|
||||
self.panel_stack.add_titled(self._library_panel, 'library-panel', locale.gettext("Library"))
|
||||
# Header
|
||||
self._playlist_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)
|
||||
self._library_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)
|
||||
#self._playlist_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)
|
||||
#self._library_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)
|
||||
# Toolbar stack
|
||||
self.toolbar_stack.add_child(self._server_panel.get_toolbar())
|
||||
self.toolbar_stack.add_child(self._cover_panel.get_toolbar())
|
||||
|
|
@ -291,13 +290,13 @@ class Window(Adw.ApplicationWindow):
|
|||
self._save_visible_panel()
|
||||
self._set_menu_visible_panel()
|
||||
for panel in self._panels:
|
||||
GObject.idle_add(
|
||||
self.panel_stack.child_set_property,
|
||||
self.panel_stack.get_visible_child(),
|
||||
'needs-attention',
|
||||
False
|
||||
)
|
||||
panel.set_selected(panel == self.panel_stack.get_visible_child())
|
||||
#GObject.idle_add(
|
||||
# self.panel_stack.child_set_property,
|
||||
# self.panel_stack.get_visible_child(),
|
||||
# 'needs-attention',
|
||||
# False
|
||||
#)
|
||||
|
||||
def on_panel_open_standalone(self, panel):
|
||||
self.set_titlebar(panel.get_headerbar_standalone())
|
||||
|
|
@ -466,6 +465,8 @@ class Window(Adw.ApplicationWindow):
|
|||
|
||||
|
||||
def on_mcg_custom(self, name):
|
||||
pass
|
||||
"""
|
||||
if name == Window._CUSTOM_STARTUP_COMPLETE:
|
||||
for panel in self._panels:
|
||||
GObject.idle_add(
|
||||
|
|
@ -474,6 +475,7 @@ class Window(Adw.ApplicationWindow):
|
|||
'needs-attention',
|
||||
False
|
||||
)
|
||||
"""
|
||||
|
||||
|
||||
def on_mcg_error(self, error):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue