~fabrixxm/confy

c72b1e35239cd5c5d509135b727ef33120473f10 — fabrixxm 7 months ago dd0a9ad
Add "search all"
4 files changed, 24 insertions(+), 6 deletions(-)

M src/mainwindow.blp
M src/mainwindow.py
M src/pages.py
M src/pages_events.blp
M src/mainwindow.blp => src/mainwindow.blp +4 -3
@@ 137,13 137,14 @@ template CMainWindow : Adw.ApplicationWindow  {
						row-activated => _on_event_row_activated();
					} // /subpage_events

					.CPageDetails subpage_details {
					} // /subpage_details

					.CPageEvents subpage_search_all {
						model: "search";
					}// /subpage_search_all}

					.CPageDetails subpage_details {
					} // /subpage_details


				}// /subpage_leaflet

			};// overlay

M src/mainwindow.py => src/mainwindow.py +4 -1
@@ 36,6 36,7 @@ class MainWindow(Adw.ApplicationWindow):
    main_stack = Gtk.Template.Child()

    subpage_events = Gtk.Template.Child()
    subpage_search_all = Gtk.Template.Child()
    subpage_details = Gtk.Template.Child()

    def __init__(self, conf, **kwargs):


@@ 55,6 56,7 @@ class MainWindow(Adw.ApplicationWindow):
        self.nm.connect("notify",self._on_networkconnectionmonitor_notify)

        self._init_pages()
        self.subpage_leaflet.get_page(self.subpage_search_all).set_navigatable(False)
        self.set_pageheader_title()
        self.show_loader()
        try:


@@ 186,7 188,8 @@ class MainWindow(Adw.ApplicationWindow):

    def show_search_all(self):
        self.subpage_leaflet.get_page(self.subpage_events).set_navigatable(False)
        self.subpage_leaflet.get_page(self.subpage_details).set_navigatable(False)
        self.subpage_search_all.set_value(None)
        self.subpage_leaflet.set_visible_child(self.subpage_search_all)

    def show_details(self, event, is_events_navigatable=None):
        # Se sono sulla pagina "starred"

M src/pages.py => src/pages.py +15 -0
@@ 273,7 273,13 @@ class PageEvents(Gtk.Box):
        self._update_handler_id = None

        self.search_button.props.visible = True
        self.search_button.props.active = False
        self.searchbar.props.search_mode_enabled = False
        self.searchbar.entry.connect("changed", self.on_searchbar_entry_changed)

        self.search_button.bind_property("active",
            self.searchbar, "search-mode-enabled",
            GObject.BindingFlags.BIDIRECTIONAL)

        if self._model == "days":
            self.props.title = _("Talks on {}").format(obj.date.strftime(FMT_DAY))


@@ 314,6 320,7 @@ class PageEvents(Gtk.Box):
        elif self.model == "search":
            self.props.title = _("Search Talks")
            self.props.subtitle = ""
            self.search_button.props.active = True
            self.filters = None
            self.group_by = None



@@ 386,8 393,16 @@ class PageEvents(Gtk.Box):

        return None

    def on_searchbar_entry_changed(self, e):
        self.update()

    def get_objects(self):
        print(f"PageEvents: get_objects for {self._model} {self.filters}")
        if self.model == "search":
            term = self.searchbar.entry.get_text()
            if term == "":
                return []
            return models.Event.search(self.searchbar.entry.get_text())
        if self.filters is None:
            return []
        return models.Event.filter(**self.filters)

M src/pages_events.blp => src/pages_events.blp +1 -2
@@ 21,7 21,7 @@ template CPageEvents : Gtk.Box {
		}

		[start]
		Gtk.Button search_button {
		Gtk.ToggleButton search_button {
			icon-name: "system-search-symbolic";
		}



@@ 34,7 34,6 @@ template CPageEvents : Gtk.Box {
	.CSearchBarOverlay searchbar {
	}


	Gtk.ScrolledWindow {
		hexpand: true;
		vexpand: true;