Skip to content

Commit

Permalink
Support of L3151, L3160, L3166, L3168
Browse files Browse the repository at this point in the history
Closes #7
  • Loading branch information
Ircama committed Aug 12, 2024
1 parent 902fd1b commit b9048b5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 19 deletions.
25 changes: 8 additions & 17 deletions epson_print_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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],
Expand All @@ -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"],
Expand Down
34 changes: 32 additions & 2 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ def __init__(self, conf_dict={}, replace_conf=False):
)
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("<F2>", self.printer_config)

# IP address entry
ip_frame = ttk.LabelFrame(
Expand Down Expand Up @@ -415,7 +416,6 @@ def __init__(self, conf_dict={}, replace_conf=False):

# 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
Expand Down Expand Up @@ -705,8 +705,10 @@ def printer_status(self, cursor=True):
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
Expand All @@ -718,6 +720,34 @@ def printer_status(self, cursor=True):
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")
Expand Down

0 comments on commit b9048b5

Please sign in to comment.