BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
Source.Util.app_data Namespace Reference

Classes

class  ELanguages
 Available application languages. More...
class  EPaper
 Supported paper widths of printer. More...
class  ETheme
 Available application themes. More...
class  EUser
 Present users. More...
class  ItemNumber
 Item number. More...

Functions

bool check_serial_device (str s_com_port)
 Check if serial device is present at this COM port.
None clear_settings ()
 Clear registry settings to write defaults at next startup.
str get_computer_name ()
 Get computer name.
dict[str, dict[str, str]] get_default_item_config (Optional[str] s_deposit_name=None)
 Get default article configuration depend on deposit name.
Any get_registry_value (SETTINGS handle, str s_key, bool b_none_err=True)
 Reads the registry value with given handle and key.
list[ListPortInfo] get_serial_ports ()
 Check if serial device is present at this COM port.
SETTINGS get_settings_handle ()
 Returns the settings handle.
None open_explorer (str explorer_path, bool b_open_input=False)
 Open explorer.
dict[str, Any] read_articles_settings ()
 Reads the articles settings from persistent storage.
str|None read_com_port_settings ()
 Reads the COM port settings from persistent storage.
ELanguages read_language ()
 Reads the language from persistent storage.
str read_last_dir ()
 Reads the last directory from persistent storage.
str read_output_path_settings ()
 Reads the output path settings from persistent storage.
int read_paper_width_settings ()
 Reads the paper width settings from persistent storage.
bool read_print_report_settings ()
 Reads the print report status from persistent storage.
list[float] read_sales ()
 Reads the sales from persistent storage.
bool read_show_price_settings ()
 Reads the show price status from persistent storage.
bool read_sound_settings ()
 Reads the sound settings from persistent storage.
ETheme read_theme_settings ()
 Reads the theme settings from persistent storage.
str read_update_version ()
 Reads the last reminded tool version from persistent storage.
dict[str, Any] read_user_settings ()
 Reads the user settings from persistent storage.
int read_verbosity_settings ()
 Reads the verbosity settings from persistent storage.
tuple[BYTE_ARRAY, BYTE_ARRAY] read_window_state ()
 Reads the window geometry and state from persistent storage.
tuple[bool, bool|None] reset_config_dialog ("MainWindow | None" ui)
 Show reset configuration dialog.
str resource_path (str s_relative_path)
 Returns the absolute path to a resource given by a relative path depending on the environment (EXE or Python)
None save_window_state (BYTE_ARRAY o_geometry, BYTE_ARRAY o_state)
 Saves the window state to persistent storage.
None thread_loop (Any obj, str thread_name)
 loop for threads.
None write_articles_settings (dict[str, dict[str, str]] d_articles)
 Writes the articles settings to persistent storage.
None write_com_port_settings (str s_com_port)
 Writes the COM port settings to persistent storage.
None write_language (ELanguages e_language)
 Writes the language to persistent storage.
None write_last_dir (str dir_path)
 Writes the last directory to persistent storage.
None write_output_path_settings (str s_output_path)
 Writes the output path settings to persistent storage.
None write_paper_width_settings (int i_paper_width)
 Writes the paper width settings to persistent storage.
None write_print_report_settings (bool b_print_report)
 Writes the print report settings to persistent storage.
None write_sales (int i_user_pos, float f_sales)
 Writes the sales to persistent storage.
None write_show_price_settings (bool b_show_price)
 Writes the show price settings to persistent storage.
None write_sound_settings (bool b_sound_status)
 Writes the sound settings to persistent storage.
None write_theme_settings (ETheme e_theme)
 Writes the theme settings to persistent storage.
None write_update_version (str version)
 Writes the last reminded tool version for update to persistent storage.
None write_user_settings (dict[str, dict[str, str]] d_user)
 Writes the user settings to persistent storage.
None write_verbosity_settings (int i_log_level)
 Writes the verbosity settings to persistent storage.

Variables

str APP_NAME = "<APP_NAME>"
bool B_DEFAULT_PRINT_REPORT = True
bool B_DEFAULT_SHOW_PRICE = True
bool B_DEFAULT_SOUND = True
str COMPANY_NAME = "<COMPANY_NAME>"
dict D_DEFAULT_ITEM
dict D_DEFAULT_USER
dict D_ITEM_NUMBER_COLUMN
dict D_ITEM_NUMBER_ROW
str DEFAULT_CODE = "1234"
 E_DEFAULT_LANGUAGE = ELanguages.ENGLISH
 E_DEFAULT_THEME = ETheme.AUTO
float F_DEFAULT_SALES = 0.0
str HELP_PATH = resource_path("Resources/Help/")
 I_DEFAULT_PAPER_WIDTH = EPaper.WIDTH_58_MM.value
int I_DEFAULT_USER_TIMEOUT = 15
int I_DEFAULT_WIN_HEIGHT = 450
int I_DEFAULT_WIN_WIDTH = 720
int I_GROUP_1 = 1
int I_GROUP_2 = 2
int I_GROUP_3 = 3
 I_ITEM_ARRAY_SIZE = ItemNumber.MAX
 I_LOG_LEVEL_DEFAULT = logging.WARNING
int I_NUMBER_OF_DISPLAYED_USER = 15
int I_NUMBER_OF_SALES = 101
str ICON_APP = resource_path(ICON_APP_PATH)
str ICON_APP_FAVICON_PATH = "Resources/favicon.ico"
str ICON_APP_PATH = "Resources/app.ico"
str ICON_ARTICLES_DARK = resource_path("Resources/Icon/articles_dark.png")
str ICON_ARTICLES_EDIT_DARK = resource_path("Resources/Icon/articles_edit_dark.png")
str ICON_ARTICLES_EDIT_LIGHT = resource_path("Resources/Icon/articles_edit_light.png")
str ICON_ARTICLES_EXPORT_DARK = resource_path("Resources/Icon/articles_export_dark.png")
str ICON_ARTICLES_EXPORT_LIGHT = resource_path("Resources/Icon/articles_export_light.png")
str ICON_ARTICLES_IMPORT_DARK = resource_path("Resources/Icon/articles_import_dark.png")
str ICON_ARTICLES_IMPORT_LIGHT = resource_path("Resources/Icon/articles_import_light.png")
str ICON_ARTICLES_LIGHT = resource_path("Resources/Icon/articles_light.png")
str ICON_ARTICLES_RESET_DARK = resource_path("Resources/Icon/articles_reset_dark.png")
str ICON_ARTICLES_RESET_LIGHT = resource_path("Resources/Icon/articles_reset_light.png")
str ICON_CHANGE_FOLDER_DARK = resource_path("Resources/Icon/change_folder_dark.png")
str ICON_CHANGE_FOLDER_LIGHT = resource_path("Resources/Icon/change_folder_light.png")
str ICON_COMBINE_DARK = resource_path("Resources/Icon/combine_dark.png")
str ICON_COMBINE_LIGHT = resource_path("Resources/Icon/combine_light.png")
str ICON_HELP_DARK = resource_path("Resources/Icon/help_dark.png")
str ICON_HELP_LIGHT = resource_path("Resources/Icon/help_light.png")
str ICON_LANGUAGE_DARK = resource_path("Resources/Icon/language_dark.png")
str ICON_LANGUAGE_ENGLISH = resource_path("Resources/Icon/language_english.png")
str ICON_LANGUAGE_GERMAN = resource_path("Resources/Icon/language_german.png")
str ICON_LANGUAGE_LIGHT = resource_path("Resources/Icon/language_light.png")
str ICON_LOCK_DARK = resource_path("Resources/Icon/lock_dark.png")
str ICON_LOCK_LIGHT = resource_path("Resources/Icon/lock_light.png")
str ICON_LOG_DARK = resource_path("Resources/Icon/log_dark.png")
str ICON_LOG_LIGHT = resource_path("Resources/Icon/log_light.png")
str ICON_OPEN_FOLDER_DARK = resource_path("Resources/Icon/open_folder_dark.png")
str ICON_OPEN_FOLDER_LIGHT = resource_path("Resources/Icon/open_folder_light.png")
str ICON_PAPER_DARK = resource_path("Resources/Icon/paper_dark.png")
str ICON_PAPER_LIGHT = resource_path("Resources/Icon/paper_light.png")
str ICON_PRINT_FILE_DARK = resource_path("Resources/Icon/print_file_dark.png")
str ICON_PRINT_FILE_LIGHT = resource_path("Resources/Icon/print_file_light.png")
str ICON_PRINT_PREVIEW_DARK = resource_path("Resources/Icon/print_preview_dark.png")
str ICON_PRINT_PREVIEW_LIGHT = resource_path("Resources/Icon/print_preview_light.png")
str ICON_PRINTER_DARK = resource_path("Resources/Icon/printer_dark.png")
str ICON_PRINTER_LIGHT = resource_path("Resources/Icon/printer_light.png")
str ICON_REPORT_DARK = resource_path("Resources/Icon/report_dark.png")
str ICON_REPORT_LIGHT = resource_path("Resources/Icon/report_light.png")
str ICON_RESET_DARK = resource_path("Resources/Icon/reset_dark.png")
str ICON_RESET_LIGHT = resource_path("Resources/Icon/reset_light.png")
str ICON_SOUND_DARK = resource_path("Resources/Icon/sound_dark.png")
str ICON_SOUND_LIGHT = resource_path("Resources/Icon/sound_light.png")
str ICON_SOUND_MUTE_DARK = resource_path("Resources/Icon/sound_mute_dark.png")
str ICON_SOUND_MUTE_LIGHT = resource_path("Resources/Icon/sound_mute_light.png")
str ICON_STATUS_DARK = resource_path("Resources/Icon/status_dark.png")
str ICON_STATUS_LIGHT = resource_path("Resources/Icon/status_light.png")
str ICON_THEME_DARK = resource_path("Resources/Icon/theme_dark.png")
str ICON_THEME_LIGHT = resource_path("Resources/Icon/theme_light.png")
str ICON_USER_DARK = resource_path("Resources/Icon/user_dark.png")
str ICON_USER_EDIT_DARK = resource_path("Resources/Icon/user_edit_dark.png")
str ICON_USER_EDIT_LIGHT = resource_path("Resources/Icon/user_edit_light.png")
str ICON_USER_EXPORT_DARK = resource_path("Resources/Icon/user_export_dark.png")
str ICON_USER_EXPORT_LIGHT = resource_path("Resources/Icon/user_export_light.png")
str ICON_USER_IMPORT_DARK = resource_path("Resources/Icon/user_import_dark.png")
str ICON_USER_IMPORT_LIGHT = resource_path("Resources/Icon/user_import_light.png")
str ICON_USER_LIGHT = resource_path("Resources/Icon/user_light.png")
str ICON_USER_RESET_DARK = resource_path("Resources/Icon/user_reset_dark.png")
str ICON_USER_RESET_LIGHT = resource_path("Resources/Icon/user_reset_light.png")
str IMG_SPLASH = resource_path("Resources/splash.gif")
 item_key = str(i + 1)
