Commit 5aa47741 authored by Roman Alifanov's avatar Roman Alifanov

opportunity created: refresh the settings page with signal

parent 16755ec6
......@@ -171,6 +171,14 @@ def init_settings_stack(stack, listbox, split_view):
merged_data = merge_categories_by_name(yaml_data)
section_factory = SectionFactory()
if stack.get_pages():
print("Clear pages...")
listbox.remove_all()
for page in stack.get_pages():
stack.remove(page)
else:
print("First init...")
categories = [Category(c, section_factory) for c in merged_data]
for category in categories:
......
......@@ -17,7 +17,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
from gi.repository import Adw, Gtk
from gi.repository import GObject, Adw, Gtk
from .settings import init_settings_stack
......@@ -29,7 +29,19 @@ class TuneitWindow(Adw.ApplicationWindow):
settings_listbox = Gtk.Template.Child()
settings_split_view = Gtk.Template.Child()
@GObject.Signal
def settings_page_update(self):
pass
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.connect('settings_page_update', self.update_settings_page)
self.update_settings_page()
def update_settings_page(self, *args):
"""
Можно вызвать вот так, благодаря сигналу:
self.settings_pagestack.get_root().emit("settings_page_update")
"""
init_settings_stack(self.settings_pagestack, self.settings_listbox, self.settings_split_view)
print("Stack cleared and initialized!")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment