BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
app_data.py File Reference

Data module (path related constants and functions) More...

Go to the source code of this file.

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...

Namespaces

namespace  Source
namespace  Source.Util
namespace  Source.Util.app_data

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

Data module (path related constants and functions)


Definition in file app_data.py.