From 28a832268df67d965b7724fb6852b44df6b7434b Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 13 Nov 2024 11:10:07 -0600 Subject: [PATCH] bug fixes --- bin/qcms | 30 +++++++++++++++++++++--------- cms/engine/themes/__init__.py | 2 +- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/bin/qcms b/bin/qcms index 333ae4b..5ff4ecc 100755 --- a/bin/qcms +++ b/bin/qcms @@ -33,8 +33,8 @@ version {meta.__version__} {meta.__license__}""" -PASSED = ' '.join(['[',colored(u'\u2713', 'green'),']']) -FAILED= ' '.join(['[',colored(u'\u2717','red'),']']) +PASSED = ' '.join(['[',colored('\u2713', 'green'),']']) +FAILED= ' '.join(['[',colored('\u2717','red'),']']) INVALID_FOLDER = """ {FAILED} Unable to proceed, could not find project manifest. It should be qcms-manifest.json @@ -323,13 +323,25 @@ def handle_theme ( _root = os.sep.join( manifest.split(os.sep)[:-1]+[_config['layout']['root']]) if show : - _df = pd.DataFrame({"available":themes.List()}) - if _df.shape[0] > 0 : - values = themes.installed(_root) - values.sort() - values = values + np.repeat(f"""{FAILED}""", _df.shape[0] - len(values)).tolist() - values.sort() - _df['installed'] = values + _available = themes.List() + _df = pd.DataFrame({"available":_available}) + # if _df.shape[0] > 0 : + if _available : + _installed = themes.installed(_root) + _available.sort() + _marks = [] + for _themeName in _available : + _symbol = '\u2713' if _themeName in _installed else '\u2717' + if _config['system']['theme'] == _themeName : + _symbol = '\u2605' + # colored('\u2713', 'green') + # _symbol = _symbol.replace('[ ','').replace(' ]','') + _marks.append( str(_symbol)) + _df = pd.DataFrame({"available":_available,"installed":_marks}) + # values.sort() + # values = values + np.repeat(f"""{FAILED}""", _df.shape[0] - len(values)).tolist() + # values.sort() + # _df['installed'] = values else: _df = f"""{FAILED} No themes were found in registry,\ncurl {themes.URL}/api/themes/List (QCMS_HOST_URL should be set)""" print (_df) diff --git a/cms/engine/themes/__init__.py b/cms/engine/themes/__init__.py index d3d00b7..63e7527 100644 --- a/cms/engine/themes/__init__.py +++ b/cms/engine/themes/__init__.py @@ -11,7 +11,7 @@ This would avoid crashes but would come at the expense of a lack of consistent v """ import requests import os -URL = os.environ['QCMS_HOME_URL'] if 'QCMS_HOME_URL' in os.environ else 'https://dev.the-phi.com/qcms' +URL = os.environ['QCMS_HOST_URL'] if 'QCMS_HOST_URL' in os.environ else 'https://dev.the-phi.com/qcms' def current (_system) : return _system['theme'] def List (_url = URL) :