int ITEM_NUMBER_COLUMN_MIN = 5
list L_ALLOWED_USER = L_CONFIG_USER + L_SELL_USER + L_ORDER_USER
list L_CONFIG_USER = [EUser.ADMIN, EUser.HOST]
list L_DEVICE = ["Device", "System"]
list L_GROUP = ["Group", "Gruppe"]
list L_ORDER_USER = [EUser.B + str(i) for i in range(1, I_NUMBER_OF_SALES)]
list L_PRINT_FILE_HEADER = ["Count", "Article Name", "Article Number", "Group", "Total Price", "User", "Date", "Printer"]
list L_SELL_USER = [EUser.LOCAL, EUser.FREE]
str LOCKED_USER_PW = "Locked"
 log = logging.getLogger(__title__)
str RESET_CODE = b""
str S_AUTO_OPEN = "auto_open"
str S_BACKGROUND = "bg"
str S_BREAK_LINE = "\\n"
str S_DATE_PRINT_FORMAT = "%Y/%m/%d %H:%M:%S"
str S_DEFAULT_AUTO_OPEN = "True"
 S_DEFAULT_COM_PORT = None
str S_DEFAULT_FREE_AUTO_LOGOUT = "True"
str S_DEFAULT_LAST_PATH = "./"
str S_DEFAULT_OUTPUT_FOLDER = "BonPrinter"
str S_DEFAULT_OUTPUT_PATH = str(Path.home()) + "/" + S_DEFAULT_OUTPUT_FOLDER
str S_DEFAULT_PRICE = "9.00"
str S_DEFAULT_PRINT_ARTICLE = "True"
str S_DEFAULT_PRINT_FREE_PRICE = "True"
str S_DEFAULT_UPDATE_VERSION = "0.0.0"
str S_DEFAULT_USER_PW = LOCKED_USER_PW
str S_DEVICE = "device"
str S_FREE_AUTO_LOGOUT = "free_auto_logout"
str S_GENERAL = "General"
str S_GROUP = "tax_group"
str S_GROUP_1 = "group1"
str S_GROUP_2 = "group2"
str S_GROUP_3 = "group3"
str S_HEADER = "Header"
str S_HEADER_1 = "header1"
str S_HEADER_2 = "header2"
str S_KEY_GEOMETRY = "window_geometry"
str S_KEY_ITEMS = "ITEMS"
str S_KEY_LANGUAGE = "language"
str S_KEY_LAST_DIR_PATH = "last_dir"
str S_KEY_OUTPUT_PATH = "output_path"
str S_KEY_PAPER_WIDTH = "paper_width"
str S_KEY_PRINT_REPORT = "print_report"
str S_KEY_PRINTER_COM_PORT = "com_port"
str S_KEY_SHOW_PRICE = "show_price"
str S_KEY_SOUND = "sound"
str S_KEY_STATE = "window_state"
str S_KEY_THEME = "darkmode"
str S_KEY_UPDATE_VERSION = "update_version"
str S_KEY_USERS = "USERS"
str S_KEY_VERBOSITY = "verbosity"
str S_MARK = "mark"
str S_NAME = "name"
str S_PRICE = "price"
str S_PRINT = "print"
str S_PRINT_ARTICLE = "print_article"
str S_PRINT_FREE_PRICE = "print_free_price"
str S_PRINTS = "Prints"
str S_PW = "pw"
str S_SECTION_CONFIGURATION = "CONFIGURATION"
str S_SECTION_PRINTER = "PRINTER"
str S_SECTION_SALES = "SALES"
str S_SECTION_SETTINGS = "SETTINGS"
str S_SOUND_CASH_PATH = resource_path("Resources/Sound/cash.wav")
str S_SOUND_CLEAR_PATH = resource_path("Resources/Sound/clear.wav")
str S_SOUND_TOUCH_PATH = resource_path("Resources/Sound/touch.wav")
str S_SOUND_UNLOCK_PATH = resource_path("Resources/Sound/unlock.wav")
str S_TAX = "Tax"
str S_UNIT = "EUR"
str S_UNIT_SYMBOL = "€"
str S_USER_TAX = "user"
str S_USER_TIMEOUT = "timeout"
str S_USER_VISIBLE = "user_visible"
 settings_handle = SETTINGS(COMPANY_NAME, APP_NAME)
str user_key = f"{EUser.B.value}{i + 1}"

Detailed Description


Function Documentation

◆ check_serial_device()

bool check_serial_device ( str s_com_port)

Check if serial device is present at this COM port.

Parameters
s_com_port: COM port to check
Returns
return display status: [True] serial device at this COM port available; [False] not available

Definition at line 121 of file app_data.py.

121def check_serial_device(s_com_port: str) -> bool:
122 """!
123 @brief Check if serial device is present at this COM port
124 @param s_com_port : COM port to check
125 @return return display status: [True] serial device at this COM port available; [False] not available
126 """
127 b_present = False
128 try:
129 device = serial.Serial(s_com_port)
130 except BaseException:
131 b_present = False
132 else:
133 device.close()
134 b_present = True
135 return b_present
136
137

◆ clear_settings()

None clear_settings ( )

Clear registry settings to write defaults at next startup.

Definition at line 444 of file app_data.py.

444def clear_settings() -> None:
445 """!
446 @brief Clear registry settings to write defaults at next startup
447 """
448 log.warning("Set default configuration settings")
449 handle = get_settings_handle()
450 # do not delete group S_SECTION_SALES
451 for group in [S_SECTION_PRINTER, S_SECTION_CONFIGURATION, S_SECTION_SETTINGS]:
452 handle.beginGroup(group)
453 handle.remove("") # delete group
454 handle.endGroup()
455
456

◆ get_computer_name()

str get_computer_name ( )

Get computer name.

Returns
computer name

Definition at line 97 of file app_data.py.

97def get_computer_name() -> str:
98 """!
99 @brief Get computer name.
100 @return computer name
101 """
102 try:
103 hostname = socket.gethostname()
104 except BaseException:
105 hostname = ""
106 return hostname
107
108

◆ get_default_item_config()

dict[str, dict[str, str]] get_default_item_config ( Optional[str] s_deposit_name = None)

Get default article configuration depend on deposit name.

Parameters
s_deposit_name: name of deposit
Returns
default article configuration

Definition at line 434 of file app_data.py.

434def get_default_item_config(s_deposit_name: Optional[str] = None) -> dict[str, dict[str, str]]:
435 """!
436 @brief Get default article configuration depend on deposit name
437 @param s_deposit_name : name of deposit
438 @return default article configuration
439 """
440 d_item_dict = copy.deepcopy(D_DEFAULT_ITEM)
441 return d_item_dict
442
443

◆ get_registry_value()

Any get_registry_value ( SETTINGS handle,
str s_key,
bool b_none_err = True )

Reads the registry value with given handle and key.

Parameters
handle: settings handle
s_key: get value for this key
b_none_err: [True] call error if None in setting [False] allowed None as setting
Returns
value that is mapped to the given key or raises a KeyError if key not found in handle.

Definition at line 465 of file app_data.py.

