meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7020__py2.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 (446) hide show
  1. meerk40t/__init__.py +1 -1
  2. meerk40t/balormk/balor_params.py +167 -167
  3. meerk40t/balormk/clone_loader.py +457 -457
  4. meerk40t/balormk/controller.py +1566 -1512
  5. meerk40t/balormk/cylindermod.py +64 -0
  6. meerk40t/balormk/device.py +966 -1959
  7. meerk40t/balormk/driver.py +778 -591
  8. meerk40t/balormk/galvo_commands.py +1194 -0
  9. meerk40t/balormk/gui/balorconfig.py +237 -111
  10. meerk40t/balormk/gui/balorcontroller.py +191 -184
  11. meerk40t/balormk/gui/baloroperationproperties.py +116 -115
  12. meerk40t/balormk/gui/corscene.py +845 -0
  13. meerk40t/balormk/gui/gui.py +179 -147
  14. meerk40t/balormk/livelightjob.py +466 -382
  15. meerk40t/balormk/mock_connection.py +131 -109
  16. meerk40t/balormk/plugin.py +133 -135
  17. meerk40t/balormk/usb_connection.py +306 -301
  18. meerk40t/camera/__init__.py +1 -1
  19. meerk40t/camera/camera.py +514 -397
  20. meerk40t/camera/gui/camerapanel.py +1241 -1095
  21. meerk40t/camera/gui/gui.py +58 -58
  22. meerk40t/camera/plugin.py +441 -399
  23. meerk40t/ch341/__init__.py +27 -27
  24. meerk40t/ch341/ch341device.py +628 -628
  25. meerk40t/ch341/libusb.py +595 -589
  26. meerk40t/ch341/mock.py +171 -171
  27. meerk40t/ch341/windriver.py +157 -157
  28. meerk40t/constants.py +13 -0
  29. meerk40t/core/__init__.py +1 -1
  30. meerk40t/core/bindalias.py +550 -539
  31. meerk40t/core/core.py +47 -47
  32. meerk40t/core/cutcode/cubiccut.py +73 -73
  33. meerk40t/core/cutcode/cutcode.py +315 -312
  34. meerk40t/core/cutcode/cutgroup.py +141 -137
  35. meerk40t/core/cutcode/cutobject.py +192 -185
  36. meerk40t/core/cutcode/dwellcut.py +37 -37
  37. meerk40t/core/cutcode/gotocut.py +29 -29
  38. meerk40t/core/cutcode/homecut.py +29 -29
  39. meerk40t/core/cutcode/inputcut.py +34 -34
  40. meerk40t/core/cutcode/linecut.py +33 -33
  41. meerk40t/core/cutcode/outputcut.py +34 -34
  42. meerk40t/core/cutcode/plotcut.py +335 -335
  43. meerk40t/core/cutcode/quadcut.py +61 -61
  44. meerk40t/core/cutcode/rastercut.py +168 -148
  45. meerk40t/core/cutcode/waitcut.py +34 -34
  46. meerk40t/core/cutplan.py +1843 -1316
  47. meerk40t/core/drivers.py +330 -329
  48. meerk40t/core/elements/align.py +801 -669
  49. meerk40t/core/elements/branches.py +1858 -1507
  50. meerk40t/core/elements/clipboard.py +229 -219
  51. meerk40t/core/elements/element_treeops.py +4595 -2837
  52. meerk40t/core/elements/element_types.py +125 -105
  53. meerk40t/core/elements/elements.py +4315 -3617
  54. meerk40t/core/elements/files.py +117 -64
  55. meerk40t/core/elements/geometry.py +473 -224
  56. meerk40t/core/elements/grid.py +467 -316
  57. meerk40t/core/elements/materials.py +158 -94
  58. meerk40t/core/elements/notes.py +50 -38
  59. meerk40t/core/elements/offset_clpr.py +934 -912
  60. meerk40t/core/elements/offset_mk.py +963 -955
  61. meerk40t/core/elements/penbox.py +339 -267
  62. meerk40t/core/elements/placements.py +300 -83
  63. meerk40t/core/elements/render.py +785 -687
  64. meerk40t/core/elements/shapes.py +2618 -2092
  65. meerk40t/core/elements/testcases.py +105 -0
  66. meerk40t/core/elements/trace.py +651 -563
  67. meerk40t/core/elements/tree_commands.py +415 -409
  68. meerk40t/core/elements/undo_redo.py +116 -58
  69. meerk40t/core/elements/wordlist.py +319 -200
  70. meerk40t/core/exceptions.py +9 -9
  71. meerk40t/core/laserjob.py +220 -220
  72. meerk40t/core/logging.py +63 -63
  73. meerk40t/core/node/blobnode.py +83 -86
  74. meerk40t/core/node/bootstrap.py +105 -103
  75. meerk40t/core/node/branch_elems.py +40 -31
  76. meerk40t/core/node/branch_ops.py +45 -38
  77. meerk40t/core/node/branch_regmark.py +48 -41
  78. meerk40t/core/node/cutnode.py +29 -32
  79. meerk40t/core/node/effect_hatch.py +375 -257
  80. meerk40t/core/node/effect_warp.py +398 -0
  81. meerk40t/core/node/effect_wobble.py +441 -309
  82. meerk40t/core/node/elem_ellipse.py +404 -309
  83. meerk40t/core/node/elem_image.py +1082 -801
  84. meerk40t/core/node/elem_line.py +358 -292
  85. meerk40t/core/node/elem_path.py +259 -201
  86. meerk40t/core/node/elem_point.py +129 -102
  87. meerk40t/core/node/elem_polyline.py +310 -246
  88. meerk40t/core/node/elem_rect.py +376 -286
  89. meerk40t/core/node/elem_text.py +445 -418
  90. meerk40t/core/node/filenode.py +59 -40
  91. meerk40t/core/node/groupnode.py +138 -74
  92. meerk40t/core/node/image_processed.py +777 -766
  93. meerk40t/core/node/image_raster.py +156 -113
  94. meerk40t/core/node/layernode.py +31 -31
  95. meerk40t/core/node/mixins.py +135 -107
  96. meerk40t/core/node/node.py +1427 -1304
  97. meerk40t/core/node/nutils.py +117 -114
  98. meerk40t/core/node/op_cut.py +463 -335
  99. meerk40t/core/node/op_dots.py +296 -251
  100. meerk40t/core/node/op_engrave.py +414 -311
  101. meerk40t/core/node/op_image.py +755 -369
  102. meerk40t/core/node/op_raster.py +787 -522
  103. meerk40t/core/node/place_current.py +37 -40
  104. meerk40t/core/node/place_point.py +329 -126
  105. meerk40t/core/node/refnode.py +58 -47
  106. meerk40t/core/node/rootnode.py +225 -219
  107. meerk40t/core/node/util_console.py +48 -48
  108. meerk40t/core/node/util_goto.py +84 -65
  109. meerk40t/core/node/util_home.py +61 -61
  110. meerk40t/core/node/util_input.py +102 -102
  111. meerk40t/core/node/util_output.py +102 -102
  112. meerk40t/core/node/util_wait.py +65 -65
  113. meerk40t/core/parameters.py +709 -707
  114. meerk40t/core/planner.py +875 -785
  115. meerk40t/core/plotplanner.py +656 -652
  116. meerk40t/core/space.py +120 -113
  117. meerk40t/core/spoolers.py +706 -705
  118. meerk40t/core/svg_io.py +1836 -1549
  119. meerk40t/core/treeop.py +534 -445
  120. meerk40t/core/undos.py +278 -124
  121. meerk40t/core/units.py +784 -680
  122. meerk40t/core/view.py +393 -322
  123. meerk40t/core/webhelp.py +62 -62
  124. meerk40t/core/wordlist.py +513 -504
  125. meerk40t/cylinder/cylinder.py +247 -0
  126. meerk40t/cylinder/gui/cylindersettings.py +41 -0
  127. meerk40t/cylinder/gui/gui.py +24 -0
  128. meerk40t/device/__init__.py +1 -1
  129. meerk40t/device/basedevice.py +322 -123
  130. meerk40t/device/devicechoices.py +50 -0
  131. meerk40t/device/dummydevice.py +163 -128
  132. meerk40t/device/gui/defaultactions.py +618 -602
  133. meerk40t/device/gui/effectspanel.py +114 -0
  134. meerk40t/device/gui/formatterpanel.py +253 -290
  135. meerk40t/device/gui/warningpanel.py +337 -260
  136. meerk40t/device/mixins.py +13 -13
  137. meerk40t/dxf/__init__.py +1 -1
  138. meerk40t/dxf/dxf_io.py +766 -554
  139. meerk40t/dxf/plugin.py +47 -35
  140. meerk40t/external_plugins.py +79 -79
  141. meerk40t/external_plugins_build.py +28 -28
  142. meerk40t/extra/cag.py +112 -116
  143. meerk40t/extra/coolant.py +403 -0
  144. meerk40t/extra/encode_detect.py +204 -0
  145. meerk40t/extra/ezd.py +1165 -1165
  146. meerk40t/extra/hershey.py +834 -340
  147. meerk40t/extra/imageactions.py +322 -316
  148. meerk40t/extra/inkscape.py +628 -622
  149. meerk40t/extra/lbrn.py +424 -424
  150. meerk40t/extra/outerworld.py +283 -0
  151. meerk40t/extra/param_functions.py +1542 -1556
  152. meerk40t/extra/potrace.py +257 -253
  153. meerk40t/extra/serial_exchange.py +118 -0
  154. meerk40t/extra/updater.py +602 -453
  155. meerk40t/extra/vectrace.py +147 -146
  156. meerk40t/extra/winsleep.py +83 -83
  157. meerk40t/extra/xcs_reader.py +597 -0
  158. meerk40t/fill/fills.py +781 -335
  159. meerk40t/fill/patternfill.py +1061 -1061
  160. meerk40t/fill/patterns.py +614 -567
  161. meerk40t/grbl/control.py +87 -87
  162. meerk40t/grbl/controller.py +990 -903
  163. meerk40t/grbl/device.py +1084 -768
  164. meerk40t/grbl/driver.py +989 -771
  165. meerk40t/grbl/emulator.py +532 -497
  166. meerk40t/grbl/gcodejob.py +783 -767
  167. meerk40t/grbl/gui/grblconfiguration.py +373 -298
  168. meerk40t/grbl/gui/grblcontroller.py +485 -271
  169. meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
  170. meerk40t/grbl/gui/grbloperationconfig.py +105 -0
  171. meerk40t/grbl/gui/gui.py +147 -116
  172. meerk40t/grbl/interpreter.py +44 -44
  173. meerk40t/grbl/loader.py +22 -22
  174. meerk40t/grbl/mock_connection.py +56 -56
  175. meerk40t/grbl/plugin.py +294 -264
  176. meerk40t/grbl/serial_connection.py +93 -88
  177. meerk40t/grbl/tcp_connection.py +81 -79
  178. meerk40t/grbl/ws_connection.py +112 -0
  179. meerk40t/gui/__init__.py +1 -1
  180. meerk40t/gui/about.py +2042 -296
  181. meerk40t/gui/alignment.py +1644 -1608
  182. meerk40t/gui/autoexec.py +199 -0
  183. meerk40t/gui/basicops.py +791 -670
  184. meerk40t/gui/bufferview.py +77 -71
  185. meerk40t/gui/busy.py +232 -133
  186. meerk40t/gui/choicepropertypanel.py +1662 -1469
  187. meerk40t/gui/consolepanel.py +706 -542
  188. meerk40t/gui/devicepanel.py +687 -581
  189. meerk40t/gui/dialogoptions.py +110 -107
  190. meerk40t/gui/executejob.py +316 -306
  191. meerk40t/gui/fonts.py +90 -90
  192. meerk40t/gui/functionwrapper.py +252 -0
  193. meerk40t/gui/gui_mixins.py +729 -0
  194. meerk40t/gui/guicolors.py +205 -182
  195. meerk40t/gui/help_assets/help_assets.py +218 -201
  196. meerk40t/gui/helper.py +154 -0
  197. meerk40t/gui/hersheymanager.py +1440 -846
  198. meerk40t/gui/icons.py +3422 -2747
  199. meerk40t/gui/imagesplitter.py +555 -508
  200. meerk40t/gui/keymap.py +354 -344
  201. meerk40t/gui/laserpanel.py +897 -806
  202. meerk40t/gui/laserrender.py +1470 -1232
  203. meerk40t/gui/lasertoolpanel.py +805 -793
  204. meerk40t/gui/magnetoptions.py +436 -0
  205. meerk40t/gui/materialmanager.py +2944 -0
  206. meerk40t/gui/materialtest.py +1722 -1694
  207. meerk40t/gui/mkdebug.py +646 -359
  208. meerk40t/gui/mwindow.py +163 -140
  209. meerk40t/gui/navigationpanels.py +2605 -2467
  210. meerk40t/gui/notes.py +143 -142
  211. meerk40t/gui/opassignment.py +414 -410
  212. meerk40t/gui/operation_info.py +310 -299
  213. meerk40t/gui/plugin.py +500 -328
  214. meerk40t/gui/position.py +714 -669
  215. meerk40t/gui/preferences.py +901 -650
  216. meerk40t/gui/propertypanels/attributes.py +1461 -1131
  217. meerk40t/gui/propertypanels/blobproperty.py +117 -114
  218. meerk40t/gui/propertypanels/consoleproperty.py +83 -80
  219. meerk40t/gui/propertypanels/gotoproperty.py +77 -0
  220. meerk40t/gui/propertypanels/groupproperties.py +223 -217
  221. meerk40t/gui/propertypanels/hatchproperty.py +489 -469
  222. meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
  223. meerk40t/gui/propertypanels/inputproperty.py +59 -58
  224. meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
  225. meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
  226. meerk40t/gui/propertypanels/outputproperty.py +59 -58
  227. meerk40t/gui/propertypanels/pathproperty.py +389 -380
  228. meerk40t/gui/propertypanels/placementproperty.py +1214 -383
  229. meerk40t/gui/propertypanels/pointproperty.py +140 -136
  230. meerk40t/gui/propertypanels/propertywindow.py +313 -181
  231. meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
  232. meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
  233. meerk40t/gui/propertypanels/textproperty.py +770 -755
  234. meerk40t/gui/propertypanels/waitproperty.py +56 -55
  235. meerk40t/gui/propertypanels/warpproperty.py +121 -0
  236. meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
  237. meerk40t/gui/ribbon.py +2471 -2210
  238. meerk40t/gui/scene/scene.py +1100 -1051
  239. meerk40t/gui/scene/sceneconst.py +22 -22
  240. meerk40t/gui/scene/scenepanel.py +439 -349
  241. meerk40t/gui/scene/scenespacewidget.py +365 -365
  242. meerk40t/gui/scene/widget.py +518 -505
  243. meerk40t/gui/scenewidgets/affinemover.py +215 -215
  244. meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
  245. meerk40t/gui/scenewidgets/bedwidget.py +120 -97
  246. meerk40t/gui/scenewidgets/elementswidget.py +137 -107
  247. meerk40t/gui/scenewidgets/gridwidget.py +785 -745
  248. meerk40t/gui/scenewidgets/guidewidget.py +765 -765
  249. meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
  250. meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
  251. meerk40t/gui/scenewidgets/nodeselector.py +28 -28
  252. meerk40t/gui/scenewidgets/rectselectwidget.py +592 -346
  253. meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
  254. meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
  255. meerk40t/gui/scenewidgets/selectionwidget.py +2958 -2756
  256. meerk40t/gui/simpleui.py +362 -333
  257. meerk40t/gui/simulation.py +2451 -2094
  258. meerk40t/gui/snapoptions.py +208 -203
  259. meerk40t/gui/spoolerpanel.py +1227 -1180
  260. meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
  261. meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
  262. meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
  263. meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
  264. meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
  265. meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
  266. meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
  267. meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
  268. meerk40t/gui/themes.py +200 -78
  269. meerk40t/gui/tips.py +590 -0
  270. meerk40t/gui/toolwidgets/circlebrush.py +35 -35
  271. meerk40t/gui/toolwidgets/toolcircle.py +248 -242
  272. meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
  273. meerk40t/gui/toolwidgets/tooldraw.py +97 -90
  274. meerk40t/gui/toolwidgets/toolellipse.py +219 -212
  275. meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
  276. meerk40t/gui/toolwidgets/toolline.py +39 -144
  277. meerk40t/gui/toolwidgets/toollinetext.py +79 -236
  278. meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
  279. meerk40t/gui/toolwidgets/toolmeasure.py +163 -216
  280. meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
  281. meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
  282. meerk40t/gui/toolwidgets/toolparameter.py +754 -668
  283. meerk40t/gui/toolwidgets/toolplacement.py +108 -108
  284. meerk40t/gui/toolwidgets/toolpoint.py +68 -59
  285. meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
  286. meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
  287. meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
  288. meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
  289. meerk40t/gui/toolwidgets/toolrect.py +211 -207
  290. meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
  291. meerk40t/gui/toolwidgets/toolribbon.py +598 -113
  292. meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
  293. meerk40t/gui/toolwidgets/tooltext.py +98 -89
  294. meerk40t/gui/toolwidgets/toolvector.py +213 -204
  295. meerk40t/gui/toolwidgets/toolwidget.py +39 -39
  296. meerk40t/gui/usbconnect.py +98 -91
  297. meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
  298. meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
  299. meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
  300. meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
  301. meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
  302. meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
  303. meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
  304. meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
  305. meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
  306. meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
  307. meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
  308. meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
  309. meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
  310. meerk40t/gui/wordlisteditor.py +985 -931
  311. meerk40t/gui/wxmeerk40t.py +1447 -1169
  312. meerk40t/gui/wxmmain.py +5644 -4112
  313. meerk40t/gui/wxmribbon.py +1591 -1076
  314. meerk40t/gui/wxmscene.py +1631 -1453
  315. meerk40t/gui/wxmtree.py +2416 -2089
  316. meerk40t/gui/wxutils.py +1769 -1099
  317. meerk40t/gui/zmatrix.py +102 -102
  318. meerk40t/image/__init__.py +1 -1
  319. meerk40t/image/dither.py +429 -0
  320. meerk40t/image/imagetools.py +2793 -2269
  321. meerk40t/internal_plugins.py +150 -130
  322. meerk40t/kernel/__init__.py +63 -12
  323. meerk40t/kernel/channel.py +259 -212
  324. meerk40t/kernel/context.py +538 -538
  325. meerk40t/kernel/exceptions.py +41 -41
  326. meerk40t/kernel/functions.py +463 -414
  327. meerk40t/kernel/jobs.py +100 -100
  328. meerk40t/kernel/kernel.py +3828 -3571
  329. meerk40t/kernel/lifecycles.py +71 -71
  330. meerk40t/kernel/module.py +49 -49
  331. meerk40t/kernel/service.py +147 -147
  332. meerk40t/kernel/settings.py +383 -343
  333. meerk40t/lihuiyu/controller.py +883 -876
  334. meerk40t/lihuiyu/device.py +1181 -1069
  335. meerk40t/lihuiyu/driver.py +1466 -1372
  336. meerk40t/lihuiyu/gui/gui.py +127 -106
  337. meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
  338. meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
  339. meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
  340. meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
  341. meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
  342. meerk40t/lihuiyu/interpreter.py +53 -53
  343. meerk40t/lihuiyu/laserspeed.py +450 -450
  344. meerk40t/lihuiyu/loader.py +90 -90
  345. meerk40t/lihuiyu/parser.py +404 -404
  346. meerk40t/lihuiyu/plugin.py +101 -102
  347. meerk40t/lihuiyu/tcp_connection.py +111 -109
  348. meerk40t/main.py +231 -165
  349. meerk40t/moshi/builder.py +788 -781
  350. meerk40t/moshi/controller.py +505 -499
  351. meerk40t/moshi/device.py +495 -442
  352. meerk40t/moshi/driver.py +862 -696
  353. meerk40t/moshi/gui/gui.py +78 -76
  354. meerk40t/moshi/gui/moshicontrollergui.py +538 -522
  355. meerk40t/moshi/gui/moshidrivergui.py +87 -75
  356. meerk40t/moshi/plugin.py +43 -43
  357. meerk40t/network/console_server.py +140 -57
  358. meerk40t/network/kernelserver.py +10 -9
  359. meerk40t/network/tcp_server.py +142 -140
  360. meerk40t/network/udp_server.py +103 -77
  361. meerk40t/network/web_server.py +404 -0
  362. meerk40t/newly/controller.py +1158 -1144
  363. meerk40t/newly/device.py +874 -732
  364. meerk40t/newly/driver.py +540 -412
  365. meerk40t/newly/gui/gui.py +219 -188
  366. meerk40t/newly/gui/newlyconfig.py +116 -101
  367. meerk40t/newly/gui/newlycontroller.py +193 -186
  368. meerk40t/newly/gui/operationproperties.py +51 -51
  369. meerk40t/newly/mock_connection.py +82 -82
  370. meerk40t/newly/newly_params.py +56 -56
  371. meerk40t/newly/plugin.py +1214 -1246
  372. meerk40t/newly/usb_connection.py +322 -322
  373. meerk40t/rotary/gui/gui.py +52 -46
  374. meerk40t/rotary/gui/rotarysettings.py +240 -232
  375. meerk40t/rotary/rotary.py +202 -98
  376. meerk40t/ruida/control.py +291 -91
  377. meerk40t/ruida/controller.py +138 -1088
  378. meerk40t/ruida/device.py +676 -231
  379. meerk40t/ruida/driver.py +534 -472
  380. meerk40t/ruida/emulator.py +1494 -1491
  381. meerk40t/ruida/exceptions.py +4 -4
  382. meerk40t/ruida/gui/gui.py +71 -76
  383. meerk40t/ruida/gui/ruidaconfig.py +239 -72
  384. meerk40t/ruida/gui/ruidacontroller.py +187 -184
  385. meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
  386. meerk40t/ruida/loader.py +54 -52
  387. meerk40t/ruida/mock_connection.py +57 -109
  388. meerk40t/ruida/plugin.py +124 -87
  389. meerk40t/ruida/rdjob.py +2084 -945
  390. meerk40t/ruida/serial_connection.py +116 -0
  391. meerk40t/ruida/tcp_connection.py +146 -0
  392. meerk40t/ruida/udp_connection.py +73 -0
  393. meerk40t/svgelements.py +9671 -9669
  394. meerk40t/tools/driver_to_path.py +584 -579
  395. meerk40t/tools/geomstr.py +5583 -4680
  396. meerk40t/tools/jhfparser.py +357 -292
  397. meerk40t/tools/kerftest.py +904 -890
  398. meerk40t/tools/livinghinges.py +1168 -1033
  399. meerk40t/tools/pathtools.py +987 -949
  400. meerk40t/tools/pmatrix.py +234 -0
  401. meerk40t/tools/pointfinder.py +942 -942
  402. meerk40t/tools/polybool.py +941 -940
  403. meerk40t/tools/rasterplotter.py +1660 -547
  404. meerk40t/tools/shxparser.py +1047 -901
  405. meerk40t/tools/ttfparser.py +726 -446
  406. meerk40t/tools/zinglplotter.py +595 -593
  407. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/LICENSE +21 -21
  408. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/METADATA +150 -139
  409. meerk40t-0.9.7020.dist-info/RECORD +446 -0
  410. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/WHEEL +1 -1
  411. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/top_level.txt +0 -1
  412. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/zip-safe +1 -1
  413. meerk40t/balormk/elementlightjob.py +0 -159
  414. meerk40t-0.9.3001.dist-info/RECORD +0 -437
  415. test/bootstrap.py +0 -63
  416. test/test_cli.py +0 -12
  417. test/test_core_cutcode.py +0 -418
  418. test/test_core_elements.py +0 -144
  419. test/test_core_plotplanner.py +0 -397
  420. test/test_core_viewports.py +0 -312
  421. test/test_drivers_grbl.py +0 -108
  422. test/test_drivers_lihuiyu.py +0 -443
  423. test/test_drivers_newly.py +0 -113
  424. test/test_element_degenerate_points.py +0 -43
  425. test/test_elements_classify.py +0 -97
  426. test/test_elements_penbox.py +0 -22
  427. test/test_file_svg.py +0 -176
  428. test/test_fill.py +0 -155
  429. test/test_geomstr.py +0 -1523
  430. test/test_geomstr_nodes.py +0 -18
  431. test/test_imagetools_actualize.py +0 -306
  432. test/test_imagetools_wizard.py +0 -258
  433. test/test_kernel.py +0 -200
  434. test/test_laser_speeds.py +0 -3303
  435. test/test_length.py +0 -57
  436. test/test_lifecycle.py +0 -66
  437. test/test_operations.py +0 -251
  438. test/test_operations_hatch.py +0 -57
  439. test/test_ruida.py +0 -19
  440. test/test_spooler.py +0 -22
  441. test/test_tools_rasterplotter.py +0 -29
  442. test/test_wobble.py +0 -133
  443. test/test_zingl.py +0 -124
  444. {test → meerk40t/cylinder}/__init__.py +0 -0
  445. /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
  446. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/entry_points.txt +0 -0
meerk40t/newly/device.py CHANGED
@@ -1,732 +1,874 @@
1
- """
2
- Newly Device
3
- """
4
- from meerk40t.core.laserjob import LaserJob
5
- from meerk40t.core.spoolers import Spooler
6
- from meerk40t.core.view import View
7
- from meerk40t.device.mixins import Status
8
- from meerk40t.kernel import CommandSyntaxError, Service, signal_listener
9
- from meerk40t.newly.driver import NewlyDriver
10
-
11
-
12
- class NewlyDevice(Service, Status):
13
- """
14
- Newly Device
15
- """
16
-
17
- def __init__(self, kernel, path, *args, choices=None, **kwargs):
18
- Service.__init__(self, kernel, path)
19
- Status.__init__(self)
20
- self.name = "newly"
21
- self.extension = "hpgl"
22
- self.job = None
23
- if choices is not None:
24
- for c in choices:
25
- attr = c.get("attr")
26
- default = c.get("default")
27
- if attr is not None and default is not None:
28
- setattr(self, attr, default)
29
-
30
- _ = kernel.translation
31
- choices = [
32
- {
33
- "attr": "speedchart",
34
- "object": self,
35
- "default": [
36
- {
37
- "speed": 100,
38
- "acceleration_length": 8,
39
- "backlash": 0,
40
- "corner_speed": 20,
41
- },
42
- {
43
- "speed": 200,
44
- "acceleration_length": 10,
45
- "backlash": 0,
46
- "corner_speed": 20,
47
- },
48
- {
49
- "speed": 300,
50
- "acceleration_length": 14,
51
- "backlash": 0,
52
- "corner_speed": 20,
53
- },
54
- {
55
- "speed": 400,
56
- "acceleration_length": 16,
57
- "backlash": 0,
58
- "corner_speed": 20,
59
- },
60
- {
61
- "speed": 500,
62
- "acceleration_length": 18,
63
- "backlash": 0,
64
- "corner_speed": 20,
65
- },
66
- ],
67
- "type": list,
68
- "columns": [
69
- {
70
- "attr": "speed",
71
- "type": int,
72
- "label": _("Speed <="),
73
- "width": 133,
74
- "editable": True,
75
- },
76
- {
77
- "attr": "acceleration_length",
78
- "type": int,
79
- "label": _("Acceleration Length"),
80
- "width": 144,
81
- "editable": True,
82
- },
83
- {
84
- "attr": "backlash",
85
- "type": int,
86
- "label": _("Backlash"),
87
- "width": 142,
88
- "editable": True,
89
- },
90
- {
91
- "attr": "corner_speed",
92
- "type": int,
93
- "label": _("Corner Speed"),
94
- "width": 133,
95
- "editable": True,
96
- },
97
- ],
98
- "style": "chart",
99
- "primary": "speed",
100
- "allow_deletion": True,
101
- "allow_duplication": True,
102
- "label": _("Speed Chart"),
103
- "tip": _("Raster speed to chart."),
104
- },
105
- ]
106
- self.register_choices("newly-speedchart", choices)
107
-
108
- choices = [
109
- {
110
- "attr": "label",
111
- "object": self,
112
- "default": "newly-device",
113
- "type": str,
114
- "label": _("Label"),
115
- "tip": _("What is this device called."),
116
- "section": "_00_General",
117
- "priority": "10",
118
- },
119
- {
120
- "attr": "bedwidth",
121
- "object": self,
122
- "default": "310mm",
123
- "type": str,
124
- "label": _("Width"),
125
- "tip": _("Width of the laser bed."),
126
- "section": "_00_General",
127
- "priority": "20",
128
- "nonzero": True,
129
- },
130
- {
131
- "attr": "bedheight",
132
- "object": self,
133
- "default": "210mm",
134
- "type": str,
135
- "label": _("Height"),
136
- "tip": _("Height of the laser bed."),
137
- "section": "_00_General",
138
- "priority": "20",
139
- "nonzero": True,
140
- },
141
- {
142
- "attr": "home_bottom",
143
- "object": self,
144
- "default": False,
145
- "type": bool,
146
- "label": _("Home Bottom"),
147
- "tip": _("Indicates the device Home is on the bottom"),
148
- "subsection": "_50_Home position",
149
- "signals": "bedsize",
150
- },
151
- {
152
- "attr": "home_right",
153
- "object": self,
154
- "default": False,
155
- "type": bool,
156
- "label": _("Home Right"),
157
- "tip": _("Indicates the device Home is at the right side"),
158
- "subsection": "_50_Home position",
159
- "signals": "bedsize",
160
- },
161
- {
162
- "attr": "flip_x",
163
- "object": self,
164
- "default": False,
165
- "type": bool,
166
- "label": _("Flip X"),
167
- "tip": _("Flip the X axis for the device"),
168
- "section": "_10_Parameters",
169
- "subsection": "_10_Axis corrections",
170
- "signals": "bedsize",
171
- },
172
- {
173
- "attr": "flip_y",
174
- "object": self,
175
- "default": False,
176
- "type": bool,
177
- "label": _("Flip Y"),
178
- "tip": _("Flip the Y axis for the device"),
179
- "section": "_10_Parameters",
180
- "subsection": "_10_Axis corrections",
181
- "signals": "bedsize",
182
- },
183
- {
184
- "attr": "swap_xy",
185
- "object": self,
186
- "default": False,
187
- "type": bool,
188
- "label": _("Swap XY"),
189
- "tip": _("Swap the X and Y axis for the device"),
190
- "section": "_10_Parameters",
191
- "subsection": "_10_Axis corrections",
192
- },
193
- {
194
- "attr": "interpolate",
195
- "object": self,
196
- "default": 50,
197
- "type": int,
198
- "label": _("Curve Interpolation"),
199
- "section": "_10_Parameters",
200
- "tip": _("Number of curve interpolation points"),
201
- },
202
- {
203
- "attr": "mock",
204
- "object": self,
205
- "default": False,
206
- "type": bool,
207
- "label": _("Run mock-usb backend"),
208
- "tip": _(
209
- "This starts connects to fake software laser rather than real one for debugging."
210
- ),
211
- "section": "_00_General",
212
- "priority": "30",
213
- },
214
- {
215
- "attr": "machine_index",
216
- "object": self,
217
- "default": 0,
218
- "type": int,
219
- "label": _("Machine index to select"),
220
- "tip": _(
221
- "Which machine should we connect to? -- Leave at 0 if you have 1 machine."
222
- ),
223
- "section": "_00_General",
224
- },
225
- {
226
- "attr": "file_index",
227
- "object": self,
228
- "default": 0,
229
- "type": int,
230
- "style": "combo",
231
- "choices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
232
- "label": _("Output File"),
233
- "tip": _(
234
- "File0 is default and instantly executes. The remaining files need to be sent and told to start"
235
- ),
236
- "section": "_30_Output",
237
- },
238
- {
239
- "attr": "autoplay",
240
- "object": self,
241
- "default": True,
242
- "type": bool,
243
- "label": _("Automatically Start"),
244
- "tip": _(
245
- "Automatically start the job when the output file is sent. You can send without execution if this is unchecked."
246
- ),
247
- "section": "_30_Output",
248
- },
249
- ]
250
- self.register_choices("newly", choices)
251
-
252
- choices = [
253
- {
254
- "attr": "h_dpi",
255
- "object": self,
256
- "default": 1000,
257
- "type": float,
258
- "label": _("Horizontal DPI"),
259
- "tip": _("The Dots-Per-Inch across the X-axis"),
260
- "section": "_10_Parameters",
261
- "subsection": "_20_Axis DPI",
262
- },
263
- {
264
- "attr": "v_dpi",
265
- "object": self,
266
- "default": 1000,
267
- "type": float,
268
- "label": _("Vertical DPI"),
269
- "tip": _("The Dots-Per-Inch across the Y-axis"),
270
- "section": "_10_Parameters",
271
- "subsection": "_20_Axis DPI",
272
- },
273
- {
274
- "attr": "h_backlash",
275
- "object": self,
276
- "default": 0,
277
- "type": float,
278
- "label": _("Horizontal Backlash"),
279
- "tip": _("Backlash amount for the laser."),
280
- "trailer": "mm",
281
- "section": "_10_Parameters",
282
- "subsection": "_30_Backlash",
283
- },
284
- {
285
- "attr": "v_backlash",
286
- "object": self,
287
- "default": 0,
288
- "type": float,
289
- "label": _("Vertical Backlash"),
290
- "tip": _("Backlash amount for the laser."),
291
- "trailer": "mm",
292
- "section": "_10_Parameters",
293
- "subsection": "_30_Backlash",
294
- },
295
- {
296
- "attr": "max_power",
297
- "object": self,
298
- "default": 20.0,
299
- "type": float,
300
- "label": _("Max Power"),
301
- "trailer": "%",
302
- "tip": _(
303
- "Maximum laser power, all other power will be a scale of this amount"
304
- ),
305
- "section": "_10_Parameters",
306
- "subsection": "_40_Power",
307
- },
308
- {
309
- "attr": "max_pulse_power",
310
- "object": self,
311
- "default": 65.0,
312
- "type": float,
313
- "label": _("Max Pulse Power"),
314
- "trailer": "%",
315
- "tip": _("What max power level should pulses be fired at?"),
316
- "section": "_10_Parameters",
317
- "subsection": "_45_Pulse",
318
- },
319
- {
320
- "attr": "pwm_enabled",
321
- "object": self,
322
- "default": False,
323
- "type": bool,
324
- "label": _("PWM Power"),
325
- "tip": _("Power Width Modulation enabled for device."),
326
- "section": "_10_Parameters",
327
- "subsection": "_40_Power",
328
- },
329
- {
330
- "attr": "pwm_frequency",
331
- "object": self,
332
- "default": 2,
333
- "type": int,
334
- "style": "combo",
335
- "choices": [1, 2, 3, 4, 5, 10, 20, 50, 75, 100, 200, 255],
336
- "conditional": (self, "pwm_enabled"),
337
- "label": _("PWM Frequency"),
338
- "trailer": "khz",
339
- "tip": _(
340
- "Set the frequency of the PWM, how often the pulse width cycles"
341
- ),
342
- "section": "_10_Parameters",
343
- "subsection": "_40_Power",
344
- },
345
- {
346
- "attr": "cut_dc",
347
- "object": self,
348
- "default": 100,
349
- "type": int,
350
- "label": _("Cut DC"),
351
- "tip": _("Set the current for the cut movements."),
352
- "section": "_10_Parameters",
353
- "subsection": "_40_Current",
354
- },
355
- {
356
- "attr": "move_dc",
357
- "object": self,
358
- "default": 100,
359
- "type": int,
360
- "label": _("Move DC"),
361
- "tip": _("Set the current for the regular movements."),
362
- "section": "_10_Parameters",
363
- "subsection": "_40_Current",
364
- },
365
- {
366
- "attr": "max_raster_jog",
367
- "object": self,
368
- "default": 15,
369
- "type": int,
370
- "label": _("Maximum Raster Jog"),
371
- "tip": _(
372
- "Maximum distance allowed to be done during a raster step/jog"
373
- ),
374
- "section": "_10_Parameters",
375
- "subsection": "_50_Raster",
376
- },
377
- ]
378
- self.register_choices("newly-specific", choices)
379
-
380
- choices = [
381
- {
382
- "attr": "default_cut_speed",
383
- "object": self,
384
- "default": 15.0,
385
- "type": float,
386
- "trailer": "mm/s",
387
- "label": _("Cut Speed"),
388
- "tip": _("How fast do we cut?"),
389
- "subsection": "_10_Cut",
390
- },
391
- {
392
- "attr": "default_cut_power",
393
- "object": self,
394
- "default": 1000.0,
395
- "type": float,
396
- "label": _("Cut Power"),
397
- "trailer": "/1000",
398
- "tip": _("What power level do we cut at?"),
399
- "subsection": "_10_Cut",
400
- },
401
- {
402
- "attr": "default_on_delay",
403
- "object": self,
404
- "default": 0,
405
- "type": float,
406
- "trailer": "ms",
407
- "label": _("On Delay"),
408
- "tip": _("Delay for laser on?"),
409
- "subsection": "_20_Timings",
410
- },
411
- {
412
- "attr": "default_off_delay",
413
- "object": self,
414
- "default": 0,
415
- "type": float,
416
- "trailer": "ms",
417
- "label": _("Off Delay"),
418
- "tip": _("Delay for laser off?"),
419
- "subsection": "_20_Timings",
420
- },
421
- {
422
- "attr": "default_raster_speed",
423
- "object": self,
424
- "default": 200.0,
425
- "type": float,
426
- "trailer": "mm/s",
427
- "label": _("Raster Speed"),
428
- "tip": _("How fast do we raster?"),
429
- "subsection": "_30_Raster",
430
- },
431
- {
432
- "attr": "default_raster_power",
433
- "object": self,
434
- "default": 1000.0,
435
- "type": float,
436
- "label": _("Raster Power"),
437
- "trailer": "%",
438
- "tip": _("At what power level do we raster?"),
439
- "subsection": "_30_Raster",
440
- },
441
- {
442
- "attr": "moving_speed",
443
- "object": self,
444
- "default": 100.0,
445
- "type": float,
446
- "trailer": "mm/s",
447
- "label": _("Moving Speed"),
448
- "tip": _("Moving speed while not cutting?"),
449
- "subsection": "_40_Moving",
450
- },
451
- {
452
- "attr": "default_corner_speed",
453
- "object": self,
454
- "default": 20.0,
455
- "type": float,
456
- "trailer": "mm/s",
457
- "label": _("Corner Speed"),
458
- "tip": _("Speed to move from acceleration corner to corner?"),
459
- "subsection": "_40_Moving",
460
- },
461
- {
462
- "attr": "default_acceleration_distance",
463
- "object": self,
464
- "default": 8.0,
465
- "type": float,
466
- "trailer": "mm",
467
- "label": _("Acceleration Distance"),
468
- "tip": _("Distance to use to ramp up to speed for movement?"),
469
- "subsection": "_40_Moving",
470
- },
471
- {
472
- "attr": "rect_speed",
473
- "object": self,
474
- "default": 100.0,
475
- "type": float,
476
- "trailer": "mm/s",
477
- "label": _("Rect Speed"),
478
- "tip": _("Speed to perform frame trace?"),
479
- "subsection": "_50_Framing",
480
- },
481
- {
482
- "attr": "rect_power",
483
- "object": self,
484
- "default": 0.0,
485
- "type": float,
486
- "trailer": "/1000",
487
- "label": _("Rect Power"),
488
- "tip": _("Power usage for draw frame operation?"),
489
- "subsection": "_50_Framing",
490
- },
491
- ]
492
- self.register_choices("newly-global", choices)
493
- # This device prefers to display power level in percent
494
- self.setting(bool, "use_percent_for_power_display", True)
495
-
496
- self.state = 0
497
- self.view = View(
498
- self.bedwidth,
499
- self.bedheight,
500
- dpi_x=self.h_dpi,
501
- dpi_y=self.v_dpi,
502
- )
503
- self.view.transform(
504
- flip_x=self.flip_x, flip_y=self.flip_y, swap_xy=self.swap_xy
505
- )
506
- self.spooler = Spooler(self)
507
- self.driver = NewlyDriver(self)
508
- self.spooler.driver = self.driver
509
-
510
- self.add_service_delegate(self.spooler)
511
-
512
- self.viewbuffer = ""
513
-
514
- # Sort the entries for the rasterchart
515
- self.speedchart.sort(key=lambda x: x["speed"])
516
-
517
- @self.console_command(
518
- "estop",
519
- help=_("stops the current job, deletes the spooler"),
520
- input_type=None,
521
- )
522
- def estop(command, channel, _, data=None, remainder=None, **kwgs):
523
- channel("Stopping Job")
524
- if self.job is not None:
525
- self.job.stop()
526
- self.spooler.clear_queue()
527
- self.driver.reset()
528
-
529
- @self.console_command(
530
- "pause",
531
- help=_("Pauses the currently running job"),
532
- )
533
- def pause(command, channel, _, data=None, remainder=None, **kwgs):
534
- if self.driver.paused:
535
- channel("Resuming current job")
536
- else:
537
- channel("Pausing current job")
538
- self.driver.pause()
539
- self.signal("pause")
540
-
541
- @self.console_command(
542
- "resume",
543
- help=_("Resume the currently running job"),
544
- )
545
- def resume(command, channel, _, data=None, remainder=None, **kwgs):
546
- channel("Resume the current job")
547
- self.driver.resume()
548
- self.signal("pause")
549
-
550
- @self.console_option(
551
- "idonotlovemyhouse",
552
- type=bool,
553
- action="store_true",
554
- help=_("override one second laser fire pulse duration"),
555
- )
556
- @self.console_argument("time", type=float, help=_("laser fire pulse duration"))
557
- @self.console_command(
558
- "pulse",
559
- help=_("pulse <time>: Pulse the laser in place."),
560
- )
561
- def pulse(command, channel, _, time=None, idonotlovemyhouse=False, **kwargs):
562
- if time is None:
563
- channel(_("Must specify a pulse time in milliseconds."))
564
- return
565
- if time > 1000.0:
566
- channel(
567
- _(
568
- '"{time}ms" exceeds 1 second limit to fire a standing laser.'
569
- ).format(time=time)
570
- )
571
- try:
572
- if not idonotlovemyhouse:
573
- return
574
- except IndexError:
575
- return
576
- if self.spooler.is_idle:
577
- self.spooler.command("pulse", time)
578
- channel(_("Pulse laser for {time} milliseconds").format(time=time))
579
- else:
580
- channel(_("Pulse laser failed: Busy"))
581
- return
582
-
583
- @self.console_command(
584
- "usb_connect",
585
- help=_("connect usb"),
586
- )
587
- def usb_connect(command, channel, _, data=None, remainder=None, **kwgs):
588
- self.spooler.command("connect", priority=1)
589
-
590
- @self.console_command(
591
- "usb_disconnect",
592
- help=_("connect usb"),
593
- )
594
- def usb_disconnect(command, channel, _, data=None, remainder=None, **kwgs):
595
- self.spooler.command("disconnect", priority=1)
596
-
597
- @self.console_command("usb_abort", help=_("Stops USB retries"))
598
- def usb_abort(command, channel, _, **kwargs):
599
- self.spooler.command("abort_retry", priority=1)
600
-
601
- @self.console_argument("filename", type=str)
602
- @self.console_command("save_job", help=_("save job export"), input_type="plan")
603
- def newly_save(channel, _, filename, data=None, **kwargs):
604
- if filename is None:
605
- raise CommandSyntaxError
606
- try:
607
- with open(filename, "wb") as f:
608
- driver = NewlyDriver(self, force_mock=True)
609
- job = LaserJob(
610
- filename, list(data.plan), driver=driver, outline=data.outline
611
- )
612
-
613
- def write(index, data):
614
- f.write(data)
615
-
616
- driver.connection.connect_if_needed()
617
- driver.connection.connection.write = write
618
- driver.job_start(job)
619
- job.execute()
620
- driver.job_finish(job)
621
-
622
- except (PermissionError, OSError):
623
- channel(_("Could not save: {filename}").format(filename=filename))
624
-
625
- @self.console_command(
626
- "raw",
627
- help=_("sends raw data exactly as composed"),
628
- )
629
- def newly_raw(
630
- channel,
631
- _,
632
- remainder=None,
633
- **kwgs,
634
- ):
635
- """
636
- Raw for newly performs raw actions and sends these commands directly to the laser.
637
- """
638
- if remainder is not None:
639
- if "\\x" in remainder:
640
- for i in range(256):
641
- remainder = remainder.replace(f"\\x{i:02X}", chr(i))
642
- self.driver.connection.raw(remainder)
643
- else:
644
- self.driver.connection.raw(remainder)
645
- channel(f"Raw: {remainder}")
646
-
647
- @self.console_argument("file_index", type=int)
648
- @self.console_command(
649
- "move_frame",
650
- help=_("sends the newly move_frame command"),
651
- all_arguments_required=True,
652
- )
653
- def move_rect(file_index, **kwargs):
654
- try:
655
- self.driver.connection.move_frame(file_index)
656
- except ConnectionRefusedError:
657
- self.signal(
658
- "warning",
659
- _("Connection was aborted. Manual connection required."),
660
- _("Not Connected"),
661
- )
662
-
663
- @self.console_argument("file_index", type=int)
664
- @self.console_command(
665
- "draw_frame",
666
- help=_("sends the newly draw_frame command"),
667
- all_arguments_required=True,
668
- )
669
- def draw_rect(file_index, **kwargs):
670
- try:
671
- self.driver.connection.draw_frame(file_index)
672
- except ConnectionRefusedError:
673
- self.signal(
674
- "warning",
675
- _("Connection was aborted. Manual connection required."),
676
- _("Not Connected"),
677
- )
678
-
679
- @self.console_argument("file_index", type=int)
680
- @self.console_command(
681
- "replay",
682
- help=_("sends the file replay command"),
683
- all_arguments_required=True,
684
- )
685
- def replay(file_index, **kwargs):
686
- try:
687
- self.driver.connection.replay(file_index)
688
- except ConnectionRefusedError:
689
- self.signal(
690
- "warning",
691
- _("Connection was aborted. Manual connection required."),
692
- _("Not Connected"),
693
- )
694
-
695
- @self.console_command(
696
- "viewport_update",
697
- hidden=True,
698
- help=_("Update newly flips for movement"),
699
- )
700
- def codes_update(**kwargs):
701
- self.realize()
702
-
703
- def service_attach(self, *args, **kwargs):
704
- self.realize()
705
-
706
- @signal_listener("flip_x")
707
- @signal_listener("flip_y")
708
- @signal_listener("swap_xy")
709
- @signal_listener("v_dpi")
710
- @signal_listener("h_dpi")
711
- def realize(self, origin=None, *args):
712
- self.view.set_dims(self.bedwidth, self.bedheight)
713
- self.view.dpi_x = self.h_dpi
714
- self.view.dpi_y = self.v_dpi
715
- self.view.transform(
716
- flip_x=self.flip_x, flip_y=self.flip_y, swap_xy=self.swap_xy
717
- )
718
- self.space.update_bounds(0, 0, self.bedwidth, self.bedheight)
719
-
720
- @property
721
- def current(self):
722
- """
723
- @return: the location in units for the current known position.
724
- """
725
- return self.view.iposition(self.driver.native_x, self.driver.native_y)
726
-
727
- @property
728
- def native(self):
729
- """
730
- @return: the location in device native units for the current known position.
731
- """
732
- return self.driver.native_x, self.driver.native_y
1
+ """
2
+ Newly Device
3
+ """
4
+ from meerk40t.core.laserjob import LaserJob
5
+ from meerk40t.core.spoolers import Spooler
6
+ from meerk40t.core.units import Length
7
+ from meerk40t.core.view import View
8
+ from meerk40t.device.mixins import Status
9
+ from meerk40t.kernel import CommandSyntaxError, Service, signal_listener
10
+ from meerk40t.newly.driver import NewlyDriver
11
+ from meerk40t.device.devicechoices import get_effect_choices
12
+
13
+
14
+ class NewlyDevice(Service, Status):
15
+ """
16
+ Newly Device
17
+ """
18
+
19
+ def __init__(self, kernel, path, *args, choices=None, **kwargs):
20
+ Service.__init__(self, kernel, path)
21
+ Status.__init__(self)
22
+ self.name = "newly"
23
+ self.extension = "hpgl"
24
+ self.job = None
25
+ if choices is not None:
26
+ for c in choices:
27
+ attr = c.get("attr")
28
+ default = c.get("default")
29
+ if attr is not None and default is not None:
30
+ setattr(self, attr, default)
31
+
32
+ _ = kernel.translation
33
+ choices = [
34
+ {
35
+ "attr": "speedchart",
36
+ "object": self,
37
+ "default": [
38
+ {
39
+ "speed": 100,
40
+ "acceleration_length": 8,
41
+ "backlash": 0,
42
+ "corner_speed": 20,
43
+ },
44
+ {
45
+ "speed": 200,
46
+ "acceleration_length": 10,
47
+ "backlash": 0,
48
+ "corner_speed": 20,
49
+ },
50
+ {
51
+ "speed": 300,
52
+ "acceleration_length": 14,
53
+ "backlash": 0,
54
+ "corner_speed": 20,
55
+ },
56
+ {
57
+ "speed": 400,
58
+ "acceleration_length": 16,
59
+ "backlash": 0,
60
+ "corner_speed": 20,
61
+ },
62
+ {
63
+ "speed": 500,
64
+ "acceleration_length": 18,
65
+ "backlash": 0,
66
+ "corner_speed": 20,
67
+ },
68
+ ],
69
+ "type": list,
70
+ "columns": [
71
+ {
72
+ "attr": "speed",
73
+ "type": int,
74
+ "label": _("Speed <="),
75
+ "width": 133,
76
+ "editable": True,
77
+ },
78
+ {
79
+ "attr": "acceleration_length",
80
+ "type": int,
81
+ "label": _("Acceleration Length"),
82
+ "width": 144,
83
+ "editable": True,
84
+ },
85
+ {
86
+ "attr": "backlash",
87
+ "type": int,
88
+ "label": _("Backlash"),
89
+ "width": 142,
90
+ "editable": True,
91
+ },
92
+ {
93
+ "attr": "corner_speed",
94
+ "type": int,
95
+ "label": _("Corner Speed"),
96
+ "width": 133,
97
+ "editable": True,
98
+ },
99
+ ],
100
+ "style": "chart",
101
+ "primary": "speed",
102
+ "allow_deletion": True,
103
+ "allow_duplication": True,
104
+ "label": _("Speed Chart"),
105
+ "tip": _("Raster speed to chart."),
106
+ },
107
+ ]
108
+ self.register_choices("newly-speedchart", choices)
109
+
110
+ self.register_choices("newly-effects", get_effect_choices(self))
111
+
112
+ choices = [
113
+ {
114
+ "attr": "label",
115
+ "object": self,
116
+ "default": "newly-device",
117
+ "type": str,
118
+ "label": _("Label"),
119
+ "tip": _("What is this device called."),
120
+ "section": "_00_General",
121
+ "priority": "10",
122
+ },
123
+ {
124
+ "attr": "bedwidth",
125
+ "object": self,
126
+ "default": "310mm",
127
+ "type": str,
128
+ "label": _("Width"),
129
+ "tip": _("Width of the laser bed."),
130
+ "section": "_00_General",
131
+ "subsection": "_10_Dimensions",
132
+ "priority": "20",
133
+ "nonzero": True,
134
+ },
135
+ {
136
+ "attr": "bedheight",
137
+ "object": self,
138
+ "default": "210mm",
139
+ "type": str,
140
+ "label": _("Height"),
141
+ "tip": _("Height of the laser bed."),
142
+ "section": "_00_General",
143
+ "subsection": "_10_Dimensions",
144
+ "priority": "20",
145
+ "nonzero": True,
146
+ },
147
+ {
148
+ "attr": "laserspot",
149
+ "object": self,
150
+ "default": "0.3mm",
151
+ "type": Length,
152
+ "label": _("Laserspot"),
153
+ "tip": _("Laser spot size"),
154
+ "section": "_00_General",
155
+ "subsection": "_10_Dimensions",
156
+ "nonzero": True,
157
+ },
158
+ {
159
+ "attr": "user_margin_x",
160
+ "object": self,
161
+ "default": 0,
162
+ "type": str,
163
+ "label": _("X-Margin"),
164
+ "tip": _(
165
+ "Margin for the X-axis. This will be a kind of unused space at the left side."
166
+ ),
167
+ "section": "_10_Parameters",
168
+ "subsection": "_45_User Offset",
169
+ },
170
+ {
171
+ "attr": "user_margin_y",
172
+ "object": self,
173
+ "default": "0",
174
+ "type": str,
175
+ "label": _("Y-Margin"),
176
+ "tip": _(
177
+ "Margin for the Y-axis. This will be a kind of unused space at the top."
178
+ ),
179
+ "section": "_10_Parameters",
180
+ "subsection": "_45_User Offset",
181
+ },
182
+ {
183
+ "attr": "home_corner",
184
+ "object": self,
185
+ "default": "auto",
186
+ "type": str,
187
+ "style": "combo",
188
+ "choices": [
189
+ "auto",
190
+ "top-left",
191
+ "top-right",
192
+ "bottom-left",
193
+ "bottom-right",
194
+ "center",
195
+ ],
196
+ "label": _("Force Declared Home"),
197
+ "tip": _("Override native home location"),
198
+ "section": "_10_Parameters",
199
+ "subsection": "_50_" + _("Home position"),
200
+ },
201
+ {
202
+ "attr": "flip_x",
203
+ "object": self,
204
+ "default": False,
205
+ "type": bool,
206
+ "label": _("Flip X"),
207
+ "tip": _("Flip the X axis for the device"),
208
+ "section": "_10_Parameters",
209
+ "subsection": "_10_Axis corrections",
210
+ },
211
+ {
212
+ "attr": "flip_y",
213
+ "object": self,
214
+ "default": False,
215
+ "type": bool,
216
+ "label": _("Flip Y"),
217
+ "tip": _("Flip the Y axis for the device"),
218
+ "section": "_10_Parameters",
219
+ "subsection": "_10_Axis corrections",
220
+ },
221
+ {
222
+ "attr": "swap_xy",
223
+ "object": self,
224
+ "default": False,
225
+ "type": bool,
226
+ "label": _("Swap XY"),
227
+ "tip": _("Swap the X and Y axis for the device"),
228
+ "section": "_10_Parameters",
229
+ "subsection": "_10_Axis corrections",
230
+ },
231
+ {
232
+ "attr": "interp",
233
+ "object": self,
234
+ "default": 5,
235
+ "type": int,
236
+ "label": _("Curve Interpolation"),
237
+ "section": "_10_Parameters",
238
+ "tip": _("Number of curve interpolation points"),
239
+ },
240
+ {
241
+ "attr": "mock",
242
+ "object": self,
243
+ "default": False,
244
+ "type": bool,
245
+ "label": _("Run mock-usb backend"),
246
+ "tip": _(
247
+ "This starts connects to fake software laser rather than real one for debugging."
248
+ ),
249
+ "section": "_00_General",
250
+ "priority": "30",
251
+ },
252
+ {
253
+ "attr": "machine_index",
254
+ "object": self,
255
+ "default": 0,
256
+ "type": int,
257
+ "label": _("Machine index to select"),
258
+ "tip": _(
259
+ "Which machine should we connect to? -- Leave at 0 if you have 1 machine."
260
+ ),
261
+ "section": "_00_General",
262
+ },
263
+ {
264
+ "attr": "file_index",
265
+ "object": self,
266
+ "default": 0,
267
+ "type": int,
268
+ "style": "combo",
269
+ "choices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
270
+ "label": _("Output File"),
271
+ "tip": _(
272
+ "File0 is default and instantly executes. The remaining files need to be sent and told to start"
273
+ ),
274
+ "section": "_30_Output",
275
+ "signals": "newly_file_index",
276
+ },
277
+ {
278
+ "attr": "autoplay",
279
+ "object": self,
280
+ "default": True,
281
+ "type": bool,
282
+ "label": _("Automatically Start"),
283
+ "tip": _(
284
+ "Automatically start the job when the output file is sent. You can send without execution if this is unchecked."
285
+ ),
286
+ "section": "_30_Output",
287
+ "signals": "newly_autoplay",
288
+ },
289
+ {
290
+ "attr": "signal_updates",
291
+ "object": self,
292
+ "default": True,
293
+ "type": bool,
294
+ "label": _("Device Position"),
295
+ "tip": _(
296
+ "Do you want to see some indicator about the current device position?"
297
+ ),
298
+ "section": "_95_" + _("Screen updates"),
299
+ "signals": "restart",
300
+ },
301
+ ]
302
+ self.register_choices("newly", choices)
303
+
304
+ choices = [
305
+ {
306
+ "attr": "h_dpi",
307
+ "object": self,
308
+ "default": 1000,
309
+ "type": float,
310
+ "label": _("Horizontal DPI"),
311
+ "tip": _("The Dots-Per-Inch across the X-axis"),
312
+ "section": "_10_Parameters",
313
+ "subsection": "_20_Axis DPI",
314
+ },
315
+ {
316
+ "attr": "v_dpi",
317
+ "object": self,
318
+ "default": 1000,
319
+ "type": float,
320
+ "label": _("Vertical DPI"),
321
+ "tip": _("The Dots-Per-Inch across the Y-axis"),
322
+ "section": "_10_Parameters",
323
+ "subsection": "_20_Axis DPI",
324
+ },
325
+ {
326
+ "attr": "h_backlash",
327
+ "object": self,
328
+ "default": 0,
329
+ "type": float,
330
+ "label": _("Horizontal Backlash"),
331
+ "tip": _("Backlash amount for the laser."),
332
+ "trailer": "mm",
333
+ "section": "_10_Parameters",
334
+ "subsection": "_30_Backlash",
335
+ },
336
+ {
337
+ "attr": "v_backlash",
338
+ "object": self,
339
+ "default": 0,
340
+ "type": float,
341
+ "label": _("Vertical Backlash"),
342
+ "tip": _("Backlash amount for the laser."),
343
+ "trailer": "mm",
344
+ "section": "_10_Parameters",
345
+ "subsection": "_30_Backlash",
346
+ },
347
+ {
348
+ "attr": "max_power",
349
+ "object": self,
350
+ "default": 20.0,
351
+ "type": float,
352
+ "label": _("Max Power"),
353
+ "trailer": "%",
354
+ "tip": _(
355
+ "Maximum laser power, all other power will be a scale of this amount"
356
+ ),
357
+ "section": "_10_Parameters",
358
+ "subsection": "_40_Power",
359
+ },
360
+ {
361
+ "attr": "max_pulse_power",
362
+ "object": self,
363
+ "default": 65.0,
364
+ "type": float,
365
+ "label": _("Max Pulse Power"),
366
+ "trailer": "%",
367
+ "tip": _("What max power level should pulses be fired at?"),
368
+ "section": "_10_Parameters",
369
+ "subsection": "_45_Pulse",
370
+ },
371
+ {
372
+ "attr": "pwm_enabled",
373
+ "object": self,
374
+ "default": False,
375
+ "type": bool,
376
+ "label": _("PWM Power"),
377
+ "tip": _("Power Width Modulation enabled for device."),
378
+ "section": "_10_Parameters",
379
+ "subsection": "_40_Power",
380
+ },
381
+ {
382
+ "attr": "pwm_frequency",
383
+ "object": self,
384
+ "default": 2,
385
+ "type": int,
386
+ "style": "combo",
387
+ "choices": [1, 2, 3, 4, 5, 10, 20, 50, 75, 100, 200, 255],
388
+ "conditional": (self, "pwm_enabled"),
389
+ "label": _("PWM Frequency"),
390
+ "trailer": "khz",
391
+ "tip": _(
392
+ "Set the frequency of the PWM, how often the pulse width cycles"
393
+ ),
394
+ "section": "_10_Parameters",
395
+ "subsection": "_40_Power",
396
+ },
397
+ {
398
+ "attr": "cut_dc",
399
+ "object": self,
400
+ "default": 100,
401
+ "type": int,
402
+ "label": _("Cut DC"),
403
+ "tip": _("Set the current for the cut movements."),
404
+ "section": "_10_Parameters",
405
+ "subsection": "_40_Current",
406
+ },
407
+ {
408
+ "attr": "move_dc",
409
+ "object": self,
410
+ "default": 100,
411
+ "type": int,
412
+ "label": _("Move DC"),
413
+ "tip": _("Set the current for the regular movements."),
414
+ "section": "_10_Parameters",
415
+ "subsection": "_40_Current",
416
+ },
417
+ {
418
+ "attr": "max_raster_jog",
419
+ "object": self,
420
+ "default": 15,
421
+ "type": int,
422
+ "label": _("Maximum Raster Jog"),
423
+ "tip": _(
424
+ "Maximum distance allowed to be done during a raster step/jog"
425
+ ),
426
+ "section": "_10_Parameters",
427
+ "subsection": "_50_Raster",
428
+ },
429
+ ]
430
+ self.register_choices("newly-specific", choices)
431
+
432
+ choices = [
433
+ {
434
+ "attr": "default_cut_speed",
435
+ "object": self,
436
+ "default": 15.0,
437
+ "type": float,
438
+ "trailer": "mm/s",
439
+ "label": _("Cut Speed"),
440
+ "tip": _("How fast do we cut?"),
441
+ "subsection": "_10_Cut",
442
+ },
443
+ {
444
+ "attr": "default_cut_power",
445
+ "object": self,
446
+ "default": 1000.0,
447
+ "type": float,
448
+ "label": _("Cut Power"),
449
+ "trailer": "/1000",
450
+ "tip": _("What power level do we cut at?"),
451
+ "subsection": "_10_Cut",
452
+ },
453
+ {
454
+ "attr": "default_on_delay",
455
+ "object": self,
456
+ "default": 0,
457
+ "type": float,
458
+ "trailer": "ms",
459
+ "label": _("On Delay"),
460
+ "tip": _("Delay for laser on?"),
461
+ "subsection": "_20_Timings",
462
+ },
463
+ {
464
+ "attr": "default_off_delay",
465
+ "object": self,
466
+ "default": 0,
467
+ "type": float,
468
+ "trailer": "ms",
469
+ "label": _("Off Delay"),
470
+ "tip": _("Delay for laser off?"),
471
+ "subsection": "_20_Timings",
472
+ },
473
+ {
474
+ "attr": "default_raster_speed",
475
+ "object": self,
476
+ "default": 200.0,
477
+ "type": float,
478
+ "trailer": "mm/s",
479
+ "label": _("Raster Speed"),
480
+ "tip": _("How fast do we raster?"),
481
+ "subsection": "_30_Raster",
482
+ },
483
+ {
484
+ "attr": "default_raster_power",
485
+ "object": self,
486
+ "default": 1000.0,
487
+ "type": float,
488
+ "label": _("Raster Power"),
489
+ "trailer": "%",
490
+ "tip": _("At what power level do we raster?"),
491
+ "subsection": "_30_Raster",
492
+ },
493
+ {
494
+ "attr": "moving_speed",
495
+ "object": self,
496
+ "default": 100.0,
497
+ "type": float,
498
+ "trailer": "mm/s",
499
+ "label": _("Moving Speed"),
500
+ "tip": _("Moving speed while not cutting?"),
501
+ "subsection": "_40_Moving",
502
+ },
503
+ {
504
+ "attr": "default_corner_speed",
505
+ "object": self,
506
+ "default": 20.0,
507
+ "type": float,
508
+ "trailer": "mm/s",
509
+ "label": _("Corner Speed"),
510
+ "tip": _("Speed to move from acceleration corner to corner?"),
511
+ "subsection": "_40_Moving",
512
+ },
513
+ {
514
+ "attr": "default_acceleration_distance",
515
+ "object": self,
516
+ "default": 8.0,
517
+ "type": float,
518
+ "trailer": "mm",
519
+ "label": _("Acceleration Distance"),
520
+ "tip": _("Distance to use to ramp up to speed for movement?"),
521
+ "subsection": "_40_Moving",
522
+ },
523
+ {
524
+ "attr": "rect_speed",
525
+ "object": self,
526
+ "default": 100.0,
527
+ "type": float,
528
+ "trailer": "mm/s",
529
+ "label": _("Rect Speed"),
530
+ "tip": _("Speed to perform frame trace?"),
531
+ "subsection": "_50_Framing",
532
+ },
533
+ {
534
+ "attr": "rect_power",
535
+ "object": self,
536
+ "default": 0.0,
537
+ "type": float,
538
+ "trailer": "/1000",
539
+ "label": _("Rect Power"),
540
+ "tip": _("Power usage for draw frame operation?"),
541
+ "subsection": "_50_Framing",
542
+ },
543
+ ]
544
+ self.register_choices("newly-global", choices)
545
+
546
+ choices = [
547
+ {
548
+ "attr": "device_coolant",
549
+ "object": self,
550
+ "default": "",
551
+ "type": str,
552
+ "style": "option",
553
+ "label": _("Coolant"),
554
+ "tip": _(
555
+ "Does this device has a method to turn on / off a coolant associated to it?"
556
+ ),
557
+ "section": "_99_" + _("Coolant Support"),
558
+ "dynamic": self.cool_helper,
559
+ "signals": "coolant_changed",
560
+ },
561
+ ]
562
+ self.register_choices("coolant", choices)
563
+
564
+ # This device prefers to display power level in percent
565
+ self.setting(bool, "use_percent_for_power_display", True)
566
+
567
+ # Tuple contains 4 value pairs: Speed Low, Speed High, Power Low, Power High, each with enabled, value
568
+ self.setting(
569
+ list, "dangerlevel_op_cut", (False, 0, False, 0, False, 0, False, 0)
570
+ )
571
+ self.setting(
572
+ list, "dangerlevel_op_engrave", (False, 0, False, 0, False, 0, False, 0)
573
+ )
574
+ self.setting(
575
+ list, "dangerlevel_op_hatch", (False, 0, False, 0, False, 0, False, 0)
576
+ )
577
+ self.setting(
578
+ list, "dangerlevel_op_raster", (False, 0, False, 0, False, 0, False, 0)
579
+ )
580
+ self.setting(
581
+ list, "dangerlevel_op_image", (False, 0, False, 0, False, 0, False, 0)
582
+ )
583
+ self.setting(
584
+ list, "dangerlevel_op_dots", (False, 0, False, 0, False, 0, False, 0)
585
+ )
586
+
587
+ self.kernel.root.coolant.claim_coolant(self, self.device_coolant)
588
+
589
+ self.state = 0
590
+ self.view = View(
591
+ self.bedwidth,
592
+ self.bedheight,
593
+ dpi_x=self.h_dpi,
594
+ dpi_y=self.v_dpi,
595
+ )
596
+ self.realize()
597
+ self.spooler = Spooler(self)
598
+ self.driver = NewlyDriver(self)
599
+ self.spooler.driver = self.driver
600
+
601
+ self.add_service_delegate(self.spooler)
602
+
603
+ self.viewbuffer = ""
604
+
605
+ # Sort the entries for the rasterchart
606
+ self.speedchart.sort(key=lambda x: x["speed"])
607
+
608
+ @self.console_command(
609
+ "estop",
610
+ help=_("stops the current job, deletes the spooler"),
611
+ input_type=None,
612
+ )
613
+ def estop(command, channel, _, data=None, remainder=None, **kwgs):
614
+ channel("Stopping Job")
615
+ if self.job is not None:
616
+ self.job.stop()
617
+ self.spooler.clear_queue()
618
+ self.driver.reset()
619
+
620
+ @self.console_command(
621
+ "pause",
622
+ help=_("Pauses the currently running job"),
623
+ )
624
+ def pause(command, channel, _, data=None, remainder=None, **kwgs):
625
+ if self.driver.paused:
626
+ channel("Resuming current job")
627
+ else:
628
+ channel("Pausing current job")
629
+ self.driver.pause()
630
+ self.signal("pause")
631
+
632
+ @self.console_command(
633
+ "resume",
634
+ help=_("Resume the currently running job"),
635
+ )
636
+ def resume(command, channel, _, data=None, remainder=None, **kwgs):
637
+ channel("Resume the current job")
638
+ self.driver.resume()
639
+ self.signal("pause")
640
+
641
+ @self.console_option(
642
+ "idonotlovemyhouse",
643
+ type=bool,
644
+ action="store_true",
645
+ help=_("override one second laser fire pulse duration"),
646
+ )
647
+ @self.console_argument("time", type=float, help=_("laser fire pulse duration"))
648
+ @self.console_command(
649
+ "pulse",
650
+ help=_("pulse <time>: Pulse the laser in place."),
651
+ )
652
+ def pulse(command, channel, _, time=None, idonotlovemyhouse=False, **kwgs):
653
+ if time is None:
654
+ channel(_("Must specify a pulse time in milliseconds."))
655
+ return
656
+ if time > 1000.0:
657
+ channel(
658
+ _(
659
+ '"{time}ms" exceeds 1 second limit to fire a standing laser.'
660
+ ).format(time=time)
661
+ )
662
+ try:
663
+ if not idonotlovemyhouse:
664
+ return
665
+ except IndexError:
666
+ return
667
+ if self.spooler.is_idle:
668
+ self.spooler.command("pulse", time)
669
+ channel(_("Pulse laser for {time} milliseconds").format(time=time))
670
+ else:
671
+ channel(_("Pulse laser failed: Busy"))
672
+ return
673
+
674
+ @self.console_command(
675
+ "usb_connect",
676
+ help=_("connect usb"),
677
+ )
678
+ def usb_connect(command, channel, _, data=None, remainder=None, **kwgs):
679
+ self.spooler.command("connect", priority=1)
680
+
681
+ @self.console_command(
682
+ "usb_disconnect",
683
+ help=_("connect usb"),
684
+ )
685
+ def usb_disconnect(command, channel, _, data=None, remainder=None, **kwgs):
686
+ self.spooler.command("disconnect", priority=1)
687
+
688
+ @self.console_command("usb_abort", help=_("Stops USB retries"))
689
+ def usb_abort(command, channel, _, **kwgs):
690
+ self.spooler.command("abort_retry", priority=1)
691
+
692
+ @self.console_argument("filename", type=str)
693
+ @self.console_command("save_job", help=_("save job export"), input_type="plan")
694
+ def newly_save(channel, _, filename, data=None, **kwgs):
695
+ if filename is None:
696
+ raise CommandSyntaxError
697
+ try:
698
+ with open(filename, "wb") as f:
699
+ driver = NewlyDriver(self, force_mock=True)
700
+ job = LaserJob(
701
+ filename, list(data.plan), driver=driver, outline=data.outline
702
+ )
703
+
704
+ def write(index, data):
705
+ f.write(data)
706
+
707
+ driver.connection.connect_if_needed()
708
+ driver.connection.connection.write = write
709
+ driver.job_start(job)
710
+ job.execute()
711
+ driver.job_finish(job)
712
+
713
+ except (PermissionError, OSError):
714
+ channel(_("Could not save: {filename}").format(filename=filename))
715
+
716
+ @self.console_command(
717
+ "raw",
718
+ help=_("sends raw data exactly as composed"),
719
+ )
720
+ def newly_raw(
721
+ channel,
722
+ _,
723
+ remainder=None,
724
+ **kwgs,
725
+ ):
726
+ """
727
+ Raw for newly performs raw actions and sends these commands directly to the laser.
728
+ """
729
+ if remainder is not None:
730
+ if "\\x" in remainder:
731
+ for i in range(256):
732
+ remainder = remainder.replace(f"\\x{i:02X}", chr(i))
733
+ self.driver.connection.raw(remainder)
734
+ else:
735
+ self.driver.connection.raw(remainder)
736
+ channel(f"Raw: {remainder}")
737
+
738
+ @self.console_argument("file_index", type=int)
739
+ @self.console_command(
740
+ "move_frame",
741
+ help=_("sends the newly move_frame command"),
742
+ all_arguments_required=True,
743
+ )
744
+ def move_rect(file_index, **kwgs):
745
+ try:
746
+ self.driver.connection.move_frame(file_index)
747
+ except ConnectionRefusedError:
748
+ self.signal(
749
+ "warning",
750
+ _("Connection was aborted. Manual connection required."),
751
+ _("Not Connected"),
752
+ )
753
+
754
+ @self.console_argument("file_index", type=int)
755
+ @self.console_command(
756
+ "select_file",
757
+ help=_("Sets the default file index to use"),
758
+ all_arguments_required=True,
759
+ )
760
+ def set_file_index(command, channel, _, file_index=None, data=None, remainder=None, **kwgs):
761
+ old_value = self.file_index
762
+ if file_index is None or file_index < 0 or file_index >= 10:
763
+ file_index = 0
764
+ self.file_index = file_index
765
+ channel(f"File index was set to #{file_index} (previous value: {old_value})")
766
+ # Let propertypanels know that this value was updated
767
+ self.signal("file_index", file_index, self)
768
+
769
+ @self.console_argument("file_index", type=int)
770
+ @self.console_command(
771
+ "draw_frame",
772
+ help=_("sends the newly draw_frame command"),
773
+ all_arguments_required=True,
774
+ )
775
+ def draw_rect(file_index, **kwgs):
776
+ try:
777
+ self.driver.connection.draw_frame(file_index)
778
+ except ConnectionRefusedError:
779
+ self.signal(
780
+ "warning",
781
+ _("Connection was aborted. Manual connection required."),
782
+ _("Not Connected"),
783
+ )
784
+
785
+ @self.console_argument("file_index", type=int)
786
+ @self.console_command(
787
+ "replay",
788
+ help=_("sends the file replay command"),
789
+ all_arguments_required=True,
790
+ )
791
+ def replay(file_index, **kwgs):
792
+ try:
793
+ self.driver.connection.replay(file_index)
794
+ except ConnectionRefusedError:
795
+ self.signal(
796
+ "warning",
797
+ _("Connection was aborted. Manual connection required."),
798
+ _("Not Connected"),
799
+ )
800
+
801
+ @property
802
+ def safe_label(self):
803
+ """
804
+ Provides a safe label without spaces or / which could cause issues when used in timer or other names.
805
+ @return:
806
+ """
807
+ if not hasattr(self, "label"):
808
+ return self.name
809
+ name = self.label.replace(" ", "-")
810
+ return name.replace("/", "-")
811
+
812
+ def service_attach(self, *args, **kwargs):
813
+ self.realize()
814
+
815
+ @signal_listener("flip_x")
816
+ @signal_listener("flip_y")
817
+ @signal_listener("swap_xy")
818
+ @signal_listener("v_dpi")
819
+ @signal_listener("h_dpi")
820
+ @signal_listener("home_corner")
821
+ @signal_listener("user_margin_x")
822
+ @signal_listener("user_margin_y")
823
+ def realize(self, origin=None, *args):
824
+ if origin is not None and origin != self.path:
825
+ return
826
+ corner = self.setting(str, "home_corner")
827
+ home_dx = 0
828
+ home_dy = 0
829
+ if corner == "auto":
830
+ pass
831
+ elif corner == "top-left":
832
+ home_dx = 1 if self.flip_x else 0
833
+ home_dy = 1 if self.flip_y else 0
834
+ elif corner == "top-right":
835
+ home_dx = 0 if self.flip_x else 1
836
+ home_dy = 1 if self.flip_y else 0
837
+ elif corner == "bottom-left":
838
+ home_dx = 1 if self.flip_x else 0
839
+ home_dy = 0 if self.flip_y else 1
840
+ elif corner == "bottom-right":
841
+ home_dx = 0 if self.flip_x else 1
842
+ home_dy = 0 if self.flip_y else 1
843
+ elif corner == "center":
844
+ home_dx = 0.5
845
+ home_dy = 0.5
846
+ self.view.set_dims(self.bedwidth, self.bedheight)
847
+ self.view.set_margins(self.user_margin_x, self.user_margin_y)
848
+ self.view.dpi_x = self.h_dpi
849
+ self.view.dpi_y = self.v_dpi
850
+ self.view.transform(
851
+ flip_x=self.flip_x,
852
+ flip_y=self.flip_y,
853
+ swap_xy=self.swap_xy,
854
+ origin_x=home_dx,
855
+ origin_y=home_dy,
856
+ )
857
+ self.signal("view;realized")
858
+
859
+ @property
860
+ def current(self):
861
+ """
862
+ @return: the location in units for the current known position.
863
+ """
864
+ return self.view.iposition(self.driver.native_x, self.driver.native_y)
865
+
866
+ @property
867
+ def native(self):
868
+ """
869
+ @return: the location in device native units for the current known position.
870
+ """
871
+ return self.driver.native_x, self.driver.native_y
872
+
873
+ def cool_helper(self, choice_dict):
874
+ self.kernel.root.coolant.coolant_choice_helper(self)(choice_dict)