zebra-day 0.0.37__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. zebra_day/__init__.py +35 -0
  2. zebra_day/bin/__init__.py +0 -0
  3. zebra_day/bin/fetch_zebra_config.py +15 -0
  4. zebra_day/bin/generate_coord_grid_zpl.py +50 -0
  5. zebra_day/bin/print_zpl_from_file.py +21 -0
  6. zebra_day/bin/probe_new_label_dimensions.py +75 -0
  7. zebra_day/bin/scan_for_networed_zebra_printers_arp_scan.sh +1 -0
  8. zebra_day/bin/scan_for_networed_zebra_printers_curl.sh +30 -0
  9. zebra_day/bin/zserve.py +701 -259
  10. zebra_day/cli/__init__.py +240 -0
  11. zebra_day/cli/cognito.py +121 -0
  12. zebra_day/cli/gui.py +255 -0
  13. zebra_day/cli/printer.py +168 -0
  14. zebra_day/cli/template.py +176 -0
  15. zebra_day/cmd_mgr.py +35 -0
  16. zebra_day/etc/Monoid-Regular-HalfTight-Dollar-0-1-l.ttf +0 -0
  17. zebra_day/etc/label_styles/blank.zpl +0 -0
  18. zebra_day/etc/label_styles/cornersStripOf4Squares_1inX1in.zpl +55 -0
  19. zebra_day/etc/label_styles/corners_1inX2in.zpl +28 -0
  20. zebra_day/etc/label_styles/corners_20cmX30cm.zpl +6 -0
  21. zebra_day/etc/label_styles/corners_smallTube.zpl +7 -0
  22. zebra_day/etc/label_styles/corners_unspecifiedDimensions.zpl +15 -0
  23. zebra_day/etc/label_styles/generic_2inX1in.zpl +21 -0
  24. zebra_day/etc/label_styles/plate_1inX0.25in.zpl +9 -0
  25. zebra_day/etc/label_styles/plate_1inX0.25inHD.zpl +9 -0
  26. zebra_day/etc/label_styles/smallTubeWdotHD_prod.zpl +8 -0
  27. zebra_day/etc/label_styles/smallTubeWdot_corners.zpl +7 -0
  28. zebra_day/etc/label_styles/smallTubeWdot_prod.zpl +8 -0
  29. zebra_day/etc/label_styles/smallTubeWdot_prodAlt1.zpl +6 -0
  30. zebra_day/etc/label_styles/smallTubeWdot_prodAlt1b.zpl +3 -0
  31. zebra_day/etc/label_styles/smallTubeWdot_prodV2.zpl +8 -0
  32. zebra_day/etc/label_styles/smallTubeWdot_reagent.zpl +29 -0
  33. zebra_day/etc/label_styles/stripOf4Squares_1inX1in.zpl +32 -0
  34. zebra_day/etc/label_styles/test_800dX800dCoordinateArray.zpl +1 -0
  35. zebra_day/etc/label_styles/tmps/.hold +0 -0
  36. zebra_day/etc/label_styles/tmps/tmp_zpl_templates.here +0 -0
  37. zebra_day/etc/label_styles/tube_20mmX30mmA.zpl +7 -0
  38. zebra_day/etc/label_styles/tube_2inX0.3in.zpl +15 -0
  39. zebra_day/etc/label_styles/tube_2inX0.5in.zpl +15 -0
  40. zebra_day/etc/label_styles/tube_2inX0.5inHD.zpl +15 -0
  41. zebra_day/etc/label_styles/tube_2inX1in.zpl +25 -0
  42. zebra_day/etc/label_styles/tube_2inX1inHD.zpl +22 -0
  43. zebra_day/etc/label_styles/tube_2inX1inHDv3.zpl +21 -0
  44. zebra_day/etc/old_printer_config/.hold +0 -0
  45. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.022846_printer_config.json +1 -0
  46. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.033657_printer_config.json +1 -0
  47. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.039597_printer_config.json +3 -0
  48. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.047295_printer_config.json +1 -0
  49. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.055804_printer_config.json +1 -0
  50. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.061337_printer_config.json +3 -0
  51. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.073326_printer_config.json +1 -0
  52. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.081950_printer_config.json +1 -0
  53. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.088251_printer_config.json +3 -0
  54. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.096501_printer_config.json +1 -0
  55. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.104767_printer_config.json +1 -0
  56. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.110364_printer_config.json +3 -0
  57. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.118239_printer_config.json +1 -0
  58. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.125950_printer_config.json +1 -0
  59. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.349866_printer_config.json +1 -0
  60. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.361085_printer_config.json +3 -0
  61. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.558323_printer_config.json +1 -0
  62. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.565756_printer_config.json +3 -0
  63. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.739070_printer_config.json +16 -0
  64. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.753796_printer_config.json +1 -0
  65. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.760201_printer_config.json +3 -0
  66. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.768747_printer_config.json +1 -0
  67. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.775312_printer_config.json +3 -0
  68. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.782533_printer_config.json +1 -0
  69. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.789287_printer_config.json +1 -0
  70. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.794230_printer_config.json +3 -0
  71. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.800021_printer_config.json +5 -0
  72. zebra_day/etc/printer_config.json +16 -0
  73. zebra_day/etc/printer_config.template.json +16 -0
  74. zebra_day/etc/tmp_printers0.json +5 -0
  75. zebra_day/etc/tmp_printers374.json +5 -0
  76. zebra_day/etc/tmp_printers383.json +5 -0
  77. zebra_day/etc/tmp_printers450.json +5 -0
  78. zebra_day/etc/tmp_printers504.json +5 -0
  79. zebra_day/etc/tmp_printers608.json +5 -0
  80. zebra_day/etc/tmp_printers657.json +5 -0
  81. zebra_day/etc/tmp_printers838.json +5 -0
  82. zebra_day/etc/tmp_printers839.json +5 -0
  83. zebra_day/etc/tmp_printers933.json +5 -0
  84. zebra_day/etc/tmp_printers957.json +5 -0
  85. zebra_day/exceptions.py +88 -0
  86. zebra_day/files/.hold +0 -0
  87. zebra_day/files/hold +0 -0
  88. zebra_day/files/test_png_17696.png +0 -0
  89. zebra_day/files/test_png_23477.png +0 -0
  90. zebra_day/files/test_png_28157.png +0 -0
  91. zebra_day/files/test_png_35832.png +0 -0
  92. zebra_day/files/test_png_36400.png +0 -0
  93. zebra_day/files/test_png_40816.png +0 -0
  94. zebra_day/files/test_png_49564.png +0 -0
  95. zebra_day/files/test_png_53848.png +0 -0
  96. zebra_day/files/test_png_62542.png +0 -0
  97. zebra_day/files/test_png_91597.png +0 -0
  98. zebra_day/files/test_png_93633.png +0 -0
  99. zebra_day/files/tmpbjo3k7q1.png +0 -0
  100. zebra_day/files/tmpigtr4pwy.png +0 -0
  101. zebra_day/files/zpl_label_tube_2inX1in_2026-02-01_01:51:24.370964.png +0 -0
  102. zebra_day/logging_config.py +74 -0
  103. zebra_day/logs/.hold +0 -0
  104. zebra_day/logs/print_requests.log +2 -0
  105. zebra_day/paths.py +143 -0
  106. zebra_day/print_mgr.py +487 -103
  107. zebra_day/static/datschund.css +140 -0
  108. zebra_day/static/datschund.png +0 -0
  109. zebra_day/static/daylily.png +0 -0
  110. zebra_day/static/favicon.svg +20 -0
  111. zebra_day/static/general.css +99 -0
  112. zebra_day/static/js/zebra_modern.js +172 -0
  113. zebra_day/static/lsmc.css +354 -0
  114. zebra_day/static/moon.jpeg +0 -0
  115. zebra_day/static/oakland.css +197 -0
  116. zebra_day/static/petrichor.css +150 -0
  117. zebra_day/static/popday_daylily.css +140 -0
  118. zebra_day/static/style.css +183 -0
  119. zebra_day/static/triangles.css +122 -0
  120. zebra_day/static/tron.css +277 -0
  121. zebra_day/static/zebra_modern.css +771 -0
  122. zebra_day/static/zebras.css +176 -0
  123. zebra_day/templates/base.html +36 -0
  124. zebra_day/templates/bpr.html +72 -0
  125. zebra_day/templates/build_new_config.html +36 -0
  126. zebra_day/templates/build_print_request.html +32 -0
  127. zebra_day/templates/chg_ui_style.html +19 -0
  128. zebra_day/templates/edit_template.html +128 -0
  129. zebra_day/templates/edit_zpl.html +37 -0
  130. zebra_day/templates/index.html +82 -0
  131. zebra_day/templates/legacy/base.html +37 -0
  132. zebra_day/templates/legacy/bpr.html +72 -0
  133. zebra_day/templates/legacy/build_new_config.html +36 -0
  134. zebra_day/templates/legacy/build_print_request.html +32 -0
  135. zebra_day/templates/legacy/chg_ui_style.html +19 -0
  136. zebra_day/templates/legacy/edit_template.html +128 -0
  137. zebra_day/templates/legacy/edit_zpl.html +37 -0
  138. zebra_day/templates/legacy/index.html +82 -0
  139. zebra_day/templates/legacy/list_prior_configs.html +24 -0
  140. zebra_day/templates/legacy/print_result.html +30 -0
  141. zebra_day/templates/legacy/printer_details.html +25 -0
  142. zebra_day/templates/legacy/printer_status.html +70 -0
  143. zebra_day/templates/legacy/save_result.html +17 -0
  144. zebra_day/templates/legacy/send_print_request.html +34 -0
  145. zebra_day/templates/legacy/simple_print.html +94 -0
  146. zebra_day/templates/legacy/view_pstation_json.html +29 -0
  147. zebra_day/templates/list_prior_configs.html +24 -0
  148. zebra_day/templates/modern/base.html +98 -0
  149. zebra_day/templates/modern/config.html +141 -0
  150. zebra_day/templates/modern/dashboard.html +160 -0
  151. zebra_day/templates/modern/print_request.html +141 -0
  152. zebra_day/templates/modern/print_result.html +88 -0
  153. zebra_day/templates/modern/printer_detail.html +117 -0
  154. zebra_day/templates/modern/printers.html +133 -0
  155. zebra_day/templates/modern/save_result.html +46 -0
  156. zebra_day/templates/modern/template_editor.html +172 -0
  157. zebra_day/templates/modern/templates.html +122 -0
  158. zebra_day/templates/print_result.html +30 -0
  159. zebra_day/templates/printer_details.html +25 -0
  160. zebra_day/templates/printer_status.html +70 -0
  161. zebra_day/templates/save_result.html +17 -0
  162. zebra_day/templates/send_print_request.html +34 -0
  163. zebra_day/templates/simple_print.html +94 -0
  164. zebra_day/templates/view_pstation_json.html +29 -0
  165. zebra_day/web/__init__.py +9 -0
  166. zebra_day/web/app.py +171 -0
  167. zebra_day/web/auth.py +172 -0
  168. zebra_day/web/middleware.py +159 -0
  169. zebra_day/web/routers/__init__.py +2 -0
  170. zebra_day/web/routers/api.py +163 -0
  171. zebra_day/web/routers/ui.py +1051 -0
  172. zebra_day/zpl_renderer.py +273 -0
  173. zebra_day-1.0.2.dist-info/METADATA +786 -0
  174. zebra_day-1.0.2.dist-info/RECORD +179 -0
  175. {zebra_day-0.0.37.dist-info → zebra_day-1.0.2.dist-info}/WHEEL +1 -1
  176. zebra_day-1.0.2.dist-info/entry_points.txt +4 -0
  177. zebra_day/bin/te.py +0 -905
  178. zebra_day-0.0.37.dist-info/METADATA +0 -1177
  179. zebra_day-0.0.37.dist-info/RECORD +0 -10
  180. {zebra_day-0.0.37.dist-info → zebra_day-1.0.2.dist-info/licenses}/LICENSE +0 -0
  181. {zebra_day-0.0.37.dist-info → zebra_day-1.0.2.dist-info}/top_level.txt +0 -0
zebra_day/__init__.py CHANGED
@@ -0,0 +1,35 @@
1
+ """
2
+ zebra_day - A Python library to manage Zebra printer fleets and ZPL print requests.
3
+ """
4
+ from __future__ import annotations
5
+
6
+ from zebra_day.exceptions import (
7
+ ConfigError,
8
+ ConfigFileNotFoundError,
9
+ ConfigParseError,
10
+ LabelTemplateError,
11
+ LabelTemplateNotFoundError,
12
+ NetworkScanError,
13
+ PrinterConnectionError,
14
+ PrinterNotFoundError,
15
+ ZebraDayError,
16
+ ZPLRenderError,
17
+ )
18
+ from zebra_day.logging_config import configure_logging, get_logger
19
+
20
+ __all__ = [
21
+ # Logging
22
+ "configure_logging",
23
+ "get_logger",
24
+ # Exceptions
25
+ "ZebraDayError",
26
+ "PrinterConnectionError",
27
+ "PrinterNotFoundError",
28
+ "ConfigError",
29
+ "ConfigFileNotFoundError",
30
+ "ConfigParseError",
31
+ "LabelTemplateError",
32
+ "LabelTemplateNotFoundError",
33
+ "ZPLRenderError",
34
+ "NetworkScanError",
35
+ ]
File without changes
@@ -0,0 +1,15 @@
1
+ import socket
2
+ import sys
3
+
4
+ def send_zpl_to_printer(ip_address, port, zpl_string):
5
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
6
+ s.connect((ip_address, port))
7
+ s.sendall(zpl_string.encode())
8
+ response = s.recv(1024)
9
+ return response.decode()
10
+
11
+ # Example usage
12
+ ip = sys.argv[1]
13
+ zpl_command = '^XA^HH^XZ' # This command retrieves the printer's configuration. Replace as needed.
14
+ response = send_zpl_to_printer(ip, 9100, zpl_command)
15
+ print(response)
@@ -0,0 +1,50 @@
1
+ import sys
2
+ import zebra_day.print_mgr as zdpm
3
+
4
+
5
+ def generate_coarse_grid(x_dim, y_dim):
6
+ step = 50
7
+ zpl_strings = []
8
+ for x in range(0, x_dim, step):
9
+ for y in range(0, y_dim, step):
10
+ zpl_strings.append(f"^FO{x},{y}^A0N,18,18^FD{x}^FS^FO{x},{y+20}^A0N,18,18^FD{y}^FS")
11
+ #zpl_strings.append(f"^FO{x},{y}^A0N,22,22^FD{x},{y}^FS")
12
+ return "^XA" + "".join(zpl_strings) + "^XZ"
13
+
14
+ def generate_fine_grid(top_left, bottom_right, step=20, expand=50):
15
+ x_start = max(0, top_left[0] - expand)
16
+ y_start = max(0, top_left[1] - expand)
17
+ x_end = bottom_right[0] + expand
18
+ y_end = bottom_right[1] + expand
19
+ zpl_strings = []
20
+ for x in range(x_start, x_end, step):
21
+ for y in range(y_start, y_end, step):
22
+ zpl_strings.append(f"^FO{x},{y}^A0N,20,20^FD{x},{y}^FS")
23
+ return "^XA" + "".join(zpl_strings) + "^XZ"
24
+
25
+ def main(ip):
26
+
27
+ zpld = zdpm.zpl()
28
+
29
+ # Part 1: Coarse Grid
30
+ x_dim = int(input("Enter width of the rectangle in dots: "))
31
+ y_dim = int(input("Enter height of the rectangle in dots: "))
32
+ print("\nZPL for coarse grid:\n")
33
+ zpl_string = generate_coarse_grid(x_dim, y_dim)
34
+ print(zpl_string)
35
+ zpld.print_raw_zpl(zpl_string , ip)
36
+
37
+ fh = open('./test_800dX800dCoordinateArray.zpl','w')
38
+ fh.write(zpl_string)
39
+ fh.close()
40
+
41
+ # Part 2: Fine Grid
42
+ #top_left = tuple(map(int, input("\nEnter top-left corner coordinates (x,y) separated by a comma: ").split(',')))
43
+ #bottom_right = tuple(map(int, input("Enter bottom-right corner coordinates (x,y) separated by a comma: ").split(',')))
44
+ #print("\nZPL for fine grid:\n")
45
+ #zpl_string2 = generate_fine_grid(top_left, bottom_right)
46
+ #zpld.print_raw_zpl(zpl_string2 , ip)
47
+
48
+ if __name__ == "__main__":
49
+
50
+ main(sys.argv[1])
@@ -0,0 +1,21 @@
1
+ import sys
2
+ import zebra_day.print_mgr as zdpm
3
+
4
+ ip = sys.argv[1]
5
+
6
+ zpl_file = sys.argv[2]
7
+
8
+ zpld = zdpm.zpl()
9
+
10
+ zpl_string = ""
11
+
12
+ fh = open(zpl_file, 'r')
13
+ for i in fh:
14
+ zpl_string += i.rstrip()
15
+
16
+
17
+ print(zpl_string)
18
+
19
+ zpld.print_raw_zpl(zpl_string , ip)
20
+
21
+ print('done!')
@@ -0,0 +1,75 @@
1
+ import sys
2
+ import zebra_day.print_mgr as zdpm
3
+
4
+ class ZPLBoundaryTester:
5
+ def __init__(self):
6
+ # Starting coordinates
7
+ self.x = 235
8
+ self.y = 20 ##235,20
9
+
10
+ # Step size (how much we move the print position each time)
11
+ # Adjust based on the printer's resolution (DPI) and desired granularity.
12
+ self.step = 100
13
+
14
+ # Flags
15
+ self.first_print_x = True
16
+ self.first_print_y = True
17
+
18
+ self.first_x = None
19
+ self.first_y = None
20
+ self.first_last_x = None
21
+ self.first_last_y = None
22
+
23
+ def generate_zpl(self):
24
+ #zpl_string = f"^XA^FO{self.x},{self.y}^ADN,30,20^FDXXX^FS^XZ"
25
+ zpl_string = f"^XA^FO{self.x},{self.y}^BY1^B3N,N,40,N,N^FDX^FS^XZ"
26
+ #zpl_string = f"^XA^FO{self.x},{self.y}^A0N,100,100^FDX^FS^XZ"
27
+ return zpl_string
28
+
29
+ def process_feedback(self, feedback):
30
+ if feedback == "n": # not yet
31
+ if not self.first_print_y:
32
+ print("Testing completed.")
33
+ return None
34
+ self.y += self.step
35
+ self.x += self.step
36
+ self.first_print_x = True
37
+ return self.generate_zpl()
38
+
39
+ elif feedback == "b": # begins
40
+ self.first_print_x = False
41
+ self.x += self.step
42
+ return self.generate_zpl()
43
+
44
+ elif feedback == "c": # continuses
45
+ self.x += self.step
46
+ return self.generate_zpl()
47
+
48
+ elif feedback == "o": # off
49
+ if self.first_print_x:
50
+ self.first_print_y = False
51
+ else:
52
+ self.y += self.step
53
+ self.x = 0
54
+ self.first_print_x = True
55
+ return self.generate_zpl()
56
+
57
+ else:
58
+ print("Invalid feedback. Please provide a valid feedback string.")
59
+ return None
60
+
61
+ def main(ip='localhost'):
62
+ tester = ZPLBoundaryTester()
63
+ zpl_string = tester.generate_zpl()
64
+
65
+ zpld = zdpm.zpl()
66
+
67
+ while zpl_string:
68
+ print(f"Send the following ZPL to the printer:\n{zpl_string}")
69
+ feedback = input("Please provide your feedback: ")
70
+ zpl_string = tester.process_feedback(feedback)
71
+ zpld.print_raw_zpl(zpl_string , ip)
72
+
73
+ if __name__ == "__main__":
74
+ ip = sys.argv[1]
75
+ main(ip)
@@ -0,0 +1 @@
1
+ sudo arp-scan --localnet
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ # Network range (modify if needed)
4
+ network=$1 # "192.168.1"
5
+ scan_wait=0.4
6
+ if [[ "$2" == "" ]]; then
7
+ scan_wait=0.4
8
+ else
9
+ scan_wait=$2
10
+ fi
11
+
12
+
13
+ # Loop through each IP and use curl
14
+ for i in {1..254}; do
15
+ ip="$network.$i"
16
+ # Use curl to fetch the page and grep to check for "Zebra"
17
+ echo $ip
18
+ if curl -m $scan_wait -s "http://$ip:80" | grep -q "Zebra"; then
19
+ content=$(curl -m 4 -s "http://$ip:80")
20
+ if echo "$content" | grep -q "Zebra"; then
21
+ model=$(echo """$content""" | perl -ne 'print $1 if /^(.*?)<\/H1>/')
22
+ combo=$(echo """$content""" | perl -ne 'print $1 if /<TITLE>(.*?)<\/TITLE>/')
23
+ serial=$(echo """$combo""" | cut -d '-' -f 1)
24
+ zstatus=$(echo """$combo""" | cut -d '-' -f 2)
25
+ arp_resp=$(arp -n $ip)
26
+ echo "ZebraPrinter|$ip|$model|$serial|$zstatus|$arp_resp"
27
+ fi
28
+ fi
29
+ done
30
+