465def get_registry_value(handle: SETTINGS, s_key: str, b_none_err: bool = True) -> Any:
466 """!
467 @brief Reads the registry value with given handle and key.
468 @param handle : settings handle
469 @param s_key : get value for this key
470 @param b_none_err : [True] call error if None in setting [False] allowed None as setting
471 @return value that is mapped to the given key or raises a KeyError if key not found in handle.
472 """
473 value = handle.value(s_key, defaultValue=None)
474 if b_none_err and (value is None):
475 raise KeyError(f"{s_key} not found in group {handle.group()}")
476 return value
477
478

◆ get_serial_ports()

list[ListPortInfo] get_serial_ports ( )

Check if serial device is present at this COM port.

Returns
return list of present serial ports

Definition at line 138 of file app_data.py.

138def get_serial_ports() -> list[ListPortInfo]:
139 """!
140 @brief Check if serial device is present at this COM port
141 @return return list of present serial ports
142 """
143 l_present_ports = sorted(comports()) # list of objects with port class
144 return l_present_ports
145
146
147# Files and Paths
148# https://icons8.com/icons/fluency-systems-regular
149# https://compresspng.com/
150# https://ezgif.com/optimize
151# https://compress-image.net/compress-image-online/compress-ico
152# https://www.zamzar.com/compress-bmp/
153# General Icon and Images

◆ get_settings_handle()

SETTINGS get_settings_handle ( )

Returns the settings handle.

Returns
settings handle

Definition at line 457 of file app_data.py.

457def get_settings_handle() -> SETTINGS:
458 """!
459 @brief Returns the settings handle
460 @return settings handle
461 """
462 return settings_handle
463
464

◆ open_explorer()

None open_explorer ( str explorer_path,
bool b_open_input = False )

Open explorer.

Parameters
explorer_path: path to open
b_open_input: open explorer into folder

Definition at line 109 of file app_data.py.

109def open_explorer(explorer_path: str, b_open_input: bool = False) -> None:
110 """!
111 @brief Open explorer.
112 @param explorer_path : path to open
113 @param b_open_input : open explorer into folder
114 """
115 s_open_folder = explorer_path.replace("/", "\\")
116 mode = "explorer " if b_open_input else r"explorer /select, "
117 with subprocess.Popen(mode + s_open_folder):
118 pass
119
120

◆ read_articles_settings()

dict[str, Any] read_articles_settings ( )

Reads the articles settings from persistent storage.

Returns
user settings

Definition at line 595 of file app_data.py.

595def read_articles_settings() -> dict[str, Any]:
596 """!
597 @brief Reads the articles settings from persistent storage
598 @return user settings
599 """
600 handle = get_settings_handle()
601 try:
602 handle.beginGroup(S_SECTION_CONFIGURATION)
603 d_articles = get_registry_value(handle, S_KEY_ITEMS)
604 handle.endGroup()
605 except BaseException as e:
606 log.debug("Articles settings not found, using default values (%s)", str(e))
607 d_articles = D_DEFAULT_ITEM
608 handle.endGroup()
609 return d_articles if isinstance(d_articles, dict) else {}
610
611

◆ read_com_port_settings()

str | None read_com_port_settings ( )

Reads the COM port settings from persistent storage.

Returns
COM port

Definition at line 623 of file app_data.py.

623def read_com_port_settings() -> str | None:
624 """!
625 @brief Reads the COM port settings from persistent storage
626 @return COM port
627 """
628 handle = get_settings_handle()
629 com_port: str | None
630 try:
631 handle.beginGroup(S_SECTION_PRINTER)
632 com_port = get_registry_value(handle, S_KEY_PRINTER_COM_PORT, b_none_err=False)
633 if com_port is not None:
634 com_port = str(com_port)
635 handle.endGroup()
636 except BaseException as e:
637 log.debug("COM Port settings not found, using default values (%s)", str(e))
638 com_port = S_DEFAULT_COM_PORT
639 handle.endGroup()
640 return com_port
641
642

◆ read_language()

ELanguages read_language ( )

Reads the language from persistent storage.

Returns
Language (enum ELanguages)

Definition at line 741 of file app_data.py.

741def read_language() -> ELanguages:
742 """!
743 @brief Reads the language from persistent storage
744 @return Language (enum ELanguages)
745 """
746 handle = get_settings_handle()
747 try:
748 handle.beginGroup(S_SECTION_SETTINGS)
749 s_language = get_registry_value(handle, S_KEY_LANGUAGE)
750 e_language = ELanguages(s_language)
751 handle.endGroup()
752 except BaseException as e:
753 log.debug("Language not found, using default values (%s)", str(e))
754 current_locale, _test = locale.getlocale() # check keyboard layout
755 if current_locale is not None: # TODO is None if start with EXE
756 e_language = ELanguages.GERMAN if current_locale.startswith("de") else E_DEFAULT_LANGUAGE
757 else:
758 e_language = E_DEFAULT_LANGUAGE
759 handle.endGroup()
760 return e_language
761
762

◆ read_last_dir()

str read_last_dir ( )

Reads the last directory from persistent storage.

Returns
directory path

Definition at line 861 of file app_data.py.

861def read_last_dir() -> str:
862 """!
863 @brief Reads the last directory from persistent storage
864 @return directory path
865 """
866 handle = get_settings_handle()
867 try:
868 handle.beginGroup(S_SECTION_SETTINGS)
869 dir_path = str(get_registry_value(handle, S_KEY_LAST_DIR_PATH))
870 handle.endGroup()
871 except BaseException as e:
872 log.debug("Last directory settings not found, using default values (%s)", str(e))
873 dir_path = S_DEFAULT_LAST_PATH
874 handle.endGroup()
875 return dir_path
876
877

◆ read_output_path_settings()

str read_output_path_settings ( )

Reads the output path settings from persistent storage.

Returns
output path

Definition at line 682 of file app_data.py.

682def read_output_path_settings() -> str:
683 """!
684 @brief Reads the output path settings from persistent storage
685 @return output path
686 """
687 handle = get_settings_handle()
688 try:
689 handle.beginGroup(S_SECTION_PRINTER)
690 s_output_path = str(get_registry_value(handle, S_KEY_OUTPUT_PATH))
691 handle.endGroup()
692 except BaseException as e:
693 log.debug("Output path settings not found, using default values (%s)", str(e))
694 if not os.path.exists(S_DEFAULT_OUTPUT_PATH):
695 os.mkdir(S_DEFAULT_OUTPUT_PATH)
696 s_output_path = S_DEFAULT_OUTPUT_PATH
697 handle.endGroup()
698 return s_output_path
699
700

◆ read_paper_width_settings()

int read_paper_width_settings ( )

Reads the paper width settings from persistent storage.

Returns
paper width

Definition at line 654 of file app_data.py.

654def read_paper_width_settings() -> int:
655 """!
656 @brief Reads the paper width settings from persistent storage
657 @return paper width
658 """
659 handle = get_settings_handle()
660 try:
661 handle.beginGroup(S_SECTION_PRINTER)
662 i_paper_width = int(get_registry_value(handle, S_KEY_PAPER_WIDTH))
663 handle.endGroup()
664 except BaseException as e:
665 log.debug("Paper Width settings not found, using default values (%s)", str(e))
666 i_paper_width = I_DEFAULT_PAPER_WIDTH
667 handle.endGroup()
668 return i_paper_width
669
670

◆ read_print_report_settings()

bool read_print_report_settings ( )

Reads the print report status from persistent storage.

Returns
print report status

Definition at line 889 of file app_data.py.

889def read_print_report_settings() -> bool:
890 """!
891 @brief Reads the print report status from persistent storage
892 @return print report status
893 """
894 handle = get_settings_handle()
895 try:
896 handle.beginGroup(S_SECTION_SETTINGS)
897 b_show_price = bool(get_registry_value(handle, S_KEY_PRINT_REPORT) == "true")
898 handle.endGroup()
899 except BaseException as e:
900 log.debug("Print Report not found, using default values (%s)", str(e))
901 b_show_price = B_DEFAULT_PRINT_REPORT
902 handle.endGroup()
903 return b_show_price
904
905

◆ read_sales()

list[float] read_sales ( )

Reads the sales from persistent storage.

Returns
sales

Definition at line 519 of file app_data.py.

519def read_sales() -> list[float]:
520 """!
521 @brief Reads the sales from persistent storage
522 @return sales
523 """
524 handle = get_settings_handle()
525 handle.beginGroup(S_SECTION_SALES)
526 l_sales = []
527 for i_user in range(I_NUMBER_OF_SALES):
528 try:
529 l_sales.append(float(get_registry_value(handle, str(i_user))))
530 except KeyError as e:
531 log.debug("Sales not found, using default values (%s)", str(e))
532 l_sales.append(F_DEFAULT_SALES)
533 except BaseException:
534 # set sales as warning to save value
535 log.warning("Sales of user %s not valid: %s", str(i_user), get_registry_value(handle, str(i_user)))
536 l_sales.append(F_DEFAULT_SALES)
537 handle.endGroup()
538 return l_sales
539
540

◆ read_show_price_settings()

bool read_show_price_settings ( )

Reads the show price status from persistent storage.

Returns
show price status

Definition at line 917 of file app_data.py.

