BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
Sound Class Reference

Sounds for actions. More...

Public Member Functions

None __init__ (self, "MainWindow" ui)
None update_sound_status (self, Optional[bool] b_sound=None, bool b_update_settings=True)
 Update sound status.

Public Attributes

bool b_sound = False
 c_sound_clear = create_sound(S_SOUND_CLEAR_PATH)
 c_sound_print = create_sound(S_SOUND_CASH_PATH)
 c_sound_touch = create_sound(S_SOUND_TOUCH_PATH)
 c_sound_unlock = create_sound(S_SOUND_UNLOCK_PATH)
 ui = ui

Detailed Description

Sounds for actions.

Parameters
ui: main window object

Definition at line 22 of file sound.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
"MainWindow" ui )

Definition at line 28 of file sound.py.

28 def __init__(self, ui: "MainWindow") -> None:
29 self.ui = ui
30 self.b_sound = False
31 self.c_sound_print = create_sound(S_SOUND_CASH_PATH)
32 self.c_sound_clear = create_sound(S_SOUND_CLEAR_PATH)
33 self.c_sound_unlock = create_sound(S_SOUND_UNLOCK_PATH)
34 self.c_sound_touch = create_sound(S_SOUND_TOUCH_PATH)
35

Member Function Documentation

◆ update_sound_status()

None update_sound_status ( self,
Optional[bool] b_sound = None,
bool b_update_settings = True )

Update sound status.

Parameters
b_sound: [True] sound active; [False] sound muted; [None] toggle actual sound state
b_update_settings: [True] print sound info at status bar; [False] no output on status bar

Definition at line 36 of file sound.py.

36 def update_sound_status(self, b_sound: Optional[bool] = None, b_update_settings: bool = True) -> None:
37 """!
38 @brief Update sound status.
39 @param b_sound : [True] sound active; [False] sound muted; [None] toggle actual sound state
40 @param b_update_settings : [True] print sound info at status bar; [False] no output on status bar
41 """
42 if b_sound is None:
43 b_sound = not self.b_sound # toggle sound status if no sound state set
44 if b_update_settings:
45 self.b_sound = b_sound
46 write_sound_settings(self.b_sound)
47 if self.b_sound:
48 s_sound_icon = ICON_SOUND_LIGHT if self.ui.model.c_monitor.is_light_theme() else ICON_SOUND_DARK
49 s_statusbar_text = ["Sound On", "Ton an"]
50 else:
51 s_sound_icon = ICON_SOUND_MUTE_LIGHT if self.ui.model.c_monitor.is_light_theme() else ICON_SOUND_MUTE_DARK
52 s_statusbar_text = ["Sound Off", "Ton aus"]
53 if b_update_settings:
54 self.ui.set_status(s_statusbar_text)
55 config_menu(self.ui.action_sound, icon=s_sound_icon)

Member Data Documentation

◆ b_sound

b_sound = False

Definition at line 30 of file sound.py.

◆ c_sound_clear

c_sound_clear = create_sound(S_SOUND_CLEAR_PATH)

Definition at line 32 of file sound.py.

◆ c_sound_print

c_sound_print = create_sound(S_SOUND_CASH_PATH)

Definition at line 31 of file sound.py.

◆ c_sound_touch

c_sound_touch = create_sound(S_SOUND_TOUCH_PATH)

Definition at line 34 of file sound.py.

◆ c_sound_unlock

c_sound_unlock = create_sound(S_SOUND_UNLOCK_PATH)

Definition at line 33 of file sound.py.

◆ ui

ui = ui

Definition at line 29 of file sound.py.


The documentation for this class was generated from the following file: