Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
paule32 committed Nov 26, 2024
1 parent 39d54c2 commit 896c582
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 104 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,9 @@ src/tools.pro/__pycache__/zipfiles.cpython-313.pyc
src/tools.pro/flags/__pycache__/downresize.cpython-313.pyc
src/locales/en_us/LC_MESSAGES/observer.mo.gz
src/locales/de_de/LC_MESSAGES/observer.mo.gz
src/build_loc.bat.bak
src/_internal/locales/en_us/LC_HELP/help.po.bak
src/_internal/locales/de_de/LC_HELP/help.po.bak
src/locales/de_de/LC_HELP/help.po.bak
src/locales/en_us/LC_HELP/help.po.bak
src/locales/en_us/LC_MESSAGES/1
27 changes: 27 additions & 0 deletions src/_internal/locales/de_de/LC_HELP/help.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ---------------------------------------------------------------------------
# File: help.po - localization translated stuff
# Author: Jens Kallup - paule32
#
# Rights: (c) 2024 by kallup non-profit software
# all rights reserved
#
# only for education, and for non-profit usage !!!
# commercial use ist not allowed.
# ---------------------------------------------------------------------------
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2024-04-06 20:33+0100\n"
"PO-Revision-Date: 2024-04-06 20:15+0100\n"
"Last-Translator: Jens Kallup <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=cp1252\n"
"Content-Transfer-Encoding: 8bit\n"

# ---------------------------------------------------------------------------
# the license of the application ...
# ---------------------------------------------------------------------------
msgid "home"
msgstr "Startseite"

35 changes: 35 additions & 0 deletions src/_internal/locales/en_us/LC_HELP/help.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ---------------------------------------------------------------------------
# File: help.po - localization translated stuff
# Author: Jens Kallup - paule32
#
# Rights: (c) 2024 by kallup non-profit software
# all rights reserved
#
# only for education, and for non-profit usage !!!
# commercial use ist not allowed.
# ---------------------------------------------------------------------------
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2024-04-06 20:33+0100\n"
"PO-Revision-Date: 2024-04-06 20:15+0100\n"
"Last-Translator: Jens Kallup <[email protected]>\n"
"Language-Team: English <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=cp1252\n"
"Content-Transfer-Encoding: 8bit\n"

# ---------------------------------------------------------------------------
# the license of the application ...
# ---------------------------------------------------------------------------
msgid "home"
msgstr ""
"<html>"
"<head>"
"<title>Beispielseite</title>"
"</head>"
"<body>"
"<h1>Hello, World!</h1>"
"<p>Dies ist ein HTML-String, der in QWebView angezeigt wird.</p>"
"</body>"
"</html>"
19 changes: 16 additions & 3 deletions src/build_loc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ echo create directories...
mkdir __pycache__\_internal\locales\de_de\LC_MESSAGES
mkdir __pycache__\_internal\locales\en_us\LC_MESSAGES

mkdir __pycache__\_internal\locales\de_de\LC_HELP
mkdir __pycache__\_internal\locales\en_us\LC_HELP

set BASEDIR=%cd%

::set PYTHONPATH=
::%PY%\Lib;%PY%\Lib\site-packagesss
::set PYTHONHOME=
set SRC=%BASEDIR%/src
set VPA=%BASEDIR%/venv

Expand All @@ -41,3 +41,16 @@ rm -rf observer.mo.gz
msgfmt -o observer.mo observer.po
gzip -9 observer.mo
copy observer.mo.gz %BASEDIR%\__pycache__\_internal\locales\en_us\LC_MESSAGES
:: ----------------------------------

cd %BASEDIR%\locales\de_de\LC_HELP
rm -rf help.mo.gz
msgfmt -o help.mo help.po
gzip -9 help.mo
copy help.mo.gz %BASEDIR%\__pycache__\_internal\locales\de_de\LC_HELP

cd %BASEDIR%\locales\en_us\LC_HELP
rm -rf help.mo.gz
msgfmt -o help.mo help.po
gzip -9 help.mo
copy help.mo.gz %BASEDIR%\__pycache__\_internal\locales\en_us\LC_HELP
86 changes: 52 additions & 34 deletions src/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ def __init__(self):
self.v__app__modul__ = os.path.join(self.v__app__app_dir__, "")

self.v__app__name = "observer"
self.v__app__help = "help"

self.v__app__name_mo = self.v__app__name + ".mo"
self.v__app__help_mo = self.v__app__help + ".mo"

self.v__app__cdn_host = "http://localhost/cdn"
self.v__app__internal__ = os.path.join(self.v__app__modul__, "_internal")
Expand Down Expand Up @@ -503,7 +506,10 @@ def __init__(self):
self.v__app_object = None
self.v__app_win = None
#
self.v__app__locales = ""
self.v__app__locales = ""
self.v__app__locales_messages = ""
self.v__app__locales_help = ""

self.v__app__img_ext__ = ".png"
self.v__app__font = "Arial"
self.v__app__font_edit = "Consolas"
Expand Down Expand Up @@ -697,7 +703,7 @@ def handle_language(lang):
#file_path = os.path.join(file_path, "LC_MESSAGES")
#file_path = os.path.join(file_path, genv. v__app__name_mo + ".gz")
#
_ = read_gzfile_to_memory(genv.v__app__locales)
_ = read_gzfile_to_memory(genv.v__app__locales_messages)
return _
except Exception as e:
exc_type, exc_value, exc_traceback = traceback.sys.exc_info()
Expand All @@ -712,6 +718,24 @@ def handle_language(lang):
print(f"llline : {tb.lineno}")
#
sys.exit(genv.EXIT_FAILURE)

def handle_help(lang):
try:
_h = read_gzfile_to_memory(genv.v__app__locales_help)
return _h
except Exception as e:
exc_type, exc_value, exc_traceback = traceback.sys.exc_info()
tb = traceback.extract_tb(e.__traceback__)[-1]

print(f"Exception occur during handle language:")
print(f"type : {exc_type.__name__}")
print(f"value: {exc_value}")
print(("-" * 40))
#
print(f"file : {tb.filename}")
print(f"llline : {tb.lineno}")
#
sys.exit(genv.EXIT_FAILURE)

# ---------------------------------------------------------------------------
# application imports ...
Expand Down Expand Up @@ -801,14 +825,20 @@ def handle_language(lang):
print(genv.v__app__config["common"]["language"])
genv.v__app__locales = os.path.join(genv.v__app__internal__, "locales")
genv.v__app__locales = os.path.join(genv.v__app__locales, genv.v__app__config["common"]["language"])
genv.v__app__locales = os.path.join(genv.v__app__locales, "LC_MESSAGES")
genv.v__app__locales = os.path.join(genv.v__app__locales, genv.v__app__name_mo + ".gz")

genv.v__app__locales_messages = os.path.join(genv.v__app__locales, "LC_MESSAGES")
genv.v__app__locales_help = os.path.join(genv.v__app__locales, "LC_HELP")

genv.v__app__locales_messages = os.path.join(genv.v__app__locales_messages, genv.v__app__name_mo + ".gz")
genv.v__app__locales_help = os.path.join(genv.v__app__locales_help , genv.v__app__help_mo + ".gz")
#
if len(genv.v__app__locales) < 5:
print("Error: locale out of seed.")
print("abort.")
sys.exit(1)
_ = handle_language(ini_lang)

_ = handle_language(ini_lang)
_h = handle_help (ini_lang)

# ------------------------------------------------------------------------
# determine on which operating the application script runs ...
Expand Down Expand Up @@ -16182,16 +16212,19 @@ def __init__(self, parent=None):
navigation_widget.setLayout(navigation_layout)

hlayout = QHBoxLayout()
topic_list = QListWidget()
topic_list.setStyleSheet("""
background-color: white;
width: 100px;
""")

# WebView Widget zum Anzeigen der CHM-Datei
self.browser = QWebEngineView()
self.browser = QWebEngineView()
self.topics = QWebEngineView()

hlayout.addWidget(topic_list)
self.topics.setMinimumWidth(180)
self.topics.setMaximumWidth(180)

self.topics.setStyleSheet("""
background-color: white;
""")

hlayout.addWidget(self.topics)
hlayout.addWidget(self.browser)

navigation_container.addWidget(navigation_widget)
Expand All @@ -16200,30 +16233,15 @@ def __init__(self, parent=None):
layout.addLayout(navigation_container)


dir_file_path = os.path.dirname(os.path.abspath(__file__))
chm_file_path = os.path.join("./_internal/help/help.chm")

chm_file_url = f"file:///{chm_file_path}"

if not os.path.exists(chm_file_path):
if not parent == None:
genv.window_login.hide()
QMessageBox.critical(self,
_("Error"),
_("Error:\nThe helpfile could not be found."))
self.deleteLater()
return None
# table of contents - TOC
html_content = _h("TOC")
self.topics.setHtml(html_content)

if not QUrl(chm_file_url).isValid():
if not parent == None:
genv.window_login.hide()
QMessageBox.critical(self,
_("Error"),
_("Error:\nThe helpfile could not be found."))
self.deleteLater()
return None
# topic content
html_content = _h("home")
self.browser.setHtml(html_content)

self.browser.setUrl(QUrl(chm_file_url))
#self.browser.setUrl(QUrl(chm_file_url))
#layout.addWidget(self.browser)