917def read_show_price_settings() -> bool:
918 """!
919 @brief Reads the show price status from persistent storage
920 @return show price status
921 """
922 handle = get_settings_handle()
923 try:
924 handle.beginGroup(S_SECTION_SETTINGS)
925 b_show_price = bool(get_registry_value(handle, S_KEY_SHOW_PRICE) == "true")
926 handle.endGroup()
927 except BaseException as e:
928 log.debug("Show Price not found, using default values (%s)", str(e))
929 b_show_price = B_DEFAULT_SHOW_PRICE
930 handle.endGroup()
931 return b_show_price

◆ read_sound_settings()

bool read_sound_settings ( )

Reads the sound settings from persistent storage.

Returns
sound status

Definition at line 490 of file app_data.py.

490def read_sound_settings() -> bool:
491 """!
492 @brief Reads the sound settings from persistent storage
493 @return sound status
494 """
495 handle = get_settings_handle()
496 try:
497 handle.beginGroup(S_SECTION_SETTINGS)
498 b_sound = bool(get_registry_value(handle, S_KEY_SOUND) == "true")
499 handle.endGroup()
500 except BaseException as e:
501 log.debug("Sound not found, using default values (%s)", str(e))
502 b_sound = B_DEFAULT_SOUND
503 handle.endGroup()
504 return b_sound
505
506

◆ read_theme_settings()

ETheme read_theme_settings ( )

Reads the theme settings from persistent storage.

Returns
Theme settings (enum ETheme)

Definition at line 712 of file app_data.py.

712def read_theme_settings() -> ETheme:
713 """!
714 @brief Reads the theme settings from persistent storage
715 @return Theme settings (enum ETheme)
716 """
717 handle = get_settings_handle()
718 try:
719 handle.beginGroup(S_SECTION_SETTINGS)
720 s_theme = get_registry_value(handle, S_KEY_THEME)
721 e_theme = ETheme(s_theme)
722 handle.endGroup()
723 except BaseException as e:
724 log.debug("Theme settings not found, using default values (%s)", str(e))
725 e_theme = E_DEFAULT_THEME
726 handle.endGroup()
727 return e_theme
728
729

◆ read_update_version()

str read_update_version ( )

Reads the last reminded tool version from persistent storage.

Returns
last reminded version

Definition at line 833 of file app_data.py.

833def read_update_version() -> str:
834 """!
835 @brief Reads the last reminded tool version from persistent storage
836 @return last reminded version
837 """
838 handle = get_settings_handle()
839 try:
840 handle.beginGroup(S_SECTION_SETTINGS)
841 version = str(get_registry_value(handle, S_KEY_UPDATE_VERSION))
842 handle.endGroup()
843 except BaseException as e:
844 log.debug("Update version settings not found, using default values (%s)", str(e))
845 version = S_DEFAULT_UPDATE_VERSION
846 handle.endGroup()
847 return version
848
849

◆ read_user_settings()

dict[str, Any] read_user_settings ( )

Reads the user settings from persistent storage.

Returns
user settings

Definition at line 561 of file app_data.py.

561def read_user_settings() -> dict[str, Any]:
562 """!
563 @brief Reads the user settings from persistent storage
564 @return user settings
565 """
566 handle = get_settings_handle()
567 try:
568 handle.beginGroup(S_SECTION_CONFIGURATION)
569 d_user = get_registry_value(handle, S_KEY_USERS)
570 if platform.system() == 'Windows':
571 for user_type, user_data in d_user.items():
572 if S_PW in user_data:
573 bytes_password_enc = user_data[S_PW]
574 _, bytes_password = win32crypt.CryptUnprotectData(bytes_password_enc) if (len(bytes_password_enc) > 0) else (None, bytes(bytes_password_enc, "utf-8"))
575 d_user[user_type][S_PW] = bytes_password.decode("utf-8")
576 handle.endGroup()
577 except BaseException as e:
578 log.debug("Invalid User settings, using default values (%s)", str(e))
579 d_user = D_DEFAULT_USER
580 handle.endGroup()
581 return d_user if isinstance(d_user, dict) else {}
582
583

◆ read_verbosity_settings()

int read_verbosity_settings ( )

Reads the verbosity settings from persistent storage.

Returns
verbosity level

Definition at line 774 of file app_data.py.

774def read_verbosity_settings() -> int:
775 """!
776 @brief Reads the verbosity settings from persistent storage
777 @return verbosity level
778 """
779 handle = get_settings_handle()
780 try:
781 handle.beginGroup(S_SECTION_SETTINGS)
782 i_log_level = int(get_registry_value(handle, S_KEY_VERBOSITY))
783 handle.endGroup()
784 except BaseException as e:
785 log.debug("Verbosity settings not found, using default values (%s)", str(e))
786 i_log_level = I_LOG_LEVEL_DEFAULT
787 handle.endGroup()
788 return i_log_level
789
790

◆ read_window_state()

tuple[BYTE_ARRAY, BYTE_ARRAY] read_window_state ( )

Reads the window geometry and state from persistent storage.

Returns
window geometry and state as QByteArray

Definition at line 804 of file app_data.py.

804def read_window_state() -> tuple[BYTE_ARRAY, BYTE_ARRAY]:
805 """!
806 @brief Reads the window geometry and state from persistent storage.
807 @return window geometry and state as QByteArray
808 """
809 handle = get_settings_handle()
810 try:
811 handle.beginGroup(S_SECTION_SETTINGS)
812 o_geometry = get_registry_value(handle, S_KEY_GEOMETRY)
813 o_state = get_registry_value(handle, S_KEY_STATE)
814 handle.endGroup()
815 except BaseException as e:
816 log.debug("WindowsSettings not found, using default values (%s)", str(e))
817 o_geometry = o_state = None
818 handle.endGroup()
819 return o_geometry, o_state
820
821

◆ reset_config_dialog()

tuple[bool, bool | None] reset_config_dialog ( "MainWindow | None" ui)

Show reset configuration dialog.

Enter reset PW to reset configuration.

Parameters
ui: main window controller
Returns
status if PW is correct

Definition at line 76 of file app_data.py.

76def reset_config_dialog(ui: "MainWindow | None") -> tuple[bool, bool | None]:
77 """!
78 @brief Show reset configuration dialog. Enter reset PW to reset configuration.
79 @param ui : main window controller
80 @return status if PW is correct
81 """
82 l_reset_title = ["Reset", "Zurücksetzen"]
83 l_reset_text = ["Enter reset code to reset configuration.", "Reset-Code eingeben, um die Konfiguration zurückzusetzen."]
84 if ui:
85 reset_title = ui.model.c_language.get_language_text(l_reset_title)
86 reset_text = ui.model.c_language.get_language_text(l_reset_text)
87 else:
88 reset_title = l_reset_title[0]
89 reset_text = l_reset_text[0]
90 password, ok = input_dialog(ui, reset_title, reset_text, password_input=True, icon=ICON_APP)
91 b_reset = bool(ok and password.isdigit() and (base64.b64encode(password.encode("utf-8")) == RESET_CODE))
92 if b_reset:
93 clear_settings()
94 return b_reset, ok
95
96

◆ resource_path()

str resource_path ( str s_relative_path)

Returns the absolute path to a resource given by a relative path depending on the environment (EXE or Python)

Parameters
s_relative_path: the relative path to a file or directory
Returns
absolute path to the resource

Definition at line 36 of file app_data.py.

36def resource_path(s_relative_path: str) -> str:
37 """!
38 @brief Returns the absolute path to a resource given by a relative path depending on the environment (EXE or Python)
39 @param s_relative_path : the relative path to a file or directory
40 @return absolute path to the resource
41 """
42 if hasattr(sys, "_MEIPASS"): # check without function call for mypy
43 # PyInstaller creates a temp folder and stores path in _MEIPASS
44 s_base_path = sys._MEIPASS
45 else:
46 s_base_path = os.path.abspath("../")
47 s_resource_path = os.path.join(s_base_path, s_relative_path)
48 log.debug("Resource Path (relative %s): %s", s_relative_path, s_resource_path)
49 return s_resource_path
50
51

◆ save_window_state()

None save_window_state ( BYTE_ARRAY o_geometry,
BYTE_ARRAY o_state )

Saves the window state to persistent storage.

Parameters
o_geometry: geometry (position, size) of the window as QByteArray
o_state: state (dock widgets etc.) of the window as QByteArray

Definition at line 791 of file app_data.py.

791def save_window_state(o_geometry: BYTE_ARRAY, o_state: BYTE_ARRAY) -> None:
792 """!
793 @brief Saves the window state to persistent storage.
794 @param o_geometry : geometry (position, size) of the window as QByteArray
795 @param o_state : state (dock widgets etc.) of the window as QByteArray
796 """
797 handle = get_settings_handle()
798 handle.beginGroup(S_SECTION_SETTINGS)
799 handle.setValue(S_KEY_GEOMETRY, o_geometry)
800 handle.setValue(S_KEY_STATE, o_state)
801 handle.endGroup()
802
803

◆ thread_loop()

None thread_loop ( Any obj,
str thread_name )

loop for threads.

Parameters
obj: object of thread class
thread_name: thread name

Definition at line 52 of file app_data.py.

52def thread_loop(obj: Any, thread_name: str) -> None:
53 """!
54 @brief loop for threads.
55 @param obj : object of thread class
56 @param thread_name : thread name
57 """
58 threading.current_thread().name = thread_name
59 try:
60 while True:
61 obj.loop()
62 except Exception:
63 exc_type, exc_obj, exc_tb = sys.exc_info()
64 if exc_tb is not None:
65 fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
66 lineno = exc_tb.tb_lineno
67 else:
68 fname = "None"
69 lineno = 0
70 s_err = f"Thread {thread_name}: {exc_type} {fname} {exc_obj} {lineno}"
71 log.error(s_err)
72 obj.ui.qt_exception_hook.exception_caught.emit(s_err)
73 sys.exit(1)
74
75

◆ write_articles_settings()

None write_articles_settings ( dict[str, dict[str, str]] d_articles)

Writes the articles settings to persistent storage.

Parameters
d_articles: articles dictionary

Definition at line 584 of file app_data.py.

584def write_articles_settings(d_articles: dict[str, dict[str, str]]) -> None:
585 """!
586 @brief Writes the articles settings to persistent storage
587 @param d_articles : articles dictionary
588 """
589 handle = get_settings_handle()
590 handle.beginGroup(S_SECTION_CONFIGURATION)
591 handle.setValue(S_KEY_ITEMS, d_articles)
592 handle.endGroup()
593
594

◆ write_com_port_settings()

None write_com_port_settings ( str s_com_port)

Writes the COM port settings to persistent storage.

Parameters
s_com_port: COM port

Definition at line 612 of file app_data.py.

612def write_com_port_settings(s_com_port: str) -> None:
613 """!
614 @brief Writes the COM port settings to persistent storage
615 @param s_com_port : COM port
616 """
617 handle = get_settings_handle()
618 handle.beginGroup(S_SECTION_PRINTER)
619 handle.setValue(S_KEY_PRINTER_COM_PORT, s_com_port)
620 handle.endGroup()
621
622

◆ write_language()

None write_language ( ELanguages e_language)

Writes the language to persistent storage.

Parameters
e_language: current language

Definition at line 730 of file app_data.py.

730def write_language(e_language: ELanguages) -> None:
731 """!
732 @brief Writes the language to persistent storage
733 @param e_language : current language
734 """
735 handle = get_settings_handle()
736 handle.beginGroup(S_SECTION_SETTINGS)
737 handle.setValue(S_KEY_LANGUAGE, e_language.value)
738 handle.endGroup()
739
740

◆ write_last_dir()

None write_last_dir ( str dir_path)

Writes the last directory to persistent storage.

Parameters
dir_path: directory path

Definition at line 850 of file app_data.py.

850def write_last_dir(dir_path: str) -> None:
851 """!
852 @brief Writes the last directory to persistent storage
853 @param dir_path : directory path
854 """
855 handle = get_settings_handle()
856 handle.beginGroup(S_SECTION_SETTINGS)
857 handle.setValue(S_KEY_LAST_DIR_PATH, dir_path)
858 handle.endGroup()
859
860

◆ write_output_path_settings()

None write_output_path_settings ( str s_output_path)

Writes the output path settings to persistent storage.

Parameters
s_output_path: output path

Definition at line 671 of file app_data.py.

671def write_output_path_settings(s_output_path: str) -> None:
672 """!
673 @brief Writes the output path settings to persistent storage
674 @param s_output_path : output path
675 """
676 handle = get_settings_handle()
677 handle.beginGroup(S_SECTION_PRINTER)
678 handle.setValue(S_KEY_OUTPUT_PATH, s_output_path)
679 handle.endGroup()
680
681

◆ write_paper_width_settings()

None write_paper_width_settings ( int i_paper_width)

Writes the paper width settings to persistent storage.

Parameters
i_paper_width: paper width

Definition at line 643 of file app_data.py.

643def write_paper_width_settings(i_paper_width: int) -> None:
644 """!
645 @brief Writes the paper width settings to persistent storage
646 @param i_paper_width : paper width
647 """
648 handle = get_settings_handle()
649 handle.beginGroup(S_SECTION_PRINTER)
650 handle.setValue(S_KEY_PAPER_WIDTH, i_paper_width)
651 handle.endGroup()
652
653

◆ write_print_report_settings()

None write_print_report_settings ( bool b_print_report)

Writes the print report settings to persistent storage.

Parameters
b_print_report: enable print report status

Definition at line 878 of file app_data.py.

878def write_print_report_settings(b_print_report: bool) -> None:
879 """!
880 @brief Writes the print report settings to persistent storage
881 @param b_print_report : enable print report status
882 """
883 handle = get_settings_handle()
884 handle.beginGroup(S_SECTION_SETTINGS)
885 handle.setValue(S_KEY_PRINT_REPORT, b_print_report)
886 handle.endGroup()
887
888

◆ write_sales()

None write_sales ( int i_user_pos,
float f_sales )

Writes the sales to persistent storage.

Parameters
i_user_pos: user position to write sales
f_sales: sales value to save

Definition at line 507 of file app_data.py.

507def write_sales(i_user_pos: int, f_sales: float) -> None:
508 """!
509 @brief Writes the sales to persistent storage
510 @param i_user_pos : user position to write sales
511 @param f_sales : sales value to save
512 """
513 handle = get_settings_handle()
514 handle.beginGroup(S_SECTION_SALES)
515 handle.setValue(str(i_user_pos), f_sales)
516 handle.endGroup()
517
518

◆ write_show_price_settings()

None write_show_price_settings ( bool b_show_price)

Writes the show price settings to persistent storage.

Parameters
b_show_price: show price status

Definition at line 906 of file app_data.py.

906def write_show_price_settings(b_show_price: bool) -> None:
907 """!
908 @brief Writes the show price settings to persistent storage
909 @param b_show_price : show price status
910 """
911 handle = get_settings_handle()
912 handle.beginGroup(S_SECTION_SETTINGS)
913 handle.setValue(S_KEY_SHOW_PRICE, b_show_price)
914 handle.endGroup()
915
916

◆ write_sound_settings()

None write_sound_settings ( bool b_sound_status)

Writes the sound settings to persistent storage.

Parameters
b_sound_status: sound status

Definition at line 479 of file app_data.py.

479def write_sound_settings(b_sound_status: bool) -> None:
480 """!
481 @brief Writes the sound settings to persistent storage
482 @param b_sound_status : sound status
483 """
484 handle = get_settings_handle()
485 handle.beginGroup(S_SECTION_SETTINGS)
486 handle.setValue(S_KEY_SOUND, b_sound_status)
487 handle.endGroup()
488
489

◆ write_theme_settings()

None write_theme_settings ( ETheme e_theme)

Writes the theme settings to persistent storage.

Parameters
e_theme: current theme

Definition at line 701 of file app_data.py.

701def write_theme_settings(e_theme: ETheme) -> None:
702 """!
703 @brief Writes the theme settings to persistent storage
704 @param e_theme : current theme
705 """
706 handle = get_settings_handle()
707 handle.beginGroup(S_SECTION_SETTINGS)
708 handle.setValue(S_KEY_THEME, e_theme.value)
709 handle.endGroup()
710
711

◆ write_update_version()

None write_update_version ( str version)

Writes the last reminded tool version for update to persistent storage.

Parameters
version: last reminded version

Definition at line 822 of file app_data.py.

822def write_update_version(version: str) -> None:
823 """!
824 @brief Writes the last reminded tool version for update to persistent storage.
825 @param version : last reminded version
826 """
827 handle = get_settings_handle()
828 handle.beginGroup(S_SECTION_SETTINGS)
829 handle.setValue(S_KEY_UPDATE_VERSION, version)
830 handle.endGroup()
831
832

◆ write_user_settings()

None write_user_settings ( dict[str, dict[str, str]] d_user)

Writes the user settings to persistent storage.

Passwords are stored encrypted. This encryption is carried out via the Windows Data Protection API (DPAPI), which enables user and machine-specific encryption.

Parameters
d_user: user dictionary

Definition at line 541 of file app_data.py.

541def write_user_settings(d_user: dict[str, dict[str, str]]) -> None:
542 """!
543 @brief Writes the user settings to persistent storage. Passwords are stored encrypted.
544 This encryption is carried out via the Windows Data Protection API (DPAPI),
545 which enables user and machine-specific encryption.
546 @param d_user : user dictionary
547 """
548 dict_to_write = copy.deepcopy(d_user)
549 if platform.system() == 'Windows':
550 for user_type, user_data in dict_to_write.items(): # protect password
551 if S_PW in user_data:
552 s_password = user_data[S_PW]
553 s_password_encrypted = win32crypt.CryptProtectData(bytes(s_password, "utf-8")) if len(s_password) > 0 else ""
554 dict_to_write[user_type][S_PW] = s_password_encrypted
555 handle = get_settings_handle()
556 handle.beginGroup(S_SECTION_CONFIGURATION)
557 handle.setValue(S_KEY_USERS, dict_to_write)
558 handle.endGroup()
559
560

◆ write_verbosity_settings()

None write_verbosity_settings ( int i_log_level)

Writes the verbosity settings to persistent storage.

Parameters
i_log_level: log verbosity

Definition at line 763 of file app_data.py.

763def write_verbosity_settings(i_log_level: int) -> None:
764 """!
765 @brief Writes the verbosity settings to persistent storage
766 @param i_log_level : log verbosity
767 """
768 handle = get_settings_handle()
769 handle.beginGroup(S_SECTION_SETTINGS)
770 handle.setValue(S_KEY_VERBOSITY, i_log_level)
771 handle.endGroup()
772
773

Variable Documentation

◆ APP_NAME

str APP_NAME = "<APP_NAME>"

Definition at line 228 of file app_data.py.

◆ B_DEFAULT_PRINT_REPORT

bool B_DEFAULT_PRINT_REPORT = True

Definition at line 282 of file app_data.py.

◆ B_DEFAULT_SHOW_PRICE

bool B_DEFAULT_SHOW_PRICE = True

Definition at line 280 of file app_data.py.

◆ B_DEFAULT_SOUND

bool B_DEFAULT_SOUND = True

Definition at line 278 of file app_data.py.

◆ COMPANY_NAME

str COMPANY_NAME = "<COMPANY_NAME>"

Definition at line 227 of file app_data.py.

◆ D_DEFAULT_ITEM

dict D_DEFAULT_ITEM
Initial value:
1= {
2 S_HEADER: {S_HEADER_1: "", S_HEADER_2: ""},
3 S_TAX: {S_GROUP_1: "19", S_GROUP_2: "19", S_GROUP_3: "0", S_USER_TAX: "0"},
4 S_PRINTS: {
5 S_PRINT_ARTICLE: S_DEFAULT_PRINT_ARTICLE,
6 S_PRINT_FREE_PRICE: S_DEFAULT_PRINT_FREE_PRICE
7 },
8}

Definition at line 413 of file app_data.py.

◆ D_DEFAULT_USER

dict D_DEFAULT_USER
Initial value:
1= {
2 S_GENERAL: {S_DEVICE: "",
3 S_USER_TIMEOUT: str(I_DEFAULT_USER_TIMEOUT),
4 S_AUTO_OPEN: str(S_DEFAULT_AUTO_OPEN),
5 S_FREE_AUTO_LOGOUT: str(S_DEFAULT_FREE_AUTO_LOGOUT)},
6 EUser.ADMIN.value: {S_PW: base64.b64decode(RESET_CODE).decode("utf-8")},
7 EUser.HOST.value: {S_PW: LOCKED_USER_PW},
8 EUser.LOCAL.value: {S_PW: LOCKED_USER_PW},
9 EUser.FREE.value: {S_PW: LOCKED_USER_PW}
10}

Definition at line 396 of file app_data.py.

◆ D_ITEM_NUMBER_COLUMN

dict D_ITEM_NUMBER_COLUMN
Initial value:
1= {
2 ItemNumber.MIN: ITEM_NUMBER_COLUMN_MIN,
3 ItemNumber.EXT: 6,
4 ItemNumber.MAX: 7
5}

Definition at line 365 of file app_data.py.

◆ D_ITEM_NUMBER_ROW

dict D_ITEM_NUMBER_ROW
Initial value:
1= {
2 ItemNumber.MIN: 6,
3 ItemNumber.EXT: 7,
4 ItemNumber.MAX: 8
5}

Definition at line 357 of file app_data.py.

◆ DEFAULT_CODE

str DEFAULT_CODE = "1234"

Definition at line 332 of file app_data.py.

◆ E_DEFAULT_LANGUAGE

E_DEFAULT_LANGUAGE = ELanguages.ENGLISH

Definition at line 286 of file app_data.py.

◆ E_DEFAULT_THEME

E_DEFAULT_THEME = ETheme.AUTO

Definition at line 284 of file app_data.py.

◆ F_DEFAULT_SALES

float F_DEFAULT_SALES = 0.0

Definition at line 336 of file app_data.py.

◆ HELP_PATH

str HELP_PATH = resource_path("Resources/Help/")

Definition at line 218 of file app_data.py.

◆ I_DEFAULT_PAPER_WIDTH

I_DEFAULT_PAPER_WIDTH = EPaper.WIDTH_58_MM.value

Definition at line 274 of file app_data.py.

◆ I_DEFAULT_USER_TIMEOUT

int I_DEFAULT_USER_TIMEOUT = 15

Definition at line 343 of file app_data.py.

◆ I_DEFAULT_WIN_HEIGHT

int I_DEFAULT_WIN_HEIGHT = 450

Definition at line 301 of file app_data.py.

◆ I_DEFAULT_WIN_WIDTH

int I_DEFAULT_WIN_WIDTH = 720

Definition at line 300 of file app_data.py.

◆ I_GROUP_1

int I_GROUP_1 = 1

Definition at line 374 of file app_data.py.

◆ I_GROUP_2

int I_GROUP_2 = 2

Definition at line 375 of file app_data.py.

◆ I_GROUP_3

int I_GROUP_3 = 3

Definition at line 376 of file app_data.py.

◆ I_ITEM_ARRAY_SIZE

I_ITEM_ARRAY_SIZE = ItemNumber.MAX

Definition at line 371 of file app_data.py.

◆ I_LOG_LEVEL_DEFAULT

I_LOG_LEVEL_DEFAULT = logging.WARNING

Definition at line 288 of file app_data.py.

◆ I_NUMBER_OF_DISPLAYED_USER

int I_NUMBER_OF_DISPLAYED_USER = 15

Definition at line 372 of file app_data.py.

◆ I_NUMBER_OF_SALES

int I_NUMBER_OF_SALES = 101

Definition at line 335 of file app_data.py.

◆ ICON_APP

str ICON_APP = resource_path(ICON_APP_PATH)

Definition at line 156 of file app_data.py.

◆ ICON_APP_FAVICON_PATH

str ICON_APP_FAVICON_PATH = "Resources/favicon.ico"

Definition at line 155 of file app_data.py.

◆ ICON_APP_PATH

str ICON_APP_PATH = "Resources/app.ico"

Definition at line 154 of file app_data.py.

◆ ICON_ARTICLES_DARK

str ICON_ARTICLES_DARK = resource_path("Resources/Icon/articles_dark.png")

Definition at line 185 of file app_data.py.

◆ ICON_ARTICLES_EDIT_DARK

str ICON_ARTICLES_EDIT_DARK = resource_path("Resources/Icon/articles_edit_dark.png")

Definition at line 187 of file app_data.py.

◆ ICON_ARTICLES_EDIT_LIGHT

str ICON_ARTICLES_EDIT_LIGHT = resource_path("Resources/Icon/articles_edit_light.png")

Definition at line 186 of file app_data.py.

◆ ICON_ARTICLES_EXPORT_DARK

str ICON_ARTICLES_EXPORT_DARK = resource_path("Resources/Icon/articles_export_dark.png")

Definition at line 191 of file app_data.py.

◆ ICON_ARTICLES_EXPORT_LIGHT

str ICON_ARTICLES_EXPORT_LIGHT = resource_path("Resources/Icon/articles_export_light.png")

Definition at line 190 of file app_data.py.

◆ ICON_ARTICLES_IMPORT_DARK

str ICON_ARTICLES_IMPORT_DARK = resource_path("Resources/Icon/articles_import_dark.png")

Definition at line 189 of file app_data.py.

◆ ICON_ARTICLES_IMPORT_LIGHT

str ICON_ARTICLES_IMPORT_LIGHT = resource_path("Resources/Icon/articles_import_light.png")

Definition at line 188 of file app_data.py.

◆ ICON_ARTICLES_LIGHT

str ICON_ARTICLES_LIGHT = resource_path("Resources/Icon/articles_light.png")

Definition at line 184 of file app_data.py.

◆ ICON_ARTICLES_RESET_DARK

str ICON_ARTICLES_RESET_DARK = resource_path("Resources/Icon/articles_reset_dark.png")

Definition at line 193 of file app_data.py.

◆ ICON_ARTICLES_RESET_LIGHT

str ICON_ARTICLES_RESET_LIGHT = resource_path("Resources/Icon/articles_reset_light.png")

Definition at line 192 of file app_data.py.

◆ ICON_CHANGE_FOLDER_DARK

str ICON_CHANGE_FOLDER_DARK = resource_path("Resources/Icon/change_folder_dark.png")

Definition at line 195 of file app_data.py.

◆ ICON_CHANGE_FOLDER_LIGHT

str ICON_CHANGE_FOLDER_LIGHT = resource_path("Resources/Icon/change_folder_light.png")

Definition at line 194 of file app_data.py.

◆ ICON_COMBINE_DARK

str ICON_COMBINE_DARK = resource_path("Resources/Icon/combine_dark.png")

Definition at line 166 of file app_data.py.

◆ ICON_COMBINE_LIGHT

str ICON_COMBINE_LIGHT = resource_path("Resources/Icon/combine_light.png")

Definition at line 165 of file app_data.py.

◆ ICON_HELP_DARK

str ICON_HELP_DARK = resource_path("Resources/Icon/help_dark.png")

Definition at line 215 of file app_data.py.

◆ ICON_HELP_LIGHT

str ICON_HELP_LIGHT = resource_path("Resources/Icon/help_light.png")

Definition at line 214 of file app_data.py.

◆ ICON_LANGUAGE_DARK

str ICON_LANGUAGE_DARK = resource_path("Resources/Icon/language_dark.png")

Definition at line 208 of file app_data.py.

◆ ICON_LANGUAGE_ENGLISH

str ICON_LANGUAGE_ENGLISH = resource_path("Resources/Icon/language_english.png")

Definition at line 209 of file app_data.py.

◆ ICON_LANGUAGE_GERMAN

str ICON_LANGUAGE_GERMAN = resource_path("Resources/Icon/language_german.png")

Definition at line 210 of file app_data.py.

◆ ICON_LANGUAGE_LIGHT

str ICON_LANGUAGE_LIGHT = resource_path("Resources/Icon/language_light.png")

Definition at line 207 of file app_data.py.

◆ ICON_LOCK_DARK

str ICON_LOCK_DARK = resource_path("Resources/Icon/lock_dark.png")

Definition at line 158 of file app_data.py.

◆ ICON_LOCK_LIGHT

str ICON_LOCK_LIGHT = resource_path("Resources/Icon/lock_light.png")

Definition at line 157 of file app_data.py.

◆ ICON_LOG_DARK

str ICON_LOG_DARK = resource_path("Resources/Icon/log_dark.png")

Definition at line 212 of file app_data.py.

◆ ICON_LOG_LIGHT

str ICON_LOG_LIGHT = resource_path("Resources/Icon/log_light.png")

Definition at line 211 of file app_data.py.

◆ ICON_OPEN_FOLDER_DARK

str ICON_OPEN_FOLDER_DARK = resource_path("Resources/Icon/open_folder_dark.png")

Definition at line 164 of file app_data.py.

◆ ICON_OPEN_FOLDER_LIGHT

str ICON_OPEN_FOLDER_LIGHT = resource_path("Resources/Icon/open_folder_light.png")

Definition at line 163 of file app_data.py.

◆ ICON_PAPER_DARK

str ICON_PAPER_DARK = resource_path("Resources/Icon/paper_dark.png")

Definition at line 199 of file app_data.py.

◆ ICON_PAPER_LIGHT

str ICON_PAPER_LIGHT = resource_path("Resources/Icon/paper_light.png")

Definition at line 198 of file app_data.py.

◆ ICON_PRINT_FILE_DARK

str ICON_PRINT_FILE_DARK = resource_path("Resources/Icon/print_file_dark.png")

Definition at line 168 of file app_data.py.

◆ ICON_PRINT_FILE_LIGHT

str ICON_PRINT_FILE_LIGHT = resource_path("Resources/Icon/print_file_light.png")

Definition at line 167 of file app_data.py.

◆ ICON_PRINT_PREVIEW_DARK

str ICON_PRINT_PREVIEW_DARK = resource_path("Resources/Icon/print_preview_dark.png")

Definition at line 170 of file app_data.py.

◆ ICON_PRINT_PREVIEW_LIGHT

str ICON_PRINT_PREVIEW_LIGHT = resource_path("Resources/Icon/print_preview_light.png")

Definition at line 169 of file app_data.py.

◆ ICON_PRINTER_DARK

str ICON_PRINTER_DARK = resource_path("Resources/Icon/printer_dark.png")

Definition at line 197 of file app_data.py.

◆ ICON_PRINTER_LIGHT

str ICON_PRINTER_LIGHT = resource_path("Resources/Icon/printer_light.png")

Definition at line 196 of file app_data.py.

◆ ICON_REPORT_DARK

str ICON_REPORT_DARK = resource_path("Resources/Icon/report_dark.png")

Definition at line 172 of file app_data.py.

◆ ICON_REPORT_LIGHT

str ICON_REPORT_LIGHT = resource_path("Resources/Icon/report_light.png")

Definition at line 171 of file app_data.py.

◆ ICON_RESET_DARK

str ICON_RESET_DARK = resource_path("Resources/Icon/reset_dark.png")

Definition at line 217 of file app_data.py.

◆ ICON_RESET_LIGHT

str ICON_RESET_LIGHT = resource_path("Resources/Icon/reset_light.png")

Definition at line 216 of file app_data.py.

◆ ICON_SOUND_DARK

str ICON_SOUND_DARK = resource_path("Resources/Icon/sound_dark.png")

Definition at line 202 of file app_data.py.

◆ ICON_SOUND_LIGHT

str ICON_SOUND_LIGHT = resource_path("Resources/Icon/sound_light.png")

Definition at line 201 of file app_data.py.

◆ ICON_SOUND_MUTE_DARK

str ICON_SOUND_MUTE_DARK = resource_path("Resources/Icon/sound_mute_dark.png")

Definition at line 204 of file app_data.py.

◆ ICON_SOUND_MUTE_LIGHT

str ICON_SOUND_MUTE_LIGHT = resource_path("Resources/Icon/sound_mute_light.png")

Definition at line 203 of file app_data.py.

◆ ICON_STATUS_DARK

str ICON_STATUS_DARK = resource_path("Resources/Icon/status_dark.png")

Definition at line 162 of file app_data.py.

◆ ICON_STATUS_LIGHT

str ICON_STATUS_LIGHT = resource_path("Resources/Icon/status_light.png")

Definition at line 161 of file app_data.py.

◆ ICON_THEME_DARK

str ICON_THEME_DARK = resource_path("Resources/Icon/theme_dark.png")

Definition at line 206 of file app_data.py.

◆ ICON_THEME_LIGHT

str ICON_THEME_LIGHT = resource_path("Resources/Icon/theme_light.png")

Definition at line 205 of file app_data.py.

◆ ICON_USER_DARK

str ICON_USER_DARK = resource_path("Resources/Icon/user_dark.png")

Definition at line 175 of file app_data.py.

◆ ICON_USER_EDIT_DARK

str ICON_USER_EDIT_DARK = resource_path("Resources/Icon/user_edit_dark.png")

Definition at line 177 of file app_data.py.

◆ ICON_USER_EDIT_LIGHT

str ICON_USER_EDIT_LIGHT = resource_path("Resources/Icon/user_edit_light.png")

Definition at line 176 of file app_data.py.

◆ ICON_USER_EXPORT_DARK

str ICON_USER_EXPORT_DARK = resource_path("Resources/Icon/user_export_dark.png")

Definition at line 181 of file app_data.py.

◆ ICON_USER_EXPORT_LIGHT

str ICON_USER_EXPORT_LIGHT = resource_path("Resources/Icon/user_export_light.png")

Definition at line 180 of file app_data.py.

◆ ICON_USER_IMPORT_DARK

str ICON_USER_IMPORT_DARK = resource_path("Resources/Icon/user_import_dark.png")

Definition at line 179 of file app_data.py.

◆ ICON_USER_IMPORT_LIGHT

str ICON_USER_IMPORT_LIGHT = resource_path("Resources/Icon/user_import_light.png")

Definition at line 178 of file app_data.py.

◆ ICON_USER_LIGHT

str ICON_USER_LIGHT = resource_path("Resources/Icon/user_light.png")

Definition at line 174 of file app_data.py.

◆ ICON_USER_RESET_DARK

str ICON_USER_RESET_DARK = resource_path("Resources/Icon/user_reset_dark.png")

Definition at line 183 of file app_data.py.

◆ ICON_USER_RESET_LIGHT

str ICON_USER_RESET_LIGHT = resource_path("Resources/Icon/user_reset_light.png")

Definition at line 182 of file app_data.py.

◆ IMG_SPLASH

str IMG_SPLASH = resource_path("Resources/splash.gif")

Definition at line 159 of file app_data.py.

◆ item_key

item_key = str(i + 1)

Definition at line 423 of file app_data.py.

◆ ITEM_NUMBER_COLUMN_MIN

int ITEM_NUMBER_COLUMN_MIN = 5

Definition at line 363 of file app_data.py.

◆ L_ALLOWED_USER

list L_ALLOWED_USER = L_CONFIG_USER + L_SELL_USER + L_ORDER_USER

Definition at line 394 of file app_data.py.

◆ L_CONFIG_USER

list L_CONFIG_USER = [EUser.ADMIN, EUser.HOST]

Definition at line 391 of file app_data.py.

◆ L_DEVICE

list L_DEVICE = ["Device", "System"]

Definition at line 267 of file app_data.py.

◆ L_GROUP

list L_GROUP = ["Group", "Gruppe"]

Definition at line 266 of file app_data.py.

◆ L_ORDER_USER

list L_ORDER_USER = [EUser.B + str(i) for i in range(1, I_NUMBER_OF_SALES)]

Definition at line 393 of file app_data.py.

◆ L_PRINT_FILE_HEADER

list L_PRINT_FILE_HEADER = ["Count", "Article Name", "Article Number", "Group", "Total Price", "User", "Date", "Printer"]

Definition at line 265 of file app_data.py.

◆ L_SELL_USER

list L_SELL_USER = [EUser.LOCAL, EUser.FREE]

Definition at line 392 of file app_data.py.

◆ LOCKED_USER_PW

str LOCKED_USER_PW = "Locked"

Definition at line 329 of file app_data.py.

◆ log

log = logging.getLogger(__title__)

Definition at line 33 of file app_data.py.

◆ RESET_CODE

str RESET_CODE = b""

Definition at line 331 of file app_data.py.

◆ S_AUTO_OPEN

str S_AUTO_OPEN = "auto_open"

Definition at line 341 of file app_data.py.

◆ S_BACKGROUND

str S_BACKGROUND = "bg"

Definition at line 325 of file app_data.py.

◆ S_BREAK_LINE

str S_BREAK_LINE = "\\n"

Definition at line 261 of file app_data.py.

◆ S_DATE_PRINT_FORMAT

str S_DATE_PRINT_FORMAT = "%Y/%m/%d %H:%M:%S"

Definition at line 264 of file app_data.py.

◆ S_DEFAULT_AUTO_OPEN

str S_DEFAULT_AUTO_OPEN = "True"

Definition at line 344 of file app_data.py.

◆ S_DEFAULT_COM_PORT

S_DEFAULT_COM_PORT = None

Definition at line 272 of file app_data.py.

◆ S_DEFAULT_FREE_AUTO_LOGOUT

str S_DEFAULT_FREE_AUTO_LOGOUT = "True"

Definition at line 345 of file app_data.py.

◆ S_DEFAULT_LAST_PATH

str S_DEFAULT_LAST_PATH = "./"

Definition at line 295 of file app_data.py.

◆ S_DEFAULT_OUTPUT_FOLDER

str S_DEFAULT_OUTPUT_FOLDER = "BonPrinter"

Definition at line 290 of file app_data.py.

◆ S_DEFAULT_OUTPUT_PATH

str S_DEFAULT_OUTPUT_PATH = str(Path.home()) + "/" + S_DEFAULT_OUTPUT_FOLDER

Definition at line 291 of file app_data.py.

◆ S_DEFAULT_PRICE

str S_DEFAULT_PRICE = "9.00"

Definition at line 328 of file app_data.py.

◆ S_DEFAULT_PRINT_ARTICLE

str S_DEFAULT_PRINT_ARTICLE = "True"

Definition at line 316 of file app_data.py.

◆ S_DEFAULT_PRINT_FREE_PRICE

str S_DEFAULT_PRINT_FREE_PRICE = "True"

Definition at line 318 of file app_data.py.

◆ S_DEFAULT_UPDATE_VERSION

str S_DEFAULT_UPDATE_VERSION = "0.0.0"

Definition at line 293 of file app_data.py.

◆ S_DEFAULT_USER_PW

str S_DEFAULT_USER_PW = LOCKED_USER_PW

Definition at line 330 of file app_data.py.

◆ S_DEVICE

str S_DEVICE = "device"

Definition at line 339 of file app_data.py.

◆ S_FREE_AUTO_LOGOUT

str S_FREE_AUTO_LOGOUT = "free_auto_logout"

Definition at line 342 of file app_data.py.

◆ S_GENERAL

str S_GENERAL = "General"

Definition at line 338 of file app_data.py.

◆ S_GROUP

str S_GROUP = "tax_group"

Definition at line 321 of file app_data.py.

◆ S_GROUP_1

str S_GROUP_1 = "group1"

Definition at line 311 of file app_data.py.

◆ S_GROUP_2

str S_GROUP_2 = "group2"

Definition at line 312 of file app_data.py.

◆ S_GROUP_3

str S_GROUP_3 = "group3"

Definition at line 313 of file app_data.py.

◆ S_HEADER

str S_HEADER = "Header"

Definition at line 307 of file app_data.py.

◆ S_HEADER_1

str S_HEADER_1 = "header1"

Definition at line 308 of file app_data.py.

◆ S_HEADER_2

str S_HEADER_2 = "header2"

Definition at line 309 of file app_data.py.

◆ S_KEY_GEOMETRY

str S_KEY_GEOMETRY = "window_geometry"

Definition at line 298 of file app_data.py.

◆ S_KEY_ITEMS

str S_KEY_ITEMS = "ITEMS"

Definition at line 305 of file app_data.py.

◆ S_KEY_LANGUAGE

str S_KEY_LANGUAGE = "language"

Definition at line 285 of file app_data.py.

◆ S_KEY_LAST_DIR_PATH

str S_KEY_LAST_DIR_PATH = "last_dir"

Definition at line 294 of file app_data.py.

◆ S_KEY_OUTPUT_PATH

str S_KEY_OUTPUT_PATH = "output_path"

Definition at line 289 of file app_data.py.

◆ S_KEY_PAPER_WIDTH

str S_KEY_PAPER_WIDTH = "paper_width"

Definition at line 273 of file app_data.py.

◆ S_KEY_PRINT_REPORT

str S_KEY_PRINT_REPORT = "print_report"

Definition at line 281 of file app_data.py.

◆ S_KEY_PRINTER_COM_PORT

str S_KEY_PRINTER_COM_PORT = "com_port"

Definition at line 271 of file app_data.py.

◆ S_KEY_SHOW_PRICE

str S_KEY_SHOW_PRICE = "show_price"

Definition at line 279 of file app_data.py.

◆ S_KEY_SOUND

str S_KEY_SOUND = "sound"

Definition at line 277 of file app_data.py.

◆ S_KEY_STATE

str S_KEY_STATE = "window_state"

Definition at line 299 of file app_data.py.

◆ S_KEY_THEME

str S_KEY_THEME = "darkmode"

Definition at line 283 of file app_data.py.

◆ S_KEY_UPDATE_VERSION

str S_KEY_UPDATE_VERSION = "update_version"

Definition at line 292 of file app_data.py.

◆ S_KEY_USERS

str S_KEY_USERS = "USERS"

Definition at line 304 of file app_data.py.

◆ S_KEY_VERBOSITY

str S_KEY_VERBOSITY = "verbosity"

Definition at line 287 of file app_data.py.

◆ S_MARK

str S_MARK = "mark"

Definition at line 324 of file app_data.py.

◆ S_NAME

str S_NAME = "name"

Definition at line 319 of file app_data.py.

◆ S_PRICE

str S_PRICE = "price"

Definition at line 320 of file app_data.py.

◆ S_PRINT

str S_PRINT = "print"

Definition at line 323 of file app_data.py.

◆ S_PRINT_ARTICLE

str S_PRINT_ARTICLE = "print_article"

Definition at line 315 of file app_data.py.

◆ S_PRINT_FREE_PRICE

str S_PRINT_FREE_PRICE = "print_free_price"

Definition at line 317 of file app_data.py.

◆ S_PRINTS

str S_PRINTS = "Prints"

Definition at line 326 of file app_data.py.

◆ S_PW

str S_PW = "pw"

Definition at line 327 of file app_data.py.

◆ S_SECTION_CONFIGURATION

str S_SECTION_CONFIGURATION = "CONFIGURATION"

Definition at line 303 of file app_data.py.

◆ S_SECTION_PRINTER

str S_SECTION_PRINTER = "PRINTER"

Definition at line 270 of file app_data.py.

◆ S_SECTION_SALES

str S_SECTION_SALES = "SALES"

Definition at line 334 of file app_data.py.

◆ S_SECTION_SETTINGS

str S_SECTION_SETTINGS = "SETTINGS"

Definition at line 276 of file app_data.py.

◆ S_SOUND_CASH_PATH

str S_SOUND_CASH_PATH = resource_path("Resources/Sound/cash.wav")

Definition at line 220 of file app_data.py.

◆ S_SOUND_CLEAR_PATH

str S_SOUND_CLEAR_PATH = resource_path("Resources/Sound/clear.wav")

Definition at line 221 of file app_data.py.

◆ S_SOUND_TOUCH_PATH

str S_SOUND_TOUCH_PATH = resource_path("Resources/Sound/touch.wav")

Definition at line 222 of file app_data.py.

◆ S_SOUND_UNLOCK_PATH

str S_SOUND_UNLOCK_PATH = resource_path("Resources/Sound/unlock.wav")

Definition at line 223 of file app_data.py.

◆ S_TAX

str S_TAX = "Tax"

Definition at line 310 of file app_data.py.

◆ S_UNIT

str S_UNIT = "EUR"

Definition at line 259 of file app_data.py.

◆ S_UNIT_SYMBOL

str S_UNIT_SYMBOL = "€"

Definition at line 260 of file app_data.py.

◆ S_USER_TAX

str S_USER_TAX = "user"

Definition at line 314 of file app_data.py.

◆ S_USER_TIMEOUT

str S_USER_TIMEOUT = "timeout"

Definition at line 340 of file app_data.py.

◆ S_USER_VISIBLE

str S_USER_VISIBLE = "user_visible"

Definition at line 322 of file app_data.py.

◆ settings_handle

settings_handle = SETTINGS(COMPANY_NAME, APP_NAME)

Definition at line 229 of file app_data.py.

◆ user_key

str user_key = f"{EUser.B.value}{i + 1}"

Definition at line 408 of file app_data.py.