From e10b5295bd5e726a91262c5b4b8da29ad510e003 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Sat, 5 Apr 2025 00:57:02 +0200 Subject: [PATCH] Fixes in admin --- .../libraries/db/extrafields/usernamefield.py | 2 +- paramecio2/libraries/i18n.py | 28 +++++++++++++++++++ paramecio2/libraries/mtemplates.py | 4 +++ paramecio2/modules/admin/__init__.py | 2 ++ paramecio2/modules/admin/media/css/admin.css | 3 ++ .../modules/admin/templates/dashboard.phtml | 1 + 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/paramecio2/libraries/db/extrafields/usernamefield.py b/paramecio2/libraries/db/extrafields/usernamefield.py index 0491858..1b79d9d 100644 --- a/paramecio2/libraries/db/extrafields/usernamefield.py +++ b/paramecio2/libraries/db/extrafields/usernamefield.py @@ -20,7 +20,7 @@ along with this program. If not, see . from paramecio2.libraries.db.corefields import PhangoField from paramecio2.libraries.db.coreforms import PasswordForm from hmac import compare_digest as compare_hash -import crypt +#import crypt import re class UserNameField(PhangoField): diff --git a/paramecio2/libraries/i18n.py b/paramecio2/libraries/i18n.py index 516a879..a36c4d4 100644 --- a/paramecio2/libraries/i18n.py +++ b/paramecio2/libraries/i18n.py @@ -108,7 +108,35 @@ class I18n: #@staticmethod #def set_lang(code_lang): # if default_lang + def __init__(self, module): + self.module=module + + def slang(self, symbol, text_default, lang=None): + """Method for get a string from selected language but object oriented + + Method for get a string from selected language but object oriented + + Args: + symbol (str): The symbol used for identify the text string. + text_default (str): The text default used. You have use how base for translations. + """ + return I18n.lang(self.module, symbol, text_default) + + def tlang(self, text_default, lang=None): + """Method for get a string from selected language but object oriented and using module and symbol by default + + Method for get a string from selected language but object oriented and using module and symbol by default + + Args: + symbol (str): The symbol used for identify the text string. + text_default (str): The text default used. You have use how base for translations. + """ + + symbol=text_default[:60] + + return I18n.lang(self.module, symbol, text_default) + @staticmethod def get_default_lang(): diff --git a/paramecio2/libraries/mtemplates.py b/paramecio2/libraries/mtemplates.py index 9b9f0b8..8c750fe 100644 --- a/paramecio2/libraries/mtemplates.py +++ b/paramecio2/libraries/mtemplates.py @@ -157,8 +157,12 @@ class PTemplate: #print(path.basename(module_env)+' '+base_name+'/languages/') self.l=PGetText(module_env+'/app.py') + + self.i18n=I18n(module_env) self.add_filter(self._) + + self.add_filter(self.i18n.tlang) def _(self, text): diff --git a/paramecio2/modules/admin/__init__.py b/paramecio2/modules/admin/__init__.py index bf4f1e8..4548b60 100644 --- a/paramecio2/modules/admin/__init__.py +++ b/paramecio2/modules/admin/__init__.py @@ -8,5 +8,7 @@ try: t=PTemplate(env) + wsgi_module=True + except: pass diff --git a/paramecio2/modules/admin/media/css/admin.css b/paramecio2/modules/admin/media/css/admin.css index 8cfd9b3..82aedd0 100644 --- a/paramecio2/modules/admin/media/css/admin.css +++ b/paramecio2/modules/admin/media/css/admin.css @@ -1039,6 +1039,7 @@ a.form_button_tab:hover box-sizing: border-box; /* border: solid #fff 1px;*/ float:left; + overflow:hidden; } @@ -1049,6 +1050,7 @@ a.form_button_tab:hover box-sizing: border-box; /*border: solid #f00 1px;*/ float:left; + overflow:hidden; } @@ -1058,6 +1060,7 @@ a.form_button_tab:hover box-sizing: border-box; /*border: solid #f00 1px;*/ float:left; + overflow:hidden; } diff --git a/paramecio2/modules/admin/templates/dashboard.phtml b/paramecio2/modules/admin/templates/dashboard.phtml index d6b5eef..9c3442c 100644 --- a/paramecio2/modules/admin/templates/dashboard.phtml +++ b/paramecio2/modules/admin/templates/dashboard.phtml @@ -17,6 +17,7 @@ if session.get('theme', '0')=='1': ${title} +