fixup! Port UI to GTK 4

This commit is contained in:
coderkun 2024-04-10 17:50:15 +02:00
commit 169d8b7abf
8 changed files with 22 additions and 98 deletions

View file

@ -26,7 +26,9 @@ class Application(Gtk.Application):
self._window = None
self._info_dialog = None
self._verbosity = logging.WARNING
#self.create_action('quit', self.quit, ['<primary>q'])
self.set_accels_for_action('window.close', ['<primary>q'])
self.set_accels_for_action('win.show-help-overlay', ['<primary>k'])
self.set_accels_for_action('app.info', ['<primary>i'])
#self.create_action('about', self.on_about_action)
#self.create_action('preferences', self.on_preferences_action)
@ -51,11 +53,15 @@ class Application(Gtk.Application):
def on_menu_info(self, action, value):
# FIXME Info dialog
#if not self._info_dialog:
# self._info_dialog = InfoDialog()
#self._info_dialog.run()
#self._info_dialog.hide()
pass
if not self._info_dialog:
self._info_dialog = Adw.AboutDialog()
self._info_dialog.set_application_icon("xyz.suruatoel.mcg")
self._info_dialog.set_application_name("CoverGrid")
self._info_dialog.set_version("3.1")
self._info_dialog.set_comments("CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks.")
self._info_dialog.set_website("https://www.suruatoel.xyz/codes/mcg")
self._info_dialog.set_license_type(Gtk.License.GPL_3_0)
self._info_dialog.present()
def on_menu_quit(self, action, value):

View file

@ -1,15 +0,0 @@
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
import logging
from gi.repository import Gtk, GdkPixbuf
@Gtk.Template(resource_path='/xyz/suruatoel/mcg/ui/info-dialog.ui')
class InfoDialog(Gtk.AboutDialog):
__gtype_name__ = 'McgInfoDialog'

View file

@ -232,12 +232,6 @@ class LibraryPanel(Adw.Bin):
self.select_button.set_active(False)
# 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()
def on_standalone_play_clicked(self, widget):
self.emit('play', self._selected_albums[0].get_id())

View file

@ -2,8 +2,8 @@
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk

View file

@ -9,13 +9,14 @@ try:
use_keyring = True
except:
use_keyring = False
use_keyring = False
import locale
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
@ -87,8 +88,8 @@ class Window(Adw.ApplicationWindow):
self._headerbar_connection_button_active = True
self._headerbar_playpause_button_active = True
# FIXME Help/Shortcuts dialog
#self.set_help_overlay(ShortcutsDialog())
# Help/Shortcuts dialog
self.set_help_overlay(ShortcutsDialog())
# Login screen
self._connection_panel = ConnectionPanel()