From 4bb6f825c4632624bd8e839f52a62a2bc12ffdcd Mon Sep 17 00:00:00 2001 From: Julian Geywitz Date: Sun, 24 Apr 2022 13:23:13 +0200 Subject: [PATCH 001/101] wip: port to gtk4 --- .gitignore | 2 + cozy/application.py | 15 +- cozy/architecture/event_sender.py | 4 +- cozy/architecture/observable.py | 2 +- cozy/report/report_to_loki.py | 2 +- cozy/ui/app_view.py | 4 +- cozy/ui/book_detail_view.py | 28 +- cozy/ui/chapter_element.py | 8 +- cozy/ui/db_migration_failed_view.py | 2 +- cozy/ui/delete_book_view.py | 2 +- cozy/ui/disk_element.py | 2 +- cozy/ui/headerbar.py | 25 +- cozy/ui/library_view.py | 9 +- cozy/ui/list_box_row_with_data.py | 2 +- cozy/ui/list_box_separator_row.py | 2 +- cozy/ui/main_view.py | 15 +- cozy/ui/media_controller.py | 6 +- cozy/ui/media_controller_big.py | 19 +- cozy/ui/media_controller_small.py | 19 +- cozy/ui/preferences_view.py | 10 +- cozy/ui/search_view.py | 2 +- cozy/ui/warnings.py | 2 +- cozy/ui/widgets/ScrollWrapper.py | 2 +- cozy/ui/widgets/album_art.py | 2 +- cozy/ui/widgets/album_element.py | 28 +- cozy/ui/widgets/book_element.py | 76 ++- cozy/ui/widgets/error_reporting.py | 2 +- cozy/ui/widgets/filter_list_box.py | 10 +- cozy/ui/widgets/list_box_extensions.py | 16 +- cozy/ui/widgets/playback_speed_popover.py | 2 +- cozy/ui/widgets/progress_popover.py | 2 +- cozy/ui/widgets/search_results.py | 8 +- cozy/ui/widgets/seek_bar.py | 19 +- cozy/ui/widgets/sleep_timer.py | 6 +- cozy/ui/widgets/storage_list_box_row.py | 1 - cozy/ui/widgets/welcome.py | 2 +- cozy/ui/widgets/whats_new_importer.py | 2 +- cozy/ui/widgets/whats_new_library.py | 2 +- cozy/ui/widgets/whats_new_m4b.py | 2 +- cozy/ui/widgets/whats_new_m4b_chapter.py | 2 +- cozy/ui/widgets/whats_new_window.py | 6 +- data/ui/about.ui | 33 +- data/ui/album_element.ui | 130 ++-- data/ui/book_detail.ui | 435 ++++---------- data/ui/book_element.ui | 58 +- data/ui/chapter_element.ui | 83 +-- data/ui/db_migration_failed.ui | 150 ++--- data/ui/delete_book_dialog.ui | 146 ++--- data/ui/error_reporting.ui | 191 ++---- data/ui/file_not_found.ui | 142 ++--- data/ui/headerbar.ui | 160 ++--- data/ui/import_failed.ui | 141 ++--- data/ui/main_window.ui | 699 +++++++++------------- data/ui/media_controller.ui | 398 ++++-------- data/ui/media_controller_big.ui | 320 +++------- data/ui/media_controller_small.ui | 166 ++--- data/ui/playback_speed_popover.ui | 39 +- data/ui/preferences.ui | 221 +++---- data/ui/progress_popover.ui | 26 +- data/ui/search_popover.ui | 432 +++++-------- data/ui/seek_bar.ui | 85 +-- data/ui/timer_popover.ui | 203 ++----- data/ui/titlebar_menu.ui | 5 +- data/ui/warning_popover.ui | 14 +- data/ui/welcome.ui | 36 +- data/ui/whats_new.ui | 49 +- data/ui/whats_new_importer.ui | 87 +-- data/ui/whats_new_library.ui | 87 +-- data/ui/whats_new_m4b.ui | 87 +-- data/ui/whats_new_m4b_chapter.ui | 87 +-- main.py | 2 +- meson.build | 2 +- 72 files changed, 1641 insertions(+), 3445 deletions(-) diff --git a/.gitignore b/.gitignore index 67314e1d..89aa95db 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ venv/ *.log *.prof *.pyc + +.DS_Store diff --git a/cozy/application.py b/cozy/application.py index 91d660c4..18a1d218 100644 --- a/cozy/application.py +++ b/cozy/application.py @@ -14,9 +14,9 @@ from cozy.ui.widgets.filter_list_box import FilterListBox from cozy.ui.widgets.seek_bar import SeekBar -gi.require_version('Handy', '1') +gi.require_version('Adw', '1') -from gi.repository import Gtk, GLib, Handy +from gi.repository import Gtk, GLib, Adw from cozy.app_controller import AppController from cozy.control.db import init_db @@ -85,13 +85,10 @@ def do_startup(self): self.ui = CozyUI(self.pkgdatadir, self, __version__) init_db() Gtk.Application.do_startup(self) - Handy.init() - try: - manager = Handy.StyleManager.get_default() - manager.set_color_scheme(Handy.ColorScheme.PREFER_LIGHT) - except: - log.info("Not setting libhandy style manager, version is too old.") - log.info("libhandy version: {}".format(Handy._version)) + Adw.init() + manager = Adw.StyleManager.get_default() + manager.set_color_scheme(Adw.ColorScheme.PREFER_LIGHT) + log.info("libadwaita version: {}".format(Adw._version)) self.ui.startup() def do_activate(self): diff --git a/cozy/architecture/event_sender.py b/cozy/architecture/event_sender.py index 31072a43..777d887d 100644 --- a/cozy/architecture/event_sender.py +++ b/cozy/architecture/event_sender.py @@ -2,7 +2,7 @@ import gi -gi.require_version('Gdk', '3.0') +gi.require_version('Gdk', '4.0') from gi.repository import Gdk, GLib @@ -22,7 +22,7 @@ def emit_event(self, event, message=None): function(event, message) def emit_event_main_thread(self, event: str, message=None): - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.emit_event, (event, message)) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, self.emit_event, (event, message)) def add_listener(self, function: Callable[[str, object], None]): self._listeners.append(function) diff --git a/cozy/architecture/observable.py b/cozy/architecture/observable.py index 9fae8311..0895f846 100644 --- a/cozy/architecture/observable.py +++ b/cozy/architecture/observable.py @@ -47,7 +47,7 @@ def _notify(self, prop: str): reporter.exception("observable", e) def _notify_main_thread(self, prop: str): - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self._notify, (prop)) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, self._notify, (prop)) def _destroy_observers(self): self._observers = {} diff --git a/cozy/report/report_to_loki.py b/cozy/report/report_to_loki.py index 0bee75d2..29c1b435 100644 --- a/cozy/report/report_to_loki.py +++ b/cozy/report/report_to_loki.py @@ -15,7 +15,7 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/app_view.py b/cozy/ui/app_view.py index ad2950a5..800c0ec5 100644 --- a/cozy/ui/app_view.py +++ b/cozy/ui/app_view.py @@ -1,4 +1,4 @@ -from gi.repository import Gtk, Handy +from gi.repository import Gtk, Adw from cozy.ext import inject from cozy.view_model.app_view_model import AppViewModel @@ -27,7 +27,7 @@ def __init__(self, builder: Gtk.Builder): def _get_ui_elements(self): self._main_stack: Gtk.Stack = self._builder.get_object("main_stack") - self._library_leaflet: Handy.Leaflet = self._builder.get_object("library_leaflet") + self._library_leaflet: Adw.Leaflet = self._builder.get_object("library_leaflet") def _connect_ui_elements(self): self._main_stack.connect("notify::visible-child", self._update_view_model_view) diff --git a/cozy/ui/book_detail_view.py b/cozy/ui/book_detail_view.py index 18ee1577..6014add4 100644 --- a/cozy/ui/book_detail_view.py +++ b/cozy/ui/book_detail_view.py @@ -15,15 +15,13 @@ from cozy.ui.widgets.album_art import AlbumArt from cozy.view_model.book_detail_view_model import BookDetailViewModel -gi.require_version('Gtk', '3.0') - -from gi.repository import Gtk, Gdk, GLib +from gi.repository import Gtk, GLib log = logging.getLogger("BookDetailView") @Gtk.Template.from_resource('/com/github/geigi/cozy/book_detail.ui') -class BookDetailView(Gtk.EventBox): +class BookDetailView(Gtk.Box): __gtype_name__ = 'BookDetail' play_book_button: Gtk.Button = Gtk.Template.Child() @@ -67,11 +65,10 @@ def __init__(self, main_window_builder: Gtk.Builder): # self._toolbar_revealer: Gtk.Revealer = main_window_builder.get_object("toolbar_revealer") self._main_stack.add_named(self, "book_overview") - if Gtk.get_minor_version() > 20: - self.book_overview_scroller.props.propagate_natural_height = True + self.book_overview_scroller.props.propagate_natural_height = True self.art = AlbumArt() - self.album_art_container.pack_start(self.art, True, True, 0) + self.album_art_container.prepend(self.art) self._chapters_event: Event = Event() self._chapters_thread: Thread = None @@ -98,10 +95,11 @@ def _connect_view_model(self): def _connect_widgets(self): self.play_book_button.connect("clicked", self._play_book_clicked) self.download_switch.connect("state-set", self._download_switch_changed) - self.main_flow_box.connect("size-allocate", self._main_flow_box_size_changed) + # TODO: Use property notification for GtkWindow:default-width and GtkWindow:default-height + #self.main_flow_box.connect("size-allocate", self._main_flow_box_size_changed) def _add_mouse_button_accel(self): - self.gesture = Gtk.GestureMultiPress(widget=self) + self.gesture = Gtk.GestureClick(widget=self) self.gesture.set_button(0) self.gesture.set_propagation_phase(Gtk.PropagationPhase.CAPTURE) self.gesture.connect('pressed', self._on_mouse_event) @@ -209,9 +207,9 @@ def _schedule_chapters_rendering(self, book: Book, callback: Callable): return if multiple_disks and disk_number != chapter.disk: - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self._add_disk, book.id, chapter) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, self._add_disk, book.id, chapter) - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self._add_chapter, book.id, chapter) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, self._add_chapter, book.id, chapter) disk_number = chapter.disk @@ -219,7 +217,7 @@ def _schedule_chapters_rendering(self, book: Book, callback: Callable): self._chapters_event.wait() self._chapters_event.clear() - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, callback) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, callback) def _on_chapters_displayed(self): self.total_label.set_text(self._view_model.total_text) @@ -249,7 +247,6 @@ def _add_disk(self, book_id: int, chapter: Chapter): disc_element = DiskElement(chapter.disk) self.chapter_box.add(disc_element) - disc_element.show_all() self._chapters_event.set() def _add_chapter(self, book_id: int, chapter: Chapter): @@ -259,11 +256,10 @@ def _add_chapter(self, book_id: int, chapter: Chapter): chapter_element = ChapterElement(chapter) chapter_element.connect("play-pause-clicked", self._play_chapter_clicked) self.chapter_box.add(chapter_element) - chapter_element.show_all() self._chapters_event.set() def _schedule_chapters_clearing(self): - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.chapter_box.remove_all_children) + GLib.MainContext.default().invoke_full(GLib.PRIORITY_DEFAULT_IDLE, self.chapter_box.remove_all_children) def _set_progress(self): self.remaining_label.set_text(self._view_model.remaining_text) @@ -324,7 +320,7 @@ def _play_chapter_clicked(self, _, chapter: Chapter): def _play_book_clicked(self, _): self._view_model.play_book() - def _on_mouse_event(self, gesture: Gtk.GestureMultiPress, _, __, ___): + def _on_mouse_event(self, gesture: Gtk.GestureClick, _, __, ___): btn = gesture.get_current_button() if btn == 8: self._view_model.navigate_back() diff --git a/cozy/ui/chapter_element.py b/cozy/ui/chapter_element.py index de6318b8..bf734e86 100644 --- a/cozy/ui/chapter_element.py +++ b/cozy/ui/chapter_element.py @@ -5,10 +5,10 @@ @Gtk.Template.from_resource('/com/github/geigi/cozy/chapter_element.ui') -class ChapterElement(Gtk.EventBox): +class ChapterElement(Gtk.Box): __gtype_name__ = "ChapterElement" - icon_event_box: Gtk.EventBox = Gtk.Template.Child() + icon_event_box: Gtk.Box = Gtk.Template.Child() icon_stack: Gtk.Stack = Gtk.Template.Child() number_label: Gtk.Label = Gtk.Template.Child() play_icon: Gtk.Image = Gtk.Template.Child() @@ -87,9 +87,9 @@ def deselect(self): def set_playing(self, playing): if playing: - self.play_icon.set_from_icon_name("pause-symbolic", Gtk.IconSize.SMALL_TOOLBAR) + self.play_icon.set_from_icon_name("pause-symbolic", Gtk.IconSize.NORMAL) else: - self.play_icon.set_from_icon_name("play-symbolic", Gtk.IconSize.SMALL_TOOLBAR) + self.play_icon.set_from_icon_name("play-symbolic", Gtk.IconSize.NORMAL) GObject.type_register(ChapterElement) diff --git a/cozy/ui/db_migration_failed_view.py b/cozy/ui/db_migration_failed_view.py index b1df22a7..9b81d339 100644 --- a/cozy/ui/db_migration_failed_view.py +++ b/cozy/ui/db_migration_failed_view.py @@ -4,7 +4,7 @@ from cozy.ext import inject -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/delete_book_view.py b/cozy/ui/delete_book_view.py index aa2dfac6..04f4f422 100644 --- a/cozy/ui/delete_book_view.py +++ b/cozy/ui/delete_book_view.py @@ -2,7 +2,7 @@ from cozy.ext import inject -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/disk_element.py b/cozy/ui/disk_element.py index 1b410a50..554801c7 100644 --- a/cozy/ui/disk_element.py +++ b/cozy/ui/disk_element.py @@ -20,7 +20,7 @@ def __init__(self, disc_number): self.container.set_orientation(Gtk.Orientation.HORIZONTAL) self.container.get_style_context().add_class("dim-label") - image = Gtk.Image.new_from_icon_name("media-optical-cd-audio-symbolic", Gtk.IconSize.SMALL_TOOLBAR) + image = Gtk.Image.new_from_icon_name("media-optical-cd-audio-symbolic", Gtk.IconSize.NORMAL) self.container.add(image) label = Gtk.Label() label.set_margin_left(5) diff --git a/cozy/ui/headerbar.py b/cozy/ui/headerbar.py index 4d306c88..6f54ef65 100644 --- a/cozy/ui/headerbar.py +++ b/cozy/ui/headerbar.py @@ -6,11 +6,9 @@ from cozy.ui.widgets.progress_popover import ProgressPopover from cozy.view_model.headerbar_view_model import HeaderbarViewModel, HeaderBarState -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') gi.require_version('Dazzle', '1.0') -from gi.repository import Gtk, Handy -from gi.repository.Handy import HeaderBar -from gi.repository.Dazzle import ProgressMenuButton +from gi.repository import Gtk, Adw log = logging.getLogger("Headerbar") @@ -18,25 +16,27 @@ @Gtk.Template.from_resource('/com/github/geigi/cozy/headerbar.ui') -class Headerbar(HeaderBar): +class Headerbar(Gtk.Box): __gtype_name__ = "Headerbar" + headerbar: Adw.HeaderBar = Gtk.Template.Child() + search_button: Gtk.MenuButton = Gtk.Template.Child() menu_button: Gtk.MenuButton = Gtk.Template.Child() - progress_menu_button: ProgressMenuButton = Gtk.Template.Child() + progress_menu_button: Gtk.MenuButton = Gtk.Template.Child() back_button: Gtk.Button = Gtk.Template.Child() - category_toolbar: Handy.ViewSwitcherTitle = Gtk.Template.Child() + category_toolbar: Adw.ViewSwitcherTitle = Gtk.Template.Child() def __init__(self, main_window_builder: Gtk.Builder): super().__init__() - self._library_mobile_view_switcher: Handy.ViewSwitcherBar = main_window_builder.get_object( + self._library_mobile_view_switcher: Adw.ViewSwitcherBar = main_window_builder.get_object( "library_mobile_view_switcher") self._library_mobile_revealer: Gtk.Revealer = main_window_builder.get_object("library_mobile_revealer") self._header_container: Gtk.Box = main_window_builder.get_object("header_container") - self._header_container.pack_start(self, False, True, 0) + self._header_container.prepend(self) self._sort_stack: Gtk.Stack = main_window_builder.get_object("sort_stack") self.category_toolbar.set_stack(self._sort_stack) @@ -70,15 +70,16 @@ def _init_app_menu(self): def _on_state_changed(self): if self._headerbar_view_model.state == HeaderBarState.PLAYING: progress_visible = False - self.progress_menu_button.set_progress(0) + #TODO Replace progress menu button + #self.progress_menu_button.set_progress(0) else: progress_visible = True - self.progress_menu_button.set_visible(progress_visible) + #self.progress_menu_button.set_visible(progress_visible) def _on_work_progress_changed(self): progress = self._headerbar_view_model.work_progress - self.progress_menu_button.set_progress(progress) + #self.progress_menu_button.set_progress(progress) self.progress_popover.set_progress(progress) def _on_work_message_changed(self): diff --git a/cozy/ui/library_view.py b/cozy/ui/library_view.py index 0695c398..2b5f3bf2 100644 --- a/cozy/ui/library_view.py +++ b/cozy/ui/library_view.py @@ -1,6 +1,6 @@ from typing import Optional -from gi.repository import Gtk, Handy +from gi.repository import Gtk, Adw from gi.repository.Gtk import Builder from cozy.ext import inject @@ -44,7 +44,7 @@ def _get_ui_elements(self): self._filter_stack_revealer: Gtk.Revealer = self._builder.get_object("sort_stack_revealer") self._author_box: FilterListBox = self._builder.get_object("author_box") self._reader_box: FilterListBox = self._builder.get_object("reader_box") - self._library_leaflet: Handy.Leaflet = self._builder.get_object("library_leaflet") + self._library_leaflet: Adw.Leaflet = self._builder.get_object("library_leaflet") self._book_stack: Gtk.Stack = self._builder.get_object("book_stack") def _connect_ui_elements(self): @@ -102,10 +102,7 @@ def populate_book_box(self): book_element.connect("play-pause-clicked", self._play_book_clicked) book_element.connect("open-book-overview", self._open_book_overview_clicked) book_element.connect("book-removed", self._on_book_removed) - book_element.show_all() - self._book_box.add(book_element) - - self._book_box.show_all() + self._book_box.append(book_element) def populate_author(self): self._author_box.populate(self._view_model.authors) diff --git a/cozy/ui/list_box_row_with_data.py b/cozy/ui/list_box_row_with_data.py index fc1a227b..44005797 100644 --- a/cozy/ui/list_box_row_with_data.py +++ b/cozy/ui/list_box_row_with_data.py @@ -28,5 +28,5 @@ def __init__(self, data, bold=False, **properties): label.set_margin_start(7) label.set_max_width_chars(30) label.set_ellipsize(Pango.EllipsizeMode.END) - self.add(label) + self.set_child(label) self.set_tooltip_text(data) diff --git a/cozy/ui/list_box_separator_row.py b/cozy/ui/list_box_separator_row.py index b0ff68bc..af1eb593 100644 --- a/cozy/ui/list_box_separator_row.py +++ b/cozy/ui/list_box_separator_row.py @@ -9,6 +9,6 @@ class ListBoxSeparatorRow(Gtk.ListBoxRow): def __init__(self): super().__init__() separator = Gtk.Separator() - self.add(separator) + self.set_child(separator) self.set_sensitive(False) self.props.selectable = False \ No newline at end of file diff --git a/cozy/ui/main_view.py b/cozy/ui/main_view.py index 22c7bf6e..fefa08c5 100644 --- a/cozy/ui/main_view.py +++ b/cozy/ui/main_view.py @@ -106,13 +106,11 @@ def __init_css(self): cssProvider.load_from_file(cssProviderFile) # add the bordered css class to the default screen for the borders around album art - screen = Gdk.Screen.get_default() - styleContext = Gtk.StyleContext() - styleContext.add_provider_for_screen( - screen, main_cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) - styleContext.add_provider_for_screen( - screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) - styleContext.add_class("bordered") + display = Gdk.Display.get_default() + Gtk.StyleContext.add_provider_for_display( + display, main_cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + Gtk.StyleContext.add_provider_for_display( + display, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) def __init_window(self): """ @@ -122,9 +120,8 @@ def __init_window(self): log.info("Initialize main window") self._restore_window_size() self.window.set_application(self.app) - self.window.show_all() self.window.present() - self.window.connect("delete-event", self.on_close) + self.window.connect("close-request", self.on_close) self.window.connect("drag_data_received", self.__on_drag_data_received) self.window.connect("size-allocate", self._on_window_size_allocate) self.window.drag_dest_set(Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, diff --git a/cozy/ui/media_controller.py b/cozy/ui/media_controller.py index cfb668bd..e271cd72 100644 --- a/cozy/ui/media_controller.py +++ b/cozy/ui/media_controller.py @@ -5,8 +5,8 @@ from cozy.ui.media_controller_big import MediaControllerBig from cozy.ui.media_controller_small import MediaControllerSmall -gi.require_version('Gtk', '3.0') -from gi.repository import Gtk, Handy +gi.require_version('Gtk', '4.0') +from gi.repository import Gtk, Adw log = logging.getLogger("MediaController") @@ -15,7 +15,7 @@ class MediaController: def __init__(self, main_window_builder: Gtk.Builder): super().__init__() - self._media_control_squeezer: Handy.Squeezer = main_window_builder.get_object("media_control_squeezer") + self._media_control_squeezer: Adw.Squeezer = main_window_builder.get_object("media_control_squeezer") self._media_controller_small: MediaControllerSmall = MediaControllerSmall() self._media_controller_big: MediaControllerBig = MediaControllerBig() self._media_control_squeezer.add(self._media_controller_big) diff --git a/cozy/ui/media_controller_big.py b/cozy/ui/media_controller_big.py index 89ef9e9a..ace7384a 100644 --- a/cozy/ui/media_controller_big.py +++ b/cozy/ui/media_controller_big.py @@ -10,7 +10,7 @@ from cozy.ui.widgets.sleep_timer import SleepTimer from cozy.view_model.playback_control_view_model import PlaybackControlViewModel -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk, Gdk log = logging.getLogger("Headerbar") @@ -30,7 +30,6 @@ class MediaControllerBig(Gtk.Box): volume_button: Gtk.VolumeButton = Gtk.Template.Child() cover_img: Gtk.Image = Gtk.Template.Child() - cover_img_event_box: Gtk.EventBox = Gtk.Template.Child() title_label: Gtk.Label = Gtk.Template.Child() subtitle_label: Gtk.Label = Gtk.Template.Child() @@ -44,7 +43,7 @@ def __init__(self): super().__init__() self.seek_bar = SeekBar() - self.seek_bar_container.add(self.seek_bar) + self.seek_bar_container.append(self.seek_bar) self.sleep_timer: SleepTimer = SleepTimer(self.timer_image) self.playback_speed_button.set_popover(PlaybackSpeedPopover()) @@ -75,9 +74,15 @@ def _connect_widgets(self): self.next_button.connect("clicked", self._forward_clicked) self.volume_button.connect("value-changed", self._on_volume_button_changed) self.seek_bar.connect("position-changed", self._on_seek_bar_position_changed) - self.cover_img_event_box.connect("button-press-event", self._cover_clicked) - self.cover_img_event_box.connect("enter-notify-event", self._on_cover_enter_notify) - self.cover_img_event_box.connect("leave-notify-event", self._on_cover_leave_notify) + + self._cover_img_gesture = Gtk.GestureClick() + self._cover_img_gesture.connect("pressed", self._cover_clicked) + self.cover_img.add_controller(self._cover_img_gesture) + + self._cover_img_motion = Gtk.EventControllerMotion() + self._cover_img_motion.connect("enter", self._on_cover_enter_notify) + self._cover_img_motion.connect("leave", self._on_cover_leave_notify) + self.cover_img.add_controller(self._cover_img_motion) def _set_cover_image(self, book: Book): pixbuf = self._artwork_cache.get_cover_pixbuf(book, self.get_scale_factor(), COVER_SIZE) @@ -85,7 +90,7 @@ def _set_cover_image(self, book: Book): surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, self.get_scale_factor(), None) self.cover_img.set_from_surface(surface) else: - self.cover_img.set_from_icon_name("book-open-variant-symbolic", Gtk.IconSize.DIALOG) + self.cover_img.set_from_icon_name("book-open-variant-symbolic") self.cover_img.props.pixel_size = COVER_SIZE def _on_book_changed(self): diff --git a/cozy/ui/media_controller_small.py b/cozy/ui/media_controller_small.py index d375136c..080fd778 100644 --- a/cozy/ui/media_controller_small.py +++ b/cozy/ui/media_controller_small.py @@ -8,7 +8,7 @@ from cozy.ui.widgets.playback_speed_popover import PlaybackSpeedPopover from cozy.view_model.playback_control_view_model import PlaybackControlViewModel -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk, Gdk log = logging.getLogger("Headerbar") @@ -25,7 +25,6 @@ class MediaControllerSmall(Gtk.Box): next_button: Gtk.Button = Gtk.Template.Child() cover_img: Gtk.Image = Gtk.Template.Child() - cover_img_event_box: Gtk.EventBox = Gtk.Template.Child() playback_speed_button: Gtk.MenuButton = Gtk.Template.Child() @@ -53,9 +52,15 @@ def _connect_widgets(self): self.play_button.connect("clicked", self._play_clicked) self.prev_button.connect("clicked", self._rewind_clicked) self.next_button.connect("clicked", self._forward_clicked) - self.cover_img_event_box.connect("button-press-event", self._cover_clicked) - self.cover_img_event_box.connect("enter-notify-event", self._on_cover_enter_notify) - self.cover_img_event_box.connect("leave-notify-event", self._on_cover_leave_notify) + + self._cover_img_gesture = Gtk.GestureClick() + self._cover_img_gesture.connect("pressed", self._cover_clicked) + self.cover_img.add_controller(self._cover_img_gesture) + + self._cover_img_motion = Gtk.EventControllerMotion() + self._cover_img_motion.connect("enter", self._on_cover_enter_notify) + self._cover_img_motion.connect("leave", self._on_cover_leave_notify) + self.cover_img.add_controller(self._cover_img_motion) def _set_cover_image(self, book: Book): pixbuf = self._artwork_cache.get_cover_pixbuf(book, self.get_scale_factor(), COVER_SIZE) @@ -63,7 +68,7 @@ def _set_cover_image(self, book: Book): surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, self.get_scale_factor(), None) self.cover_img.set_from_surface(surface) else: - self.cover_img.set_from_icon_name("book-open-variant-symbolic", Gtk.IconSize.DIALOG) + self.cover_img.set_from_icon_name("book-open-variant-symbolic") self.cover_img.props.pixel_size = COVER_SIZE def _on_book_changed(self): @@ -89,7 +94,7 @@ def _on_play_changed(self): play_button_img = "pause-symbolic" if playing else "play-symbolic" icon_size = 16 if playing else 20 - self.play_img.set_from_icon_name(play_button_img, Gtk.IconSize.LARGE_TOOLBAR) + self.play_img.set_from_icon_name(play_button_img) self.play_img.set_pixel_size(icon_size) def _on_lock_ui_changed(self): diff --git a/cozy/ui/preferences_view.py b/cozy/ui/preferences_view.py index c8bcbded..8081b117 100644 --- a/cozy/ui/preferences_view.py +++ b/cozy/ui/preferences_view.py @@ -1,17 +1,17 @@ from gi.repository import Gtk from cozy.view_model.settings_view_model import SettingsViewModel import gi -from gi.repository import Handy, Gio +from gi.repository import Adw, Gio from cozy.ext import inject from cozy.ui.widgets.error_reporting import ErrorReporting from cozy.ui.widgets.storage_list_box_row import StorageListBoxRow -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') @Gtk.Template.from_resource('/com/github/geigi/cozy/preferences.ui') -class PreferencesView(Handy.PreferencesWindow): +class PreferencesView(Adw.PreferencesWindow): __gtype_name__ = "PreferencesWindow" _glib_settings: Gio.Settings = inject.attr(Gio.Settings) @@ -21,7 +21,7 @@ class PreferencesView(Handy.PreferencesWindow): swap_author_reader_switch: Gtk.Switch = Gtk.Template.Child() replay_switch: Gtk.Switch = Gtk.Template.Child() sleep_timer_fadeout_switch: Gtk.Switch = Gtk.Template.Child() - sleep_timer_fadeout_row: Handy.ActionRow = Gtk.Template.Child() + sleep_timer_fadeout_row: Adw.ActionRow = Gtk.Template.Child() artwork_prefer_external_switch: Gtk.Switch = Gtk.Template.Child() rewind_duration_adjustment: Gtk.Adjustment = Gtk.Template.Child() @@ -34,7 +34,7 @@ class PreferencesView(Handy.PreferencesWindow): external_storage_toggle_button: Gtk.ToggleButton = Gtk.Template.Child() default_storage_button: Gtk.ToggleButton = Gtk.Template.Child() - user_feedback_preference_row: Handy.PreferencesRow = Gtk.Template.Child() + user_feedback_preference_row: Adw.PreferencesRow = Gtk.Template.Child() def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/cozy/ui/search_view.py b/cozy/ui/search_view.py index e6d206c8..6cd343ee 100644 --- a/cozy/ui/search_view.py +++ b/cozy/ui/search_view.py @@ -8,7 +8,7 @@ from cozy.view_model.search_view_model import SearchViewModel -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk, GLib diff --git a/cozy/ui/warnings.py b/cozy/ui/warnings.py index 66f699f2..015fd49c 100644 --- a/cozy/ui/warnings.py +++ b/cozy/ui/warnings.py @@ -5,7 +5,7 @@ from cozy.control.filesystem_monitor import FilesystemMonitor -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/ScrollWrapper.py b/cozy/ui/widgets/ScrollWrapper.py index 1deb1910..faa68a97 100644 --- a/cozy/ui/widgets/ScrollWrapper.py +++ b/cozy/ui/widgets/ScrollWrapper.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/album_art.py b/cozy/ui/widgets/album_art.py index 21d6c138..4d8c5d83 100644 --- a/cozy/ui/widgets/album_art.py +++ b/cozy/ui/widgets/album_art.py @@ -13,7 +13,7 @@ def __init__(self, **properties): self.art = None self.set_visible(True) - self.connect("draw", self._on_draw) + self.set_draw_func(self._on_draw) def set_art(self, art: GdkPixbuf): self.art = art diff --git a/cozy/ui/widgets/album_element.py b/cozy/ui/widgets/album_element.py index c403114b..6a9ddc71 100644 --- a/cozy/ui/widgets/album_element.py +++ b/cozy/ui/widgets/album_element.py @@ -11,7 +11,7 @@ from gi.repository import Gtk, GObject, Gdk ALBUM_ART_SIZE = 200 -PLAY_BUTTON_ICON_SIZE = Gtk.IconSize.SMALL_TOOLBAR +PLAY_BUTTON_ICON_SIZE = Gtk.IconSize.NORMAL STROKE_WIDTH = 3 log = logging.getLogger("album_element") @@ -38,20 +38,28 @@ def __init__(self, book: Book): pixbuf = self.artwork_cache.get_cover_pixbuf(book, self.get_scale_factor(), ALBUM_ART_SIZE) if pixbuf: - surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, self.get_scale_factor(), None) - self.album_art_image.set_from_surface(surface) + self.album_art_image.set_from_pixbuf(pixbuf) else: - self.album_art_image.set_from_icon_name("book-open-variant-symbolic", Gtk.IconSize.DIALOG) + self.album_art_image.set_from_icon_name("book-open-variant-symbolic") self.album_art_image.props.pixel_size = ALBUM_ART_SIZE self.set_size_request(ALBUM_ART_SIZE, ALBUM_ART_SIZE) - self.play_button.connect("button-release-event", self._on_play_button_press) + + self._play_button_click = Gtk.GestureClick() + self._play_button_click.connect("released", self._on_play_button_press) + self.play_button.add_controller(self._play_button_click) self.progress_drawing_area.connect("realize", lambda w: w.get_window().set_pass_through(True)) - self.progress_drawing_area.connect("draw", self._draw_progress) - self.album_art_drawing_area.connect("draw", self._draw_album_hover) - self.album_art_overlay_revealer.connect("enter-notify-event", self._on_revealer_enter_event) - self.play_button_revealer.connect("enter-notify-event", self._on_revealer_enter_event) + self.progress_drawing_area.set_draw_func(self._draw_progress) + self.album_art_drawing_area.set_draw_func(self._draw_album_hover) + + self._album_art_overlay_revealer_motion = Gtk.EventControllerMotion() + self._album_art_overlay_revealer_motion.connect("enter", self._on_revealer_enter_event) + self.album_art_overlay_revealer.add_controller(self._album_art_overlay_revealer_motion) + + self._play_button_revealer_motion = Gtk.EventControllerMotion() + self._play_button_revealer_motion.connect("enter", self._on_revealer_enter_event) + self.play_button_revealer.add_controller(self._play_button_revealer_motion) def set_playing(self, playing: bool): if playing: @@ -101,7 +109,7 @@ def draw_background(self, area: Gtk.DrawingArea, context: cairo.Context): def update_progress(self): self.progress_drawing_area.queue_draw() - def _on_revealer_enter_event(self, widget, _): + def _on_revealer_enter_event(self, widget, _, __): # Somehow the GTK Revealer steals the mouse events from the parent # Maybe this is a bug in GTK but for now we have to handle hover in here as well self.set_hover(True) diff --git a/cozy/ui/widgets/book_element.py b/cozy/ui/widgets/book_element.py index 4ee2795b..2718576c 100644 --- a/cozy/ui/widgets/book_element.py +++ b/cozy/ui/widgets/book_element.py @@ -32,14 +32,28 @@ def __init__(self, book: Book): self.context_menu = None self.pressed = False - self.container_box.pack_start(self.art, False, True, 0) + self.container_box.prepend(self.art) self.art.connect("play-pause-clicked", self._on_album_art_press_event) - self.event_box.connect("button-press-event", self._on_button_press_event) - self.event_box.connect("button-release-event", self._on_button_release_event) - self.event_box.connect("key-press-event", self._on_key_press_event) - self.event_box.connect("enter-notify-event", self._on_cover_enter_notify) - self.event_box.connect("leave-notify-event", self._on_cover_leave_notify) + + self._event_box_primary_gesture = Gtk.GestureClick() + self._event_box_primary_gesture.set_button(Gdk.BUTTON_PRIMARY) + self._event_box_primary_gesture.connect("pressed", self._select_item) + self._event_box_primary_gesture.connect("released", self._open_book_overview) + self.event_box.add_controller(self._event_box_primary_gesture) + + self._event_box_context_gesture = Gtk.GestureClick() + self._event_box_context_gesture.set_button(Gdk.BUTTON_SECONDARY) + self._event_box_context_gesture.connect("released", self._show_context_menu) + self.event_box.add_controller(self._event_box_context_gesture) + + self._event_box_key = Gtk.EventControllerKey() + self._event_box_key.connect("key-pressed", self._on_key_press_event) + self.event_box.add_controller(self._event_box_key) + + self._event_box_motion = Gtk.EventControllerMotion() + self._event_box_motion.connect("enter", self._on_cover_enter_notify) + self._event_box_motion.connect("leave", self._on_cover_leave_notify) def set_playing(self, is_playing): self.art.set_playing(is_playing) @@ -63,7 +77,6 @@ def _create_context_menu(self): menu.append(Gtk.SeparatorMenuItem()) menu.append(rm_item) menu.attach_to_widget(self) - menu.show_all() return menu def _remove_book(self, _, __): @@ -83,32 +96,29 @@ def _jump_to_folder(self, _, __): path = os.path.dirname(track.file) subprocess.Popen(['xdg-open', path]) - def _on_button_press_event(self, _, event): - if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: - if self.context_menu is None: - self.context_menu = self._create_context_menu() - self.context_menu.popup( - None, None, None, None, event.button, event.time) - return True - elif event.type == Gdk.EventType.BUTTON_PRESS and event.button == 1: - if super().get_sensitive(): - self.pressed = True - self.container_box.get_style_context().add_class("selected") - elif event.type == Gdk.EventType.KEY_PRESS and event.keyval == Gdk.KEY_Return: - if super().get_sensitive(): - self.emit("open-book-overview", self.book) - return True - - def _on_button_release_event(self, _, event): - if event.type == Gdk.EventType.BUTTON_RELEASE and event.button == 1 and self.pressed: - self.pressed = False - self.container_box.get_style_context().remove_class("selected") - if super().get_sensitive(): - self.emit("open-book-overview", self.book) - return True - - def _on_key_press_event(self, _, key): - if key.keyval == Gdk.KEY_Return and super().get_sensitive(): + def _show_context_menu(self, gesture: Gtk.Gesture, *_): + gesture.set_state(Gtk.EventSequenceState.CLAIMED) + + if self.context_menu is None: + self.context_menu = self._create_context_menu() + self.context_menu.popup() + + def _select_item(self, gesture: Gtk.Gesture, *_): + if super().get_sensitive(): + gesture.set_state(Gtk.EventSequenceState.CLAIMED) + self.pressed = True + self.container_box.get_style_context().add_class("selected") + + def _open_book_overview(self, gesture, *_): + gesture.set_state(Gtk.EventSequenceState.CLAIMED) + + self.pressed = False + self.container_box.get_style_context().remove_class("selected") + if super().get_sensitive(): + self.emit("open-book-overview", self.book) + + def _on_key_press_event(self, keyval, *_): + if keyval == Gdk.KEY_Return and super().get_sensitive(): self.emit("open-book-overview", self.book) return True diff --git a/cozy/ui/widgets/error_reporting.py b/cozy/ui/widgets/error_reporting.py index 20b0f768..0ce91103 100644 --- a/cozy/ui/widgets/error_reporting.py +++ b/cozy/ui/widgets/error_reporting.py @@ -5,7 +5,7 @@ from cozy.application_settings import ApplicationSettings from cozy.ext import inject -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk LEVELS = [ diff --git a/cozy/ui/widgets/filter_list_box.py b/cozy/ui/widgets/filter_list_box.py index 10a72724..3e5d0cd9 100644 --- a/cozy/ui/widgets/filter_list_box.py +++ b/cozy/ui/widgets/filter_list_box.py @@ -1,7 +1,7 @@ from typing import List import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk from cozy.ui.list_box_row_with_data import ListBoxRowWithData @@ -19,15 +19,13 @@ def populate(self, elements: List[str]): all_row = ListBoxRowWithData(_("All"), False) all_row.set_tooltip_text(_("Display all books")) - self.add(all_row) - self.add(ListBoxSeparatorRow()) + self.append(all_row) + self.append(ListBoxSeparatorRow()) self.select_row(all_row) for element in elements: row = ListBoxRowWithData(element, False) - self.add(row) - - self.show_all() + self.append(row) def select_row_with_content(self, row_content: str): for row in self.get_children(): diff --git a/cozy/ui/widgets/list_box_extensions.py b/cozy/ui/widgets/list_box_extensions.py index 3d1d8ebf..b71444e8 100644 --- a/cozy/ui/widgets/list_box_extensions.py +++ b/cozy/ui/widgets/list_box_extensions.py @@ -3,15 +3,19 @@ def remove_all_children(self): """ - Removes all widgets from a gtk container. + Removes all widgets from a gtk widget. """ self.set_visible(False) - childs = self.get_children() - for element in childs: - self.remove(element) - element.destroy() + + child = self.get_first_child() + while child: + next = child.get_next_sibling() + self.remove(child) + child.destory() + child = next + self.set_visible(True) def extend_gtk_container(): - Gtk.Container.remove_all_children = remove_all_children + Gtk.Widget.remove_all_children = remove_all_children diff --git a/cozy/ui/widgets/playback_speed_popover.py b/cozy/ui/widgets/playback_speed_popover.py index 746bb185..2ea60e9b 100644 --- a/cozy/ui/widgets/playback_speed_popover.py +++ b/cozy/ui/widgets/playback_speed_popover.py @@ -3,7 +3,7 @@ from cozy.ext import inject from cozy.view_model.playback_speed_view_model import PlaybackSpeedViewModel -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/progress_popover.py b/cozy/ui/widgets/progress_popover.py index 2d90f4b8..3e8c160e 100644 --- a/cozy/ui/widgets/progress_popover.py +++ b/cozy/ui/widgets/progress_popover.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/search_results.py b/cozy/ui/widgets/search_results.py index 251f5d1c..de8fc3bc 100644 --- a/cozy/ui/widgets/search_results.py +++ b/cozy/ui/widgets/search_results.py @@ -8,7 +8,7 @@ BOOK_ICON_SIZE = 40 -class SearchResult(Gtk.EventBox): +class SearchResult(Gtk.Box): """ This class is the base class for all search result GUI object. It features a GTK box that is highlighted when hovered. @@ -38,7 +38,7 @@ def __init__(self, on_click, on_click_data): def _on_enter_notify(self, widget, event): """ On enter notify add css hover class - :param widget: as Gtk.EventBox + :param widget: as Gtk.Box :param event: as Gdk.Event """ self.box.get_style_context().add_class("box_hover") @@ -46,7 +46,7 @@ def _on_enter_notify(self, widget, event): def _on_leave_notify(self, widget, event): """ On leave notify remove css hover class - :param widget: as Gtk.EventBox (can be None) + :param widget: as Gtk.Box (can be None) :param event: as Gdk.Event (can be None) """ self.box.get_style_context().remove_class("box_hover") @@ -85,7 +85,6 @@ def __init__(self, on_click, artist: str, is_author): self.box.add(title_label) self.add(self.box) - self.show_all() class BookSearchResult(SearchResult): @@ -123,4 +122,3 @@ def __init__(self, book: Book, on_click): self.box.add(img) self.box.add(title_label) self.add(self.box) - self.show_all() diff --git a/cozy/ui/widgets/seek_bar.py b/cozy/ui/widgets/seek_bar.py index 29795918..8e79e7cd 100644 --- a/cozy/ui/widgets/seek_bar.py +++ b/cozy/ui/widgets/seek_bar.py @@ -3,7 +3,7 @@ from cozy.control.string_representation import seconds_to_str -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk @@ -14,17 +14,22 @@ class SeekBar(Gtk.Box): progress_scale: Gtk.Scale = Gtk.Template.Child() current_label: Gtk.Label = Gtk.Template.Child() remaining_label: Gtk.Label = Gtk.Template.Child() - remaining_event_box: Gtk.EventBox = Gtk.Template.Child() + remaining_event_box: Gtk.Box = Gtk.Template.Child() def __init__(self, **kwargs): super().__init__(**kwargs) self._progress_scale_pressed = False - self.progress_scale.connect("value-changed", self._on_progress_scale_changed) - self.progress_scale.connect("button-release-event", self._on_progress_scale_clicked) - self.progress_scale.connect("button-press-event", self._on_progress_scale_press) - self.progress_scale.connect("key-press-event", self._on_progress_key_pressed) + self._progress_scale_gesture = Gtk.GestureClick() + self._progress_scale_gesture.connect("pressed", self._on_progress_scale_press) + self._progress_scale_gesture.connect("released", self._on_progress_scale_release) + self.progress_scale.add_controller(self._progress_scale_gesture) + + self._progress_scale_key = Gtk.EventControllerKey() + self._progress_scale_key.connect("key-pressed", self._on_progress_scale_press) + self._progress_scale_key.connect("key-released", self._on_progress_scale_release) + self.progress_scale.add_controller(self._progress_scale_key) @property def position(self) -> float: @@ -72,7 +77,7 @@ def _on_progress_scale_changed(self, _): self.current_label.set_markup("" + current_text + "") self.remaining_label.set_markup("-" + remaining_text + "") - def _on_progress_scale_clicked(self, _, __): + def _on_progress_scale_release(self, _, __): self._progress_scale_pressed = False value = self.progress_scale.get_value() self.emit("position-changed", value) diff --git a/cozy/ui/widgets/sleep_timer.py b/cozy/ui/widgets/sleep_timer.py index 4c49e79c..1e7bfeb8 100644 --- a/cozy/ui/widgets/sleep_timer.py +++ b/cozy/ui/widgets/sleep_timer.py @@ -3,7 +3,7 @@ from cozy.ext import inject from cozy.view_model.sleep_timer_view_model import SleepTimerViewModel, SystemPowerControl -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk @@ -21,8 +21,8 @@ class SleepTimer(Gtk.Popover): power_control_switch: Gtk.Switch = Gtk.Template.Child() power_control_options: Gtk.Box = Gtk.Template.Child() - system_shutdown_radiob: Gtk.RadioButton = Gtk.Template.Child() - system_suspend_radiob: Gtk.RadioButton = Gtk.Template.Child() + system_shutdown_radiob: Gtk.CheckButton = Gtk.Template.Child() + system_suspend_radiob: Gtk.CheckButton = Gtk.Template.Child() def __init__(self, timer_image: Gtk.Image): super().__init__() diff --git a/cozy/ui/widgets/storage_list_box_row.py b/cozy/ui/widgets/storage_list_box_row.py index b630b07a..548322d4 100644 --- a/cozy/ui/widgets/storage_list_box_row.py +++ b/cozy/ui/widgets/storage_list_box_row.py @@ -49,7 +49,6 @@ def __init__(self, model: Storage): box.add(self.location_chooser) box.add(self.default_image) self.add(box) - self.show_all() self._set_default_icon() @property diff --git a/cozy/ui/widgets/welcome.py b/cozy/ui/widgets/welcome.py index 5798fb3f..ce438ca3 100644 --- a/cozy/ui/widgets/welcome.py +++ b/cozy/ui/widgets/welcome.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/whats_new_importer.py b/cozy/ui/widgets/whats_new_importer.py index 7148f974..9b6931ba 100644 --- a/cozy/ui/widgets/whats_new_importer.py +++ b/cozy/ui/widgets/whats_new_importer.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/whats_new_library.py b/cozy/ui/widgets/whats_new_library.py index ec548b1d..b03aceb4 100644 --- a/cozy/ui/widgets/whats_new_library.py +++ b/cozy/ui/widgets/whats_new_library.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/whats_new_m4b.py b/cozy/ui/widgets/whats_new_m4b.py index 0f72ec6d..2b06bd2a 100644 --- a/cozy/ui/widgets/whats_new_m4b.py +++ b/cozy/ui/widgets/whats_new_m4b.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/whats_new_m4b_chapter.py b/cozy/ui/widgets/whats_new_m4b_chapter.py index 23234fad..c9f9c879 100644 --- a/cozy/ui/widgets/whats_new_m4b_chapter.py +++ b/cozy/ui/widgets/whats_new_m4b_chapter.py @@ -1,6 +1,6 @@ import gi -gi.require_version('Gtk', '3.0') +gi.require_version('Gtk', '4.0') from gi.repository import Gtk diff --git a/cozy/ui/widgets/whats_new_window.py b/cozy/ui/widgets/whats_new_window.py index 1e80d1ef..cc5f3b2b 100644 --- a/cozy/ui/widgets/whats_new_window.py +++ b/cozy/ui/widgets/whats_new_window.py @@ -8,12 +8,12 @@ from cozy.ui.main_view import CozyUI from cozy.version import __version__ as CozyVersion -gi.require_version('Gtk', '3.0') -from gi.repository import Gtk, Handy +gi.require_version('Gtk', '4.0') +from gi.repository import Gtk, Adw @Gtk.Template(resource_path='/com/github/geigi/cozy/whats_new.ui') -class WhatsNewWindow(Handy.Window): +class WhatsNewWindow(Adw.Window): __gtype_name__ = 'WhatsNew' content_stack: Gtk.Stack = Gtk.Template.Child() diff --git a/data/ui/about.ui b/data/ui/about.ui index 4691fac4..16e94c89 100644 --- a/data/ui/about.ui +++ b/data/ui/about.ui @@ -1,11 +1,8 @@ - - + - False - True - dialog + 1 Cozy 0.0.1 Bundled dependencies: @@ -13,7 +10,7 @@ python-inject by ivankorobkov - Apache-2.0 Licence Thanks all supporters: https://www.patreon.com/geigi Help translate Cozy: https://transifex.com/geigi/cozy https://github.com/geigi/cozy - GitHub + GitHub geigi Contributions on GitHub: @@ -163,31 +160,11 @@ yalexaner - + - False + 0 vertical 2 - - - False - end - - - - - - - - - False - False - 0 - - - - - diff --git a/data/ui/album_element.ui b/data/ui/album_element.ui index 1b9b0046..df5b7a15 100644 --- a/data/ui/album_element.ui +++ b/data/ui/album_element.ui @@ -1,150 +1,102 @@ - - - - True - False - play-symbolic - 2 - - + diff --git a/data/ui/book_detail.ui b/data/ui/book_detail.ui index 0b6eb43a..d62ac88a 100644 --- a/data/ui/book_detail.ui +++ b/data/ui/book_detail.ui @@ -1,42 +1,32 @@ - - - -