BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
help_dialog.py
Go to the documentation of this file.
1"""!
2********************************************************************************
3@file help_dialog.py
4@brief Create help dialog
5********************************************************************************
6"""
7
8import os
9import logging
10from typing import TYPE_CHECKING
11
12from Source.version import __title__
13from Source.Util.app_data import HELP_PATH
14from Source.Util.gui_toolkit import HELP_DIALOG, create_dialog, config_tab, DIALOG
15if TYPE_CHECKING:
16 from Source.Controller.main_window import MainWindow
17
18log = logging.getLogger(__title__)
19
20
21def create_help_dialog(ui: "MainWindow") -> DIALOG:
22 """!
23 @brief Create help dialog.
24 @param ui : main window to create dialog with same style
25 @return help dialog
26 """
27 dialog_help = create_dialog(ui, minmax=True)
28 ui_help = HELP_DIALOG()
29 ui_help.setupUi(dialog_help)
30 d_help_text_source_link = {}
31 d_help_text_source_link[ui_help.helpTextGeneral] = "general.md"
32 d_help_text_source_link[ui_help.helpTextConfiguration] = "configuration.md"
33 d_help_text_source_link[ui_help.helpTextUser] = "user.md"
34 d_help_text_source_link[ui_help.helpTextArticles] = "articles.md"
35 d_help_text_source_link[ui_help.helpTextReport] = "report.md"
36 d_help_text_source_link[ui_help.helpTextPrinter] = "printer.md"
37 config_tab(ui_help.helpTextReader, text="", tab_index=6, main_tab=ui_help.tabWidget_helpMenu, tab_name="")
38 config_tab(ui_help.helpTextDisplay, text="", tab_index=7, main_tab=ui_help.tabWidget_helpMenu, tab_name="")
39 config_tab(ui_help.helpTextWebserver, text="", tab_index=8, main_tab=ui_help.tabWidget_helpMenu, tab_name="")
40 config_tab(None, main_tab=ui_help.tabWidget_helpMenu, tab_index=0)
41 for q_text_browser, s_source_file in d_help_text_source_link.items():
42 with open(os.path.join(HELP_PATH + s_source_file), mode="r", encoding="utf-8") as f:
43 text = f.read()
44 text = text[text.find("#"):]
45 config_tab(q_text_browser, text=text)
46 return dialog_help
DIALOG create_help_dialog("MainWindow" ui)
Create help dialog.