Files
VoidManifest/src/gnomeframe/window.py

61 lines
2.0 KiB
Python

# window.py
#
# Copyright 2025 nihil
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import json
import os
from pathlib import Path
from .pages.home import HomePage
from .pages.settings import SettingsPage
from .pages.checklist import ChecklistPage
from gi.repository import Adw
from gi.repository import Gtk, Gio
from gi.repository import GLib
@Gtk.Template(resource_path='/gay/valhrafnaz/VoidManifest/ui/window.ui')
class VoidManifestWindow(Adw.ApplicationWindow):
__gtype_name__ = 'VoidManifestWindow'
viewstack = Gtk.Template.Child()
btn_reset_profile = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.app = self.get_application()
self._load_page_templates()
reset_action = Gio.SimpleAction.new("reset-selections", None)
reset_action.connect("activate", self.app.reset_frames)
self.get_application().add_action(reset_action)
self.btn_reset_profile.connect("clicked", self.app.reset_frames)
self.connect("close-request", self._on_close_request)
def _load_page_templates(self):
self.home_page = HomePage(parent=self.viewstack)
self.checklist_page = ChecklistPage(parent=self.viewstack, window=self)
self.settings_page = SettingsPage(parent=self.viewstack)
def _on_close_request(self, *args):
self.app.save_profile(self.app.profile)
return False