Dynamically disable EEPROM buttons
Some checks are pending
Python syntax checker / build (3.10) (push) Waiting to run
Python syntax checker / build (3.7) (push) Waiting to run
Python syntax checker / build (3.8) (push) Waiting to run
Python syntax checker / build (3.9) (push) Waiting to run
Python syntax checker / build (3.x) (push) Waiting to run

This commit is contained in:
Ircama 2024-10-05 17:45:04 +02:00
parent aa6dc225b4
commit 27433686ec

32
ui.py
View file

@ -482,21 +482,19 @@ class EpsonPrinterUI(tk.Tk):
self.read_eeprom_button.grid( self.read_eeprom_button.grid(
row=0, column=3, padx=PADX, pady=PADX, sticky=(tk.W, tk.E) row=0, column=3, padx=PADX, pady=PADX, sticky=(tk.W, tk.E)
) )
self.read_eeprom_button.state(["disabled"])
# Read EEPROM # Write EEPROM
self.write_eeprom_button = ttk.Button( self.write_eeprom_button = ttk.Button(
button_frame, button_frame,
text="Write\nEEPROM", text="Write\nEEPROM",
command=self.write_eeprom, command=self.write_eeprom,
style="Centered.TButton" style="Centered.TButton"
) )
ToolTip(
self.write_eeprom_button,
"Ensure you really want this before pressing this key."
)
self.write_eeprom_button.grid( self.write_eeprom_button.grid(
row=0, column=4, padx=PADX, pady=PADX, sticky=(tk.W, tk.E) row=0, column=4, padx=PADX, pady=PADX, sticky=(tk.W, tk.E)
) )
self.write_eeprom_button.state(["disabled"])
# [row 3] Status display (including ScrolledText and Treeview) # [row 3] Status display (including ScrolledText and Treeview)
row_n += 1 row_n += 1
@ -649,6 +647,30 @@ class EpsonPrinterUI(tk.Tk):
self.reset_button, self.reset_button,
"Feature not defined in the printer configuration." "Feature not defined in the printer configuration."
) )
if "read_key" in self.printer.parm:
self.read_eeprom_button.state(["!disabled"])
ToolTip(
self.read_eeprom_button,
""
)
else:
self.read_eeprom_button.state(["disabled"])
ToolTip(
self.read_eeprom_button,
"Feature not defined in the printer configuration."
)
if "write_key" in self.printer.parm:
self.write_eeprom_button.state(["!disabled"])
ToolTip(
self.write_eeprom_button,
"Ensure you really want this before pressing this key."
)
else:
self.write_eeprom_button.state(["disabled"])
ToolTip(
self.write_eeprom_button,
"Feature not defined in the printer configuration."
)
else: else:
self.po_timer_entry.state(["disabled"]) self.po_timer_entry.state(["disabled"])
self.get_po_minutes.state(["disabled"]) self.get_po_minutes.state(["disabled"])