zebra-day 0.0.32__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 (190) hide show
  1. zebra_day/__init__.py +35 -0
  2. zebra_day/bin/fetch_zebra_config.py +15 -0
  3. zebra_day/bin/generate_coord_grid_zpl.py +50 -0
  4. zebra_day/bin/print_zpl_from_file.py +21 -0
  5. zebra_day/bin/probe_new_label_dimensions.py +75 -0
  6. zebra_day/bin/scan_for_networed_zebra_printers_curl.sh +2 -1
  7. zebra_day/bin/zserve.py +701 -259
  8. zebra_day/cli/__init__.py +240 -0
  9. zebra_day/cli/cognito.py +121 -0
  10. zebra_day/cli/gui.py +255 -0
  11. zebra_day/cli/printer.py +168 -0
  12. zebra_day/cli/template.py +176 -0
  13. zebra_day/cmd_mgr.py +35 -0
  14. zebra_day/etc/label_styles/blank.zpl +0 -0
  15. zebra_day/etc/label_styles/cornersStripOf4Squares_1inX1in.zpl +55 -0
  16. zebra_day/etc/label_styles/corners_1inX2in.zpl +28 -0
  17. zebra_day/etc/label_styles/corners_20cmX30cm.zpl +6 -0
  18. zebra_day/etc/label_styles/corners_smallTube.zpl +7 -0
  19. zebra_day/etc/label_styles/corners_unspecifiedDimensions.zpl +15 -0
  20. zebra_day/etc/label_styles/plate_1inX0.25inHD.zpl +9 -0
  21. zebra_day/etc/label_styles/smallTubeWdotHD_prod.zpl +8 -0
  22. zebra_day/etc/label_styles/smallTubeWdot_corners.zpl +7 -0
  23. zebra_day/etc/label_styles/smallTubeWdot_prod.zpl +8 -0
  24. zebra_day/etc/label_styles/smallTubeWdot_prodAlt1.zpl +6 -0
  25. zebra_day/etc/label_styles/smallTubeWdot_prodAlt1b.zpl +3 -0
  26. zebra_day/etc/label_styles/smallTubeWdot_prodV2.zpl +8 -0
  27. zebra_day/etc/label_styles/smallTubeWdot_reagent.zpl +29 -0
  28. zebra_day/etc/label_styles/stripOf4Squares_1inX1in.zpl +32 -0
  29. zebra_day/etc/label_styles/test_800dX800dCoordinateArray.zpl +1 -0
  30. zebra_day/etc/label_styles/tmps/tmp_zpl_templates.here +0 -0
  31. zebra_day/etc/label_styles/tube_20mmX30mmA.zpl +7 -0
  32. zebra_day/etc/label_styles/tube_2inX0.5in.zpl +15 -0
  33. zebra_day/etc/label_styles/tube_2inX0.5inHD.zpl +15 -0
  34. zebra_day/etc/label_styles/tube_2inX1inHD.zpl +22 -0
  35. zebra_day/etc/label_styles/tube_2inX1inHDv3.zpl +21 -0
  36. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.022846_printer_config.json +1 -0
  37. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.033657_printer_config.json +1 -0
  38. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.039597_printer_config.json +3 -0
  39. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.047295_printer_config.json +1 -0
  40. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.055804_printer_config.json +1 -0
  41. zebra_day/etc/old_printer_config/2026-02-01_01:50:25.061337_printer_config.json +3 -0
  42. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.073326_printer_config.json +1 -0
  43. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.081950_printer_config.json +1 -0
  44. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.088251_printer_config.json +3 -0
  45. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.096501_printer_config.json +1 -0
  46. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.104767_printer_config.json +1 -0
  47. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.110364_printer_config.json +3 -0
  48. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.118239_printer_config.json +1 -0
  49. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.125950_printer_config.json +1 -0
  50. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.349866_printer_config.json +1 -0
  51. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.361085_printer_config.json +3 -0
  52. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.558323_printer_config.json +1 -0
  53. zebra_day/etc/old_printer_config/2026-02-01_01:51:24.565756_printer_config.json +3 -0
  54. zebra_day/etc/old_printer_config/{2023-10-25_02:19:04.139607_printer_config.json → 2026-02-01_01:51:29.739070_printer_config.json} +4 -3
  55. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.753796_printer_config.json +1 -0
  56. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.760201_printer_config.json +3 -0
  57. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.768747_printer_config.json +1 -0
  58. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.775312_printer_config.json +3 -0
  59. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.782533_printer_config.json +1 -0
  60. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.789287_printer_config.json +1 -0
  61. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.794230_printer_config.json +3 -0
  62. zebra_day/etc/old_printer_config/2026-02-01_01:51:29.800021_printer_config.json +5 -0
  63. zebra_day/etc/printer_config.json +3 -54
  64. zebra_day/etc/printer_config.template.json +3 -2
  65. zebra_day/etc/tmp_printers0.json +5 -0
  66. zebra_day/etc/tmp_printers374.json +5 -0
  67. zebra_day/etc/tmp_printers383.json +5 -0
  68. zebra_day/etc/tmp_printers450.json +5 -0
  69. zebra_day/etc/tmp_printers504.json +5 -0
  70. zebra_day/etc/tmp_printers608.json +5 -0
  71. zebra_day/etc/tmp_printers657.json +5 -0
  72. zebra_day/etc/tmp_printers838.json +5 -0
  73. zebra_day/etc/tmp_printers839.json +5 -0
  74. zebra_day/etc/tmp_printers933.json +5 -0
  75. zebra_day/etc/tmp_printers957.json +5 -0
  76. zebra_day/exceptions.py +88 -0
  77. zebra_day/files/hold +0 -0
  78. zebra_day/files/test_png_17696.png +0 -0
  79. zebra_day/files/test_png_23477.png +0 -0
  80. zebra_day/files/test_png_28157.png +0 -0
  81. zebra_day/files/test_png_35832.png +0 -0
  82. zebra_day/files/test_png_36400.png +0 -0
  83. zebra_day/files/test_png_40816.png +0 -0
  84. zebra_day/files/test_png_49564.png +0 -0
  85. zebra_day/files/test_png_53848.png +0 -0
  86. zebra_day/files/test_png_62542.png +0 -0
  87. zebra_day/files/test_png_91597.png +0 -0
  88. zebra_day/files/test_png_93633.png +0 -0
  89. zebra_day/files/tmpbjo3k7q1.png +0 -0
  90. zebra_day/files/tmpigtr4pwy.png +0 -0
  91. zebra_day/files/zpl_label_tube_2inX1in_2026-02-01_01:51:24.370964.png +0 -0
  92. zebra_day/logging_config.py +74 -0
  93. zebra_day/logs/.hold +0 -0
  94. zebra_day/logs/print_requests.log +2 -0
  95. zebra_day/paths.py +143 -0
  96. zebra_day/print_mgr.py +489 -103
  97. zebra_day/static/datschund.css +63 -43
  98. zebra_day/static/datschund.png +0 -0
  99. zebra_day/static/daylily.png +0 -0
  100. zebra_day/static/favicon.svg +20 -0
  101. zebra_day/static/general.css +99 -0
  102. zebra_day/static/js/zebra_modern.js +172 -0
  103. zebra_day/static/lsmc.css +354 -0
  104. zebra_day/static/moon.jpeg +0 -0
  105. zebra_day/static/oakland.css +0 -32
  106. zebra_day/static/popday_daylily.css +1 -1
  107. zebra_day/static/style.css +39 -0
  108. zebra_day/static/zebra_modern.css +771 -0
  109. zebra_day/templates/base.html +36 -0
  110. zebra_day/templates/bpr.html +72 -0
  111. zebra_day/templates/build_new_config.html +36 -0
  112. zebra_day/templates/build_print_request.html +32 -0
  113. zebra_day/templates/chg_ui_style.html +19 -0
  114. zebra_day/templates/edit_template.html +128 -0
  115. zebra_day/templates/edit_zpl.html +37 -0
  116. zebra_day/templates/index.html +82 -0
  117. zebra_day/templates/legacy/base.html +37 -0
  118. zebra_day/templates/legacy/bpr.html +72 -0
  119. zebra_day/templates/legacy/build_new_config.html +36 -0
  120. zebra_day/templates/legacy/build_print_request.html +32 -0
  121. zebra_day/templates/legacy/chg_ui_style.html +19 -0
  122. zebra_day/templates/legacy/edit_template.html +128 -0
  123. zebra_day/templates/legacy/edit_zpl.html +37 -0
  124. zebra_day/templates/legacy/index.html +82 -0
  125. zebra_day/templates/legacy/list_prior_configs.html +24 -0
  126. zebra_day/templates/legacy/print_result.html +30 -0
  127. zebra_day/templates/legacy/printer_details.html +25 -0
  128. zebra_day/templates/legacy/printer_status.html +70 -0
  129. zebra_day/templates/legacy/save_result.html +17 -0
  130. zebra_day/templates/legacy/send_print_request.html +34 -0
  131. zebra_day/templates/legacy/simple_print.html +94 -0
  132. zebra_day/templates/legacy/view_pstation_json.html +29 -0
  133. zebra_day/templates/list_prior_configs.html +24 -0
  134. zebra_day/templates/modern/base.html +98 -0
  135. zebra_day/templates/modern/config.html +141 -0
  136. zebra_day/templates/modern/dashboard.html +160 -0
  137. zebra_day/templates/modern/print_request.html +141 -0
  138. zebra_day/templates/modern/print_result.html +88 -0
  139. zebra_day/templates/modern/printer_detail.html +117 -0
  140. zebra_day/templates/modern/printers.html +133 -0
  141. zebra_day/templates/modern/save_result.html +46 -0
  142. zebra_day/templates/modern/template_editor.html +172 -0
  143. zebra_day/templates/modern/templates.html +122 -0
  144. zebra_day/templates/print_result.html +30 -0
  145. zebra_day/templates/printer_details.html +25 -0
  146. zebra_day/templates/printer_status.html +70 -0
  147. zebra_day/templates/save_result.html +17 -0
  148. zebra_day/templates/send_print_request.html +34 -0
  149. zebra_day/templates/simple_print.html +94 -0
  150. zebra_day/templates/view_pstation_json.html +29 -0
  151. zebra_day/web/__init__.py +9 -0
  152. zebra_day/web/app.py +171 -0
  153. zebra_day/web/auth.py +172 -0
  154. zebra_day/web/middleware.py +159 -0
  155. zebra_day/web/routers/__init__.py +2 -0
  156. zebra_day/web/routers/api.py +163 -0
  157. zebra_day/web/routers/ui.py +1051 -0
  158. zebra_day/zpl_renderer.py +273 -0
  159. zebra_day-1.0.2.dist-info/METADATA +786 -0
  160. zebra_day-1.0.2.dist-info/RECORD +179 -0
  161. {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info}/WHEEL +1 -1
  162. zebra_day-1.0.2.dist-info/entry_points.txt +4 -0
  163. zebra_day/etc/.blind +0 -1
  164. zebra_day/etc/current_style.txt +0 -1
  165. zebra_day/etc/label_styles/test_2inX1in.zpl +0 -22
  166. zebra_day/etc/label_styles/tmps/labware_2inX1in.na.2023-10-24_12:49:21.045127.zpl +0 -21
  167. zebra_day/etc/label_styles/tmps/labware_2inX1in.naggg.2023-10-24_16:02:04.704814.8888.2023-10-24_16:02:16.443911.zpl +0 -21
  168. zebra_day/etc/label_styles/tmps/labware_2inX1in.naggg.2023-10-24_16:02:04.704814.zpl +0 -21
  169. zebra_day/etc/label_styles/tmps/test_2inX1in.na.2023-10-24_12:45:37.002774.zpl +0 -22
  170. zebra_day/etc/old_printer_config/2023-10-24_16:06:06.931764_printer_config.json +0 -67
  171. zebra_day/etc/printer_config.json~ +0 -67
  172. zebra_day/files/tmp_2olihg4.png +0 -0
  173. zebra_day/files/tmpveojoyvn.png +0 -0
  174. zebra_day/files/zpl_label_labware_2inX1in_2023-10-25_02:30:08.093631.png +0 -0
  175. zebra_day/files/zpl_label_test_2inX1in_2023-10-24_15:54:29.343124.png +0 -0
  176. zebra_day/files/zpl_label_test_2inX1in_2023-10-24_16:01:45.670132.png +0 -0
  177. zebra_day/static/beyonce.css +0 -227
  178. zebra_day/static/datschund_on_moon.css +0 -164
  179. zebra_day/static/medicalsci.css +0 -144
  180. zebra_day/static/moar_zebra.css +0 -133
  181. zebra_day/static/popday.css +0 -140
  182. zebra_day/static/popday_dark.css +0 -140
  183. zebra_day/static/popday_dog.css +0 -140
  184. zebra_day-0.0.32.dist-info/METADATA +0 -14
  185. zebra_day-0.0.32.dist-info/RECORD +0 -53
  186. zebra_day-0.0.32.dist-info/entry_points.txt +0 -2
  187. /zebra_day/{etc/label_styles/blank_0inX0in.zpl → bin/__init__.py} +0 -0
  188. /zebra_day/etc/label_styles/{labware_2inX1in.zpl → generic_2inX1in.zpl} +0 -0
  189. {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info/licenses}/LICENSE +0 -0
  190. {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,15 @@
1
+ ^XA
2
+ ^FO235,10
3
+ ^BY2
4
+ ^B3N,N,28,N,N
5
+ ^FD{uid_barcode}^FS
6
+ ^FO235,42
7
+ ^ADN,30,20
8
+ ^FD{uid_barcode}^FS
9
+ ^FO235,75
10
+ ^ADN,24,14
11
+ ^FD{alt_a}^FS
12
+ ^FO455,76
13
+ ^ADN,24,14
14
+ ^FD{alt_b}^FS
15
+ ^XZ
@@ -0,0 +1,15 @@
1
+ ^XA
2
+ ^FO305,25
3
+ ^BY2
4
+ ^B3N,N,45,N,N
5
+ ^FD{uid_barcode}^FS
6
+ ^FO300,80
7
+ ^ADN,30,20
8
+ ^FD{uid_barcode}^FS
9
+ ^FO300,130
10
+ ^ADN,24,14
11
+ ^FD{alt_a}^FS
12
+ ^FO515,123
13
+ ^ADN,30,20
14
+ ^FD{alt_b}^FS
15
+ ^XZ
@@ -0,0 +1,22 @@
1
+ ^XA
2
+ ^FO235,20
3
+ ^BY2
4
+ ^B3N,N,60,N,N
5
+ ^FD{uid_barcode}^FS
6
+ ^FO235,100
7
+ ^ADN,50,30
8
+ ^FD{uid_barcode}^FS
9
+ ^FO235,170
10
+ ^ADN,30,20
11
+ ^FD{alt_a}^FS
12
+ ^FO470,170
13
+ ^ADN,30,20
14
+ ^FD{alt_b}^FS
15
+ ^FO70,210
16
+ ^FO235,220
17
+ ^ADN,50,30
18
+ ^FD{alt_c}^FS
19
+ ^FO550,235
20
+ ^ADN,30,20
21
+ ^FD{alt_d}^FS
22
+ ^XZ
@@ -0,0 +1,21 @@
1
+ ^XA
2
+ ^FO235,20
3
+ ^BY2
4
+ ^B3N,N,60,N,N
5
+ ^FD{uid_barcode}^FS
6
+ ^FO235,100
7
+ ^ADN,50,30
8
+ ^FD{uid_barcode}^FS
9
+ ^FO235,160
10
+ ^ADN,30,20
11
+ ^FD{alt_a}^FS
12
+ ^FO235,200
13
+ ^ADN,30,20
14
+ ^FD{alt_b}^FS
15
+ ^FO235,240
16
+ ^ADN,50,30
17
+ ^FD{alt_c}^FS
18
+ ^FO550,240
19
+ ^ADN,30,20
20
+ ^FD{alt_d}^FS
21
+ ^XZ
@@ -4,12 +4,13 @@
4
4
  "Download-Label-png": {
5
5
  "ip_address": "dl_png",
6
6
  "label_zpl_styles": [
7
- "test_2inX1in"
7
+ "tube_2inX1in"
8
8
  ],
9
9
  "print_method": "generate png",
10
10
  "model": "na",
11
- "serial": "na"
11
+ "serial": "na",
12
+ "arp_data": "na"
12
13
  }
13
14
  }
14
15
  }
15
- }
16
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -4,63 +4,12 @@
4
4
  "Download-Label-png": {
5
5
  "ip_address": "dl_png",
6
6
  "label_zpl_styles": [
7
- "test_2inX1in"
7
+ "tube_2inX1in"
8
8
  ],
9
9
  "print_method": "generate png",
10
10
  "model": "na",
11
- "serial": "na"
12
- },
13
- "192.168.1.7": {
14
- "ip_address": "192.168.1.7",
15
- "label_zpl_styles": [
16
- "blank_0inX0in",
17
- "test_2inX1in",
18
- "tube_2inX1in",
19
- "plate_1inX0.25in",
20
- "tube_2inX0.3in"
21
- ],
22
- "print_method": "unk",
23
- "model": "ZTC GX420d",
24
- "serial": "ZBR7563510 "
25
- },
26
- "192.168.1.16": {
27
- "ip_address": "192.168.1.16",
28
- "label_zpl_styles": [
29
- "blank_0inX0in",
30
- "test_2inX1in",
31
- "tube_2inX1in",
32
- "plate_1inX0.25in",
33
- "tube_2inX0.3in"
34
- ],
35
- "print_method": "unk",
36
- "model": "ZTC ZD620-203dpi ZPL",
37
- "serial": "D3N203700385 "
38
- },
39
- "192.168.1.17": {
40
- "ip_address": "192.168.1.17",
41
- "label_zpl_styles": [
42
- "blank_0inX0in",
43
- "test_2inX1in",
44
- "tube_2inX1in",
45
- "plate_1inX0.25in",
46
- "tube_2inX0.3in"
47
- ],
48
- "print_method": "unk",
49
- "model": "ZTC ZD620-203dpi ZPL",
50
- "serial": "D3J194806028 "
51
- },
52
- "192.168.1.18": {
53
- "ip_address": "192.168.1.18",
54
- "label_zpl_styles": [
55
- "blank_0inX0in",
56
- "test_2inX1in",
57
- "tube_2inX1in",
58
- "plate_1inX0.25in",
59
- "tube_2inX0.3in"
60
- ],
61
- "print_method": "unk",
62
- "model": "ZTC GX420d",
63
- "serial": "ZBR3715954 "
11
+ "serial": "na",
12
+ "arp_data": "na"
64
13
  }
65
14
  }
66
15
  }
@@ -4,11 +4,12 @@
4
4
  "Download-Label-png": {
5
5
  "ip_address": "dl_png",
6
6
  "label_zpl_styles": [
7
- "test_2inX1in"
7
+ "tube_2inX1in"
8
8
  ],
9
9
  "print_method": "generate png",
10
10
  "model": "na",
11
- "serial": "na"
11
+ "serial": "na",
12
+ "arp_data": "na"
12
13
  }
13
14
  }
14
15
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "labs": {
3
+ "test": {}
4
+ }
5
+ }
@@ -0,0 +1,88 @@
1
+ """
2
+ Custom exceptions for zebra_day.
3
+
4
+ Provides specific exception types for different error conditions.
5
+ """
6
+ from __future__ import annotations
7
+
8
+
9
+ class ZebraDayError(Exception):
10
+ """Base exception for all zebra_day errors."""
11
+
12
+ pass
13
+
14
+
15
+ class PrinterConnectionError(ZebraDayError):
16
+ """Raised when unable to connect to a printer."""
17
+
18
+ def __init__(self, printer_ip: str, message: str = ""):
19
+ self.printer_ip = printer_ip
20
+ super().__init__(f"Failed to connect to printer at {printer_ip}: {message}")
21
+
22
+
23
+ class PrinterNotFoundError(ZebraDayError):
24
+ """Raised when a printer is not found in the configuration."""
25
+
26
+ def __init__(self, printer_name: str, lab: str = ""):
27
+ self.printer_name = printer_name
28
+ self.lab = lab
29
+ msg = f"Printer '{printer_name}' not found"
30
+ if lab:
31
+ msg += f" in lab '{lab}'"
32
+ super().__init__(msg)
33
+
34
+
35
+ class ConfigError(ZebraDayError):
36
+ """Raised when there's an issue with configuration."""
37
+
38
+ def __init__(self, message: str, config_path: str = ""):
39
+ self.config_path = config_path
40
+ super().__init__(message)
41
+
42
+
43
+ class ConfigFileNotFoundError(ConfigError):
44
+ """Raised when a configuration file is not found."""
45
+
46
+ def __init__(self, path: str):
47
+ super().__init__(f"Configuration file not found: {path}", config_path=path)
48
+
49
+
50
+ class ConfigParseError(ConfigError):
51
+ """Raised when a configuration file cannot be parsed."""
52
+
53
+ def __init__(self, path: str, details: str = ""):
54
+ msg = f"Failed to parse configuration file: {path}"
55
+ if details:
56
+ msg += f" ({details})"
57
+ super().__init__(msg, config_path=path)
58
+
59
+
60
+ class LabelTemplateError(ZebraDayError):
61
+ """Raised when there's an issue with a label template."""
62
+
63
+ def __init__(self, template_name: str, message: str = ""):
64
+ self.template_name = template_name
65
+ super().__init__(f"Label template error '{template_name}': {message}")
66
+
67
+
68
+ class LabelTemplateNotFoundError(LabelTemplateError):
69
+ """Raised when a label template file is not found."""
70
+
71
+ def __init__(self, template_name: str):
72
+ super().__init__(template_name, "template not found")
73
+
74
+
75
+ class ZPLRenderError(ZebraDayError):
76
+ """Raised when ZPL rendering fails."""
77
+
78
+ def __init__(self, message: str):
79
+ super().__init__(f"ZPL render error: {message}")
80
+
81
+
82
+ class NetworkScanError(ZebraDayError):
83
+ """Raised when network scanning for printers fails."""
84
+
85
+ def __init__(self, ip_stub: str, message: str = ""):
86
+ self.ip_stub = ip_stub
87
+ super().__init__(f"Network scan failed for {ip_stub}.*: {message}")
88
+
zebra_day/files/hold ADDED
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,74 @@
1
+ """
2
+ Logging configuration for zebra_day.
3
+
4
+ Provides structured logging with configurable levels and formats.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import logging
9
+ import sys
10
+ from pathlib import Path
11
+ from typing import Optional
12
+
13
+
14
+ def get_logger(name: str) -> logging.Logger:
15
+ """Get a logger with the zebra_day namespace.
16
+
17
+ Args:
18
+ name: Module name (typically __name__)
19
+
20
+ Returns:
21
+ Configured logger instance
22
+ """
23
+ if name.startswith("zebra_day"):
24
+ return logging.getLogger(name)
25
+ return logging.getLogger(f"zebra_day.{name}")
26
+
27
+
28
+ def configure_logging(
29
+ level: int = logging.INFO,
30
+ log_file: Optional[Path] = None,
31
+ format_string: Optional[str] = None,
32
+ ) -> None:
33
+ """Configure zebra_day logging.
34
+
35
+ Args:
36
+ level: Logging level (default: INFO)
37
+ log_file: Optional path to log file
38
+ format_string: Optional custom format string
39
+ """
40
+ if format_string is None:
41
+ format_string = (
42
+ "\033[1m%(asctime)s\033[0m "
43
+ "[%(levelname)s] "
44
+ "%(name)s: %(message)s"
45
+ )
46
+
47
+ formatter = logging.Formatter(format_string, datefmt="%Y-%m-%d %H:%M:%S")
48
+
49
+ # Root zebra_day logger
50
+ logger = logging.getLogger("zebra_day")
51
+ logger.setLevel(level)
52
+
53
+ # Clear existing handlers to avoid duplicates
54
+ logger.handlers.clear()
55
+
56
+ # Console handler (stderr)
57
+ console_handler = logging.StreamHandler(sys.stderr)
58
+ console_handler.setLevel(level)
59
+ console_handler.setFormatter(formatter)
60
+ logger.addHandler(console_handler)
61
+
62
+ # File handler if specified
63
+ if log_file is not None:
64
+ log_file.parent.mkdir(parents=True, exist_ok=True)
65
+ file_handler = logging.FileHandler(log_file)
66
+ file_handler.setLevel(level)
67
+ file_handler.setFormatter(
68
+ logging.Formatter(
69
+ "%(asctime)s [%(levelname)s] %(name)s: %(message)s",
70
+ datefmt="%Y-%m-%d %H:%M:%S",
71
+ )
72
+ )
73
+ logger.addHandler(file_handler)
74
+
zebra_day/logs/.hold ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ scan-results Download-Label-png TESTBC tube_2inX1in dl_png 1 pkg None
2
+