Details view improvements

This commit is contained in:
kramo
2023-04-10 15:24:24 +02:00
parent 3107bda8e0
commit d93c6aa81d
4 changed files with 56 additions and 29 deletions

View File

@@ -80,7 +80,7 @@ menu game_options {
section {
item {
label: _("Edit");
action: "app.edit_details";
action: "app.edit_game";
}
item {
@@ -99,7 +99,7 @@ menu hidden_game_options {
section {
item {
label: _("Edit");
action: "app.edit_details";
action: "app.edit_game";
}
item {

View File

@@ -122,21 +122,23 @@ template CartridgesWindow : Adw.ApplicationWindow {
]
}
Label overview_added {
Box {
orientation: horizontal;
margin-top: 12;
hexpand: true;
halign: start;
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
}
Label overview_last_played {
margin-top: 6;
hexpand: true;
halign: start;
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
Label overview_added {
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
}
Label overview_last_played {
margin-start: 12;
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
}
}
Box {
hexpand: true;
@@ -155,17 +157,42 @@ template CartridgesWindow : Adw.ApplicationWindow {
]
}
MenuButton overview_menu_button {
icon-name: "view-more-symbolic";
Box {
hexpand: true;
vexpand: true;
halign: start;
vexpand: true;
valign: center;
margin-top: 24;
margin-start: 6;
margin-start: 12;
Button {
icon-name: "document-edit-symbolic";
action-name: "app.edit_game";
tooltip-text: _("Edit");
styles [
"circular",
]
}
Button overview_hide_button {
action-name: "app.hide_game";
styles [
"circular",
]
}
Button {
icon-name: "user-trash-symbolic";
action-name: "app.remove_game";
tooltip-text: _("Remove");
styles [
"circular",
]
}
styles [
"circular",
"linked",
]
}
}

View File

@@ -53,7 +53,7 @@ class CartridgesApplication(Adw.Application):
)
self.create_action("launch_game", self.on_launch_game_action)
self.create_action("hide_game", self.on_hide_game_action)
self.create_action("edit_details", self.on_edit_details_action)
self.create_action("edit_game", self.on_edit_game_action)
self.create_action("add_game", self.on_add_game_action, ["<primary>n"])
self.create_action("import", self.on_import_action, ["<primary>i"])
self.create_action(
@@ -64,7 +64,6 @@ class CartridgesApplication(Adw.Application):
self.win = None
def do_activate(self): # pylint: disable=arguments-differ
# Create the main window
self.win = self.props.active_window # pylint: disable=no-member
if not self.win:
@@ -184,7 +183,7 @@ class CartridgesApplication(Adw.Application):
self.win.toasts[(game_id, "hide")] = toast
self.win.toast_overlay.add_toast(toast)
def on_edit_details_action(self, _widget, _callback=None):
def on_edit_game_action(self, _widget, _callback=None):
create_details_window(self.win, self.win.active_game_id)
def on_add_game_action(self, _widget, _callback=None):

View File

@@ -54,10 +54,10 @@ class CartridgesWindow(Adw.ApplicationWindow):
overview_header_bar_title = Gtk.Template.Child()
overview_launch = Gtk.Template.Child()
overview_blurred_cover = Gtk.Template.Child()
overview_menu_button = Gtk.Template.Child()
overview_developer = Gtk.Template.Child()
overview_added = Gtk.Template.Child()
overview_last_played = Gtk.Template.Child()
overview_hide_button = Gtk.Template.Child()
hidden_library = Gtk.Template.Child()
hidden_library_view = Gtk.Template.Child()
@@ -267,9 +267,12 @@ class CartridgesWindow(Adw.ApplicationWindow):
else:
self.overview_developer.set_visible(False)
self.overview_menu_button.set_menu_model(
current_game.menu_button.get_menu_model()
)
if current_game.hidden:
self.overview_hide_button.set_icon_name("view-reveal-symbolic")
self.overview_hide_button.set_tooltip_text(_("Unhide"))
else:
self.overview_hide_button.set_icon_name("view-conceal-symbolic")
self.overview_hide_button.set_tooltip_text(_("Hide"))
if self.stack.get_visible_child() != self.overview:
self.stack.set_transition_type(Gtk.StackTransitionType.OVER_LEFT)
@@ -338,7 +341,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
)
else:
self.overview_blurred_cover.set_opacity(
0.2 + (sum(luminances) / len(luminances) + min(luminances)) / 2
0.1 + (sum(luminances) / len(luminances) + min(luminances)) / 2
)
def a_z_sort(self, child1, child2):
@@ -497,5 +500,3 @@ class CartridgesWindow(Adw.ApplicationWindow):
def on_open_menu_action(self, _widget, _unused):
if self.stack.get_visible_child() != self.overview:
self.primary_menu_button.set_active(True)
else:
self.overview_menu_button.set_active(True)