Keep project expanded after request reorder; hide request menu button until hover
This commit is contained in:
parent
25b3f9b20a
commit
71f01edde0
@ -32,6 +32,7 @@
|
|||||||
<property name="tooltip-text">Options</property>
|
<property name="tooltip-text">Options</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="flat"/>
|
<class name="flat"/>
|
||||||
|
<class name="request-menu-button"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@ -224,6 +224,16 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Request menu button: hidden by default, visible on row hover or when open */
|
||||||
|
.request-menu-button {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 150ms ease;
|
||||||
|
}
|
||||||
|
row:hover .request-menu-button,
|
||||||
|
.request-menu-button:checked {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Method chips in sidebar request list */
|
/* Method chips in sidebar request list */
|
||||||
.method-chip {
|
.method-chip {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@ -961,6 +971,14 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
def _load_projects(self) -> None:
|
def _load_projects(self) -> None:
|
||||||
"""Load and display projects."""
|
"""Load and display projects."""
|
||||||
|
# Remember which projects are currently expanded
|
||||||
|
expanded_ids = set()
|
||||||
|
child = self.projects_listbox.get_first_child()
|
||||||
|
while child:
|
||||||
|
if isinstance(child, ProjectItem) and child.expanded:
|
||||||
|
expanded_ids.add(child.project.id)
|
||||||
|
child = child.get_next_sibling()
|
||||||
|
|
||||||
# Clear existing
|
# Clear existing
|
||||||
while child := self.projects_listbox.get_first_child():
|
while child := self.projects_listbox.get_first_child():
|
||||||
self.projects_listbox.remove(child)
|
self.projects_listbox.remove(child)
|
||||||
@ -984,6 +1002,11 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
item.connect('request-move-up-requested', self._on_request_move_up, project)
|
item.connect('request-move-up-requested', self._on_request_move_up, project)
|
||||||
item.connect('request-move-down-requested', self._on_request_move_down, project)
|
item.connect('request-move-down-requested', self._on_request_move_down, project)
|
||||||
item.connect('request-move-to-project-requested', self._on_request_move_to_project, project)
|
item.connect('request-move-to-project-requested', self._on_request_move_to_project, project)
|
||||||
|
if project.id in expanded_ids:
|
||||||
|
item.expanded = True
|
||||||
|
item.requests_revealer.set_transition_duration(0)
|
||||||
|
item.requests_revealer.set_reveal_child(True)
|
||||||
|
GLib.idle_add(lambda r=item.requests_revealer: (r.set_transition_duration(250), False)[1])
|
||||||
self.projects_listbox.append(item)
|
self.projects_listbox.append(item)
|
||||||
|
|
||||||
def on_add_project_clicked(self, button):
|
def on_add_project_clicked(self, button):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user