From: Michael Tremer Date: Wed, 5 May 2021 15:06:47 +0000 (+0000) Subject: Add scaffolding for a text user interface X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0e5d1ed92eb330c1448f2b5d0fe05f4defaf3c5;p=people%2Fms%2Fbricklayer.git Add scaffolding for a text user interface Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 8cb73c2..0623158 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/src/python/__init__.py b/src/python/__init__.py index 2602890..5667f54 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -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 index 0000000..20ead6c --- /dev/null +++ b/src/python/tui/__init__.py @@ -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 . # +# # +############################################################################### + +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