meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7010__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 (445) 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 +1195 -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 +1844 -1507
  50. meerk40t/core/elements/clipboard.py +229 -219
  51. meerk40t/core/elements/element_treeops.py +4561 -2837
  52. meerk40t/core/elements/element_types.py +125 -105
  53. meerk40t/core/elements/elements.py +4329 -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 +933 -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/trace.py +651 -563
  66. meerk40t/core/elements/tree_commands.py +415 -409
  67. meerk40t/core/elements/undo_redo.py +116 -58
  68. meerk40t/core/elements/wordlist.py +319 -200
  69. meerk40t/core/exceptions.py +9 -9
  70. meerk40t/core/laserjob.py +220 -220
  71. meerk40t/core/logging.py +63 -63
  72. meerk40t/core/node/blobnode.py +83 -86
  73. meerk40t/core/node/bootstrap.py +105 -103
  74. meerk40t/core/node/branch_elems.py +40 -31
  75. meerk40t/core/node/branch_ops.py +45 -38
  76. meerk40t/core/node/branch_regmark.py +48 -41
  77. meerk40t/core/node/cutnode.py +29 -32
  78. meerk40t/core/node/effect_hatch.py +375 -257
  79. meerk40t/core/node/effect_warp.py +398 -0
  80. meerk40t/core/node/effect_wobble.py +441 -309
  81. meerk40t/core/node/elem_ellipse.py +404 -309
  82. meerk40t/core/node/elem_image.py +1082 -801
  83. meerk40t/core/node/elem_line.py +358 -292
  84. meerk40t/core/node/elem_path.py +259 -201
  85. meerk40t/core/node/elem_point.py +129 -102
  86. meerk40t/core/node/elem_polyline.py +310 -246
  87. meerk40t/core/node/elem_rect.py +376 -286
  88. meerk40t/core/node/elem_text.py +445 -418
  89. meerk40t/core/node/filenode.py +59 -40
  90. meerk40t/core/node/groupnode.py +138 -74
  91. meerk40t/core/node/image_processed.py +777 -766
  92. meerk40t/core/node/image_raster.py +156 -113
  93. meerk40t/core/node/layernode.py +31 -31
  94. meerk40t/core/node/mixins.py +135 -107
  95. meerk40t/core/node/node.py +1427 -1304
  96. meerk40t/core/node/nutils.py +117 -114
  97. meerk40t/core/node/op_cut.py +462 -335
  98. meerk40t/core/node/op_dots.py +296 -251
  99. meerk40t/core/node/op_engrave.py +414 -311
  100. meerk40t/core/node/op_image.py +755 -369
  101. meerk40t/core/node/op_raster.py +787 -522
  102. meerk40t/core/node/place_current.py +37 -40
  103. meerk40t/core/node/place_point.py +329 -126
  104. meerk40t/core/node/refnode.py +58 -47
  105. meerk40t/core/node/rootnode.py +225 -219
  106. meerk40t/core/node/util_console.py +48 -48
  107. meerk40t/core/node/util_goto.py +84 -65
  108. meerk40t/core/node/util_home.py +61 -61
  109. meerk40t/core/node/util_input.py +102 -102
  110. meerk40t/core/node/util_output.py +102 -102
  111. meerk40t/core/node/util_wait.py +65 -65
  112. meerk40t/core/parameters.py +709 -707
  113. meerk40t/core/planner.py +875 -785
  114. meerk40t/core/plotplanner.py +656 -652
  115. meerk40t/core/space.py +120 -113
  116. meerk40t/core/spoolers.py +706 -705
  117. meerk40t/core/svg_io.py +1836 -1549
  118. meerk40t/core/treeop.py +534 -445
  119. meerk40t/core/undos.py +278 -124
  120. meerk40t/core/units.py +784 -680
  121. meerk40t/core/view.py +393 -322
  122. meerk40t/core/webhelp.py +62 -62
  123. meerk40t/core/wordlist.py +513 -504
  124. meerk40t/cylinder/cylinder.py +247 -0
  125. meerk40t/cylinder/gui/cylindersettings.py +41 -0
  126. meerk40t/cylinder/gui/gui.py +24 -0
  127. meerk40t/device/__init__.py +1 -1
  128. meerk40t/device/basedevice.py +322 -123
  129. meerk40t/device/devicechoices.py +50 -0
  130. meerk40t/device/dummydevice.py +163 -128
  131. meerk40t/device/gui/defaultactions.py +618 -602
  132. meerk40t/device/gui/effectspanel.py +114 -0
  133. meerk40t/device/gui/formatterpanel.py +253 -290
  134. meerk40t/device/gui/warningpanel.py +337 -260
  135. meerk40t/device/mixins.py +13 -13
  136. meerk40t/dxf/__init__.py +1 -1
  137. meerk40t/dxf/dxf_io.py +766 -554
  138. meerk40t/dxf/plugin.py +47 -35
  139. meerk40t/external_plugins.py +79 -79
  140. meerk40t/external_plugins_build.py +28 -28
  141. meerk40t/extra/cag.py +112 -116
  142. meerk40t/extra/coolant.py +403 -0
  143. meerk40t/extra/encode_detect.py +198 -0
  144. meerk40t/extra/ezd.py +1165 -1165
  145. meerk40t/extra/hershey.py +835 -340
  146. meerk40t/extra/imageactions.py +322 -316
  147. meerk40t/extra/inkscape.py +630 -622
  148. meerk40t/extra/lbrn.py +424 -424
  149. meerk40t/extra/outerworld.py +284 -0
  150. meerk40t/extra/param_functions.py +1542 -1556
  151. meerk40t/extra/potrace.py +257 -253
  152. meerk40t/extra/serial_exchange.py +118 -0
  153. meerk40t/extra/updater.py +602 -453
  154. meerk40t/extra/vectrace.py +147 -146
  155. meerk40t/extra/winsleep.py +83 -83
  156. meerk40t/extra/xcs_reader.py +597 -0
  157. meerk40t/fill/fills.py +781 -335
  158. meerk40t/fill/patternfill.py +1061 -1061
  159. meerk40t/fill/patterns.py +614 -567
  160. meerk40t/grbl/control.py +87 -87
  161. meerk40t/grbl/controller.py +990 -903
  162. meerk40t/grbl/device.py +1081 -768
  163. meerk40t/grbl/driver.py +989 -771
  164. meerk40t/grbl/emulator.py +532 -497
  165. meerk40t/grbl/gcodejob.py +783 -767
  166. meerk40t/grbl/gui/grblconfiguration.py +373 -298
  167. meerk40t/grbl/gui/grblcontroller.py +485 -271
  168. meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
  169. meerk40t/grbl/gui/grbloperationconfig.py +105 -0
  170. meerk40t/grbl/gui/gui.py +147 -116
  171. meerk40t/grbl/interpreter.py +44 -44
  172. meerk40t/grbl/loader.py +22 -22
  173. meerk40t/grbl/mock_connection.py +56 -56
  174. meerk40t/grbl/plugin.py +294 -264
  175. meerk40t/grbl/serial_connection.py +93 -88
  176. meerk40t/grbl/tcp_connection.py +81 -79
  177. meerk40t/grbl/ws_connection.py +112 -0
  178. meerk40t/gui/__init__.py +1 -1
  179. meerk40t/gui/about.py +2042 -296
  180. meerk40t/gui/alignment.py +1644 -1608
  181. meerk40t/gui/autoexec.py +199 -0
  182. meerk40t/gui/basicops.py +791 -670
  183. meerk40t/gui/bufferview.py +77 -71
  184. meerk40t/gui/busy.py +170 -133
  185. meerk40t/gui/choicepropertypanel.py +1673 -1469
  186. meerk40t/gui/consolepanel.py +706 -542
  187. meerk40t/gui/devicepanel.py +687 -581
  188. meerk40t/gui/dialogoptions.py +110 -107
  189. meerk40t/gui/executejob.py +316 -306
  190. meerk40t/gui/fonts.py +90 -90
  191. meerk40t/gui/functionwrapper.py +252 -0
  192. meerk40t/gui/gui_mixins.py +729 -0
  193. meerk40t/gui/guicolors.py +205 -182
  194. meerk40t/gui/help_assets/help_assets.py +218 -201
  195. meerk40t/gui/helper.py +154 -0
  196. meerk40t/gui/hersheymanager.py +1430 -846
  197. meerk40t/gui/icons.py +3422 -2747
  198. meerk40t/gui/imagesplitter.py +555 -508
  199. meerk40t/gui/keymap.py +354 -344
  200. meerk40t/gui/laserpanel.py +892 -806
  201. meerk40t/gui/laserrender.py +1470 -1232
  202. meerk40t/gui/lasertoolpanel.py +805 -793
  203. meerk40t/gui/magnetoptions.py +436 -0
  204. meerk40t/gui/materialmanager.py +2917 -0
  205. meerk40t/gui/materialtest.py +1722 -1694
  206. meerk40t/gui/mkdebug.py +646 -359
  207. meerk40t/gui/mwindow.py +163 -140
  208. meerk40t/gui/navigationpanels.py +2605 -2467
  209. meerk40t/gui/notes.py +143 -142
  210. meerk40t/gui/opassignment.py +414 -410
  211. meerk40t/gui/operation_info.py +310 -299
  212. meerk40t/gui/plugin.py +494 -328
  213. meerk40t/gui/position.py +714 -669
  214. meerk40t/gui/preferences.py +901 -650
  215. meerk40t/gui/propertypanels/attributes.py +1461 -1131
  216. meerk40t/gui/propertypanels/blobproperty.py +117 -114
  217. meerk40t/gui/propertypanels/consoleproperty.py +83 -80
  218. meerk40t/gui/propertypanels/gotoproperty.py +77 -0
  219. meerk40t/gui/propertypanels/groupproperties.py +223 -217
  220. meerk40t/gui/propertypanels/hatchproperty.py +489 -469
  221. meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
  222. meerk40t/gui/propertypanels/inputproperty.py +59 -58
  223. meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
  224. meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
  225. meerk40t/gui/propertypanels/outputproperty.py +59 -58
  226. meerk40t/gui/propertypanels/pathproperty.py +389 -380
  227. meerk40t/gui/propertypanels/placementproperty.py +1214 -383
  228. meerk40t/gui/propertypanels/pointproperty.py +140 -136
  229. meerk40t/gui/propertypanels/propertywindow.py +313 -181
  230. meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
  231. meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
  232. meerk40t/gui/propertypanels/textproperty.py +770 -755
  233. meerk40t/gui/propertypanels/waitproperty.py +56 -55
  234. meerk40t/gui/propertypanels/warpproperty.py +121 -0
  235. meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
  236. meerk40t/gui/ribbon.py +2468 -2210
  237. meerk40t/gui/scene/scene.py +1100 -1051
  238. meerk40t/gui/scene/sceneconst.py +22 -22
  239. meerk40t/gui/scene/scenepanel.py +439 -349
  240. meerk40t/gui/scene/scenespacewidget.py +365 -365
  241. meerk40t/gui/scene/widget.py +518 -505
  242. meerk40t/gui/scenewidgets/affinemover.py +215 -215
  243. meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
  244. meerk40t/gui/scenewidgets/bedwidget.py +120 -97
  245. meerk40t/gui/scenewidgets/elementswidget.py +137 -107
  246. meerk40t/gui/scenewidgets/gridwidget.py +785 -745
  247. meerk40t/gui/scenewidgets/guidewidget.py +765 -765
  248. meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
  249. meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
  250. meerk40t/gui/scenewidgets/nodeselector.py +28 -28
  251. meerk40t/gui/scenewidgets/rectselectwidget.py +589 -346
  252. meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
  253. meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
  254. meerk40t/gui/scenewidgets/selectionwidget.py +2952 -2756
  255. meerk40t/gui/simpleui.py +357 -333
  256. meerk40t/gui/simulation.py +2431 -2094
  257. meerk40t/gui/snapoptions.py +208 -203
  258. meerk40t/gui/spoolerpanel.py +1227 -1180
  259. meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
  260. meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
  261. meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
  262. meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
  263. meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
  264. meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
  265. meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
  266. meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
  267. meerk40t/gui/themes.py +200 -78
  268. meerk40t/gui/tips.py +591 -0
  269. meerk40t/gui/toolwidgets/circlebrush.py +35 -35
  270. meerk40t/gui/toolwidgets/toolcircle.py +248 -242
  271. meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
  272. meerk40t/gui/toolwidgets/tooldraw.py +97 -90
  273. meerk40t/gui/toolwidgets/toolellipse.py +219 -212
  274. meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
  275. meerk40t/gui/toolwidgets/toolline.py +39 -144
  276. meerk40t/gui/toolwidgets/toollinetext.py +79 -236
  277. meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
  278. meerk40t/gui/toolwidgets/toolmeasure.py +160 -216
  279. meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
  280. meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
  281. meerk40t/gui/toolwidgets/toolparameter.py +754 -668
  282. meerk40t/gui/toolwidgets/toolplacement.py +108 -108
  283. meerk40t/gui/toolwidgets/toolpoint.py +68 -59
  284. meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
  285. meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
  286. meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
  287. meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
  288. meerk40t/gui/toolwidgets/toolrect.py +211 -207
  289. meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
  290. meerk40t/gui/toolwidgets/toolribbon.py +598 -113
  291. meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
  292. meerk40t/gui/toolwidgets/tooltext.py +98 -89
  293. meerk40t/gui/toolwidgets/toolvector.py +213 -204
  294. meerk40t/gui/toolwidgets/toolwidget.py +39 -39
  295. meerk40t/gui/usbconnect.py +98 -91
  296. meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
  297. meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
  298. meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
  299. meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
  300. meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
  301. meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
  302. meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
  303. meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
  304. meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
  305. meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
  306. meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
  307. meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
  308. meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
  309. meerk40t/gui/wordlisteditor.py +985 -931
  310. meerk40t/gui/wxmeerk40t.py +1444 -1169
  311. meerk40t/gui/wxmmain.py +5578 -4112
  312. meerk40t/gui/wxmribbon.py +1591 -1076
  313. meerk40t/gui/wxmscene.py +1635 -1453
  314. meerk40t/gui/wxmtree.py +2410 -2089
  315. meerk40t/gui/wxutils.py +1769 -1099
  316. meerk40t/gui/zmatrix.py +102 -102
  317. meerk40t/image/__init__.py +1 -1
  318. meerk40t/image/dither.py +429 -0
  319. meerk40t/image/imagetools.py +2778 -2269
  320. meerk40t/internal_plugins.py +150 -130
  321. meerk40t/kernel/__init__.py +63 -12
  322. meerk40t/kernel/channel.py +259 -212
  323. meerk40t/kernel/context.py +538 -538
  324. meerk40t/kernel/exceptions.py +41 -41
  325. meerk40t/kernel/functions.py +463 -414
  326. meerk40t/kernel/jobs.py +100 -100
  327. meerk40t/kernel/kernel.py +3809 -3571
  328. meerk40t/kernel/lifecycles.py +71 -71
  329. meerk40t/kernel/module.py +49 -49
  330. meerk40t/kernel/service.py +147 -147
  331. meerk40t/kernel/settings.py +383 -343
  332. meerk40t/lihuiyu/controller.py +883 -876
  333. meerk40t/lihuiyu/device.py +1181 -1069
  334. meerk40t/lihuiyu/driver.py +1466 -1372
  335. meerk40t/lihuiyu/gui/gui.py +127 -106
  336. meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
  337. meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
  338. meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
  339. meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
  340. meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
  341. meerk40t/lihuiyu/interpreter.py +53 -53
  342. meerk40t/lihuiyu/laserspeed.py +450 -450
  343. meerk40t/lihuiyu/loader.py +90 -90
  344. meerk40t/lihuiyu/parser.py +404 -404
  345. meerk40t/lihuiyu/plugin.py +101 -102
  346. meerk40t/lihuiyu/tcp_connection.py +111 -109
  347. meerk40t/main.py +231 -165
  348. meerk40t/moshi/builder.py +788 -781
  349. meerk40t/moshi/controller.py +505 -499
  350. meerk40t/moshi/device.py +495 -442
  351. meerk40t/moshi/driver.py +862 -696
  352. meerk40t/moshi/gui/gui.py +78 -76
  353. meerk40t/moshi/gui/moshicontrollergui.py +538 -522
  354. meerk40t/moshi/gui/moshidrivergui.py +87 -75
  355. meerk40t/moshi/plugin.py +43 -43
  356. meerk40t/network/console_server.py +102 -57
  357. meerk40t/network/kernelserver.py +10 -9
  358. meerk40t/network/tcp_server.py +142 -140
  359. meerk40t/network/udp_server.py +103 -77
  360. meerk40t/network/web_server.py +390 -0
  361. meerk40t/newly/controller.py +1158 -1144
  362. meerk40t/newly/device.py +874 -732
  363. meerk40t/newly/driver.py +540 -412
  364. meerk40t/newly/gui/gui.py +219 -188
  365. meerk40t/newly/gui/newlyconfig.py +116 -101
  366. meerk40t/newly/gui/newlycontroller.py +193 -186
  367. meerk40t/newly/gui/operationproperties.py +51 -51
  368. meerk40t/newly/mock_connection.py +82 -82
  369. meerk40t/newly/newly_params.py +56 -56
  370. meerk40t/newly/plugin.py +1214 -1246
  371. meerk40t/newly/usb_connection.py +322 -322
  372. meerk40t/rotary/gui/gui.py +52 -46
  373. meerk40t/rotary/gui/rotarysettings.py +240 -232
  374. meerk40t/rotary/rotary.py +202 -98
  375. meerk40t/ruida/control.py +291 -91
  376. meerk40t/ruida/controller.py +138 -1088
  377. meerk40t/ruida/device.py +672 -231
  378. meerk40t/ruida/driver.py +534 -472
  379. meerk40t/ruida/emulator.py +1494 -1491
  380. meerk40t/ruida/exceptions.py +4 -4
  381. meerk40t/ruida/gui/gui.py +71 -76
  382. meerk40t/ruida/gui/ruidaconfig.py +239 -72
  383. meerk40t/ruida/gui/ruidacontroller.py +187 -184
  384. meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
  385. meerk40t/ruida/loader.py +54 -52
  386. meerk40t/ruida/mock_connection.py +57 -109
  387. meerk40t/ruida/plugin.py +124 -87
  388. meerk40t/ruida/rdjob.py +2084 -945
  389. meerk40t/ruida/serial_connection.py +116 -0
  390. meerk40t/ruida/tcp_connection.py +146 -0
  391. meerk40t/ruida/udp_connection.py +73 -0
  392. meerk40t/svgelements.py +9671 -9669
  393. meerk40t/tools/driver_to_path.py +584 -579
  394. meerk40t/tools/geomstr.py +5583 -4680
  395. meerk40t/tools/jhfparser.py +357 -292
  396. meerk40t/tools/kerftest.py +904 -890
  397. meerk40t/tools/livinghinges.py +1168 -1033
  398. meerk40t/tools/pathtools.py +987 -949
  399. meerk40t/tools/pmatrix.py +234 -0
  400. meerk40t/tools/pointfinder.py +942 -942
  401. meerk40t/tools/polybool.py +940 -940
  402. meerk40t/tools/rasterplotter.py +1660 -547
  403. meerk40t/tools/shxparser.py +989 -901
  404. meerk40t/tools/ttfparser.py +726 -446
  405. meerk40t/tools/zinglplotter.py +595 -593
  406. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/LICENSE +21 -21
  407. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/METADATA +150 -139
  408. meerk40t-0.9.7010.dist-info/RECORD +445 -0
  409. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/WHEEL +1 -1
  410. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/top_level.txt +0 -1
  411. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/zip-safe +1 -1
  412. meerk40t/balormk/elementlightjob.py +0 -159
  413. meerk40t-0.9.3001.dist-info/RECORD +0 -437
  414. test/bootstrap.py +0 -63
  415. test/test_cli.py +0 -12
  416. test/test_core_cutcode.py +0 -418
  417. test/test_core_elements.py +0 -144
  418. test/test_core_plotplanner.py +0 -397
  419. test/test_core_viewports.py +0 -312
  420. test/test_drivers_grbl.py +0 -108
  421. test/test_drivers_lihuiyu.py +0 -443
  422. test/test_drivers_newly.py +0 -113
  423. test/test_element_degenerate_points.py +0 -43
  424. test/test_elements_classify.py +0 -97
  425. test/test_elements_penbox.py +0 -22
  426. test/test_file_svg.py +0 -176
  427. test/test_fill.py +0 -155
  428. test/test_geomstr.py +0 -1523
  429. test/test_geomstr_nodes.py +0 -18
  430. test/test_imagetools_actualize.py +0 -306
  431. test/test_imagetools_wizard.py +0 -258
  432. test/test_kernel.py +0 -200
  433. test/test_laser_speeds.py +0 -3303
  434. test/test_length.py +0 -57
  435. test/test_lifecycle.py +0 -66
  436. test/test_operations.py +0 -251
  437. test/test_operations_hatch.py +0 -57
  438. test/test_ruida.py +0 -19
  439. test/test_spooler.py +0 -22
  440. test/test_tools_rasterplotter.py +0 -29
  441. test/test_wobble.py +0 -133
  442. test/test_zingl.py +0 -124
  443. {test → meerk40t/cylinder}/__init__.py +0 -0
  444. /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
  445. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/entry_points.txt +0 -0
