diff --git a/README.md b/README.md index 3896aa8..acd0de8 100644 --- a/README.md +++ b/README.md @@ -564,24 +564,26 @@ cs | | | (0 or 1) cx | | | di | Device Identification ("di" 01H 00H 01H) | Implemented in this program | (1) ei | | | (0) -ex | Set Vertical Print Page Line Mode, Roll Paper Mode | - EX BC=6 00 00 00 00 0x14 xx (Set Vertical Print Page Line Mode. xx=00 is off, xx=01 is on. If turned on, this prints vertical trim lines at the left and right margins).
- EX BC=6 00 00 00 00 0x05 xx (Set Roll Paper Mode. If xx is 0, roll paper mode is off; if xx is 1, roll paper mode is on).
- EX BC=3 00 xx yy (Appears to be a synonym for the SN command described above.) | +ex | Set Vertical Print Page Line Mode, Roll Paper Mode | - ex BC=6 00 00 00 00 0x14 xx (Set Vertical Print Page Line Mode. xx=00 is off, xx=01 is on. If turned on, this prints vertical trim lines at the left and right margins).
- ex BC=6 00 00 00 00 0x05 xx (Set Roll Paper Mode. If xx is 0, roll paper mode is off; if xx is 1, roll paper mode is on).
- ex BC=3 00 xx yy (Appears to be a synonym for the SN command described above.) | fl | Firmware load. Enter recovery mode | | ht | Horizontal tab | | ia | List of cartridge types | Implemented in this program | (0) -ii | List cartridge properties | Implemented in this program | (1 + cartridge number) +ii | List cartridge properties | Implemented in this program ("ii\2\0\1\1") | (1 + cartridge number) ot | Power Off Timer | Implemented in this program | (1, 1) pe | (paper ?) | | (1) pj | Pause jobs (?) | | -pm | Select control language ("PM" 02H 00H 00H m1m1=0(ESC/P), 2(IBM 238x Plus emulation) | | (1) +pm | Select control language ("pm" 02H 00H 00H m1m1=0(ESC/P), 2(IBM 238x Plus emulation) | | (1) rj | Resume jobs (?) | | rp | (serial number ? ) | | (0) rs | Initialize | | (1) rw | Reset Waste | Implemented in this program | (1, 0) + [Serial SHA1 hash](https://codeberg.org/atufi/reinkpy/issues/12#issuecomment-1661250) (20 bytes) st | Get printer status ("st" 01H 00H 01H) | Implemented in this program; se below "ST2 Status Reply Codes" | (1) -ti | Set printer time | (" TI" 08H 00H 00H YYYY MM DD hh mm ss) | +ti | Set printer time | ("ti" 08H 00H 00H YYYY MM DD hh mm ss) | vi | Version Information | Implemented in this program | (0) xi | | | (1) +escutil.c also mentions ["ri\2\0\0\0"](https://github.com/echiu64/gutenprint/blob/master/src/escputil/escputil.c#L1944) (Attempt to reset ink). + ### Examples for EEPROM access #### Read EEPROM @@ -997,6 +999,8 @@ emanage x900: Reversing Epson printers: +escputil.c: https://github.com/echiu64/gutenprint/blob/master/src/escputil/escputil.c# + ### Other programs - Epson One-Time Maintenance Ink Pad Reset Utility: diff --git a/epson_print_conf.py b/epson_print_conf.py index ac21d0d..421d7e9 100644 --- a/epson_print_conf.py +++ b/epson_print_conf.py @@ -2635,7 +2635,7 @@ class EpsonPrinter: ] try: lpr.connect() - resp = lpr.send(b"".join(commands)) + lpr.send(b"".join(commands)) except Exception as e: status = False finally: diff --git a/requirements.txt b/requirements.txt index 24c5435..f372439 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ pyyaml -pysnmp -pysnmp_sync_adapter +pysnmp>=7.1.20 +pysnmp_sync_adapter>=1.0.6 tkcalendar pyperclip black tomli -text-console +text-console>=2.0.0 diff --git a/ui.py b/ui.py index 4e2c55a..e425404 100644 --- a/ui.py +++ b/ui.py @@ -37,7 +37,7 @@ from find_printers import PrinterScanner from text_console import TextConsole -VERSION = "6.1.0" +VERSION = "6.2.0" NO_CONF_ERROR = ( " Please select a printer model and a valid IP address," @@ -270,6 +270,11 @@ class EpsonPrinterUI(tk.Tk): conf_dict = {}, replace_conf=False ): + def plain_fn(event, fn_handler): + if event.state: # Shift | Control | Alt + return + fn_handler() + try: super().__init__() except Exception as e: @@ -359,9 +364,6 @@ class EpsonPrinterUI(tk.Tk): help_menu.add_command(label="Show printer keys of the selected model", command=self.key_values) help_menu.entryconfig("Show printer keys of the selected model", accelerator="F3") - help_menu.add_command(label="Remove selected printer configuration", command=self.remove_printer_conf) - help_menu.entryconfig("Remove selected printer configuration", accelerator="F4") - help_menu.add_command(label="Keep only selected printer configuration", command=self.keep_printer_conf) help_menu.entryconfig("Keep only selected printer configuration", accelerator="F5") @@ -371,6 +373,9 @@ class EpsonPrinterUI(tk.Tk): help_menu.add_command(label="Debug shell", command=self.tk_console) help_menu.entryconfig("Debug shell", accelerator="F7") + help_menu.add_command(label="Remove selected printer configuration", command=self.remove_printer_conf) + help_menu.entryconfig("Remove selected printer configuration", accelerator="F8") + help_menu.add_command(label="Get next local IP addresss", command=lambda: self.next_ip(0)) help_menu.entryconfig("Get next local IP addresss", accelerator="F9") @@ -434,14 +439,14 @@ class EpsonPrinterUI(tk.Tk): ToolTip( self.model_dropdown, "Select the model of the printer, or press 'Detect Printers'." - " Special features are allowed via F2, F3, F4, F5, or F6.\n" + " Special features are allowed via F2, F3, F5, F6, F8, F9.\n" ) - self.bind_all("", self.printer_config) - self.bind_all("", self.key_values) - self.bind_all("", lambda event: self.remove_printer_conf()) - self.bind_all("", lambda event: self.keep_printer_conf()) - self.bind_all("", lambda event: self.clear_printer_list()) - self.bind_all("", lambda event: self.tk_console()) + self.bind_all("", lambda e: plain_fn(e, self.printer_config)) + self.bind_all("", lambda e: plain_fn(e, self.key_values)) + self.bind_all("", lambda e: plain_fn(e, self.keep_printer_conf)) + self.bind_all("", lambda e: plain_fn(e, self.clear_printer_list)) + self.bind_all("", lambda e: plain_fn(e, self.tk_console)) + self.bind_all("", lambda e: plain_fn(e, self.remove_printer_conf)) # BOX IP address ip_frame = ttk.LabelFrame( @@ -469,7 +474,7 @@ class EpsonPrinterUI(tk.Tk): self.ip_entry.grid( row=0, column=1, pady=PADY, padx=PADX, sticky=(tk.W, tk.E) ) - self.ip_entry.bind("", self.next_ip) + self.ip_entry.bind_all("", self.next_ip) ToolTip( self.ip_entry, "Enter the IP address, or press 'Detect Printers'" @@ -1169,16 +1174,29 @@ class EpsonPrinterUI(tk.Tk): ) def tk_console(self): - console_window = tk.Toplevel(self) - console_window.title("Debug Console") - console_window.geometry("800x400") + if hasattr( + self, '_console_window' + ) and self._console_window.winfo_exists(): + self._console_window.deiconify() + self._console_window.lift() + self._console_window.focus_force() + # Find the console widget and focus it properly + for widget in self._console_window.winfo_children(): + widget.focus_set() + return - console = EpcTextConsole(self, console_window) - console.pack(fill='both', expand=True) # Use pack within the frame + self._console_window = tk.Toplevel(self) + self._console_window.title("Debug Console") + self._console_window.geometry("800x400") - # Configure grid resizing for the frame - self.grid_rowconfigure(0, weight=1) - self.grid_columnconfigure(0, weight=1) + console = EpcTextConsole(self, self._console_window) + console.focus_set() + console.pack(fill='both', expand=True) + + # Optional: handle window close to remove reference + def on_close(): + self._console_window.destroy() + self._console_window = None def open_help_browser(self): # Opens a web browser to a help URL @@ -2714,12 +2732,9 @@ Web site: https://github.com/Ircama/epson_print_conf def show_clean_dialog(): # Define groups groups = [ - "Clean all nozzles", - "Cyan + Vivid Magenta", - "Photo Black + Matte Black + Light Black", - "Orange + Green", - "Light Light Black + Yellow", - "Vivid Light Magenta + Light Cyan" + "Clean all nozzles", # 0 + "Clean the black ink nozzle", # 1 + "Clean the color ink nozzles", # 2 ] # Create modal dialog