]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
Add scaffolding for a text user interface
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 May 2021 15:06:47 +0000 (15:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 May 2021 15:06:47 +0000 (15:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/python/__init__.py
src/python/tui/__init__.py [new file with mode: 0644]

index 8cb73c241a0ae53b996a5c008e1499ca2fd26fca..0623158766a7916a299581a4c7d961a700e36fa1 100644 (file)
@@ -47,3 +47,8 @@ dist_pkgpython_PYTHON = \
        src/python/__init__.py \
        src/python/i18n.py \
        src/python/logger.py
+
+pkgpython_tuidir = $(pkgpythondir)/tui
+
+dist_pkgpython_tui_PYTHON = \
+       src/python/tui/__init__.py
index 260289020774d452633bc395ea5f7061592a728d..5667f546968d2205341aa69501493a81af5c4137 100644 (file)
@@ -21,6 +21,7 @@
 import logging
 
 from . import logger
+from . import tui
 
 # Setup logging
 log = logging.getLogger("bricklayer")
@@ -37,6 +38,9 @@ class Bricklayer(object):
                if debug:
                        log.setLevel(logging.DEBUG)
 
+               # Initialise the text user interface
+               self.tui = tui.Tui(self)
+
                # Log when we are ready
                if self.test:
                        log.info("Bricklayer initialized in test mode")
@@ -44,4 +48,5 @@ class Bricklayer(object):
                        log.info("Bricklayer initialized")
 
        def __call__(self):
-               pass
+               with self.tui:
+                       pass
diff --git a/src/python/tui/__init__.py b/src/python/tui/__init__.py
new file mode 100644 (file)
index 0000000..20ead6c
--- /dev/null
@@ -0,0 +1,36 @@
+###############################################################################
+#                                                                             #
+# Bricklayer - An Installer for IPFire                                        #
+# Copyright (C) 2021 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software; you can redistribute it and/or               #
+# modify it under the terms of the GNU General Public License                 #
+# as published by the Free Software Foundation; either version 2              #
+# 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 General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+import logging
+
+# Setup logging
+log = logging.getLogger("bricklayer.tui")
+
+class Tui(object):
+       def __init__(self, bricklayer):
+               self.bricklayer = bricklayer
+
+       # Make this class usable as context
+
+       def __enter__(self):
+               return self
+
+       def __exit__(self, type, value, traceback):
+               pass