From c07d4316d612ce7a72b74954a170e41784f67726 Mon Sep 17 00:00:00 2001 From: Rory Fewell Date: Fri, 27 Jun 2025 21:02:21 +0100 Subject: [PATCH] Prelim: Startup stuff for setup autorun --- base/setup/initial/autorun/main.py | 10 ++++++++++ base/setup/initial/autorun/warapp.py | 21 +++++++++++++++++++++ base/setup/initial/autorun/warwndar.py | 16 ++++++++++++++++ base/setup/initial/setup.sh | 18 +++++++++++------- 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 base/setup/initial/autorun/main.py create mode 100644 base/setup/initial/autorun/warapp.py create mode 100644 base/setup/initial/autorun/warwndar.py diff --git a/base/setup/initial/autorun/main.py b/base/setup/initial/autorun/main.py new file mode 100644 index 0000000..0265f25 --- /dev/null +++ b/base/setup/initial/autorun/main.py @@ -0,0 +1,10 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk +from warapp import WinTCAutorunApplication + +if __name__ == "__main__": + app = WinTCAutorunApplication() + app.run(sys.argv) diff --git a/base/setup/initial/autorun/warapp.py b/base/setup/initial/autorun/warapp.py new file mode 100644 index 0000000..e375410 --- /dev/null +++ b/base/setup/initial/autorun/warapp.py @@ -0,0 +1,21 @@ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk +from warwndar import WinTCAutorunWindow + +class WinTCAutorunApplication(Gtk.Application): + def __init__(self, *args, **kwargs): + super().__init__( + *args, + application_id="uk.oddmatics.wintc.autorun", + **kwargs + ) + + self.window_startup = None + + def do_activate(self): + if not self.window_startup: + self.window_startup = WinTCAutorunWindow(application=self) + + self.window_startup.present() diff --git a/base/setup/initial/autorun/warwndar.py b/base/setup/initial/autorun/warwndar.py new file mode 100644 index 0000000..206d5d9 --- /dev/null +++ b/base/setup/initial/autorun/warwndar.py @@ -0,0 +1,16 @@ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +class WinTCAutorunWindow(Gtk.ApplicationWindow): + def __init__(self, *args, **kwargs): + super().__init__( + *args, + title="Windows Setup", + **kwargs + ) + + self.testlabel = Gtk.Label(label="Welcome to Windows WinTC") + self.add(self.testlabel) + self.show_all() diff --git a/base/setup/initial/setup.sh b/base/setup/initial/setup.sh index 50b1605..e9ffee1 100755 --- a/base/setup/initial/setup.sh +++ b/base/setup/initial/setup.sh @@ -19,10 +19,15 @@ python_path=`which python 2>/dev/null` if [ $? != 0 ] then - printf "%s%s\n" \ - "Your system is missing the Python 3 interpreter, this is required " \ - "by setup. Setup will now exit."; - exit 1; + python_path=`which python3 2>/dev/null` + + if [ $? != 0 ] + then + printf "%s%s\n" \ + "Your system is missing the Python 3 interpreter, this is " \ + "required by setup. Setup will now exit."; + exit 1; + fi fi # Inspect the distro @@ -36,8 +41,7 @@ export DIST_ID_EXT # if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] then - $python_path textmode/main.py; + $python_path textmode/main.py else - printf "%s\n" "GUI mode setup is not yet implemented. Sorry!" - exit 1 + $python_path autorun/main.py fi