File indexing completed on 2025-01-26 05:06:13
0001 #!/usr/bin/env python3 0002 0003 # SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com> 0004 # SPDX-License-Identifier: MIT 0005 0006 import gi 0007 0008 gi.require_version('Gtk', '4.0') 0009 from gi.repository import GLib, Gtk 0010 0011 0012 class TestWindow(Gtk.ApplicationWindow): 0013 0014 def __init__(self, _app: Gtk.Application) -> None: 0015 super().__init__(application=_app, title="Test Window") 0016 0017 self.button = Gtk.Button(label="Install Software") 0018 self.button.connect("clicked", self.on_button_clicked) 0019 self.set_child(self.button) 0020 0021 GLib.timeout_add_seconds(10, self.close) 0022 0023 def on_button_clicked(self, widget) -> None: 0024 self.close() 0025 0026 0027 def on_activate(_app: Gtk.Application) -> None: 0028 win = TestWindow(_app) 0029 win.present() 0030 0031 0032 if __name__ == "__main__": 0033 app = Gtk.Application(application_id='org.kde.testwindow') 0034 app.connect('activate', on_activate) 0035 app.run(None)