Fix overlay layering
This commit is contained in:
@@ -30,9 +30,10 @@ template game : Box {
|
|||||||
Box {
|
Box {
|
||||||
Overlay overlay {
|
Overlay overlay {
|
||||||
[overlay]
|
[overlay]
|
||||||
Revealer button_revealer {
|
Revealer play_revealer {
|
||||||
reveal-child: false;
|
reveal-child: false;
|
||||||
transition-type: crossfade;
|
transition-type: crossfade;
|
||||||
|
Box {
|
||||||
Button button_play {
|
Button button_play {
|
||||||
halign: start;
|
halign: start;
|
||||||
label: _("Play");
|
label: _("Play");
|
||||||
@@ -41,10 +42,6 @@ template game : Box {
|
|||||||
margin-top: 6;
|
margin-top: 6;
|
||||||
margin-bottom: 6;
|
margin-bottom: 6;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
[overlay]
|
|
||||||
Revealer menu_revealer {
|
|
||||||
transition-type: crossfade;
|
|
||||||
MenuButton menu_button {
|
MenuButton menu_button {
|
||||||
icon-name: "view-more-symbolic";
|
icon-name: "view-more-symbolic";
|
||||||
margin-top: 6;
|
margin-top: 6;
|
||||||
@@ -52,6 +49,7 @@ template game : Box {
|
|||||||
margin-end: 6;
|
margin-end: 6;
|
||||||
margin-start: 6;
|
margin-start: 6;
|
||||||
menu-model: game_options;
|
menu-model: game_options;
|
||||||
|
hexpand: true;
|
||||||
halign: end;
|
halign: end;
|
||||||
|
|
||||||
styles [
|
styles [
|
||||||
@@ -59,6 +57,7 @@ template game : Box {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Revealer title_revealer {
|
Revealer title_revealer {
|
||||||
transition-type: crossfade;
|
transition-type: crossfade;
|
||||||
reveal-child: true;
|
reveal-child: true;
|
||||||
|
|||||||
12
src/game.py
12
src/game.py
@@ -30,9 +30,8 @@ class game(Gtk.Box):
|
|||||||
cover_button = Gtk.Template.Child()
|
cover_button = Gtk.Template.Child()
|
||||||
menu_button = Gtk.Template.Child()
|
menu_button = Gtk.Template.Child()
|
||||||
hidden_game_options = Gtk.Template.Child()
|
hidden_game_options = Gtk.Template.Child()
|
||||||
button_revealer = Gtk.Template.Child()
|
play_revealer = Gtk.Template.Child()
|
||||||
title_revealer = Gtk.Template.Child()
|
title_revealer = Gtk.Template.Child()
|
||||||
menu_revealer = Gtk.Template.Child()
|
|
||||||
|
|
||||||
def __init__(self, parent_widget, title, pixbuf, game_id, **kwargs):
|
def __init__(self, parent_widget, title, pixbuf, game_id, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@@ -47,8 +46,7 @@ class game(Gtk.Box):
|
|||||||
|
|
||||||
self.event_contoller_motion = Gtk.EventControllerMotion.new()
|
self.event_contoller_motion = Gtk.EventControllerMotion.new()
|
||||||
self.overlay.add_controller(self.event_contoller_motion)
|
self.overlay.add_controller(self.event_contoller_motion)
|
||||||
self.overlay.set_measure_overlay(self.button_revealer, True)
|
self.overlay.set_measure_overlay(self.play_revealer, True)
|
||||||
self.overlay.set_measure_overlay(self.menu_revealer, True)
|
|
||||||
|
|
||||||
self.button_play.connect("clicked", self.launch_game)
|
self.button_play.connect("clicked", self.launch_game)
|
||||||
self.event_contoller_motion.connect("enter", self.show_play)
|
self.event_contoller_motion.connect("enter", self.show_play)
|
||||||
@@ -56,15 +54,13 @@ class game(Gtk.Box):
|
|||||||
self.menu_button.get_popover().connect("notify::visible", self.hide_play)
|
self.menu_button.get_popover().connect("notify::visible", self.hide_play)
|
||||||
|
|
||||||
def show_play(self, widget, *args):
|
def show_play(self, widget, *args):
|
||||||
self.button_revealer.set_reveal_child(True)
|
self.play_revealer.set_reveal_child(True)
|
||||||
self.title_revealer.set_reveal_child(False)
|
self.title_revealer.set_reveal_child(False)
|
||||||
self.menu_revealer.set_reveal_child(True)
|
|
||||||
|
|
||||||
def hide_play(self, widget, *args):
|
def hide_play(self, widget, *args):
|
||||||
if not self.menu_button.get_active():
|
if not self.menu_button.get_active():
|
||||||
self.button_revealer.set_reveal_child(False)
|
self.play_revealer.set_reveal_child(False)
|
||||||
self.title_revealer.set_reveal_child(True)
|
self.title_revealer.set_reveal_child(True)
|
||||||
self.menu_revealer.set_reveal_child(False)
|
|
||||||
|
|
||||||
def launch_game(self, widget):
|
def launch_game(self, widget):
|
||||||
self.parent_widget.set_active_game(None, None, self.game_id)
|
self.parent_widget.set_active_game(None, None, self.game_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user