From b9048b5bcd41a282dc35602141a44cf4c23cc2d1 Mon Sep 17 00:00:00 2001 From: Ircama Date: Mon, 12 Aug 2024 09:16:31 +0200 Subject: [PATCH] Support of L3151, L3160, L3166, L3168 Closes #7 --- epson_print_conf.py | 25 ++++++++----------------- ui.py | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/epson_print_conf.py b/epson_print_conf.py index 7c315a7..e9cdc82 100644 --- a/epson_print_conf.py +++ b/epson_print_conf.py @@ -206,7 +206,6 @@ class EpsonPrinter: "main_waste": {"oids": [48, 49, 47], "divider": 63.45}, "second_waste": {"oids": [50, 51, 47], "divider": 34.15}, "third_waste": {"oids": [252, 253, 254], "divider": 13}, - "raw_waste_reset": { 48: 0, 49: 0, 47: 0, 52: 0, 53: 0, 54: 94, 50: 0, 51: 0, 55: 94, 28: 0, 252: 0, 253: 0, 254: 0, 255: 94, @@ -346,23 +345,12 @@ class EpsonPrinter: "serial_number": range(1604, 1614), "alias": ["ET-2814", "ET-2816", "ET-2818"], }, - "L3160": { + "L3150": { + "alias": ["L3151", "L3160", "L3166", "L3168"], "read_key": [151, 7], "write_key": b'Maribaya', "main_waste": {"oids": [48, 49, 47], "divider": 63.46}, "borderless_waste": {"oids": [50, 51, 47], "divider": 34.16}, - "stats": { - "Maintenance required level of 1st waste ink counter": [54], - "Maintenance required level of 2nd waste ink counter": [55], - "First TI received time": [9, 8], - "Total print pass counter": [133, 132, 131, 130], - "Total print page counter": [776, 775, 774, 773], - "Total scan counter": [1843, 1842, 1841, 1840], - "Ink replacement counter - Black": [554], - "Ink replacement counter - Cyan": [555], - "Ink replacement counter - Magenta": [556], - "Ink replacement counter - Yellow": [557], - }, "same-as": "L4160" }, "L405": { @@ -396,7 +384,7 @@ class EpsonPrinter: "Maintenance required level of 2nd waste ink counter": [55], "First TI received time": [9, 8], "Total print pass counter": [133, 132, 131, 130], - "Total print page counter - rear feed": [755, 754, 753, 752], + "Total print page counter": [776, 775, 774, 773], "Total scan counter": [1843, 1842, 1841, 1840], "Ink replacement counter - Black": [554], "Ink replacement counter - Cyan": [555], @@ -406,8 +394,11 @@ class EpsonPrinter: "serial_number": range(1604, 1614), "raw_waste_reset": { 48: 0, 49: 0, 47: 0, 52: 0, 53: 0, - 54: 94, 50: 0, 51: 0, 55: 94, 28: 0 - } + 54: 94, + 50: 0, 51: 0, + 55: 94, + 28: 0 + }, }, "XP-315": { "alias": ["XP-312", "XP-313"], diff --git a/ui.py b/ui.py index 859d365..d23cb47 100644 --- a/ui.py +++ b/ui.py @@ -203,8 +203,9 @@ class EpsonPrinterUI(tk.Tk): ) ToolTip( self.model_dropdown, - "Select the model of the printer, or press 'Detect Printers'.", + "Select the model of the printer, or press 'Detect Printers'.\nPress F2 to dump the parameters associated to the printer model.", ) + self.model_dropdown.bind("", self.printer_config) # IP address entry ip_frame = ttk.LabelFrame( @@ -415,7 +416,6 @@ class EpsonPrinterUI(tk.Tk): # Create and configure the Treeview widget self.tree = ttk.Treeview(self.tree_frame, style="Treeview") - self.tree.heading("#0", text="Status Information", anchor="w") self.tree.grid(column=0, row=0, sticky=(tk.W, tk.E, tk.N, tk.S)) # Create a vertical scrollbar for the Treeview @@ -705,8 +705,10 @@ class EpsonPrinterUI(tk.Tk): self.tree.tag_configure("key", foreground="black") self.tree.tag_configure("key_value", foreground="dark blue") self.tree.tag_configure("value", foreground="blue") + self.tree.heading("#0", text="Status Information", anchor="w") # Populate the Treeview + self.tree.delete(*self.tree.get_children()) self.populate_treeview("", self.tree, printer.stats()) # Expand all nodes @@ -718,6 +720,34 @@ class EpsonPrinterUI(tk.Tk): self.config(cursor="") self.update_idletasks() + def printer_config(self, cursor=True): + model = self.model_var.get() + printer = EpsonPrinter( + conf_dict=self.conf_dict, + replace_conf=self.replace_conf, + model=model + ) + try: + self.show_treeview() + + # Configure tags + self.tree.tag_configure("key", foreground="black") + self.tree.tag_configure("key_value", foreground="dark blue") + self.tree.tag_configure("value", foreground="blue") + self.tree.heading("#0", text="Printer parameters", anchor="w") + + # Populate the Treeview + self.tree.delete(*self.tree.get_children()) + self.populate_treeview("", self.tree, printer.parm) + + # Expand all nodes + self.expand_all(self.tree) + except Exception as e: + self.show_status_text_view() + self.status_text.insert(tk.END, f"[ERROR] {e}\n") + finally: + self.update_idletasks() + def reset_waste_ink(self, cursor=True): if cursor: self.config(cursor="watch")