# Schließen-Button
Expand Down
27 changes: 27 additions & 0 deletions src/locales/de_de/LC_HELP/help.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ---------------------------------------------------------------------------
# File: help.po - localization translated stuff
# Author: Jens Kallup - paule32
#
# Rights: (c) 2024 by kallup non-profit software
# all rights reserved
#
# only for education, and for non-profit usage !!!
# commercial use ist not allowed.
# ---------------------------------------------------------------------------
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2024-04-06 20:33+0100\n"
"PO-Revision-Date: 2024-04-06 20:15+0100\n"
"Last-Translator: Jens Kallup <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=cp1252\n"
"Content-Transfer-Encoding: 8bit\n"

# ---------------------------------------------------------------------------
# the license of the application ...
# ---------------------------------------------------------------------------
msgid "home"
msgstr "Startseite"

Binary file modified src/locales/de_de/LC_MESSAGES/observer.mo.gz
Binary file not shown.
65 changes: 0 additions & 65 deletions src/locales/de_de/LC_MESSAGES/observer.po
Original file line number Diff line number Diff line change
Expand Up @@ -862,71 +862,6 @@ msgstr ""
"\"Persian (Farsi)\",\"Polish\",\"Portuguese\",\"Romanian\",\"Russian\",\"Serbian\",\"Serbian-Cyrillic\",\"Slovak\","
"\"Slovene\",\"Spanish\",\"Swedish\",\"Turkish\",\"Ukrainian\",\"Vietnamese\"]"

msgid "login_dialog_style"
msgstr ""
"background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,"
"stop: 0 #000080,"
"stop: 1 #000000);"
"border: 4px solid red;"
"border-radius: 8px;"

msgid "login_dialog_combobox"
msgstr ""
"background-color: #fff;"
"padding: 6px;"
"font-size: 14px;"
"line-height: 20px;"
"border: 2px solid #ffffff;"
"border-radius: 4px;"
"margin: 8px 0;"
"font-family: monospace;"

msgid "login_dialog_edit1"
msgstr ""
"background-color: #fff;"
"padding: 6px;"
"font-size: 14px;"
"line-height: 20px;"
"border: 2px solid #ffffff;"
"border-radius: 4px;"
"margin: 8px 0;"
"font-family: monospace;"

msgid "login_dialog_edit2"
msgstr ""
"background-color: #fff;"
"padding: 6px;"
"font-size: 14px;"
"line-height: 20px;"
"border: 2px solid #ffffff;"
"border-radius: 4px;"
"margin: 8px 0;"
"font-family: monospace;"

msgid "login_dialog_pass"
msgstr ""
"background-color: #fff;"
"padding: 6px;"
"font-size: 14px;"
"line-height: 20px;"
"border: 2px solid #ffffff;"
"border-radius: 4px;"
"margin: 8px 0;"
"font-family: monospace;"

msgid "login_dialog_push"
msgstr ""
"padding: 8px;"
"background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, "
"stop: 0 #243949, stop: 1 #517fa4);"
"color: #ffffff;"
"font-size: 14px;"
"line-height: 20px;"
"font-weight: 500;"
"text-transform: uppercase;"
"border: none;"
"border-radius: 4px;"

msgid "opti00"
msgstr "wählen Sie ein gewünschtes Ausgabe-Format:"

Expand Down
Empty file.
39 changes: 39 additions & 0 deletions src/locales/en_us/LC_HELP/help.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ---------------------------------------------------------------------------
# File: help.po - localization translated stuff
# Author: Jens Kallup - paule32
#
# Rights: (c) 2024 by kallup non-profit software
# all rights reserved
#
# only for education, and for non-profit usage !!!
# commercial use ist not allowed.
# ---------------------------------------------------------------------------
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2024-04-06 20:33+0100\n"
"PO-Revision-Date: 2024-04-06 20:15+0100\n"
"Last-Translator: Jens Kallup <[email protected]>\n"
"Language-Team: English <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=cp1252\n"
"Content-Transfer-Encoding: 8bit\n"

# ---------------------------------------------------------------------------
# the license of the application ...
# ---------------------------------------------------------------------------
msgid "TOC"
msgstr ""
"local:/home"

msgid "home"
msgstr ""
"<html>"
"<head>"
"<title>Beispielseite</title>"
"</head>"
"<body>"
"<h1>Hello, World!</h1>"
"<p>Dies ist ein HTML-String, der in QWebView angezeigt wird.</p>"
"</body>"
"</html>"
Binary file modified src/locales/en_us/LC_MESSAGES/observer.mo.gz
Binary file not shown.
Loading

0 comments on commit 896c582

Please sign in to comment.