@@ -1,650 +1,901 @@
1
- #
2
- # generated by wxGlade 0.9.3 on Thu Jun 27 21:45:40 2019
3
- #
4
- import platform
5
-
6
- import wx
7
-
8
- from meerk40t.kernel.kernel import signal_listener
9
-
10
- from .choicepropertypanel import ChoicePropertyPanel
11
- from .icons import icons8_administrative_tools
12
- from .mwindow import MWindow
13
- from .wxmribbon import RibbonEditor
14
- from .wxutils import StaticBoxSizer, TextCtrl
15
-
16
- _ = wx.GetTranslation
17
-
18
-
19
- class PreferencesUnitsPanel(wx.Panel):
20
- def __init__(self, *args, context=None, **kwds):
21
- # begin wxGlade: PreferencesUnitsPanel.__init__
22
- kwds["style"] = kwds.get("style", 0)
23
- wx.Panel.__init__(self, *args, **kwds)
24
- self.context = context
25
-
26
- sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
27
-
28
- self.radio_units = wx.RadioBox(
29
- self,
30
- wx.ID_ANY,
31
- _("Units"),
32
- choices=["mm", "cm", "inch", "mils"],
33
- majorDimension=1,
34
- style=wx.RA_SPECIFY_ROWS,
35
- )
36
- self.radio_units.SetToolTip(_("Set default units for guides"))
37
- sizer_1.Add(self.radio_units, 0, wx.EXPAND, 0)
38
-
39
- self.SetSizer(sizer_1)
40
-
41
- self.Layout()
42
-
43
- self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
44
-
45
- self.radio_units.SetSelection(self._get_units_index())
46
-
47
- def on_radio_units(self, event):
48
- if event.Int == 0:
49
- self.set_mm()
50
- elif event.Int == 1:
51
- self.set_cm()
52
- elif event.Int == 2:
53
- self.set_inch()
54
- elif event.Int == 3:
55
- self.set_mil()
56
-
57
- def _get_units_index(self):
58
- p = self.context.root
59
- units = p.units_name
60
- if units == "mm":
61
- return 0
62
- if units == "cm":
63
- return 1
64
- if units in ("in", "inch", "inches"):
65
- return 2
66
- if units == "mil":
67
- return 3
68
- return 0
69
-
70
- def set_inch(self):
71
- p = self.context.root
72
- p.units_name = "inch"
73
- p.signal("units", p.units_name)
74
-
75
- def set_mil(self):
76
- p = self.context.root
77
- p.units_name = "mil"
78
- p.signal("units", p.units_name)
79
-
80
- def set_cm(self):
81
- p = self.context.root
82
- p.units_name = "cm"
83
- p.signal("units", p.units_name)
84
-
85
- def set_mm(self):
86
- p = self.context.root
87
- p.units_name = "mm"
88
- p.signal("units", p.units_name)
89
-
90
-
91
- # end of class PreferencesUnitsPanel
92
-
93
-
94
- class PreferencesLanguagePanel(wx.Panel):
95
- def __init__(self, *args, context=None, **kwds):
96
- # begin wxGlade: PreferencesLanguagePanel.__init__
97
- kwds["style"] = kwds.get("style", 0)
98
- wx.Panel.__init__(self, *args, **kwds)
99
- self.context = context
100
-
101
- sizer_2 = StaticBoxSizer(self, wx.ID_ANY, _("Language"), wx.HORIZONTAL)
102
- from .wxmeerk40t import supported_languages
103
-
104
- choices = [
105
- language_name
106
- for language_code, language_name, language_index in supported_languages
107
- ]
108
- self.combo_language = wx.ComboBox(
109
- self, wx.ID_ANY, choices=choices, style=wx.CB_READONLY
110
- )
111
- self.combo_language.SetToolTip(
112
- _("Select the desired language to use (requires a restart to take effect).")
113
- )
114
- sizer_2.Add(self.combo_language, 0, wx.ALIGN_CENTER_VERTICAL, 0)
115
-
116
- self.SetSizer(sizer_2)
117
-
118
- self.Layout()
119
-
120
- self.context.setting(int, "language", 0)
121
-
122
- self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
123
- # end wxGlade
124
- self.combo_language.SetSelection(self.context.language)
125
-
126
- def on_combo_language(self, event=None):
127
- lang = self.combo_language.GetSelection()
128
- if lang != -1 and self.context.app is not None:
129
- self.context.app.update_language(lang)
130
- self.context.signal("restart")
131
-
132
-
133
- # end of class PreferencesLanguagePanel
134
-
135
-
136
- class PreferencesSavingPanel(wx.Panel):
137
- def __init__(self, *args, context=None, **kwds):
138
- # begin wxGlade: PreferencesLanguagePanel.__init__
139
- kwds["style"] = kwds.get("style", 0)
140
- wx.Panel.__init__(self, *args, **kwds)
141
- self.context = context
142
-
143
- main_sizer = StaticBoxSizer(self, wx.ID_ANY, _("Management"), wx.HORIZONTAL)
144
- self.button_save = wx.Button(self, wx.ID_ANY, _("Save"))
145
- self.button_save.SetToolTip(_("Immediately save the settings to disk"))
146
- self.button_export = wx.Button(self, wx.ID_ANY, _("Export"))
147
- self.button_export.SetToolTip(
148
- _("Export the current settings to a different location")
149
- )
150
- self.button_import = wx.Button(self, wx.ID_ANY, _("Import"))
151
- self.button_import.SetToolTip(_("Import a previously saved setting file"))
152
- main_sizer.Add(self.button_save, 0, wx.ALIGN_CENTER_VERTICAL, 0)
153
- self.Bind(wx.EVT_BUTTON, self.on_button_save, self.button_save)
154
- main_sizer.AddStretchSpacer(1)
155
- main_sizer.Add(self.button_export, 0, wx.ALIGN_CENTER_VERTICAL, 0)
156
- main_sizer.Add(self.button_import, 0, wx.ALIGN_CENTER_VERTICAL, 0)
157
-
158
- self.SetSizer(main_sizer)
159
- self.Layout()
160
- self.Bind(wx.EVT_BUTTON, self.on_button_save, self.button_save)
161
- self.Bind(wx.EVT_BUTTON, self.on_button_import, self.button_import)
162
- self.Bind(wx.EVT_BUTTON, self.on_button_export, self.button_export)
163
-
164
- def on_button_save(self, event=None):
165
- self.context("flush\n")
166
-
167
- def on_button_export(self, event=None):
168
- dlg = wx.DirDialog(
169
- self,
170
- _("Choose target directory:"),
171
- style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST,
172
- )
173
-
174
- if dlg.ShowModal() == wx.ID_OK:
175
- self.context(f"setting_export {dlg.GetPath()}\n")
176
- wx.MessageBox(_("Export completed"), _("Info"), wx.OK | wx.ICON_INFORMATION)
177
-
178
- dlg.Destroy()
179
-
180
- def on_button_import(self, event=None):
181
- message = _("This will import a previously saved configuration file!") + "\n"
182
- message += (
183
- _(
184
- "This may make MeerK40t unworkable if the file does not have the right format!"
185
- )
186
- + "\n"
187
- )
188
- message += _("You do this at you own risk - are you really sure?")
189
- caption = _("Warning")
190
- dlg = wx.MessageDialog(
191
- self,
192
- message,
193
- caption,
194
- wx.YES_NO | wx.ICON_WARNING,
195
- )
196
- dlgresult = dlg.ShowModal()
197
- dlg.Destroy()
198
- if dlgresult != wx.ID_YES:
199
- return
200
- dlg = wx.FileDialog(
201
- self,
202
- message=_("Choose a previously saved configuration-file"),
203
- wildcard="Meerk40t-Config-Files (*.cfg)|*.cfg|All files (*.*)|*.*",
204
- style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW,
205
- )
206
- dlgresult = dlg.ShowModal()
207
- if dlgresult == wx.ID_YES:
208
- myfile = dlg.GetPath()
209
- dlg.Destroy()
210
- else:
211
- dlg.Destroy()
212
- return
213
-
214
- self.context(f"setting_import {myfile}\n")
215
- wx.MessageBox(_("Import completed"), _("Info"), wx.OK | wx.ICON_INFORMATION)
216
-
217
-
218
- class PreferencesPixelsPerInchPanel(wx.Panel):
219
- def __init__(self, *args, context=None, **kwds):
220
- # begin wxGlade: PreferencesPixelsPerInchPanel.__init__
221
- kwds["style"] = kwds.get("style", 0)
222
- wx.Panel.__init__(self, *args, **kwds)
223
- self.context = context
224
-
225
- sizer_3 = StaticBoxSizer(
226
- self, wx.ID_ANY, _("SVG Pixel Per Inch"), wx.HORIZONTAL
227
- )
228
-
229
- self.combo_svg_ppi = wx.ComboBox(
230
- self,
231
- wx.ID_ANY,
232
- choices=[
233
- _("96 px/in Inkscape"),
234
- _("72 px/in Illustrator"),
235
- _("90 px/in Old Inkscape"),
236
- _("Custom"),
237
- ],
238
- style=wx.CB_READONLY,
239
- )
240
- self.combo_svg_ppi.SetToolTip(
241
- _("Select the Pixels Per Inch to use when loading an SVG file")
242
- )
243
- sizer_3.Add(self.combo_svg_ppi, 0, wx.ALIGN_CENTER_VERTICAL, 0)
244
-
245
- sizer_3.Add((20, 20), 0, 0, 0)
246
-
247
- self.text_svg_ppi = TextCtrl(
248
- self, wx.ID_ANY, "", check="float", style=wx.TE_PROCESS_ENTER, limited=True
249
- )
250
- self.text_svg_ppi.SetToolTip(
251
- _("Custom Pixels Per Inch to use when loading an SVG file")
252
- )
253
- sizer_3.Add(self.text_svg_ppi, 1, wx.EXPAND, 0)
254
-
255
- self.SetSizer(sizer_3)
256
-
257
- self.Layout()
258
-
259
- self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
260
- self.text_svg_ppi.SetActionRoutine(self.on_text_svg_ppi)
261
- # end wxGlade
262
-
263
- context.elements.setting(float, "svg_ppi", 96.0)
264
- self.text_svg_ppi.SetValue(str(context.elements.svg_ppi))
265
- self.on_text_svg_ppi()
266
-
267
- def on_combo_svg_ppi(self, event=None):
268
- elements = self.context.elements
269
- ppi = self.combo_svg_ppi.GetSelection()
270
- if ppi == 0:
271
- elements.svg_ppi = 96.0
272
- elif ppi == 1:
273
- elements.svg_ppi = 72.0
274
- elif ppi == 2:
275
- elements.svg_ppi = 90.0
276
- else:
277
- elements.svg_ppi = 96.0
278
- self.text_svg_ppi.SetValue(str(elements.svg_ppi))
279
-
280
- def on_text_svg_ppi(self):
281
- elements = self.context.elements
282
- try:
283
- svg_ppi = float(self.text_svg_ppi.GetValue())
284
- except ValueError:
285
- return
286
- if svg_ppi == 96:
287
- if self.combo_svg_ppi.GetSelection() != 0:
288
- self.combo_svg_ppi.SetSelection(0)
289
- elif svg_ppi == 72:
290
- if self.combo_svg_ppi.GetSelection() != 1:
291
- self.combo_svg_ppi.SetSelection(1)
292
- elif svg_ppi == 90:
293
- if self.combo_svg_ppi.GetSelection() != 2:
294
- self.combo_svg_ppi.SetSelection(2)
295
- else:
296
- if self.combo_svg_ppi.GetSelection() != 3:
297
- self.combo_svg_ppi.SetSelection(3)
298
- elements.svg_ppi = svg_ppi
299
-
300
-
301
- # end of class PreferencesPixelsPerInchPanel
302
-
303
-
304
- class PreferencesMain(wx.Panel):
305
- def __init__(self, *args, context=None, **kwds):
306
- # begin wxGlade: PreferencesMain.__init__
307
- kwds["style"] = kwds.get("style", 0)
308
- wx.Panel.__init__(self, *args, **kwds)
309
- self.context = None
310
-
311
- sizer_main = wx.BoxSizer(wx.VERTICAL)
312
-
313
- self.panel_units = PreferencesUnitsPanel(self, wx.ID_ANY, context=context)
314
- sizer_main.Add(self.panel_units, 0, wx.EXPAND, 0)
315
-
316
- self.panel_language = PreferencesLanguagePanel(self, wx.ID_ANY, context=context)
317
- sizer_main.Add(self.panel_language, 0, wx.EXPAND, 0)
318
-
319
- self.panel_ppi = PreferencesPixelsPerInchPanel(self, wx.ID_ANY, context=context)
320
- sizer_main.Add(self.panel_ppi, 0, wx.EXPAND, 0)
321
-
322
- self.panel_pref1 = ChoicePropertyPanel(
323
- self,
324
- id=wx.ID_ANY,
325
- context=context,
326
- choices="preferences",
327
- constraint=("-Classification", "-Gui", "-Scene"),
328
- )
329
- sizer_main.Add(self.panel_pref1, 1, wx.EXPAND, 0)
330
-
331
- self.panel_management = PreferencesSavingPanel(self, wx.ID_ANY, context=context)
332
- sizer_main.Add(self.panel_management, 0, wx.EXPAND, 0)
333
-
334
- self.SetSizer(sizer_main)
335
-
336
- self.Layout()
337
- # end wxGlade
338
-
339
- def delegates(self):
340
- yield self.panel_ppi
341
- yield self.panel_language
342
- yield self.panel_units
343
- yield self.panel_pref1
344
- yield self.panel_management
345
-
346
-
347
- # end of class PreferencesMain
348
-
349
- #
350
- # class PreferencesPanel(wx.Panel):
351
- # def __init__(self, *args, context=None, **kwds):
352
- # # begin wxGlade: PreferencesPanel.__init__
353
- # kwds["style"] = kwds.get("style", 0)
354
- # wx.Panel.__init__(self, *args, **kwds)
355
- # self.context = context
356
- #
357
- # sizer_settings = wx.BoxSizer(wx.VERTICAL)
358
- #
359
- # self.panel_main = PreferencesMain(self, wx.ID_ANY, context=context)
360
- # sizer_settings.Add(self.panel_main, 1, wx.EXPAND, 0)
361
- #
362
- # self.SetSizer(sizer_settings)
363
- #
364
- # self.Layout()
365
- # # end wxGlade
366
- #
367
- # def delegates(self):
368
- # yield self.panel_main
369
-
370
-
371
- class Preferences(MWindow):
372
- def __init__(self, *args, **kwds):
373
- super().__init__(
374
- 525,
375
- 605,
376
- *args,
377
- style=wx.CAPTION
378
- | wx.CLOSE_BOX
379
- | wx.FRAME_FLOAT_ON_PARENT
380
- | wx.TAB_TRAVERSAL
381
- | (wx.RESIZE_BORDER if platform.system() != "Darwin" else 0),
382
- **kwds,
383
- )
384
- self.notebook_main = wx.aui.AuiNotebook(
385
- self,
386
- -1,
387
- style=wx.aui.AUI_NB_TAB_EXTERNAL_MOVE
388
- | wx.aui.AUI_NB_SCROLL_BUTTONS
389
- | wx.aui.AUI_NB_TAB_SPLIT
390
- | wx.aui.AUI_NB_TAB_MOVE,
391
- )
392
-
393
- # self.panel_main = PreferencesPanel(self, wx.ID_ANY, context=self.context)
394
- self.panel_main = PreferencesMain(self, wx.ID_ANY, context=self.context)
395
- inject_choices = [
396
- {
397
- "attr": "preset_classify_automatic",
398
- "object": self,
399
- "default": False,
400
- "type": bool,
401
- "style": "button",
402
- "label": _("Automatic"),
403
- "tip": _("Set options for a good automatic experience"),
404
- "page": "Classification",
405
- "section": "_AA_Presets",
406
- "subsection": "_0_",
407
- },
408
- {
409
- "attr": "preset_classify_manual",
410
- "object": self,
411
- "default": False,
412
- "type": bool,
413
- "style": "button",
414
- "label": _("Manual"),
415
- "tip": _("Set options for complete manual control"),
416
- "page": "Classification",
417
- "section": "_AA_Presets",
418
- "subsection": "_0_",
419
- },
420
- {
421
- "attr": "dummy",
422
- "default": "dummy",
423
- "object": self,
424
- "type": str,
425
- "style": "info",
426
- "label": _(
427
- "Classification is the (automatic) process of assigning an element to an operation."
428
- )
429
- + "\n"
430
- + _("That link between element and operation is called an assignment."),
431
- "page": "Classification",
432
- # "section": "_000_Information",
433
- },
434
- ]
435
- self.presets = [
436
- # object, property, automatic, manual
437
- (self.context.elements, "operation_default_empty", False, True),
438
- (self.context.elements, "classify_reverse", False, False),
439
- (self.context.elements, "classify_new", True, False),
440
- (self.context.elements, "classify_fuzzy", True, True),
441
- (self.context.elements, "classify_fuzzydistance", 100, 100),
442
- (self.context.elements, "classify_black_as_raster", True, True),
443
- (self.context.elements, "classify_default", True, False),
444
- (self.context.elements, "classify_autogenerate", True, False),
445
- # (self.context.elements, "classify_auto_inherit", False, True),
446
- (self.context.elements, "classify_on_color", True, False),
447
- (self.context.elements, "classify_autogenerate_both", True, True),
448
- ]
449
- self.panel_classification = ChoicePropertyPanel(
450
- self,
451
- id=wx.ID_ANY,
452
- context=self.context,
453
- choices="preferences",
454
- constraint="Classification",
455
- injector=inject_choices,
456
- )
457
- self.panel_classification.SetupScrolling()
458
-
459
- self.panel_gui = ChoicePropertyPanel(
460
- self,
461
- id=wx.ID_ANY,
462
- context=self.context,
463
- choices="preferences",
464
- constraint="Gui",
465
- )
466
- self.panel_gui.SetupScrolling()
467
-
468
- self.panel_scene = ChoicePropertyPanel(
469
- self,
470
- id=wx.ID_ANY,
471
- context=self.context,
472
- choices="preferences",
473
- constraint="Scene",
474
- )
475
- self.panel_scene.SetupScrolling()
476
-
477
- main_scene = getattr(self.context.root, "mainscene", None)
478
- color_choices = []
479
- local_default_color = []
480
- for key, value in main_scene.colors.__dict__.items():
481
- if not key.startswith("_") and isinstance(value, str):
482
- local_default_color.append(key)
483
- local_default_color.sort()
484
- section = ""
485
- for key in local_default_color:
486
- # Try to make a sensible name out of it
487
- keyname = key.replace("_", " ")
488
- idx = 1 # Intentionally
489
- while idx < len(keyname):
490
- if keyname[idx] in "0123456789" and keyname[idx - 1] != " ":
491
- keyname = keyname[:idx] + " " + keyname[idx:]
492
- idx += 1
493
- keyname = keyname[0].upper() + keyname[1:]
494
- words = keyname.split()
495
- possible_section = words[0]
496
- if possible_section[0:2] != section[0:2]:
497
- section = possible_section
498
- color_choices.append(
499
- {
500
- "attr": f"color_{key}",
501
- "object": main_scene.colors,
502
- "default": main_scene.colors[key],
503
- "type": str,
504
- "style": "color", # hexa representation
505
- "label": keyname,
506
- "section": section,
507
- "signals": ("refresh_scene", "theme"),
508
- }
509
- )
510
-
511
- color_choices.append(
512
- {
513
- "attr": "color_reset",
514
- "object": self,
515
- "type": bool,
516
- "style": "button",
517
- "label": _("Reset Colors to Default"),
518
- "section": "_ZZ_",
519
- }
520
- )
521
-
522
- self.panel_color = ChoicePropertyPanel(
523
- self,
524
- id=wx.ID_ANY,
525
- context=self.context,
526
- choices=color_choices,
527
- entries_per_column=12,
528
- )
529
- self.panel_color.SetupScrolling()
530
-
531
- self.panel_ribbon = RibbonEditor(self, wx.ID_ANY, context=self.context)
532
-
533
- self.notebook_main.AddPage(self.panel_main, _("General"))
534
- self.notebook_main.AddPage(self.panel_classification, _("Classification"))
535
- self.notebook_main.AddPage(self.panel_gui, _("GUI"))
536
- self.notebook_main.AddPage(self.panel_scene, _("Scene"))
537
- self.notebook_main.AddPage(self.panel_color, _("Colors"))
538
- self.notebook_main.AddPage(self.panel_ribbon, _("Ribbon"))
539
-
540
- self.panels = [
541
- self.panel_main,
542
- self.panel_classification,
543
- self.panel_gui,
544
- self.panel_scene,
545
- self.panel_color,
546
- self.panel_ribbon,
547
- ]
548
- self.panel_ids = ["main", "classification", "gui", "scene", "color", "ribbon"]
549
- self.context.setting(bool, "developer_mode", False)
550
- if self.context.developer_mode:
551
- panel_space = ChoicePropertyPanel(
552
- self, wx.ID_ANY, context=self.context, choices="space"
553
- )
554
- self.notebook_main.AddPage(panel_space, _("Coordinate Space"))
555
- self.panels.append(panel_space)
556
- self.panel_ids.append("space")
557
- self.Layout()
558
-
559
- _icon = wx.NullIcon
560
- _icon.CopyFromBitmap(icons8_administrative_tools.GetBitmap())
561
- self.SetIcon(_icon)
562
- self.SetTitle(_("Preferences"))
563
-
564
- @signal_listener("preferences")
565
- def on_pref_signal(self, origin, *args):
566
- if not args:
567
- return
568
- panel = args[0]
569
- if panel and panel in self.panel_ids:
570
- self.Show()
571
- self.notebook_main.SetSelection(self.panel_ids.index(panel))
572
-
573
- @property
574
- def color_reset(self):
575
- # Not relevant
576
- return False
577
-
578
- @color_reset.setter
579
- def color_reset(self, value):
580
- if value:
581
- # We are resetting all GUI.colors
582
- self.context("scene color unset\n")
583
- self.context.signal("theme", True)
584
-
585
- @property
586
- def preset_classify_manual(self):
587
- # Not relevant
588
- return False
589
-
590
- @preset_classify_manual.setter
591
- def preset_classify_manual(self, value):
592
- if value:
593
- # We are setting presets for a couple of parameters
594
- for preset in self.presets:
595
- setattr(preset[0], preset[1], preset[3])
596
- self.context.signal(preset[1], preset[3], preset[0])
597
-
598
- @property
599
- def preset_classify_automatic(self):
600
- # Not relevant
601
- return False
602
-
603
- @preset_classify_automatic.setter
604
- def preset_classify_automatic(self, value):
605
- if value:
606
- # We are setting presets for a couple of parameters
607
- for preset in self.presets:
608
- setattr(preset[0], preset[1], preset[2])
609
- self.context.signal(preset[1], preset[2], preset[0])
610
-
611
- def delegates(self):
612
- yield from self.panels
613
-
614
- @staticmethod
615
- def sub_register(kernel):
616
- import platform
617
-
618
- if platform.system() != "Darwin":
619
- kernel.register(
620
- "button/config/Preferences",
621
- {
622
- "label": _("Preferences"),
623
- "icon": icons8_administrative_tools,
624
- "tip": _("Opens Preferences Window"),
625
- "action": lambda v: kernel.console("window toggle Preferences\n"),
626
- },
627
- )
628
-
629
- def window_open(self):
630
- pass
631
-
632
- def window_close(self):
633
- pass
634
-
635
- @staticmethod
636
- def menu_label():
637
- return _("Pr&eferences...\tCtrl-,")
638
-
639
- @staticmethod
640
- def menu_tip():
641
- return _("Show/Hide the Preferences window")
642
-
643
- @staticmethod
644
- def menu_id():
645
- return wx.ID_PREFERENCES
646
-
647
- @staticmethod
648
- def submenu():
649
- # suppress in tool-menu
650
- return "", "Preferences", True
1
+ #
2
+ # generated by wxGlade 0.9.3 on Thu Jun 27 21:45:40 2019
3
+ #
4
+ import platform
5
+
6
+ import wx
7
+
8
+ from meerk40t.kernel.kernel import signal_listener
9
+
10
+ from .choicepropertypanel import ChoicePropertyPanel
11
+ from .icons import icons8_administrative_tools
12
+ from .mwindow import MWindow
13
+ from .wxmribbon import RibbonEditor
14
+ from .wxutils import (
15
+ StaticBoxSizer,
16
+ TextCtrl,
17
+ dip_size,
18
+ wxButton,
19
+ wxComboBox,
20
+ wxRadioBox,
21
+ )
22
+
23
+ _ = wx.GetTranslation
24
+
25
+
26
+ class PreferencesUnitsPanel(wx.Panel):
27
+ def __init__(self, *args, context=None, **kwds):
28
+ # begin wxGlade: PreferencesUnitsPanel.__init__
29
+ kwds["style"] = kwds.get("style", 0)
30
+ wx.Panel.__init__(self, *args, **kwds)
31
+ self.context = context
32
+ self.context.themes.set_window_colors(self)
33
+
34
+ sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
35
+
36
+ self.radio_units = wxRadioBox(
37
+ self,
38
+ wx.ID_ANY,
39
+ _("Units"),
40
+ choices=["mm", "cm", "inch", "mils"],
41
+ majorDimension=1,
42
+ style=wx.RA_SPECIFY_ROWS,
43
+ )
44
+ self.radio_units.SetToolTip(_("Set default units for guides"))
45
+ sizer_1.Add(self.radio_units, 0, wx.EXPAND, 0)
46
+
47
+ self.SetSizer(sizer_1)
48
+
49
+ self.Layout()
50
+
51
+ self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
52
+
53
+ self.radio_units.SetSelection(self._get_units_index())
54
+
55
+ def on_radio_units(self, event):
56
+ if event.Int == 0:
57
+ self.set_mm()
58
+ elif event.Int == 1:
59
+ self.set_cm()
60
+ elif event.Int == 2:
61
+ self.set_inch()
62
+ elif event.Int == 3:
63
+ self.set_mil()
64
+
65
+ def _get_units_index(self):
66
+ p = self.context.root
67
+ units = p.units_name
68
+ if units == "mm":
69
+ return 0
70
+ if units == "cm":
71
+ return 1
72
+ if units in ("in", "inch", "inches"):
73
+ return 2
74
+ if units == "mil":
75
+ return 3
76
+ return 0
77
+
78
+ def set_inch(self):
79
+ p = self.context.root
80
+ p.units_name = "inch"
81
+ p.signal("units", p.units_name)
82
+
83
+ def set_mil(self):
84
+ p = self.context.root
85
+ p.units_name = "mil"
86
+ p.signal("units", p.units_name)
87
+
88
+ def set_cm(self):
89
+ p = self.context.root
90
+ p.units_name = "cm"
91
+ p.signal("units", p.units_name)
92
+
93
+ def set_mm(self):
94
+ p = self.context.root
95
+ p.units_name = "mm"
96
+ p.signal("units", p.units_name)
97
+
98
+
99
+ # end of class PreferencesUnitsPanel
100
+
101
+
102
+ class PreferencesLanguagePanel(wx.Panel):
103
+ def __init__(self, *args, context=None, **kwds):
104
+ # begin wxGlade: PreferencesLanguagePanel.__init__
105
+ kwds["style"] = kwds.get("style", 0)
106
+ wx.Panel.__init__(self, *args, **kwds)
107
+ self.context = context
108
+ self.context.themes.set_window_colors(self)
109
+
110
+ sizer_2 = StaticBoxSizer(self, wx.ID_ANY, _("Language"), wx.HORIZONTAL)
111
+ from .wxmeerk40t import supported_languages
112
+
113
+ choices = [
114
+ language_name
115
+ for language_code, language_name, language_index in supported_languages
116
+ ]
117
+ self.combo_language = wxComboBox(
118
+ self, wx.ID_ANY, choices=choices, style=wx.CB_READONLY
119
+ )
120
+ self.combo_language.SetToolTip(
121
+ _("Select the desired language to use (requires a restart to take effect).")
122
+ )
123
+ sizer_2.Add(self.combo_language, 0, wx.ALIGN_CENTER_VERTICAL, 0)
124
+
125
+ self.SetSizer(sizer_2)
126
+
127
+ self.Layout()
128
+
129
+ self.context.setting(int, "language", 0)
130
+
131
+ self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
132
+ # end wxGlade
133
+ self.combo_language.SetSelection(self.context.language)
134
+
135
+ def on_combo_language(self, event=None):
136
+ lang = self.combo_language.GetSelection()
137
+ if lang != -1 and self.context.app is not None:
138
+ self.context.app.update_language(lang)
139
+ self.context.signal("restart")
140
+
141
+
142
+ # end of class PreferencesLanguagePanel
143
+
144
+
145
+ class PreferencesSavingPanel(wx.Panel):
146
+ def __init__(self, *args, context=None, **kwds):
147
+ # begin wxGlade: PreferencesLanguagePanel.__init__
148
+ kwds["style"] = kwds.get("style", 0)
149
+ wx.Panel.__init__(self, *args, **kwds)
150
+ self.context = context
151
+ self.context.themes.set_window_colors(self)
152
+
153
+ main_sizer = StaticBoxSizer(self, wx.ID_ANY, _("Management"), wx.HORIZONTAL)
154
+ self.button_save = wxButton(self, wx.ID_ANY, _("Save"))
155
+ self.button_save.SetToolTip(_("Immediately save the settings to disk"))
156
+ self.button_export = wxButton(self, wx.ID_ANY, _("Export"))
157
+ self.button_export.SetToolTip(
158
+ _("Export the current settings to a different location")
159
+ )
160
+ self.button_import = wxButton(self, wx.ID_ANY, _("Import"))
161
+ self.button_import.SetToolTip(_("Import a previously saved setting file"))
162
+ main_sizer.Add(self.button_save, 0, wx.ALIGN_CENTER_VERTICAL, 0)
163
+ self.Bind(wx.EVT_BUTTON, self.on_button_save, self.button_save)
164
+ main_sizer.AddStretchSpacer(1)
165
+ main_sizer.Add(self.button_export, 0, wx.ALIGN_CENTER_VERTICAL, 0)
166
+ main_sizer.Add(self.button_import, 0, wx.ALIGN_CENTER_VERTICAL, 0)
167
+
168
+ self.SetSizer(main_sizer)
169
+ self.Layout()
170
+ self.Bind(wx.EVT_BUTTON, self.on_button_save, self.button_save)
171
+ self.Bind(wx.EVT_BUTTON, self.on_button_import, self.button_import)
172
+ self.Bind(wx.EVT_BUTTON, self.on_button_export, self.button_export)
173
+
174
+ self.Bind(wx.EVT_RIGHT_DOWN, self.pane_right_click, self)
175
+ self.Bind(wx.EVT_RIGHT_DOWN, self.pane_right_click, self.button_save)
176
+
177
+ def save_config_and_prevent_further_writing(self):
178
+ self.context.kernel.prevent_persisting = False
179
+ self.context.kernel.write_configuration()
180
+ self.context.kernel.prevent_persisting = True
181
+ self.context.signal("restart")
182
+ wx.MessageBox(
183
+ message=_(
184
+ "The modified configuration has been saved.\n"
185
+ + "Please note further changes to your configuration will not be saved until the end of the program.\n"
186
+ + "So please exit MeerK40t as soon as possible."
187
+ ),
188
+ caption=_("Warning"),
189
+ style=wx.OK | wx.ICON_EXCLAMATION,
190
+ )
191
+
192
+ def delete_persistent_starting_with(self, section: str, startpattern: str):
193
+ to_be_deleted = list()
194
+ for key in self.context.kernel.keylist(section):
195
+ if key.startswith(startpattern):
196
+ to_be_deleted.append(key)
197
+ for key in to_be_deleted:
198
+ # print (f"Will delete {section}.{key}")
199
+ self.context.kernel.delete_persistent(section, key)
200
+ if len(to_be_deleted):
201
+ # d = list(self.context.kernel.keylist(section))
202
+ # d.sort()
203
+ # print (d)
204
+ self.save_config_and_prevent_further_writing()
205
+
206
+ def clear_persistent_starting_with(self, startpattern):
207
+ to_be_deleted = list()
208
+ for key in self.context.kernel.section_set():
209
+ if key.startswith(startpattern):
210
+ to_be_deleted.append(key)
211
+ for key in to_be_deleted:
212
+ # print (f"Will delete section {key}")
213
+ self.context.kernel.clear_persistent(key)
214
+ if len(to_be_deleted):
215
+ self.save_config_and_prevent_further_writing()
216
+
217
+ def on_clear_all(self, event):
218
+ self.context.kernel.clear_persistent("/")
219
+ self.save_config_and_prevent_further_writing()
220
+
221
+ def on_clear_camera_settings(self, event):
222
+ self.clear_persistent_starting_with("camera/")
223
+
224
+ def on_clear_planner(self, event):
225
+ self.context.kernel.clear_persistent("planner")
226
+ self.save_config_and_prevent_further_writing()
227
+
228
+ def on_clear_positions(self, event):
229
+ self.context.kernel.delete_persistent("/", "aui")
230
+ self.context.kernel.delete_persistent("/", "perspective")
231
+ self.clear_persistent_starting_with("window/")
232
+ # print ([l for l in self.context.kernel._config_dict])
233
+
234
+ def on_clear_colors(self, event):
235
+ self.context.kernel.clear_persistent("colors")
236
+ self.delete_persistent_starting_with("/", "color_")
237
+
238
+ def on_clear_files(self, event):
239
+ self.delete_persistent_starting_with("/", "file")
240
+
241
+ def on_clear_hinges(self, event):
242
+ self.delete_persistent_starting_with("/", "hinge_")
243
+
244
+ def pane_right_click(self, event):
245
+ menu = wx.Menu()
246
+ item = menu.Append(
247
+ wx.ID_ANY,
248
+ _("Clear..."),
249
+ "",
250
+ wx.ITEM_NORMAL,
251
+ )
252
+ item.Enable(False)
253
+ item = menu.Append(
254
+ wx.ID_ANY,
255
+ _("...Pane + Windows-Positions"),
256
+ "",
257
+ wx.ITEM_NORMAL,
258
+ )
259
+ self.Bind(wx.EVT_MENU, self.on_clear_positions, item)
260
+ item = menu.Append(
261
+ wx.ID_ANY,
262
+ _("...color settings"),
263
+ "",
264
+ wx.ITEM_NORMAL,
265
+ )
266
+ self.Bind(wx.EVT_MENU, self.on_clear_colors, item)
267
+ item = menu.Append(
268
+ wx.ID_ANY,
269
+ _("...recent file names"),
270
+ "",
271
+ wx.ITEM_NORMAL,
272
+ )
273
+ self.Bind(wx.EVT_MENU, self.on_clear_files, item)
274
+ menu.AppendSeparator()
275
+ item = menu.Append(
276
+ wx.ID_ANY,
277
+ _("...living hinge settings"),
278
+ "",
279
+ wx.ITEM_NORMAL,
280
+ )
281
+ self.Bind(wx.EVT_MENU, self.on_clear_hinges, item)
282
+ # item = menu.Append(wx.ID_ANY, _("...material test settings"), "", wx.ITEM_NORMAL, )
283
+ # self.Bind(wx.EVT_MENU, self.on_clear_templates, item)
284
+ menu.AppendSeparator()
285
+ item = menu.Append(
286
+ wx.ID_ANY,
287
+ _("...camera settings"),
288
+ "",
289
+ wx.ITEM_NORMAL,
290
+ )
291
+ self.Bind(wx.EVT_MENU, self.on_clear_camera_settings, item)
292
+ if self.context.root.setting(bool, "developer_mode", False):
293
+ menu.AppendSeparator()
294
+ item = menu.Append(
295
+ wx.ID_ANY,
296
+ _("...all user settings"),
297
+ "",
298
+ wx.ITEM_NORMAL,
299
+ )
300
+ self.Bind(wx.EVT_MENU, self.on_clear_all, item)
301
+ self.PopupMenu(menu)
302
+ menu.Destroy()
303
+
304
+ def on_button_save(self, event=None):
305
+ self.context("flush\n")
306
+
307
+ def on_button_export(self, event=None):
308
+ dlg = wx.DirDialog(
309
+ self,
310
+ _("Choose target directory:"),
311
+ style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST,
312
+ )
313
+
314
+ if dlg.ShowModal() == wx.ID_OK:
315
+ self.context(f"setting_export {dlg.GetPath()}\n")
316
+ wx.MessageBox(_("Export completed"), _("Info"), wx.OK | wx.ICON_INFORMATION)
317
+
318
+ dlg.Destroy()
319
+
320
+ def on_button_import(self, event=None):
321
+ message = _("This will import a previously saved configuration file!") + "\n"
322
+ message += (
323
+ _(
324
+ "This may make MeerK40t unworkable if the file does not have the right format!"
325
+ )
326
+ + "\n"
327
+ )
328
+ message += _("You do this at you own risk - are you really sure?")
329
+ caption = _("Warning")
330
+ dlg = wx.MessageDialog(
331
+ self,
332
+ message,
333
+ caption,
334
+ wx.YES_NO | wx.ICON_WARNING,
335
+ )
336
+ dlgresult = dlg.ShowModal()
337
+ dlg.Destroy()
338
+ if dlgresult != wx.ID_YES:
339
+ return
340
+ dlg = wx.FileDialog(
341
+ self,
342
+ message=_("Choose a previously saved configuration-file"),
343
+ wildcard="Meerk40t-Config-Files (*.cfg)|*.cfg|All files (*.*)|*.*",
344
+ style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW,
345
+ )
346
+ dlgresult = dlg.ShowModal()
347
+ if dlgresult == wx.ID_YES:
348
+ myfile = dlg.GetPath()
349
+ dlg.Destroy()
350
+ else:
351
+ dlg.Destroy()
352
+ return
353
+
354
+ self.context(f"setting_import {myfile}\n")
355
+ wx.MessageBox(_("Import completed"), _("Info"), wx.OK | wx.ICON_INFORMATION)
356
+
357
+
358
+ class PreferencesPixelsPerInchPanel(wx.Panel):
359
+ def __init__(self, *args, context=None, **kwds):
360
+ # begin wxGlade: PreferencesPixelsPerInchPanel.__init__
361
+ kwds["style"] = kwds.get("style", 0)
362
+ wx.Panel.__init__(self, *args, **kwds)
363
+ self.context = context
364
+ self.context.themes.set_window_colors(self)
365
+
366
+ sizer_3 = StaticBoxSizer(
367
+ self, wx.ID_ANY, _("SVG Pixel Per Inch"), wx.HORIZONTAL
368
+ )
369
+
370
+ self.combo_svg_ppi = wxComboBox(
371
+ self,
372
+ wx.ID_ANY,
373
+ choices=[
374
+ _("96 px/in Inkscape"),
375
+ _("72 px/in Illustrator"),
376
+ _("90 px/in Old Inkscape"),
377
+ _("Custom"),
378
+ ],
379
+ style=wx.CB_READONLY,
380
+ )
381
+ self.combo_svg_ppi.SetToolTip(
382
+ _("Select the Pixels Per Inch to use when loading an SVG file")
383
+ )
384
+ sizer_3.Add(self.combo_svg_ppi, 0, wx.ALIGN_CENTER_VERTICAL, 0)
385
+
386
+ sizer_3.Add((20, 20), 0, 0, 0)
387
+
388
+ self.text_svg_ppi = TextCtrl(
389
+ self, wx.ID_ANY, "", check="float", style=wx.TE_PROCESS_ENTER, limited=True
390
+ )
391
+ self.text_svg_ppi.SetToolTip(
392
+ _("Custom Pixels Per Inch to use when loading an SVG file")
393
+ )
394
+ sizer_3.Add(self.text_svg_ppi, 1, wx.EXPAND, 0)
395
+
396
+ self.SetSizer(sizer_3)
397
+
398
+ self.Layout()
399
+
400
+ self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
401
+ self.text_svg_ppi.SetActionRoutine(self.on_text_svg_ppi)
402
+ # end wxGlade
403
+
404
+ context.elements.setting(float, "svg_ppi", 96.0)
405
+ self.text_svg_ppi.SetValue(str(context.elements.svg_ppi))
406
+ self.on_text_svg_ppi()
407
+
408
+ def on_combo_svg_ppi(self, event=None):
409
+ elements = self.context.elements
410
+ ppi = self.combo_svg_ppi.GetSelection()
411
+ if ppi == 0:
412
+ elements.svg_ppi = 96.0
413
+ elif ppi == 1:
414
+ elements.svg_ppi = 72.0
415
+ elif ppi == 2:
416
+ elements.svg_ppi = 90.0
417
+ else:
418
+ elements.svg_ppi = 96.0
419
+ self.text_svg_ppi.SetValue(str(elements.svg_ppi))
420
+
421
+ def on_text_svg_ppi(self):
422
+ elements = self.context.elements
423
+ try:
424
+ svg_ppi = float(self.text_svg_ppi.GetValue())
425
+ except ValueError:
426
+ return
427
+ if svg_ppi == 96:
428
+ if self.combo_svg_ppi.GetSelection() != 0:
429
+ self.combo_svg_ppi.SetSelection(0)
430
+ elif svg_ppi == 72:
431
+ if self.combo_svg_ppi.GetSelection() != 1:
432
+ self.combo_svg_ppi.SetSelection(1)
433
+ elif svg_ppi == 90:
434
+ if self.combo_svg_ppi.GetSelection() != 2:
435
+ self.combo_svg_ppi.SetSelection(2)
436
+ else:
437
+ if self.combo_svg_ppi.GetSelection() != 3:
438
+ self.combo_svg_ppi.SetSelection(3)
439
+ elements.svg_ppi = svg_ppi
440
+
441
+ # end of class PreferencesPixelsPerInchPanel
442
+
443
+
444
+ class PreferencesMain(wx.Panel):
445
+ def __init__(self, *args, context=None, **kwds):
446
+ # begin wxGlade: PreferencesMain.__init__
447
+ kwds["style"] = kwds.get("style", 0)
448
+ wx.Panel.__init__(self, *args, **kwds)
449
+ self.context = context
450
+ self.context.themes.set_window_colors(self)
451
+ self.SetHelpText("preferences")
452
+ sizer_main = wx.BoxSizer(wx.VERTICAL)
453
+
454
+ self.panel_units = PreferencesUnitsPanel(self, wx.ID_ANY, context=context)
455
+ sizer_main.Add(self.panel_units, 0, wx.EXPAND, 0)
456
+
457
+ self.panel_language = PreferencesLanguagePanel(self, wx.ID_ANY, context=context)
458
+ sizer_main.Add(self.panel_language, 0, wx.EXPAND, 0)
459
+
460
+ self.panel_pref1 = ChoicePropertyPanel(
461
+ self,
462
+ id=wx.ID_ANY,
463
+ context=context,
464
+ choices="preferences",
465
+ constraint=("-Input/Output", "-Classification", "-Gui", "-Scene", "-Operations"),
466
+ )
467
+ sizer_main.Add(self.panel_pref1, 1, wx.EXPAND, 0)
468
+
469
+ self.panel_management = PreferencesSavingPanel(self, wx.ID_ANY, context=context)
470
+ sizer_main.Add(self.panel_management, 0, wx.EXPAND, 0)
471
+
472
+ self.SetSizer(sizer_main)
473
+
474
+ self.Layout()
475
+ # end wxGlade
476
+
477
+ def delegates(self):
478
+ yield self.panel_language
479
+ yield self.panel_units
480
+ yield self.panel_pref1
481
+ yield self.panel_management
482
+
483
+
484
+ class PreferencesInputOutput(wx.Panel):
485
+ def __init__(self, *args, context=None, **kwds):
486
+ # begin wxGlade: PreferencesMain.__init__
487
+ kwds["style"] = kwds.get("style", 0)
488
+ wx.Panel.__init__(self, *args, **kwds)
489
+ self.context = context
490
+ self.context.themes.set_window_colors(self)
491
+ self.SetHelpText("preferences")
492
+ sizer_main = wx.BoxSizer(wx.VERTICAL)
493
+
494
+ self.panel_ppi = PreferencesPixelsPerInchPanel(self, wx.ID_ANY, context=context)
495
+ sizer_main.Add(self.panel_ppi, 0, wx.EXPAND, 0)
496
+
497
+ self.panel_input_output = ChoicePropertyPanel(
498
+ self,
499
+ id=wx.ID_ANY,
500
+ context=self.context,
501
+ choices="preferences",
502
+ constraint="Input/Output",
503
+ )
504
+ self.panel_input_output.SetupScrolling()
505
+ sizer_main.Add(self.panel_input_output, 1, wx.EXPAND, 0)
506
+
507
+ self.SetSizer(sizer_main)
508
+
509
+ self.Layout()
510
+ # end wxGlade
511
+
512
+ def delegates(self):
513
+ yield self.panel_ppi
514
+ yield self.panel_input_output
515
+
516
+ # end of class PreferencesMain
517
+
518
+ #
519
+ # class PreferencesPanel(wx.Panel):
520
+ # def __init__(self, *args, context=None, **kwds):
521
+ # # begin wxGlade: PreferencesPanel.__init__
522
+ # kwds["style"] = kwds.get("style", 0)
523
+ # wx.Panel.__init__(self, *args, **kwds)
524
+ # self.context = context
525
+ #
526
+ # sizer_settings = wx.BoxSizer(wx.VERTICAL)
527
+ #
528
+ # self.panel_main = PreferencesMain(self, wx.ID_ANY, context=context)
529
+ # sizer_settings.Add(self.panel_main, 1, wx.EXPAND, 0)
530
+ #
531
+ # self.SetSizer(sizer_settings)
532
+ #
533
+ # self.Layout()
534
+ # # end wxGlade
535
+ #
536
+ # def delegates(self):
537
+ # yield self.panel_main
538
+
539
+
540
+ class Preferences(MWindow):
541
+ def __init__(self, *args, **kwds):
542
+ super().__init__(
543
+ 525,
544
+ 750,
545
+ *args,
546
+ style=wx.CAPTION
547
+ | wx.CLOSE_BOX
548
+ | wx.FRAME_FLOAT_ON_PARENT
549
+ | wx.TAB_TRAVERSAL
550
+ | (wx.RESIZE_BORDER if platform.system() != "Darwin" else 0),
551
+ **kwds,
552
+ )
553
+ self.notebook_main = wx.aui.AuiNotebook(
554
+ self,
555
+ -1,
556
+ style=wx.aui.AUI_NB_TAB_EXTERNAL_MOVE
557
+ | wx.aui.AUI_NB_SCROLL_BUTTONS
558
+ | wx.aui.AUI_NB_TAB_SPLIT
559
+ | wx.aui.AUI_NB_TAB_MOVE,
560
+ )
561
+ # ARGGH, the color setting via the ArtProvider does only work
562
+ # if you set the tabs to the bottom! wx.aui.AUI_NB_BOTTOM
563
+ self.window_context.themes.set_window_colors(self.notebook_main)
564
+ bg_std = self.window_context.themes.get("win_bg")
565
+ bg_active = self.window_context.themes.get("highlight")
566
+ self.notebook_main.GetArtProvider().SetColour(bg_std)
567
+ self.notebook_main.GetArtProvider().SetActiveColour(bg_active)
568
+
569
+ self.sizer.Add(self.notebook_main, 1, wx.EXPAND, 0)
570
+
571
+ # self.panel_main = PreferencesPanel(self, wx.ID_ANY, context=self.context)
572
+ self.panel_main = PreferencesMain(self, wx.ID_ANY, context=self.context)
573
+
574
+ self.panel_input_output = PreferencesInputOutput(self, wx.ID_ANY, context=self.context)
575
+
576
+ inject_choices = [
577
+ {
578
+ "attr": "preset_classify_automatic",
579
+ "object": self,
580
+ "default": False,
581
+ "type": bool,
582
+ "style": "button",
583
+ "label": _("Automatic"),
584
+ "tip": _("Set options for a good automatic experience"),
585
+ "help": "classification",
586
+ "page": "Classification",
587
+ "section": "_AA_Presets",
588
+ "subsection": "_0_",
589
+ },
590
+ {
591
+ "attr": "preset_classify_manual",
592
+ "object": self,
593
+ "default": False,
594
+ "type": bool,
595
+ "style": "button",
596
+ "label": _("Manual"),
597
+ "tip": _("Set options for complete manual control"),
598
+ "help": "classification",
599
+ "page": "Classification",
600
+ "section": "_AA_Presets",
601
+ "subsection": "_0_",
602
+ },
603
+ {
604
+ "attr": "dummy",
605
+ "default": "dummy",
606
+ "object": self,
607
+ "type": str,
608
+ "style": "info",
609
+ "label": _(
610
+ "Classification is the (automatic) process of assigning an element to an operation."
611
+ )
612
+ + "\n"
613
+ + _("That link between element and operation is called an assignment."),
614
+ "help": "classification",
615
+ "page": "Classification",
616
+ # "section": "_000_Information",
617
+ },
618
+ ]
619
+ self.presets = [
620
+ # object, property, automatic, manual
621
+ (self.context.elements, "operation_default_empty", False, True),
622
+ (self.context.elements, "classify_reverse", False, False),
623
+ (self.context.elements, "classify_new", True, False),
624
+ (self.context.elements, "classify_fuzzy", True, True),
625
+ (self.context.elements, "classify_fuzzydistance", 100, 100),
626
+ (self.context.elements, "classify_black_as_raster", True, True),
627
+ (self.context.elements, "classify_default", True, False),
628
+ (self.context.elements, "classify_autogenerate", True, False),
629
+ # (self.context.elements, "classify_auto_inherit", False, True),
630
+ (self.context.elements, "classify_on_color", True, False),
631
+ (self.context.elements, "classify_autogenerate_both", True, True),
632
+ ]
633
+ self.panel_classification = ChoicePropertyPanel(
634
+ self,
635
+ id=wx.ID_ANY,
636
+ context=self.context,
637
+ choices="preferences",
638
+ constraint="Classification",
639
+ injector=inject_choices,
640
+ )
641
+ self.panel_classification.SetupScrolling()
642
+
643
+ self.panel_ops = ChoicePropertyPanel(
644
+ self,
645
+ id=wx.ID_ANY,
646
+ context=self.context,
647
+ choices="preferences",
648
+ constraint="Operations",
649
+ )
650
+ self.panel_ops.SetupScrolling()
651
+
652
+ self.panel_gui = ChoicePropertyPanel(
653
+ self,
654
+ id=wx.ID_ANY,
655
+ context=self.context,
656
+ choices="preferences",
657
+ constraint="Gui",
658
+ )
659
+ self.panel_gui.SetupScrolling()
660
+
661
+ self.panel_scene = ChoicePropertyPanel(
662
+ self,
663
+ id=wx.ID_ANY,
664
+ context=self.context,
665
+ choices="preferences",
666
+ constraint="Scene",
667
+ )
668
+ self.panel_scene.SetupScrolling()
669
+
670
+ main_scene = getattr(self.context.root, "mainscene", None)
671
+ color_choices = []
672
+ local_default_color = []
673
+ for key, value in main_scene.colors.__dict__.items():
674
+ if not key.startswith("_") and isinstance(value, str):
675
+ local_default_color.append(key)
676
+ local_default_color.sort()
677
+ section = ""
678
+ for key in local_default_color:
679
+ # Try to make a sensible name out of it
680
+ keyname = key.replace("_", " ")
681
+ idx = 1 # Intentionally
682
+ while idx < len(keyname):
683
+ if keyname[idx] in "0123456789" and keyname[idx - 1] != " ":
684
+ keyname = keyname[:idx] + " " + keyname[idx:]
685
+ idx += 1
686
+ keyname = keyname[0].upper() + keyname[1:]
687
+ words = keyname.split()
688
+ possible_section = words[0]
689
+ if possible_section[0:2] != section[0:2]:
690
+ section = possible_section
691
+ color_choices.append(
692
+ {
693
+ "attr": f"color_{key}",
694
+ "object": main_scene.colors,
695
+ "default": main_scene.colors[key],
696
+ "type": str,
697
+ "style": "color", # hexa representation
698
+ "label": keyname,
699
+ "section": section,
700
+ "signals": ("refresh_scene", "theme"),
701
+ }
702
+ )
703
+ col = self.context.root.setting(str, "label_display_color", "#ff0000ff")
704
+ color_choices.append(
705
+ {
706
+ "attr": "color_label",
707
+ "object": self,
708
+ "default": self.color_label,
709
+ "type": str,
710
+ "style": "color", # hexa representation
711
+ "label": _("Object-Label"),
712
+ "section": "Scene",
713
+ "signals": ("refresh_scene", "theme"),
714
+ }
715
+ )
716
+ color_choices.append(
717
+ {
718
+ "attr": "color_reset",
719
+ "object": self,
720
+ "type": bool,
721
+ "style": "button",
722
+ "label": _("Reset Colors to Default"),
723
+ "section": "_ZZ_",
724
+ }
725
+ )
726
+ if self.window_context.themes.dark:
727
+ color_choices.append(
728
+ {
729
+ "attr": "color_reset_brighter",
730
+ "object": self,
731
+ "type": bool,
732
+ "style": "button",
733
+ "label": _("Reset Colors to brighter defaults"),
734
+ "section": "_ZZ_",
735
+ }
736
+ )
737
+
738
+ self.panel_color = ChoicePropertyPanel(
739
+ self,
740
+ id=wx.ID_ANY,
741
+ context=self.context,
742
+ choices=color_choices,
743
+ entries_per_column=12,
744
+ )
745
+ self.panel_color.SetupScrolling()
746
+
747
+ self.panel_ribbon = RibbonEditor(self, wx.ID_ANY, context=self.context)
748
+
749
+ self.notebook_main.AddPage(self.panel_main, _("General"))
750
+ self.notebook_main.AddPage(self.panel_input_output, _("Input/Output"))
751
+ self.notebook_main.AddPage(self.panel_classification, _("Classification"))
752
+ self.notebook_main.AddPage(self.panel_ops, _("Operations"))
753
+ self.notebook_main.AddPage(self.panel_gui, _("GUI"))
754
+ self.notebook_main.AddPage(self.panel_scene, _("Scene"))
755
+ self.notebook_main.AddPage(self.panel_color, _("Colors"))
756
+ self.notebook_main.AddPage(self.panel_ribbon, _("Ribbon"))
757
+
758
+ self.panels = [
759
+ self.panel_main,
760
+ self.panel_input_output,
761
+ self.panel_classification,
762
+ self.panel_ops,
763
+ self.panel_gui,
764
+ self.panel_scene,
765
+ self.panel_color,
766
+ self.panel_ribbon,
767
+ ]
768
+ self.panel_ids = ["main", "classification", "ops", "gui", "scene", "color", "ribbon"]
769
+ self.context.setting(bool, "developer_mode", False)
770
+ if self.context.developer_mode:
771
+ panel_space = ChoicePropertyPanel(
772
+ self, wx.ID_ANY, context=self.context, choices="space"
773
+ )
774
+ self.notebook_main.AddPage(panel_space, _("Coordinate Space"))
775
+ self.panels.append(panel_space)
776
+ self.panel_ids.append("space")
777
+ self.Layout()
778
+ self.restore_aspect(honor_initial_values=True)
779
+
780
+ _icon = wx.NullIcon
781
+ _icon.CopyFromBitmap(icons8_administrative_tools.GetBitmap())
782
+ self.SetIcon(_icon)
783
+ self.SetTitle(_("Preferences"))
784
+
785
+ @signal_listener("preferences")
786
+ def on_pref_signal(self, origin, *args):
787
+ if not args:
788
+ return
789
+ panel = args[0]
790
+ if panel and panel in self.panel_ids:
791
+ self.Show()
792
+ self.notebook_main.SetSelection(self.panel_ids.index(panel))
793
+
794
+ @property
795
+ def color_label(self):
796
+ col = self.context.root.setting(str, "label_display_color", "#ff0000ff")
797
+ return col
798
+
799
+ @color_label.setter
800
+ def color_label(self, value):
801
+ if value:
802
+ self.context.root.label_display_color = value
803
+
804
+ @property
805
+ def color_reset(self):
806
+ # Not relevant
807
+ return False
808
+
809
+ @color_reset.setter
810
+ def color_reset(self, value):
811
+ if value:
812
+ # We are resetting all GUI.colors
813
+ self.context("scene color unset\n")
814
+ self.context.root.label_display_color = "#ff0000ff"
815
+ self.context.signal("theme", True)
816
+ self.panel_color.reload()
817
+
818
+ @property
819
+ def color_reset_brighter(self):
820
+ # Not relevant
821
+ return False
822
+
823
+ @color_reset.setter
824
+ def color_reset_brighter(self, value):
825
+ if value:
826
+ # We are resetting all GUI.colors
827
+ self.context("scene color unsetbright\n")
828
+ self.context.root.label_display_color = "#ff0000ff"
829
+ self.context.signal("theme", True)
830
+ self.panel_color.reload()
831
+
832
+ @property
833
+ def preset_classify_manual(self):
834
+ # Not relevant
835
+ return False
836
+
837
+ @preset_classify_manual.setter
838
+ def preset_classify_manual(self, value):
839
+ if value:
840
+ # We are setting presets for a couple of parameters
841
+ for preset in self.presets:
842
+ setattr(preset[0], preset[1], preset[3])
843
+ self.context.signal(preset[1], preset[3], preset[0])
844
+
845
+ @property
846
+ def preset_classify_automatic(self):
847
+ # Not relevant
848
+ return False
849
+
850
+ @preset_classify_automatic.setter
851
+ def preset_classify_automatic(self, value):
852
+ if value:
853
+ # We are setting presets for a couple of parameters
854
+ for preset in self.presets:
855
+ setattr(preset[0], preset[1], preset[2])
856
+ self.context.signal(preset[1], preset[2], preset[0])
857
+
858
+ def delegates(self):
859
+ yield from self.panels
860
+
861
+ @staticmethod
862
+ def sub_register(kernel):
863
+ import platform
864
+
865
+ if platform.system() != "Darwin":
866
+ kernel.register(
867
+ "button/config/Preferences",
868
+ {
869
+ "label": _("Preferences"),
870
+ "icon": icons8_administrative_tools,
871
+ "tip": _("Opens Preferences Window"),
872
+ "action": lambda v: kernel.console("window toggle Preferences\n"),
873
+ },
874
+ )
875
+
876
+ def window_open(self):
877
+ pass
878
+
879
+ def window_close(self):
880
+ pass
881
+
882
+ @staticmethod
883
+ def menu_label():
884
+ return _("Pr&eferences...\tCtrl-,")
885
+
886
+ @staticmethod
887
+ def menu_tip():
888
+ return _("Show/Hide the Preferences window")
889
+
890
+ @staticmethod
891
+ def menu_id():
892
+ return wx.ID_PREFERENCES
893
+
894
+ @staticmethod
895
+ def submenu():
896
+ # suppress in tool-menu
897
+ return "", "Preferences", True
898
+
899
+ @staticmethod
900
+ def helptext():
901
+ return _("Configure MeerK40ts behaviour")