Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MERGE IF IMPLEMENTATION WITH REVEALER NOT POSSIBLE: clubhouse: Vertically expand achievements view #959

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions data/achievements-view.ui
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">300</property>
<property name="max_content_height">500</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
Expand Down Expand Up @@ -139,8 +137,6 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">300</property>
<property name="max_content_height">500</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
Expand Down
45 changes: 41 additions & 4 deletions data/clubhouse-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@
</object>
</child>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
<child type="overlay">
<object class="GtkEventBox" id="_headerbar_eventbox">
Expand Down Expand Up @@ -502,18 +505,45 @@
<object class="GtkEventBox" id="_user_event_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="above_child">True</property>
<child>
<object class="GtkBox" id="_achievements_view_box">
<object class="GtkBox" id="_achievements_view_stack_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkRevealer" id="_achievements_view_revealer">
<object class="GtkStack" id="_achievements_view_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="notify::child-revealed" handler="_achievements_view_revealer_child_revealed_notify_cb" swapped="no"/>
<signal name="notify::transition-running" handler="_achievements_view_stack_transition_running_notify_cb" swapped="no"/>
<child>
<placeholder/>
<object class="GtkBox" id="_achievements_view_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">ACHIEVEMENTS_PAGE</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="_achievements_dummy_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">DUMMY_PAGE</property>
<property name="title" translatable="yes">page0</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
Expand All @@ -522,6 +552,12 @@
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="achievements-view-box"/>
</style>
Expand Down Expand Up @@ -559,6 +595,7 @@
</style>
</object>
<packing>
<property name="pass_through">True</property>
<property name="index">2</property>
</packing>
</child>
Expand Down
29 changes: 22 additions & 7 deletions eosclubhouse/clubhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,8 @@ class ClubhouseWindow(Gtk.ApplicationWindow):
_user_button_image_revealer = Gtk.Template.Child()
_user_image_button = Gtk.Template.Child()
_achievements_view_box = Gtk.Template.Child()
_achievements_view_revealer = Gtk.Template.Child()
_achievements_view_stack = Gtk.Template.Child()
_achievements_view_stack_box = Gtk.Template.Child()
_achievements_view_revealer_revealer = Gtk.Template.Child()

_pathways_menu_button = Gtk.Template.Child()
Expand All @@ -1707,7 +1708,10 @@ def __init__(self, app):
self.character = CharacterView()

self._achievements_view = AchievementsView()
self._achievements_view_revealer.add(self._achievements_view)
self._achievements_view_box.add(self._achievements_view)

# Otherwise it's impossible to click Ada and Riley characters.
self._user_event_box.remove(self._achievements_view_stack_box)

self._stack_event_box.connect('button-press-event',
lambda _box, _event: self.hide_achievements_view())
Expand Down Expand Up @@ -1975,23 +1979,34 @@ def _user_button_clicked_cb(self, _user_button):
else:
self.hide_achievements_view()

def hide_achievements_view(self):
self._user_box.props.valign = Gtk.Align.START
# self._achievements_view_stack.props.valign = Gtk.Align.START
self._achievements_view_stack.props.transition_type = Gtk.StackTransitionType.SLIDE_UP
self._achievements_view_stack.props.visible_child_name = 'DUMMY_PAGE'

@Gtk.Template.Callback()
def _achievements_view_revealer_revealer_child_revealed_notify_cb(self, revealer, _pspec):
if revealer.props.child_revealed:
self._user_button_image_revealer.props.reveal_child = True
self._achievements_view_revealer.props.reveal_child = True

self._user_box.props.valign = Gtk.Align.FILL
self._user_event_box.add(self._achievements_view_stack_box)

self._achievements_view_stack.props.transition_type = Gtk.StackTransitionType.SLIDE_DOWN
self._achievements_view_stack.props.visible_child_name = 'ACHIEVEMENTS_PAGE'
# Set the achievements view to its default state.
self._achievements_view.set_page(AchievementsView.PAGE_GRID)
self._achievements_view.reset_scrollbar_position()

@Gtk.Template.Callback()
def _achievements_view_revealer_child_revealed_notify_cb(self, revealer, _pspec):
if not revealer.props.child_revealed:
def _achievements_view_stack_transition_running_notify_cb(self, stack, _pspec):
if not stack.props.transition_running and stack.props.visible_child_name == 'DUMMY_PAGE':
self._user_button_image_revealer.props.reveal_child = False
self._achievements_view_revealer_revealer.props.reveal_child = False

def hide_achievements_view(self):
self._achievements_view_revealer.props.reveal_child = False
# Otherwise it's impossible to click Ada and Riley characters.
self._user_event_box.remove(self._achievements_view_stack_box)

@Gtk.Template.Callback()
def _on_visibile_property_changed(self, _window, _param):
Expand Down