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.
- meerk40t/__init__.py +1 -1
- meerk40t/balormk/balor_params.py +167 -167
- meerk40t/balormk/clone_loader.py +457 -457
- meerk40t/balormk/controller.py +1566 -1512
- meerk40t/balormk/cylindermod.py +64 -0
- meerk40t/balormk/device.py +966 -1959
- meerk40t/balormk/driver.py +778 -591
- meerk40t/balormk/galvo_commands.py +1194 -0
- meerk40t/balormk/gui/balorconfig.py +237 -111
- meerk40t/balormk/gui/balorcontroller.py +191 -184
- meerk40t/balormk/gui/baloroperationproperties.py +116 -115
- meerk40t/balormk/gui/corscene.py +845 -0
- meerk40t/balormk/gui/gui.py +179 -147
- meerk40t/balormk/livelightjob.py +466 -382
- meerk40t/balormk/mock_connection.py +131 -109
- meerk40t/balormk/plugin.py +133 -135
- meerk40t/balormk/usb_connection.py +306 -301
- meerk40t/camera/__init__.py +1 -1
- meerk40t/camera/camera.py +514 -397
- meerk40t/camera/gui/camerapanel.py +1241 -1095
- meerk40t/camera/gui/gui.py +58 -58
- meerk40t/camera/plugin.py +441 -399
- meerk40t/ch341/__init__.py +27 -27
- meerk40t/ch341/ch341device.py +628 -628
- meerk40t/ch341/libusb.py +595 -589
- meerk40t/ch341/mock.py +171 -171
- meerk40t/ch341/windriver.py +157 -157
- meerk40t/constants.py +13 -0
- meerk40t/core/__init__.py +1 -1
- meerk40t/core/bindalias.py +550 -539
- meerk40t/core/core.py +47 -47
- meerk40t/core/cutcode/cubiccut.py +73 -73
- meerk40t/core/cutcode/cutcode.py +315 -312
- meerk40t/core/cutcode/cutgroup.py +141 -137
- meerk40t/core/cutcode/cutobject.py +192 -185
- meerk40t/core/cutcode/dwellcut.py +37 -37
- meerk40t/core/cutcode/gotocut.py +29 -29
- meerk40t/core/cutcode/homecut.py +29 -29
- meerk40t/core/cutcode/inputcut.py +34 -34
- meerk40t/core/cutcode/linecut.py +33 -33
- meerk40t/core/cutcode/outputcut.py +34 -34
- meerk40t/core/cutcode/plotcut.py +335 -335
- meerk40t/core/cutcode/quadcut.py +61 -61
- meerk40t/core/cutcode/rastercut.py +168 -148
- meerk40t/core/cutcode/waitcut.py +34 -34
- meerk40t/core/cutplan.py +1843 -1316
- meerk40t/core/drivers.py +330 -329
- meerk40t/core/elements/align.py +801 -669
- meerk40t/core/elements/branches.py +1858 -1507
- meerk40t/core/elements/clipboard.py +229 -219
- meerk40t/core/elements/element_treeops.py +4595 -2837
- meerk40t/core/elements/element_types.py +125 -105
- meerk40t/core/elements/elements.py +4315 -3617
- meerk40t/core/elements/files.py +117 -64
- meerk40t/core/elements/geometry.py +473 -224
- meerk40t/core/elements/grid.py +467 -316
- meerk40t/core/elements/materials.py +158 -94
- meerk40t/core/elements/notes.py +50 -38
- meerk40t/core/elements/offset_clpr.py +934 -912
- meerk40t/core/elements/offset_mk.py +963 -955
- meerk40t/core/elements/penbox.py +339 -267
- meerk40t/core/elements/placements.py +300 -83
- meerk40t/core/elements/render.py +785 -687
- meerk40t/core/elements/shapes.py +2618 -2092
- meerk40t/core/elements/testcases.py +105 -0
- meerk40t/core/elements/trace.py +651 -563
- meerk40t/core/elements/tree_commands.py +415 -409
- meerk40t/core/elements/undo_redo.py +116 -58
- meerk40t/core/elements/wordlist.py +319 -200
- meerk40t/core/exceptions.py +9 -9
- meerk40t/core/laserjob.py +220 -220
- meerk40t/core/logging.py +63 -63
- meerk40t/core/node/blobnode.py +83 -86
- meerk40t/core/node/bootstrap.py +105 -103
- meerk40t/core/node/branch_elems.py +40 -31
- meerk40t/core/node/branch_ops.py +45 -38
- meerk40t/core/node/branch_regmark.py +48 -41
- meerk40t/core/node/cutnode.py +29 -32
- meerk40t/core/node/effect_hatch.py +375 -257
- meerk40t/core/node/effect_warp.py +398 -0
- meerk40t/core/node/effect_wobble.py +441 -309
- meerk40t/core/node/elem_ellipse.py +404 -309
- meerk40t/core/node/elem_image.py +1082 -801
- meerk40t/core/node/elem_line.py +358 -292
- meerk40t/core/node/elem_path.py +259 -201
- meerk40t/core/node/elem_point.py +129 -102
- meerk40t/core/node/elem_polyline.py +310 -246
- meerk40t/core/node/elem_rect.py +376 -286
- meerk40t/core/node/elem_text.py +445 -418
- meerk40t/core/node/filenode.py +59 -40
- meerk40t/core/node/groupnode.py +138 -74
- meerk40t/core/node/image_processed.py +777 -766
- meerk40t/core/node/image_raster.py +156 -113
- meerk40t/core/node/layernode.py +31 -31
- meerk40t/core/node/mixins.py +135 -107
- meerk40t/core/node/node.py +1427 -1304
- meerk40t/core/node/nutils.py +117 -114
- meerk40t/core/node/op_cut.py +463 -335
- meerk40t/core/node/op_dots.py +296 -251
- meerk40t/core/node/op_engrave.py +414 -311
- meerk40t/core/node/op_image.py +755 -369
- meerk40t/core/node/op_raster.py +787 -522
- meerk40t/core/node/place_current.py +37 -40
- meerk40t/core/node/place_point.py +329 -126
- meerk40t/core/node/refnode.py +58 -47
- meerk40t/core/node/rootnode.py +225 -219
- meerk40t/core/node/util_console.py +48 -48
- meerk40t/core/node/util_goto.py +84 -65
- meerk40t/core/node/util_home.py +61 -61
- meerk40t/core/node/util_input.py +102 -102
- meerk40t/core/node/util_output.py +102 -102
- meerk40t/core/node/util_wait.py +65 -65
- meerk40t/core/parameters.py +709 -707
- meerk40t/core/planner.py +875 -785
- meerk40t/core/plotplanner.py +656 -652
- meerk40t/core/space.py +120 -113
- meerk40t/core/spoolers.py +706 -705
- meerk40t/core/svg_io.py +1836 -1549
- meerk40t/core/treeop.py +534 -445
- meerk40t/core/undos.py +278 -124
- meerk40t/core/units.py +784 -680
- meerk40t/core/view.py +393 -322
- meerk40t/core/webhelp.py +62 -62
- meerk40t/core/wordlist.py +513 -504
- meerk40t/cylinder/cylinder.py +247 -0
- meerk40t/cylinder/gui/cylindersettings.py +41 -0
- meerk40t/cylinder/gui/gui.py +24 -0
- meerk40t/device/__init__.py +1 -1
- meerk40t/device/basedevice.py +322 -123
- meerk40t/device/devicechoices.py +50 -0
- meerk40t/device/dummydevice.py +163 -128
- meerk40t/device/gui/defaultactions.py +618 -602
- meerk40t/device/gui/effectspanel.py +114 -0
- meerk40t/device/gui/formatterpanel.py +253 -290
- meerk40t/device/gui/warningpanel.py +337 -260
- meerk40t/device/mixins.py +13 -13
- meerk40t/dxf/__init__.py +1 -1
- meerk40t/dxf/dxf_io.py +766 -554
- meerk40t/dxf/plugin.py +47 -35
- meerk40t/external_plugins.py +79 -79
- meerk40t/external_plugins_build.py +28 -28
- meerk40t/extra/cag.py +112 -116
- meerk40t/extra/coolant.py +403 -0
- meerk40t/extra/encode_detect.py +204 -0
- meerk40t/extra/ezd.py +1165 -1165
- meerk40t/extra/hershey.py +834 -340
- meerk40t/extra/imageactions.py +322 -316
- meerk40t/extra/inkscape.py +628 -622
- meerk40t/extra/lbrn.py +424 -424
- meerk40t/extra/outerworld.py +283 -0
- meerk40t/extra/param_functions.py +1542 -1556
- meerk40t/extra/potrace.py +257 -253
- meerk40t/extra/serial_exchange.py +118 -0
- meerk40t/extra/updater.py +602 -453
- meerk40t/extra/vectrace.py +147 -146
- meerk40t/extra/winsleep.py +83 -83
- meerk40t/extra/xcs_reader.py +597 -0
- meerk40t/fill/fills.py +781 -335
- meerk40t/fill/patternfill.py +1061 -1061
- meerk40t/fill/patterns.py +614 -567
- meerk40t/grbl/control.py +87 -87
- meerk40t/grbl/controller.py +990 -903
- meerk40t/grbl/device.py +1084 -768
- meerk40t/grbl/driver.py +989 -771
- meerk40t/grbl/emulator.py +532 -497
- meerk40t/grbl/gcodejob.py +783 -767
- meerk40t/grbl/gui/grblconfiguration.py +373 -298
- meerk40t/grbl/gui/grblcontroller.py +485 -271
- meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
- meerk40t/grbl/gui/grbloperationconfig.py +105 -0
- meerk40t/grbl/gui/gui.py +147 -116
- meerk40t/grbl/interpreter.py +44 -44
- meerk40t/grbl/loader.py +22 -22
- meerk40t/grbl/mock_connection.py +56 -56
- meerk40t/grbl/plugin.py +294 -264
- meerk40t/grbl/serial_connection.py +93 -88
- meerk40t/grbl/tcp_connection.py +81 -79
- meerk40t/grbl/ws_connection.py +112 -0
- meerk40t/gui/__init__.py +1 -1
- meerk40t/gui/about.py +2042 -296
- meerk40t/gui/alignment.py +1644 -1608
- meerk40t/gui/autoexec.py +199 -0
- meerk40t/gui/basicops.py +791 -670
- meerk40t/gui/bufferview.py +77 -71
- meerk40t/gui/busy.py +232 -133
- meerk40t/gui/choicepropertypanel.py +1662 -1469
- meerk40t/gui/consolepanel.py +706 -542
- meerk40t/gui/devicepanel.py +687 -581
- meerk40t/gui/dialogoptions.py +110 -107
- meerk40t/gui/executejob.py +316 -306
- meerk40t/gui/fonts.py +90 -90
- meerk40t/gui/functionwrapper.py +252 -0
- meerk40t/gui/gui_mixins.py +729 -0
- meerk40t/gui/guicolors.py +205 -182
- meerk40t/gui/help_assets/help_assets.py +218 -201
- meerk40t/gui/helper.py +154 -0
- meerk40t/gui/hersheymanager.py +1440 -846
- meerk40t/gui/icons.py +3422 -2747
- meerk40t/gui/imagesplitter.py +555 -508
- meerk40t/gui/keymap.py +354 -344
- meerk40t/gui/laserpanel.py +897 -806
- meerk40t/gui/laserrender.py +1470 -1232
- meerk40t/gui/lasertoolpanel.py +805 -793
- meerk40t/gui/magnetoptions.py +436 -0
- meerk40t/gui/materialmanager.py +2944 -0
- meerk40t/gui/materialtest.py +1722 -1694
- meerk40t/gui/mkdebug.py +646 -359
- meerk40t/gui/mwindow.py +163 -140
- meerk40t/gui/navigationpanels.py +2605 -2467
- meerk40t/gui/notes.py +143 -142
- meerk40t/gui/opassignment.py +414 -410
- meerk40t/gui/operation_info.py +310 -299
- meerk40t/gui/plugin.py +500 -328
- meerk40t/gui/position.py +714 -669
- meerk40t/gui/preferences.py +901 -650
- meerk40t/gui/propertypanels/attributes.py +1461 -1131
- meerk40t/gui/propertypanels/blobproperty.py +117 -114
- meerk40t/gui/propertypanels/consoleproperty.py +83 -80
- meerk40t/gui/propertypanels/gotoproperty.py +77 -0
- meerk40t/gui/propertypanels/groupproperties.py +223 -217
- meerk40t/gui/propertypanels/hatchproperty.py +489 -469
- meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
- meerk40t/gui/propertypanels/inputproperty.py +59 -58
- meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
- meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
- meerk40t/gui/propertypanels/outputproperty.py +59 -58
- meerk40t/gui/propertypanels/pathproperty.py +389 -380
- meerk40t/gui/propertypanels/placementproperty.py +1214 -383
- meerk40t/gui/propertypanels/pointproperty.py +140 -136
- meerk40t/gui/propertypanels/propertywindow.py +313 -181
- meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
- meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
- meerk40t/gui/propertypanels/textproperty.py +770 -755
- meerk40t/gui/propertypanels/waitproperty.py +56 -55
- meerk40t/gui/propertypanels/warpproperty.py +121 -0
- meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
- meerk40t/gui/ribbon.py +2471 -2210
- meerk40t/gui/scene/scene.py +1100 -1051
- meerk40t/gui/scene/sceneconst.py +22 -22
- meerk40t/gui/scene/scenepanel.py +439 -349
- meerk40t/gui/scene/scenespacewidget.py +365 -365
- meerk40t/gui/scene/widget.py +518 -505
- meerk40t/gui/scenewidgets/affinemover.py +215 -215
- meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
- meerk40t/gui/scenewidgets/bedwidget.py +120 -97
- meerk40t/gui/scenewidgets/elementswidget.py +137 -107
- meerk40t/gui/scenewidgets/gridwidget.py +785 -745
- meerk40t/gui/scenewidgets/guidewidget.py +765 -765
- meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
- meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
- meerk40t/gui/scenewidgets/nodeselector.py +28 -28
- meerk40t/gui/scenewidgets/rectselectwidget.py +592 -346
- meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
- meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
- meerk40t/gui/scenewidgets/selectionwidget.py +2958 -2756
- meerk40t/gui/simpleui.py +362 -333
- meerk40t/gui/simulation.py +2451 -2094
- meerk40t/gui/snapoptions.py +208 -203
- meerk40t/gui/spoolerpanel.py +1227 -1180
- meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
- meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
- meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
- meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
- meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
- meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
- meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
- meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
- meerk40t/gui/themes.py +200 -78
- meerk40t/gui/tips.py +590 -0
- meerk40t/gui/toolwidgets/circlebrush.py +35 -35
- meerk40t/gui/toolwidgets/toolcircle.py +248 -242
- meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
- meerk40t/gui/toolwidgets/tooldraw.py +97 -90
- meerk40t/gui/toolwidgets/toolellipse.py +219 -212
- meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
- meerk40t/gui/toolwidgets/toolline.py +39 -144
- meerk40t/gui/toolwidgets/toollinetext.py +79 -236
- meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
- meerk40t/gui/toolwidgets/toolmeasure.py +163 -216
- meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
- meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
- meerk40t/gui/toolwidgets/toolparameter.py +754 -668
- meerk40t/gui/toolwidgets/toolplacement.py +108 -108
- meerk40t/gui/toolwidgets/toolpoint.py +68 -59
- meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
- meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
- meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
- meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
- meerk40t/gui/toolwidgets/toolrect.py +211 -207
- meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
- meerk40t/gui/toolwidgets/toolribbon.py +598 -113
- meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
- meerk40t/gui/toolwidgets/tooltext.py +98 -89
- meerk40t/gui/toolwidgets/toolvector.py +213 -204
- meerk40t/gui/toolwidgets/toolwidget.py +39 -39
- meerk40t/gui/usbconnect.py +98 -91
- meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
- meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
- meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
- meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
- meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
- meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
- meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
- meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
- meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
- meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
- meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
- meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
- meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
- meerk40t/gui/wordlisteditor.py +985 -931
- meerk40t/gui/wxmeerk40t.py +1447 -1169
- meerk40t/gui/wxmmain.py +5644 -4112
- meerk40t/gui/wxmribbon.py +1591 -1076
- meerk40t/gui/wxmscene.py +1631 -1453
- meerk40t/gui/wxmtree.py +2416 -2089
- meerk40t/gui/wxutils.py +1769 -1099
- meerk40t/gui/zmatrix.py +102 -102
- meerk40t/image/__init__.py +1 -1
- meerk40t/image/dither.py +429 -0
- meerk40t/image/imagetools.py +2793 -2269
- meerk40t/internal_plugins.py +150 -130
- meerk40t/kernel/__init__.py +63 -12
- meerk40t/kernel/channel.py +259 -212
- meerk40t/kernel/context.py +538 -538
- meerk40t/kernel/exceptions.py +41 -41
- meerk40t/kernel/functions.py +463 -414
- meerk40t/kernel/jobs.py +100 -100
- meerk40t/kernel/kernel.py +3828 -3571
- meerk40t/kernel/lifecycles.py +71 -71
- meerk40t/kernel/module.py +49 -49
- meerk40t/kernel/service.py +147 -147
- meerk40t/kernel/settings.py +383 -343
- meerk40t/lihuiyu/controller.py +883 -876
- meerk40t/lihuiyu/device.py +1181 -1069
- meerk40t/lihuiyu/driver.py +1466 -1372
- meerk40t/lihuiyu/gui/gui.py +127 -106
- meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
- meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
- meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
- meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
- meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
- meerk40t/lihuiyu/interpreter.py +53 -53
- meerk40t/lihuiyu/laserspeed.py +450 -450
- meerk40t/lihuiyu/loader.py +90 -90
- meerk40t/lihuiyu/parser.py +404 -404
- meerk40t/lihuiyu/plugin.py +101 -102
- meerk40t/lihuiyu/tcp_connection.py +111 -109
- meerk40t/main.py +231 -165
- meerk40t/moshi/builder.py +788 -781
- meerk40t/moshi/controller.py +505 -499
- meerk40t/moshi/device.py +495 -442
- meerk40t/moshi/driver.py +862 -696
- meerk40t/moshi/gui/gui.py +78 -76
- meerk40t/moshi/gui/moshicontrollergui.py +538 -522
- meerk40t/moshi/gui/moshidrivergui.py +87 -75
- meerk40t/moshi/plugin.py +43 -43
- meerk40t/network/console_server.py +140 -57
- meerk40t/network/kernelserver.py +10 -9
- meerk40t/network/tcp_server.py +142 -140
- meerk40t/network/udp_server.py +103 -77
- meerk40t/network/web_server.py +404 -0
- meerk40t/newly/controller.py +1158 -1144
- meerk40t/newly/device.py +874 -732
- meerk40t/newly/driver.py +540 -412
- meerk40t/newly/gui/gui.py +219 -188
- meerk40t/newly/gui/newlyconfig.py +116 -101
- meerk40t/newly/gui/newlycontroller.py +193 -186
- meerk40t/newly/gui/operationproperties.py +51 -51
- meerk40t/newly/mock_connection.py +82 -82
- meerk40t/newly/newly_params.py +56 -56
- meerk40t/newly/plugin.py +1214 -1246
- meerk40t/newly/usb_connection.py +322 -322
- meerk40t/rotary/gui/gui.py +52 -46
- meerk40t/rotary/gui/rotarysettings.py +240 -232
- meerk40t/rotary/rotary.py +202 -98
- meerk40t/ruida/control.py +291 -91
- meerk40t/ruida/controller.py +138 -1088
- meerk40t/ruida/device.py +676 -231
- meerk40t/ruida/driver.py +534 -472
- meerk40t/ruida/emulator.py +1494 -1491
- meerk40t/ruida/exceptions.py +4 -4
- meerk40t/ruida/gui/gui.py +71 -76
- meerk40t/ruida/gui/ruidaconfig.py +239 -72
- meerk40t/ruida/gui/ruidacontroller.py +187 -184
- meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
- meerk40t/ruida/loader.py +54 -52
- meerk40t/ruida/mock_connection.py +57 -109
- meerk40t/ruida/plugin.py +124 -87
- meerk40t/ruida/rdjob.py +2084 -945
- meerk40t/ruida/serial_connection.py +116 -0
- meerk40t/ruida/tcp_connection.py +146 -0
- meerk40t/ruida/udp_connection.py +73 -0
- meerk40t/svgelements.py +9671 -9669
- meerk40t/tools/driver_to_path.py +584 -579
- meerk40t/tools/geomstr.py +5583 -4680
- meerk40t/tools/jhfparser.py +357 -292
- meerk40t/tools/kerftest.py +904 -890
- meerk40t/tools/livinghinges.py +1168 -1033
- meerk40t/tools/pathtools.py +987 -949
- meerk40t/tools/pmatrix.py +234 -0
- meerk40t/tools/pointfinder.py +942 -942
- meerk40t/tools/polybool.py +941 -940
- meerk40t/tools/rasterplotter.py +1660 -547
- meerk40t/tools/shxparser.py +1047 -901
- meerk40t/tools/ttfparser.py +726 -446
- meerk40t/tools/zinglplotter.py +595 -593
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/LICENSE +21 -21
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/METADATA +150 -139
- meerk40t-0.9.7020.dist-info/RECORD +446 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/WHEEL +1 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/top_level.txt +0 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/zip-safe +1 -1
- meerk40t/balormk/elementlightjob.py +0 -159
- meerk40t-0.9.3001.dist-info/RECORD +0 -437
- test/bootstrap.py +0 -63
- test/test_cli.py +0 -12
- test/test_core_cutcode.py +0 -418
- test/test_core_elements.py +0 -144
- test/test_core_plotplanner.py +0 -397
- test/test_core_viewports.py +0 -312
- test/test_drivers_grbl.py +0 -108
- test/test_drivers_lihuiyu.py +0 -443
- test/test_drivers_newly.py +0 -113
- test/test_element_degenerate_points.py +0 -43
- test/test_elements_classify.py +0 -97
- test/test_elements_penbox.py +0 -22
- test/test_file_svg.py +0 -176
- test/test_fill.py +0 -155
- test/test_geomstr.py +0 -1523
- test/test_geomstr_nodes.py +0 -18
- test/test_imagetools_actualize.py +0 -306
- test/test_imagetools_wizard.py +0 -258
- test/test_kernel.py +0 -200
- test/test_laser_speeds.py +0 -3303
- test/test_length.py +0 -57
- test/test_lifecycle.py +0 -66
- test/test_operations.py +0 -251
- test/test_operations_hatch.py +0 -57
- test/test_ruida.py +0 -19
- test/test_spooler.py +0 -22
- test/test_tools_rasterplotter.py +0 -29
- test/test_wobble.py +0 -133
- test/test_zingl.py +0 -124
- {test → meerk40t/cylinder}/__init__.py +0 -0
- /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/entry_points.txt +0 -0
meerk40t/gui/materialtest.py
CHANGED
@@ -1,1694 +1,1722 @@
|
|
1
|
-
from copy import copy
|
2
|
-
from math import tau
|
3
|
-
|
4
|
-
import wx
|
5
|
-
from wx import aui
|
6
|
-
|
7
|
-
from meerk40t.core.node.effect_hatch import HatchEffectNode
|
8
|
-
from meerk40t.core.node.op_cut import CutOpNode
|
9
|
-
from meerk40t.core.node.op_engrave import EngraveOpNode
|
10
|
-
from meerk40t.core.node.op_image import ImageOpNode
|
11
|
-
from meerk40t.core.node.op_raster import RasterOpNode
|
12
|
-
from meerk40t.core.units import UNITS_PER_PIXEL, Angle, Length
|
13
|
-
from meerk40t.gui.icons import
|
14
|
-
from meerk40t.gui.mwindow import MWindow
|
15
|
-
from meerk40t.gui.wxutils import
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
self.
|
43
|
-
self.
|
44
|
-
self.
|
45
|
-
|
46
|
-
|
47
|
-
sizer_name
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
self.
|
53
|
-
self.
|
54
|
-
|
55
|
-
)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
self.
|
60
|
-
|
61
|
-
|
62
|
-
self.
|
63
|
-
self.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
self.
|
69
|
-
self.
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
info = self.
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
self.
|
134
|
-
self.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
self.
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
idx = self.list_slots.GetSelection()
|
148
|
-
# print (f"
|
149
|
-
if idx >= 0:
|
150
|
-
info = self.choices[idx]
|
151
|
-
self.txt_name.SetValue(info)
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
#
|
179
|
-
|
180
|
-
|
181
|
-
self.
|
182
|
-
self.
|
183
|
-
self.
|
184
|
-
self.
|
185
|
-
self.
|
186
|
-
self.
|
187
|
-
|
188
|
-
|
189
|
-
self.
|
190
|
-
|
191
|
-
|
192
|
-
self.default_op.append(
|
193
|
-
self.color_scheme_free.append(True)
|
194
|
-
|
195
|
-
self.
|
196
|
-
self.
|
197
|
-
|
198
|
-
self.
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
self.
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
self.combo_images
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
self.
|
247
|
-
self.
|
248
|
-
self.
|
249
|
-
|
250
|
-
self.
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
self.
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
)
|
260
|
-
self.
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
self.
|
270
|
-
|
271
|
-
self.
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
self.
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
)
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
self.
|
294
|
-
|
295
|
-
)
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
)
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
hline_count_1
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
mylbl =
|
342
|
-
size_it(mylbl,
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
mylbl =
|
349
|
-
size_it(mylbl,
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
mylbl
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
mylbl
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
)
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
mylbl
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
mylbl =
|
405
|
-
size_it(mylbl,
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
mylbl =
|
412
|
-
size_it(mylbl,
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
mylbl
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
mylbl
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
)
|
453
|
-
|
454
|
-
|
455
|
-
)
|
456
|
-
infomsg
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
infomsg += "
|
461
|
-
"
|
462
|
-
)
|
463
|
-
infomsg += " " + _(
|
464
|
-
"
|
465
|
-
)
|
466
|
-
infomsg += "
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
)
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
)
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
)
|
489
|
-
|
490
|
-
|
491
|
-
)
|
492
|
-
self.
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
self.
|
530
|
-
|
531
|
-
|
532
|
-
self.
|
533
|
-
|
534
|
-
|
535
|
-
self.
|
536
|
-
|
537
|
-
self.
|
538
|
-
self.
|
539
|
-
self.
|
540
|
-
self.
|
541
|
-
self.
|
542
|
-
self.
|
543
|
-
|
544
|
-
self.
|
545
|
-
self.
|
546
|
-
self.
|
547
|
-
self.
|
548
|
-
self.
|
549
|
-
self.
|
550
|
-
self.
|
551
|
-
self.
|
552
|
-
|
553
|
-
self.
|
554
|
-
self.
|
555
|
-
self.
|
556
|
-
self.
|
557
|
-
self.
|
558
|
-
self.
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
node.
|
610
|
-
|
611
|
-
def
|
612
|
-
# Will be called ahead of the modification of
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
self.
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
if self.
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
self.
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
("
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
("
|
708
|
-
("
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
("
|
717
|
-
("
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
),
|
739
|
-
(
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
)
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
self.combo_param_2.
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
self.
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
self.
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
self.
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
if
|
860
|
-
active = False
|
861
|
-
if
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
r = 0
|
944
|
-
g = 0
|
945
|
-
b = 0
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
self.context.elements.
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
float(Length(
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
text_op_y
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
this_op =
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
usefill = False
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
if
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
this_op
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
value = p_value_2
|
1151
|
-
|
1152
|
-
value
|
1153
|
-
if param_type_2 == "
|
1154
|
-
value
|
1155
|
-
if
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
if
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
if
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
if
|
1249
|
-
return
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
if
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
if
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
try:
|
1327
|
-
|
1328
|
-
except ValueError:
|
1329
|
-
|
1330
|
-
try:
|
1331
|
-
|
1332
|
-
except ValueError:
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
self.context.
|
1375
|
-
self.context.
|
1376
|
-
self.
|
1377
|
-
|
1378
|
-
|
1379
|
-
self.context.setting(
|
1380
|
-
self.context.setting(
|
1381
|
-
self.context.setting(int, "
|
1382
|
-
self.context.setting(
|
1383
|
-
self.context.setting(
|
1384
|
-
self.context.setting(
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
self.context.
|
1402
|
-
self.context.
|
1403
|
-
self.context.
|
1404
|
-
self.context.
|
1405
|
-
self.context.
|
1406
|
-
self.context.
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
)
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
self.context.
|
1436
|
-
self.context.
|
1437
|
-
self.context.
|
1438
|
-
self.context.
|
1439
|
-
self.context.
|
1440
|
-
self.context.
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
self.context.
|
1457
|
-
self.context.
|
1458
|
-
self.context.
|
1459
|
-
self.context.
|
1460
|
-
self.context.
|
1461
|
-
self.context.
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
self.
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
self.
|
1493
|
-
self.
|
1494
|
-
self.
|
1495
|
-
|
1496
|
-
|
1497
|
-
self.
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
self.
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
self.
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
)
|
1546
|
-
|
1547
|
-
self.
|
1548
|
-
self,
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
#
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
)
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1
|
+
from copy import copy
|
2
|
+
from math import tau
|
3
|
+
|
4
|
+
import wx
|
5
|
+
from wx import aui
|
6
|
+
|
7
|
+
from meerk40t.core.node.effect_hatch import HatchEffectNode
|
8
|
+
from meerk40t.core.node.op_cut import CutOpNode
|
9
|
+
from meerk40t.core.node.op_engrave import EngraveOpNode
|
10
|
+
from meerk40t.core.node.op_image import ImageOpNode
|
11
|
+
from meerk40t.core.node.op_raster import RasterOpNode
|
12
|
+
from meerk40t.core.units import UNITS_PER_PIXEL, Angle, Length
|
13
|
+
from meerk40t.gui.icons import get_default_icon_size, icons8_detective
|
14
|
+
from meerk40t.gui.mwindow import MWindow
|
15
|
+
from meerk40t.gui.wxutils import (
|
16
|
+
StaticBoxSizer,
|
17
|
+
TextCtrl,
|
18
|
+
dip_size,
|
19
|
+
wxButton,
|
20
|
+
wxCheckBox,
|
21
|
+
wxComboBox,
|
22
|
+
wxListBox,
|
23
|
+
wxStaticText,
|
24
|
+
)
|
25
|
+
from meerk40t.kernel import Settings, lookup_listener, signal_listener
|
26
|
+
from meerk40t.svgelements import Color, Matrix
|
27
|
+
|
28
|
+
_ = wx.GetTranslation
|
29
|
+
|
30
|
+
|
31
|
+
class SaveLoadPanel(wx.Panel):
|
32
|
+
"""
|
33
|
+
Provides the scaffold for saving and loading of parameter sets.
|
34
|
+
Does not know a lot about the underlying structure of data as it
|
35
|
+
blindly interacts with the parent via the callback routine
|
36
|
+
(could hence work as a generic way to save / load data)
|
37
|
+
"""
|
38
|
+
|
39
|
+
def __init__(self, *args, context=None, **kwds):
|
40
|
+
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
|
41
|
+
wx.Panel.__init__(self, *args, **kwds)
|
42
|
+
self.context = context
|
43
|
+
self.context.themes.set_window_colors(self)
|
44
|
+
self.callback = None
|
45
|
+
sizer_main = wx.BoxSizer(wx.VERTICAL)
|
46
|
+
self.SetSizer(sizer_main)
|
47
|
+
sizer_name = wx.BoxSizer(wx.HORIZONTAL)
|
48
|
+
lbl_info = wxStaticText(self, wx.ID_ANY, _("Template-Name"))
|
49
|
+
self.txt_name = TextCtrl(self, wx.ID_ANY, "")
|
50
|
+
self.btn_save = wxButton(self, wx.ID_ANY, _("Save"))
|
51
|
+
self.btn_load = wxButton(self, wx.ID_ANY, _("Load"))
|
52
|
+
self.btn_delete = wxButton(self, wx.ID_ANY, _("Delete"))
|
53
|
+
self.btn_load.Enable(False)
|
54
|
+
self.btn_save.Enable(False)
|
55
|
+
self.btn_delete.Enable(False)
|
56
|
+
sizer_name.Add(lbl_info, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
57
|
+
sizer_name.Add(self.txt_name, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
58
|
+
sizer_name.Add(self.btn_save, 0, wx.EXPAND, 0)
|
59
|
+
sizer_name.Add(self.btn_load, 0, wx.EXPAND, 0)
|
60
|
+
sizer_name.Add(self.btn_delete, 0, wx.EXPAND, 0)
|
61
|
+
|
62
|
+
self.choices = []
|
63
|
+
self.list_slots = wxListBox(
|
64
|
+
self, wx.ID_ANY, choices=self.choices, style=wx.LB_SINGLE
|
65
|
+
)
|
66
|
+
self.list_slots.SetToolTip(_("Select an entry to reload"))
|
67
|
+
sizer_main.Add(sizer_name, 0, wx.EXPAND, 0)
|
68
|
+
sizer_main.Add(self.list_slots, 1, wx.EXPAND, 0)
|
69
|
+
self.Layout()
|
70
|
+
self.Bind(wx.EVT_TEXT, self.on_text_change, self.txt_name)
|
71
|
+
self.Bind(wx.EVT_BUTTON, self.on_btn_load, self.btn_load)
|
72
|
+
self.Bind(wx.EVT_BUTTON, self.on_btn_save, self.btn_save)
|
73
|
+
self.Bind(wx.EVT_BUTTON, self.on_btn_delete, self.btn_delete)
|
74
|
+
self.list_slots.Bind(wx.EVT_LISTBOX, self.on_listbox_click)
|
75
|
+
self.list_slots.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_double_click)
|
76
|
+
|
77
|
+
def set_callback(self, routine):
|
78
|
+
self.callback = routine
|
79
|
+
self.fill_choices("")
|
80
|
+
|
81
|
+
def standardize(self, text):
|
82
|
+
text = text.lower()
|
83
|
+
for invalid in (
|
84
|
+
"=",
|
85
|
+
":",
|
86
|
+
):
|
87
|
+
text = text.replace(invalid, "_")
|
88
|
+
return text
|
89
|
+
|
90
|
+
def fill_choices(self, txt):
|
91
|
+
self.choices = []
|
92
|
+
if self.callback is not None:
|
93
|
+
self.choices = self.callback("get", "")
|
94
|
+
|
95
|
+
self.list_slots.Clear()
|
96
|
+
self.list_slots.SetItems(self.choices)
|
97
|
+
if txt:
|
98
|
+
try:
|
99
|
+
idx = self.choices.index(txt)
|
100
|
+
except ValueError:
|
101
|
+
idx = -1
|
102
|
+
if idx >= 0:
|
103
|
+
self.list_slots.SetSelection(idx)
|
104
|
+
self.list_slots.Refresh()
|
105
|
+
|
106
|
+
def on_text_change(self, event):
|
107
|
+
info = self.txt_name.GetValue()
|
108
|
+
flag1 = False
|
109
|
+
flag2 = False
|
110
|
+
if info:
|
111
|
+
info = self.standardize(info)
|
112
|
+
flag2 = True
|
113
|
+
try:
|
114
|
+
idx = self.choices.index(info)
|
115
|
+
except ValueError:
|
116
|
+
idx = -1
|
117
|
+
flag1 = idx >= 0
|
118
|
+
self.btn_load.Enable(flag1)
|
119
|
+
self.btn_delete.Enable(flag1)
|
120
|
+
self.btn_save.Enable(flag2)
|
121
|
+
|
122
|
+
def on_btn_load(self, event):
|
123
|
+
info = self.txt_name.GetValue()
|
124
|
+
if self.callback is None or not info:
|
125
|
+
return
|
126
|
+
info = self.standardize(info)
|
127
|
+
__ = self.callback("load", info)
|
128
|
+
|
129
|
+
def on_btn_delete(self, event):
|
130
|
+
info = self.txt_name.GetValue()
|
131
|
+
if self.callback is None or not info:
|
132
|
+
return
|
133
|
+
info = self.standardize(info)
|
134
|
+
__ = self.callback("delete", info)
|
135
|
+
self.fill_choices("")
|
136
|
+
|
137
|
+
def on_btn_save(self, event):
|
138
|
+
info = self.txt_name.GetValue()
|
139
|
+
if self.callback is None or not info:
|
140
|
+
return
|
141
|
+
info = self.standardize(info)
|
142
|
+
__ = self.callback("save", info)
|
143
|
+
self.fill_choices(info)
|
144
|
+
self.on_text_change(None)
|
145
|
+
|
146
|
+
def on_listbox_click(self, event):
|
147
|
+
idx = self.list_slots.GetSelection()
|
148
|
+
# print (f"Click with {idx}")
|
149
|
+
if idx >= 0:
|
150
|
+
info = self.choices[idx]
|
151
|
+
self.txt_name.SetValue(info)
|
152
|
+
self.on_text_change(None)
|
153
|
+
|
154
|
+
def on_listbox_double_click(self, event):
|
155
|
+
idx = self.list_slots.GetSelection()
|
156
|
+
# print (f"DClick with {idx}")
|
157
|
+
if idx >= 0:
|
158
|
+
info = self.choices[idx]
|
159
|
+
self.txt_name.SetValue(info)
|
160
|
+
self.on_btn_load(None)
|
161
|
+
self.on_text_change(None)
|
162
|
+
|
163
|
+
|
164
|
+
class TemplatePanel(wx.Panel):
|
165
|
+
"""
|
166
|
+
Responsible for the generation of testpatterns and the user interface
|
167
|
+
params:
|
168
|
+
context - the current context
|
169
|
+
storage - an instance of kernel.Settings to store/load parameter sets
|
170
|
+
"""
|
171
|
+
|
172
|
+
def __init__(self, *args, context=None, storage=None, **kwds):
|
173
|
+
def size_it(ctrl, value):
|
174
|
+
ctrl.SetMaxSize(dip_size(self, int(value), -1))
|
175
|
+
ctrl.SetMinSize(dip_size(self, int(value * 0.75), -1))
|
176
|
+
ctrl.SetSize(dip_size(self, value, -1))
|
177
|
+
|
178
|
+
# begin wxGlade: clsLasertools.__init__
|
179
|
+
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
|
180
|
+
wx.Panel.__init__(self, *args, **kwds)
|
181
|
+
self.context = context
|
182
|
+
self.context.themes.set_window_colors(self)
|
183
|
+
self.SetHelpText("testpattern")
|
184
|
+
self.storage = storage
|
185
|
+
self.callback = None
|
186
|
+
self.current_op = None
|
187
|
+
opchoices = [_("Cut"), _("Engrave"), _("Raster"), _("Image"), _("Hatch")]
|
188
|
+
# Setup 5 Op nodes - they aren't saved yet
|
189
|
+
self.default_op = []
|
190
|
+
# A tuple defining whether a free color-selection scheme is allowed, linked to default_op
|
191
|
+
self.color_scheme_free = []
|
192
|
+
self.default_op.append(CutOpNode())
|
193
|
+
self.color_scheme_free.append(True)
|
194
|
+
self.default_op.append(EngraveOpNode())
|
195
|
+
self.color_scheme_free.append(True)
|
196
|
+
self.default_op.append(RasterOpNode())
|
197
|
+
self.color_scheme_free.append(False)
|
198
|
+
self.default_op.append(ImageOpNode())
|
199
|
+
self.color_scheme_free.append(True)
|
200
|
+
op = EngraveOpNode()
|
201
|
+
self.default_op.append(op)
|
202
|
+
self.color_scheme_free.append(True)
|
203
|
+
|
204
|
+
self.use_image = [False] * len(self.default_op)
|
205
|
+
self.use_image[3] = True
|
206
|
+
|
207
|
+
self._freecolor = True
|
208
|
+
|
209
|
+
self.parameters = []
|
210
|
+
color_choices = [_("Red"), _("Green"), _("Blue")]
|
211
|
+
|
212
|
+
LABEL_WIDTH = 115
|
213
|
+
|
214
|
+
self.combo_ops = wxComboBox(
|
215
|
+
self, id=wx.ID_ANY, choices=opchoices, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
216
|
+
)
|
217
|
+
self.images = []
|
218
|
+
self.image_labels = []
|
219
|
+
self.image_labels.append(_("Choose image..."))
|
220
|
+
|
221
|
+
for node in self.context.elements.elems():
|
222
|
+
if node.type == "elem image":
|
223
|
+
imagenode = copy(node)
|
224
|
+
bb = imagenode.bounds
|
225
|
+
if bb is not None:
|
226
|
+
# Put it back on origin
|
227
|
+
imagenode.matrix.post_translate(-bb[0], -bb[1])
|
228
|
+
self.images.append(imagenode)
|
229
|
+
w, h = imagenode.active_image.size
|
230
|
+
label = f"{w} x {h} Pixel"
|
231
|
+
if node.label:
|
232
|
+
label += "(" + node.display_label() + ")"
|
233
|
+
self.image_labels.append(label)
|
234
|
+
|
235
|
+
self.combo_images = wxComboBox(
|
236
|
+
self,
|
237
|
+
id=wx.ID_ANY,
|
238
|
+
choices=self.image_labels,
|
239
|
+
style=wx.CB_DROPDOWN | wx.CB_READONLY,
|
240
|
+
)
|
241
|
+
self.combo_images.SetToolTip(
|
242
|
+
_(
|
243
|
+
"Choose from one of the existing images on your canvas to use as the test template"
|
244
|
+
)
|
245
|
+
)
|
246
|
+
self.combo_images.SetSelection(0)
|
247
|
+
self.check_labels = wxCheckBox(self, wx.ID_ANY, _("Labels"))
|
248
|
+
self.check_values = wxCheckBox(self, wx.ID_ANY, _("Values"))
|
249
|
+
|
250
|
+
self.combo_param_1 = wxComboBox(
|
251
|
+
self, id=wx.ID_ANY, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
252
|
+
)
|
253
|
+
self.spin_count_1 = wx.SpinCtrl(self, wx.ID_ANY, initial=5, min=1, max=100)
|
254
|
+
self.text_min_1 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
255
|
+
self.text_max_1 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
256
|
+
self.text_dim_1 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
257
|
+
self.text_dim_1.set_range(0, 50)
|
258
|
+
self.text_delta_1 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
259
|
+
self.text_delta_1.set_range(0, 50)
|
260
|
+
self.unit_param_1a = wxStaticText(self, wx.ID_ANY, "")
|
261
|
+
self.unit_param_1b = wxStaticText(self, wx.ID_ANY, "")
|
262
|
+
|
263
|
+
self.combo_color_1 = wxComboBox(
|
264
|
+
self,
|
265
|
+
wx.ID_ANY,
|
266
|
+
choices=color_choices,
|
267
|
+
style=wx.CB_DROPDOWN | wx.CB_READONLY,
|
268
|
+
)
|
269
|
+
self.check_color_direction_1 = wxCheckBox(self, wx.ID_ANY, _("Growing"))
|
270
|
+
|
271
|
+
self.combo_param_2 = wxComboBox(
|
272
|
+
self, id=wx.ID_ANY, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
273
|
+
)
|
274
|
+
self.spin_count_2 = wx.SpinCtrl(self, wx.ID_ANY, initial=5, min=1, max=100)
|
275
|
+
self.text_min_2 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
276
|
+
self.text_max_2 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
277
|
+
self.text_dim_2 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
278
|
+
self.text_dim_2.set_range(0, 50)
|
279
|
+
self.text_delta_2 = TextCtrl(self, wx.ID_ANY, limited=True, check="float")
|
280
|
+
self.text_delta_2.set_range(0, 50)
|
281
|
+
self.unit_param_2a = wxStaticText(self, wx.ID_ANY, "")
|
282
|
+
self.unit_param_2b = wxStaticText(self, wx.ID_ANY, "")
|
283
|
+
|
284
|
+
self.combo_color_2 = wxComboBox(
|
285
|
+
self,
|
286
|
+
wx.ID_ANY,
|
287
|
+
choices=color_choices,
|
288
|
+
style=wx.CB_DROPDOWN | wx.CB_READONLY,
|
289
|
+
)
|
290
|
+
self.check_color_direction_2 = wxCheckBox(self, wx.ID_ANY, _("Growing"))
|
291
|
+
|
292
|
+
self.button_create = wxButton(self, wx.ID_ANY, _("Create Pattern"))
|
293
|
+
self.button_create.SetBitmap(
|
294
|
+
icons8_detective.GetBitmap(resize=0.5 * get_default_icon_size(self.context))
|
295
|
+
)
|
296
|
+
|
297
|
+
sizer_main = wx.BoxSizer(wx.VERTICAL)
|
298
|
+
sizer_param_optype = wx.BoxSizer(wx.HORIZONTAL)
|
299
|
+
|
300
|
+
self.sizer_param_op = StaticBoxSizer(
|
301
|
+
self, wx.ID_ANY, _("Operation to test"), wx.VERTICAL
|
302
|
+
)
|
303
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Operation:"))
|
304
|
+
size_it(mylbl, LABEL_WIDTH)
|
305
|
+
h1 = wx.BoxSizer(wx.HORIZONTAL)
|
306
|
+
h1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
307
|
+
h1.Add(self.combo_ops, 1, wx.EXPAND, 0)
|
308
|
+
self.sizer_param_op.Add(h1, 0, wx.EXPAND, 0)
|
309
|
+
self.sizer_param_op.Add(self.combo_images, 0, wx.EXPAND, 0)
|
310
|
+
|
311
|
+
sizer_param_check = StaticBoxSizer(
|
312
|
+
self, wx.ID_ANY, _("Show Labels / Values"), wx.HORIZONTAL
|
313
|
+
)
|
314
|
+
sizer_param_check.Add(self.check_labels, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
315
|
+
sizer_param_check.Add(self.check_values, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
316
|
+
|
317
|
+
sizer_param_optype.Add(self.sizer_param_op, 1, wx.EXPAND, 0)
|
318
|
+
sizer_param_optype.Add(sizer_param_check, 1, wx.EXPAND, 0)
|
319
|
+
|
320
|
+
sizer_param_xy = wx.BoxSizer(wx.HORIZONTAL)
|
321
|
+
sizer_param_x = StaticBoxSizer(
|
322
|
+
self, wx.ID_ANY, _("First parameter (X-Axis)"), wx.VERTICAL
|
323
|
+
)
|
324
|
+
|
325
|
+
hline_param_1 = wx.BoxSizer(wx.HORIZONTAL)
|
326
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Parameter:"))
|
327
|
+
size_it(mylbl, LABEL_WIDTH)
|
328
|
+
hline_param_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
329
|
+
hline_param_1.Add(self.combo_param_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
330
|
+
|
331
|
+
hline_count_1 = wx.BoxSizer(wx.HORIZONTAL)
|
332
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Count:"))
|
333
|
+
size_it(mylbl, LABEL_WIDTH)
|
334
|
+
self.info_delta_1 = wxStaticText(self, wx.ID_ANY, "")
|
335
|
+
|
336
|
+
hline_count_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
337
|
+
hline_count_1.Add(self.spin_count_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
338
|
+
hline_count_1.Add(self.info_delta_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
339
|
+
|
340
|
+
hline_min_1 = wx.BoxSizer(wx.HORIZONTAL)
|
341
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Minimum:"))
|
342
|
+
size_it(mylbl, LABEL_WIDTH)
|
343
|
+
hline_min_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
344
|
+
hline_min_1.Add(self.text_min_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
345
|
+
hline_min_1.Add(self.unit_param_1a, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
346
|
+
|
347
|
+
hline_max_1 = wx.BoxSizer(wx.HORIZONTAL)
|
348
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Maximum:"))
|
349
|
+
size_it(mylbl, LABEL_WIDTH)
|
350
|
+
hline_max_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
351
|
+
hline_max_1.Add(self.text_max_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
352
|
+
hline_max_1.Add(self.unit_param_1b, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
353
|
+
|
354
|
+
hline_dim_1 = wx.BoxSizer(wx.HORIZONTAL)
|
355
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Width:"))
|
356
|
+
size_it(mylbl, LABEL_WIDTH)
|
357
|
+
hline_dim_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
358
|
+
hline_dim_1.Add(self.text_dim_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
359
|
+
mylbl = wxStaticText(self, wx.ID_ANY, "mm")
|
360
|
+
hline_dim_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
361
|
+
|
362
|
+
hline_delta_1 = wx.BoxSizer(wx.HORIZONTAL)
|
363
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Delta:"))
|
364
|
+
size_it(mylbl, LABEL_WIDTH)
|
365
|
+
hline_delta_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
366
|
+
hline_delta_1.Add(self.text_delta_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
367
|
+
mylbl = wxStaticText(self, wx.ID_ANY, "mm")
|
368
|
+
hline_delta_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
369
|
+
|
370
|
+
hline_color_1 = wx.BoxSizer(wx.HORIZONTAL)
|
371
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Color:"))
|
372
|
+
size_it(mylbl, LABEL_WIDTH)
|
373
|
+
hline_color_1.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
374
|
+
hline_color_1.Add(self.combo_color_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
375
|
+
hline_color_1.Add(self.check_color_direction_1, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
376
|
+
|
377
|
+
sizer_param_x.Add(hline_param_1, 0, wx.EXPAND, 0)
|
378
|
+
sizer_param_x.Add(hline_count_1, 0, wx.EXPAND, 0)
|
379
|
+
sizer_param_x.Add(hline_min_1, 0, wx.EXPAND, 0)
|
380
|
+
sizer_param_x.Add(hline_max_1, 0, wx.EXPAND, 0)
|
381
|
+
sizer_param_x.Add(hline_dim_1, 0, wx.EXPAND, 0)
|
382
|
+
sizer_param_x.Add(hline_delta_1, 0, wx.EXPAND, 0)
|
383
|
+
sizer_param_x.Add(hline_color_1, 0, wx.EXPAND, 0)
|
384
|
+
|
385
|
+
sizer_param_y = StaticBoxSizer(
|
386
|
+
self, wx.ID_ANY, _("Second parameter (Y-Axis)"), wx.VERTICAL
|
387
|
+
)
|
388
|
+
|
389
|
+
hline_param_2 = wx.BoxSizer(wx.HORIZONTAL)
|
390
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Parameter:"))
|
391
|
+
size_it(mylbl, LABEL_WIDTH)
|
392
|
+
hline_param_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
393
|
+
hline_param_2.Add(self.combo_param_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
394
|
+
|
395
|
+
hline_count_2 = wx.BoxSizer(wx.HORIZONTAL)
|
396
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Count:"))
|
397
|
+
size_it(mylbl, LABEL_WIDTH)
|
398
|
+
self.info_delta_2 = wxStaticText(self, wx.ID_ANY, "")
|
399
|
+
hline_count_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
400
|
+
hline_count_2.Add(self.spin_count_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
401
|
+
hline_count_2.Add(self.info_delta_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
402
|
+
|
403
|
+
hline_min_2 = wx.BoxSizer(wx.HORIZONTAL)
|
404
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Minimum:"))
|
405
|
+
size_it(mylbl, LABEL_WIDTH)
|
406
|
+
hline_min_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
407
|
+
hline_min_2.Add(self.text_min_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
408
|
+
hline_min_2.Add(self.unit_param_2a, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
409
|
+
|
410
|
+
hline_max_2 = wx.BoxSizer(wx.HORIZONTAL)
|
411
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Maximum:"))
|
412
|
+
size_it(mylbl, LABEL_WIDTH)
|
413
|
+
hline_max_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
414
|
+
hline_max_2.Add(self.text_max_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
415
|
+
hline_max_2.Add(self.unit_param_2b, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
416
|
+
|
417
|
+
hline_dim_2 = wx.BoxSizer(wx.HORIZONTAL)
|
418
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Height:"))
|
419
|
+
size_it(mylbl, LABEL_WIDTH)
|
420
|
+
hline_dim_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
421
|
+
hline_dim_2.Add(self.text_dim_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
422
|
+
mylbl = wxStaticText(self, wx.ID_ANY, "mm")
|
423
|
+
hline_dim_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
424
|
+
|
425
|
+
hline_delta_2 = wx.BoxSizer(wx.HORIZONTAL)
|
426
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Delta:"))
|
427
|
+
size_it(mylbl, LABEL_WIDTH)
|
428
|
+
hline_delta_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
429
|
+
hline_delta_2.Add(self.text_delta_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
430
|
+
mylbl = wxStaticText(self, wx.ID_ANY, "mm")
|
431
|
+
hline_delta_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
432
|
+
|
433
|
+
hline_color_2 = wx.BoxSizer(wx.HORIZONTAL)
|
434
|
+
mylbl = wxStaticText(self, wx.ID_ANY, _("Color:"))
|
435
|
+
size_it(mylbl, LABEL_WIDTH)
|
436
|
+
hline_color_2.Add(mylbl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
437
|
+
hline_color_2.Add(self.combo_color_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
438
|
+
hline_color_2.Add(self.check_color_direction_2, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
439
|
+
|
440
|
+
sizer_param_y.Add(hline_param_2, 0, wx.EXPAND, 0)
|
441
|
+
sizer_param_y.Add(hline_count_2, 0, wx.EXPAND, 0)
|
442
|
+
sizer_param_y.Add(hline_min_2, 0, wx.EXPAND, 0)
|
443
|
+
sizer_param_y.Add(hline_max_2, 0, wx.EXPAND, 0)
|
444
|
+
sizer_param_y.Add(hline_dim_2, 0, wx.EXPAND, 0)
|
445
|
+
sizer_param_y.Add(hline_delta_2, 0, wx.EXPAND, 0)
|
446
|
+
sizer_param_y.Add(hline_color_2, 0, wx.EXPAND, 0)
|
447
|
+
|
448
|
+
sizer_param_xy.Add(sizer_param_x, 1, wx.EXPAND, 0)
|
449
|
+
sizer_param_xy.Add(sizer_param_y, 1, wx.EXPAND, 0)
|
450
|
+
|
451
|
+
sizer_main.Add(sizer_param_optype, 0, wx.EXPAND, 0)
|
452
|
+
sizer_main.Add(sizer_param_xy, 0, wx.EXPAND, 0)
|
453
|
+
sizer_main.Add(self.button_create, 0, wx.EXPAND, 0)
|
454
|
+
|
455
|
+
sizer_info = StaticBoxSizer(self, wx.ID_ANY, _("How to use it"), wx.VERTICAL)
|
456
|
+
infomsg = _("To provide the best burning results, the parameters of operations")
|
457
|
+
infomsg += " " + _(
|
458
|
+
"need to be adjusted according to *YOUR* laser and the specific material"
|
459
|
+
)
|
460
|
+
infomsg += " " + _(
|
461
|
+
"you want to work with (e.g. one batch of poplar plywood from one supplier"
|
462
|
+
)
|
463
|
+
infomsg += " " + _(
|
464
|
+
"may respond completely different to a batch of another supplier despite"
|
465
|
+
)
|
466
|
+
infomsg += " " + _("having the very same specifications on paper).")
|
467
|
+
infomsg += "\n" + _(
|
468
|
+
"E.g. for a regular CO2 laser you want to optimize the burn speed"
|
469
|
+
)
|
470
|
+
infomsg += " " + _(
|
471
|
+
"for a given power to reduce burn marks or decrease execution time."
|
472
|
+
)
|
473
|
+
infomsg += "\n" + _(
|
474
|
+
"Meerk40t simplifies this task to find out the optimal settings"
|
475
|
+
)
|
476
|
+
infomsg += " " + _(
|
477
|
+
"by creating a testpattern that varies two different parameters."
|
478
|
+
)
|
479
|
+
|
480
|
+
info_label = TextCtrl(
|
481
|
+
self, wx.ID_ANY, value=infomsg, style=wx.TE_READONLY | wx.TE_MULTILINE
|
482
|
+
)
|
483
|
+
info_label.SetBackgroundColour(self.GetBackgroundColour())
|
484
|
+
sizer_info.Add(info_label, 1, wx.EXPAND, 0)
|
485
|
+
sizer_main.Add(sizer_info, 1, wx.EXPAND, 0)
|
486
|
+
|
487
|
+
self.button_create.SetToolTip(_("Create a grid with your values"))
|
488
|
+
s = _("Operation type for which the testpattern will be generated")
|
489
|
+
s += "\n" + _(
|
490
|
+
"You can define the common parameters for this operation in the other tabs on top of this window"
|
491
|
+
)
|
492
|
+
self.combo_ops.SetToolTip(s)
|
493
|
+
self.combo_param_1.SetToolTip(
|
494
|
+
_("Choose the first parameter that you want to be tested")
|
495
|
+
)
|
496
|
+
self.combo_param_2.SetToolTip(
|
497
|
+
_("Choose the second parameter that you want to be tested")
|
498
|
+
)
|
499
|
+
self.combo_color_1.SetToolTip(
|
500
|
+
_(
|
501
|
+
"Choose the color aspect for the first parameter. NB: the colors for both parameters will be combined"
|
502
|
+
)
|
503
|
+
)
|
504
|
+
self.combo_color_2.SetToolTip(
|
505
|
+
_(
|
506
|
+
"Choose the color aspect for the second parameter. NB: the colors for both parameters will be combined"
|
507
|
+
)
|
508
|
+
)
|
509
|
+
self.check_color_direction_1.SetToolTip(
|
510
|
+
_(
|
511
|
+
"If checked, then the color aspect will grow from min to max values, if not then shrink"
|
512
|
+
)
|
513
|
+
)
|
514
|
+
self.check_color_direction_2.SetToolTip(
|
515
|
+
_(
|
516
|
+
"If checked, then the color aspect will grow from min to max values, if not then shrink"
|
517
|
+
)
|
518
|
+
)
|
519
|
+
self.spin_count_1.SetToolTip(
|
520
|
+
_(
|
521
|
+
"Define how many values you want to test in the interval between min and max"
|
522
|
+
)
|
523
|
+
)
|
524
|
+
self.spin_count_2.SetToolTip(
|
525
|
+
_(
|
526
|
+
"Define how many values you want to test in the interval between min and max"
|
527
|
+
)
|
528
|
+
)
|
529
|
+
self.check_labels.SetToolTip(
|
530
|
+
_("Will create a descriptive label at the sides of the grid")
|
531
|
+
)
|
532
|
+
self.check_values.SetToolTip(
|
533
|
+
_("Will create the corresponding values as labels at the sides of the grid")
|
534
|
+
)
|
535
|
+
self.text_min_1.SetToolTip(_("Minimum value for 1st parameter"))
|
536
|
+
self.text_max_1.SetToolTip(_("Maximum value for 1st parameter"))
|
537
|
+
self.text_min_2.SetToolTip(_("Minimum value for 2nd parameter"))
|
538
|
+
self.text_max_2.SetToolTip(_("Maximum value for 2nd parameter"))
|
539
|
+
self.text_dim_1.SetToolTip(_("Width of the to be created pattern"))
|
540
|
+
self.text_dim_2.SetToolTip(_("Height of the to be created pattern"))
|
541
|
+
self.text_delta_1.SetToolTip(_("Horizontal gap between patterns"))
|
542
|
+
self.text_delta_2.SetToolTip(_("Vertical gap between patterns"))
|
543
|
+
|
544
|
+
self.button_create.Bind(wx.EVT_BUTTON, self.on_button_create_pattern)
|
545
|
+
self.combo_ops.Bind(wx.EVT_COMBOBOX, self.set_param_according_to_op)
|
546
|
+
self.text_min_1.Bind(wx.EVT_TEXT, self.validate_input)
|
547
|
+
self.text_max_1.Bind(wx.EVT_TEXT, self.validate_input)
|
548
|
+
self.text_min_2.Bind(wx.EVT_TEXT, self.validate_input)
|
549
|
+
self.text_max_2.Bind(wx.EVT_TEXT, self.validate_input)
|
550
|
+
self.text_dim_1.Bind(wx.EVT_TEXT, self.validate_input)
|
551
|
+
self.text_delta_1.Bind(wx.EVT_TEXT, self.validate_input)
|
552
|
+
self.text_dim_2.Bind(wx.EVT_TEXT, self.validate_input)
|
553
|
+
self.text_delta_2.Bind(wx.EVT_TEXT, self.validate_input)
|
554
|
+
self.combo_param_1.Bind(wx.EVT_COMBOBOX, self.on_combo_1)
|
555
|
+
self.combo_param_2.Bind(wx.EVT_COMBOBOX, self.on_combo_2)
|
556
|
+
self.combo_images.Bind(wx.EVT_COMBOBOX, self.on_combo_image)
|
557
|
+
self.spin_count_1.Bind(wx.EVT_SPINCTRL, self.validate_input)
|
558
|
+
self.spin_count_2.Bind(wx.EVT_SPINCTRL, self.validate_input)
|
559
|
+
|
560
|
+
self.SetSizer(sizer_main)
|
561
|
+
self.Layout()
|
562
|
+
self.setup_settings()
|
563
|
+
self.combo_ops.SetSelection(0)
|
564
|
+
self.restore_settings()
|
565
|
+
self.sync_fields()
|
566
|
+
|
567
|
+
def shortened(self, value, digits):
|
568
|
+
result = str(round(value, digits))
|
569
|
+
if "." in result:
|
570
|
+
while result.endswith("0"):
|
571
|
+
result = result[:-1]
|
572
|
+
if result.endswith("."):
|
573
|
+
if result == ".":
|
574
|
+
result = "0"
|
575
|
+
else:
|
576
|
+
result = result[:-1]
|
577
|
+
return result
|
578
|
+
|
579
|
+
def on_combo_image(self, event):
|
580
|
+
op = self.combo_ops.GetSelection()
|
581
|
+
if op != 3: # No Image?
|
582
|
+
return
|
583
|
+
idx = self.combo_images.GetSelection() - 1
|
584
|
+
if 0 <= idx < len(self.images):
|
585
|
+
bb = self.images[idx].bounds
|
586
|
+
if bb is not None:
|
587
|
+
wd = Length(amount=bb[2] - bb[0], preferred_units="mm")
|
588
|
+
ht = Length(amount=bb[3] - bb[1], preferred_units="mm")
|
589
|
+
self.text_dim_1.SetValue(f"{wd.mm:.1f}")
|
590
|
+
self.text_dim_2.SetValue(f"{ht.mm:.1f}")
|
591
|
+
|
592
|
+
def set_callback(self, routine):
|
593
|
+
self.callback = routine
|
594
|
+
idx = self.combo_ops.GetSelection()
|
595
|
+
if self.callback is not None and idx >= 0:
|
596
|
+
self.callback(self.default_op[idx])
|
597
|
+
|
598
|
+
def use_percent(self):
|
599
|
+
self.context.device.setting(bool, "use_percent_for_power_display", False)
|
600
|
+
return self.context.device.use_percent_for_power_display
|
601
|
+
|
602
|
+
def use_mm_min(self):
|
603
|
+
self.context.device.setting(bool, "use_mm_min_for_speed_display", False)
|
604
|
+
return self.context.device.use_mm_min_for_speed_display
|
605
|
+
|
606
|
+
def set_param_according_to_op(self, event):
|
607
|
+
def preset_image_dpi(node=None):
|
608
|
+
# Will be called ahead of the modification of the 'op image' dpi variable
|
609
|
+
node.overrule_dpi = True
|
610
|
+
|
611
|
+
def preset_passes(node=None):
|
612
|
+
# Will be called ahead of the modification of the passes variable
|
613
|
+
node.passes_custom = True
|
614
|
+
|
615
|
+
def preset_balor_wobble(node=None):
|
616
|
+
# Will be called ahead of the modification of a wobble variable
|
617
|
+
# to copy the device defaults
|
618
|
+
if node is None or "balor" not in self.context.device.path:
|
619
|
+
return
|
620
|
+
node.settings["wobble_enabled"] = True
|
621
|
+
|
622
|
+
def preset_balor_rapid(node=None):
|
623
|
+
# Will be called ahead of the modification of a rapid variable
|
624
|
+
# to copy the device defaults
|
625
|
+
if node is None or "balor" not in self.context.device.path:
|
626
|
+
return
|
627
|
+
node.settings["rapid_enabled"] = True
|
628
|
+
|
629
|
+
def preset_balor_pulse(node=None):
|
630
|
+
# Will be called ahead of the modification of a pulse variable
|
631
|
+
# to copy the device defaults
|
632
|
+
if node is None or "balor" not in self.context.device.path:
|
633
|
+
return
|
634
|
+
node.settings["pulse_width_enabled"] = True
|
635
|
+
|
636
|
+
def preset_balor_timings(node=None):
|
637
|
+
# Will be called ahead of the modification of a timing variable
|
638
|
+
# to copy the device defaults
|
639
|
+
if node is None or "balor" not in self.context.device.path:
|
640
|
+
return
|
641
|
+
if not node.settings["timing_enabled"]:
|
642
|
+
node.settings["timing_enabled"] = True
|
643
|
+
node.settings["delay_laser_on"] = self.context.device.delay_laser_on
|
644
|
+
node.settings["delay_laser_off"] = self.context.device.delay_laser_off
|
645
|
+
node.settings["delay_polygon"] = self.context.device.delay_polygon
|
646
|
+
|
647
|
+
opidx = self.combo_ops.GetSelection()
|
648
|
+
if self.current_op == opidx:
|
649
|
+
return
|
650
|
+
self.current_op = opidx
|
651
|
+
|
652
|
+
busy = wx.BusyCursor()
|
653
|
+
self.Freeze()
|
654
|
+
if opidx < 0:
|
655
|
+
opnode = None
|
656
|
+
self._freecolor = True
|
657
|
+
self.combo_images.Show(False)
|
658
|
+
self.text_dim_1.Enable(True)
|
659
|
+
self.text_dim_2.Enable(True)
|
660
|
+
else:
|
661
|
+
opnode = self.default_op[opidx]
|
662
|
+
self._freecolor = self.color_scheme_free[opidx]
|
663
|
+
self.combo_images.Show(self.use_image[opidx])
|
664
|
+
self.text_dim_1.Enable(not self.use_image[opidx])
|
665
|
+
self.text_dim_2.Enable(not self.use_image[opidx])
|
666
|
+
self.sizer_param_op.Layout()
|
667
|
+
if self.callback is not None:
|
668
|
+
self.callback(opnode)
|
669
|
+
self.combo_color_1.Enable(self._freecolor)
|
670
|
+
self.combo_color_2.Enable(self._freecolor)
|
671
|
+
self.check_color_direction_1.Enable(self._freecolor)
|
672
|
+
self.check_color_direction_2.Enable(self._freecolor)
|
673
|
+
|
674
|
+
# (internal_attribute, secondary_attribute, Label, unit, keep_unit, needs_to_be_positive)
|
675
|
+
if self.use_percent():
|
676
|
+
ppi = "%"
|
677
|
+
else:
|
678
|
+
ppi = "ppi"
|
679
|
+
if self.use_mm_min():
|
680
|
+
speed_unit = "mm/min"
|
681
|
+
else:
|
682
|
+
speed_unit = "mm/s"
|
683
|
+
self.parameters = [
|
684
|
+
("speed", None, _("Speed"), speed_unit, False, True),
|
685
|
+
("power", None, _("Power"), ppi, False, True),
|
686
|
+
("passes", preset_passes, _("Passes"), "x", False, True),
|
687
|
+
]
|
688
|
+
|
689
|
+
if opidx == 0:
|
690
|
+
# Cut
|
691
|
+
# (internal_attribute, secondary_attribute, Label, unit, keep_unit, needs_to_be_positive, type)
|
692
|
+
self.parameters = [
|
693
|
+
("speed", None, _("Speed"), speed_unit, False, True, None),
|
694
|
+
("power", None, _("Power"), ppi, False, True, None),
|
695
|
+
("passes", preset_passes, _("Passes"), "x", False, True, int),
|
696
|
+
]
|
697
|
+
elif opidx == 1:
|
698
|
+
# Engrave
|
699
|
+
self.parameters = [
|
700
|
+
("speed", None, _("Speed"), speed_unit, False, True, None),
|
701
|
+
("power", None, _("Power"), ppi, False, True, None),
|
702
|
+
("passes", preset_passes, _("Passes"), "x", False, True, int),
|
703
|
+
]
|
704
|
+
elif opidx == 2:
|
705
|
+
# Raster
|
706
|
+
self.parameters = [
|
707
|
+
("speed", None, _("Speed"), speed_unit, False, True, None),
|
708
|
+
("power", None, _("Power"), ppi, False, True, None),
|
709
|
+
("passes", preset_passes, _("Passes"), "x", False, True, int),
|
710
|
+
("dpi", None, _("DPI"), "dpi", False, True, int),
|
711
|
+
("overscan", None, _("Overscan"), "mm", False, True, None),
|
712
|
+
]
|
713
|
+
elif opidx == 3:
|
714
|
+
# Image
|
715
|
+
self.parameters = [
|
716
|
+
("speed", None, _("Speed"), speed_unit, False, True, None),
|
717
|
+
("power", None, _("Power"), ppi, False, True, None),
|
718
|
+
("passes", preset_passes, _("Passes"), "x", False, True, int),
|
719
|
+
("dpi", preset_image_dpi, _("DPI"), "dpi", False, True, int),
|
720
|
+
("overscan", None, _("Overscan"), "mm", False, True, None),
|
721
|
+
]
|
722
|
+
elif opidx == 4:
|
723
|
+
# Hatch
|
724
|
+
self.parameters = [
|
725
|
+
("speed", None, _("Speed"), speed_unit, False, True, None),
|
726
|
+
("power", None, _("Power"), ppi, False, True, None),
|
727
|
+
("passes", preset_passes, _("Passes"), "x", False, True, int),
|
728
|
+
("hatch_distance", None, _("Hatch Distance"), "mm", False, True, None),
|
729
|
+
("hatch_angle", None, _("Hatch Angle"), "deg", False, True, None),
|
730
|
+
]
|
731
|
+
|
732
|
+
if "balor" in self.context.device.path:
|
733
|
+
balor_choices = [
|
734
|
+
("frequency", None, _("Frequency"), "kHz", False, True, None),
|
735
|
+
("rapid_speed", preset_balor_rapid, _("Rapid Speed"), "mm/s", False, True, None,),
|
736
|
+
("delay_laser_on", preset_balor_timings, _("Laser On Delay"), "µs", False, False, None,),
|
737
|
+
("delay_laser_off", preset_balor_timings, _("Laser Off Delay"), "µs", False, False, None,),
|
738
|
+
("delay_polygon", preset_balor_timings, _("Polygon Delay"), "µs", False, False, None,),
|
739
|
+
("wobble_radius", preset_balor_wobble, _("Wobble Radius"), "mm", True, True, None,),
|
740
|
+
("wobble_interval", preset_balor_wobble, _("Wobble Interval"), "mm", True, True, None,),
|
741
|
+
("wobble_speed", preset_balor_wobble, _("Wobble Speed Multiplier"), "x", False, True, None,),
|
742
|
+
]
|
743
|
+
if self.context.device.pulse_width_enabled:
|
744
|
+
balor_choices.append(
|
745
|
+
(
|
746
|
+
"pulse_width",
|
747
|
+
preset_balor_pulse,
|
748
|
+
_("Pulse Width"),
|
749
|
+
"ns",
|
750
|
+
False,
|
751
|
+
True,
|
752
|
+
None,
|
753
|
+
)
|
754
|
+
)
|
755
|
+
|
756
|
+
for entry in balor_choices:
|
757
|
+
self.parameters.append(entry)
|
758
|
+
# for p in self.parameters:
|
759
|
+
# if len(p) != 7:
|
760
|
+
# print (f"No good: {p}")
|
761
|
+
choices = []
|
762
|
+
for entry in self.parameters:
|
763
|
+
choices.append(entry[2])
|
764
|
+
self.combo_param_1.Clear()
|
765
|
+
self.combo_param_1.Set(choices)
|
766
|
+
self.combo_param_2.Clear()
|
767
|
+
self.combo_param_2.Set(choices)
|
768
|
+
idx1 = -1
|
769
|
+
idx2 = -1
|
770
|
+
if len(self.parameters) > 0:
|
771
|
+
idx1 = 0
|
772
|
+
idx2 = 0
|
773
|
+
if len(self.parameters) > 1:
|
774
|
+
idx2 = 1
|
775
|
+
self.combo_param_1.SetSelection(idx1)
|
776
|
+
self.on_combo_1(None)
|
777
|
+
self.combo_param_2.SetSelection(idx2)
|
778
|
+
self.on_combo_2(None)
|
779
|
+
self.Layout()
|
780
|
+
self.Thaw()
|
781
|
+
del busy
|
782
|
+
|
783
|
+
def on_combo_1(self, input):
|
784
|
+
s_unit = ""
|
785
|
+
b_positive = True
|
786
|
+
idx = self.combo_param_1.GetSelection()
|
787
|
+
# 0 = internal_attribute, 1 = secondary_attribute,
|
788
|
+
# 2 = Label, 3 = unit,
|
789
|
+
# 4 = keep_unit, 5 = needs_to_be_positive)
|
790
|
+
if 0 <= idx < len(self.parameters):
|
791
|
+
s_unit = self.parameters[idx][3]
|
792
|
+
b_positive = self.parameters[idx][5]
|
793
|
+
self.unit_param_1a.SetLabel(s_unit)
|
794
|
+
self.unit_param_1b.SetLabel(s_unit)
|
795
|
+
# And now enter validation...
|
796
|
+
self.validate_input(None)
|
797
|
+
|
798
|
+
def on_combo_2(self, input):
|
799
|
+
s_unit = ""
|
800
|
+
idx = self.combo_param_2.GetSelection()
|
801
|
+
# 0 = internal_attribute, 1 = secondary_attribute,
|
802
|
+
# 2 = Label, 3 = unit,
|
803
|
+
# 4 = keep_unit, 5 = needs_to_be_positive)
|
804
|
+
if 0 <= idx < len(self.parameters):
|
805
|
+
s_unit = self.parameters[idx][3]
|
806
|
+
self.unit_param_2a.SetLabel(s_unit)
|
807
|
+
self.unit_param_2b.SetLabel(s_unit)
|
808
|
+
# And now enter validation...
|
809
|
+
self.validate_input(None)
|
810
|
+
|
811
|
+
def validate_input(self, event):
|
812
|
+
def valid_float(ctrl):
|
813
|
+
result = True
|
814
|
+
if ctrl.GetValue() == "":
|
815
|
+
result = False
|
816
|
+
else:
|
817
|
+
try:
|
818
|
+
value = float(ctrl.GetValue())
|
819
|
+
except ValueError:
|
820
|
+
result = False
|
821
|
+
return result
|
822
|
+
|
823
|
+
active = True
|
824
|
+
valid_interval_1 = True
|
825
|
+
valid_interval_2 = True
|
826
|
+
optype = self.combo_ops.GetSelection()
|
827
|
+
if optype < 0:
|
828
|
+
active = False
|
829
|
+
if (
|
830
|
+
optype == 3 and self.combo_images.GetSelection() < 1
|
831
|
+
): # image and no valid image chosen
|
832
|
+
active = False
|
833
|
+
idx1 = self.combo_param_1.GetSelection()
|
834
|
+
if idx1 < 0:
|
835
|
+
active = False
|
836
|
+
idx2 = self.combo_param_2.GetSelection()
|
837
|
+
if idx2 < 0:
|
838
|
+
active = False
|
839
|
+
if idx1 == idx2:
|
840
|
+
active = False
|
841
|
+
if not valid_float(self.text_min_1):
|
842
|
+
active = False
|
843
|
+
valid_interval_1 = False
|
844
|
+
if not valid_float(self.text_max_1):
|
845
|
+
active = False
|
846
|
+
valid_interval_1 = False
|
847
|
+
if not valid_float(self.text_min_2):
|
848
|
+
active = False
|
849
|
+
valid_interval_2 = False
|
850
|
+
if not valid_float(self.text_max_2):
|
851
|
+
active = False
|
852
|
+
valid_interval_2 = False
|
853
|
+
if not valid_float(self.text_dim_1):
|
854
|
+
active = False
|
855
|
+
if not valid_float(self.text_delta_1):
|
856
|
+
active = False
|
857
|
+
if not valid_float(self.text_dim_2):
|
858
|
+
active = False
|
859
|
+
if not valid_float(self.text_delta_2):
|
860
|
+
active = False
|
861
|
+
if valid_interval_1:
|
862
|
+
minv = float(self.text_min_1.GetValue())
|
863
|
+
maxv = float(self.text_max_1.GetValue())
|
864
|
+
count = self.spin_count_1.GetValue()
|
865
|
+
delta = maxv - minv
|
866
|
+
if count > 1:
|
867
|
+
delta /= count - 1
|
868
|
+
s_unit = ""
|
869
|
+
idx = self.combo_param_1.GetSelection()
|
870
|
+
# 0 = internal_attribute, 1 = secondary_attribute,
|
871
|
+
# 2 = Label, 3 = unit,
|
872
|
+
# 4 = keep_unit, 5 = needs_to_be_positive)
|
873
|
+
if 0 <= idx < len(self.parameters):
|
874
|
+
s_unit = self.parameters[idx][3]
|
875
|
+
self.info_delta_1.SetLabel(
|
876
|
+
_("Every {dist}").format(dist=self.shortened(delta, 3) + s_unit)
|
877
|
+
)
|
878
|
+
else:
|
879
|
+
self.info_delta_1.SetLabel("---")
|
880
|
+
if valid_interval_2:
|
881
|
+
minv = float(self.text_min_2.GetValue())
|
882
|
+
maxv = float(self.text_max_2.GetValue())
|
883
|
+
count = self.spin_count_2.GetValue()
|
884
|
+
delta = maxv - minv
|
885
|
+
if count > 1:
|
886
|
+
delta /= count - 1
|
887
|
+
s_unit = ""
|
888
|
+
idx = self.combo_param_2.GetSelection()
|
889
|
+
# 0 = internal_attribute, 1 = secondary_attribute,
|
890
|
+
# 2 = Label, 3 = unit,
|
891
|
+
# 4 = keep_unit, 5 = needs_to_be_positive)
|
892
|
+
if 0 <= idx < len(self.parameters):
|
893
|
+
s_unit = self.parameters[idx][3]
|
894
|
+
self.info_delta_2.SetLabel(
|
895
|
+
_("Every {dist}").format(dist=self.shortened(delta, 3) + s_unit)
|
896
|
+
)
|
897
|
+
else:
|
898
|
+
self.info_delta_2.SetLabel("---")
|
899
|
+
|
900
|
+
self.button_create.Enable(active)
|
901
|
+
|
902
|
+
def on_device_update(self):
|
903
|
+
self.current_op = None
|
904
|
+
self.set_param_according_to_op(None)
|
905
|
+
# self.on_combo_1(None)
|
906
|
+
# self.on_combo_2(None)
|
907
|
+
|
908
|
+
def on_button_create_pattern(self, event):
|
909
|
+
def make_color(idx1, max1, idx2, max2, aspect1, growing1, aspect2, growing2):
|
910
|
+
if self._freecolor:
|
911
|
+
r = 0
|
912
|
+
g = 0
|
913
|
+
b = 0
|
914
|
+
|
915
|
+
rel = max1 - 1
|
916
|
+
if rel < 1:
|
917
|
+
rel = 1
|
918
|
+
if growing1:
|
919
|
+
val1 = int(idx1 / rel * 255.0)
|
920
|
+
else:
|
921
|
+
val1 = 255 - int(idx1 / rel * 255.0)
|
922
|
+
|
923
|
+
rel = max2 - 1
|
924
|
+
if rel < 1:
|
925
|
+
rel = 1
|
926
|
+
if growing2:
|
927
|
+
val2 = int(idx2 / rel * 255.0)
|
928
|
+
else:
|
929
|
+
val2 = 255 - int(idx2 / rel * 255.0)
|
930
|
+
if aspect1 == 1:
|
931
|
+
g = val1
|
932
|
+
elif aspect1 == 2:
|
933
|
+
b = val1
|
934
|
+
else:
|
935
|
+
r = val1
|
936
|
+
if aspect2 == 1:
|
937
|
+
g = val1
|
938
|
+
elif aspect2 == 2:
|
939
|
+
b = val2
|
940
|
+
else:
|
941
|
+
r = val2
|
942
|
+
else:
|
943
|
+
r = 0
|
944
|
+
g = 0
|
945
|
+
b = 0
|
946
|
+
mycolor = Color(r, g, b)
|
947
|
+
return mycolor
|
948
|
+
|
949
|
+
def clear_all():
|
950
|
+
self.context.elements.clear_operations(fast=True)
|
951
|
+
self.context.elements.clear_elements(fast=True)
|
952
|
+
|
953
|
+
def create_operations():
|
954
|
+
# opchoices = [_("Cut"), _("Engrave"), _("Raster"), _("Image"), _("Hatch")]
|
955
|
+
display_labels = self.check_labels.GetValue()
|
956
|
+
display_values = self.check_values.GetValue()
|
957
|
+
color_aspect_1 = max(0, self.combo_color_1.GetSelection())
|
958
|
+
color_aspect_2 = max(0, self.combo_color_2.GetSelection())
|
959
|
+
color_growing_1 = self.check_color_direction_1.GetValue()
|
960
|
+
color_growing_2 = self.check_color_direction_2.GetValue()
|
961
|
+
|
962
|
+
if optype < 0 or optype > 4:
|
963
|
+
return
|
964
|
+
if optype == 3:
|
965
|
+
shapetype = "image"
|
966
|
+
else:
|
967
|
+
shapetype = "rect"
|
968
|
+
size_x = float(Length(f"{dimension_1}mm"))
|
969
|
+
size_y = float(Length(f"{dimension_2}mm"))
|
970
|
+
gap_x = float(Length(f"{gap_1}mm"))
|
971
|
+
gap_y = float(Length(f"{gap_2}mm"))
|
972
|
+
expected_width = count_1 * size_x + (count_1 - 1) * gap_x
|
973
|
+
expected_height = count_2 * size_y + (count_2 - 1) * gap_y
|
974
|
+
# Need to be adjusted to allow for centering
|
975
|
+
start_x = (
|
976
|
+
float(Length(self.context.device.view.width)) - expected_width
|
977
|
+
) / 2
|
978
|
+
start_y = (
|
979
|
+
float(Length(self.context.device.view.height)) - expected_height
|
980
|
+
) / 2
|
981
|
+
operation_branch = self.context.elements._tree.get(type="branch ops")
|
982
|
+
element_branch = self.context.elements._tree.get(type="branch elems")
|
983
|
+
|
984
|
+
text_scale_x = min(1.0, size_y / float(Length("20mm")))
|
985
|
+
text_scale_y = min(1.0, size_x / float(Length("20mm")))
|
986
|
+
|
987
|
+
# Make one op for text
|
988
|
+
if display_labels or display_values:
|
989
|
+
text_op_x = RasterOpNode()
|
990
|
+
text_op_x.color = Color("black")
|
991
|
+
text_op_x.label = "Descriptions X-Axis"
|
992
|
+
text_op_y = RasterOpNode()
|
993
|
+
text_op_y.color = Color("black")
|
994
|
+
text_op_y.label = "Descriptions Y-Axis"
|
995
|
+
operation_branch.add_node(text_op_x)
|
996
|
+
operation_branch.add_node(text_op_y)
|
997
|
+
if display_labels:
|
998
|
+
text_x = start_x + expected_width / 2
|
999
|
+
text_y = start_y - min(float(Length("10mm")), 3 * gap_y)
|
1000
|
+
node = self.context.elements.elem_branch.add(
|
1001
|
+
text=f"{param_name_1} [{param_unit_1}]",
|
1002
|
+
matrix=Matrix(
|
1003
|
+
f"translate({text_x}, {text_y}) scale({2 * max(text_scale_x, text_scale_y) * UNITS_PER_PIXEL})"
|
1004
|
+
),
|
1005
|
+
anchor="middle",
|
1006
|
+
fill=Color("black"),
|
1007
|
+
type="elem text",
|
1008
|
+
)
|
1009
|
+
text_op_x.add_reference(node, 0)
|
1010
|
+
|
1011
|
+
text_x = start_x - min(float(Length("10mm")), 3 * gap_x)
|
1012
|
+
text_y = start_y + expected_height / 2
|
1013
|
+
node = self.context.elements.elem_branch.add(
|
1014
|
+
text=f"{param_name_2} [{param_unit_2}]",
|
1015
|
+
matrix=Matrix(
|
1016
|
+
f"translate({text_x}, {text_y}) scale({2 * max(text_scale_x, text_scale_y) * UNITS_PER_PIXEL})"
|
1017
|
+
),
|
1018
|
+
anchor="middle",
|
1019
|
+
fill=Color("black"),
|
1020
|
+
type="elem text",
|
1021
|
+
)
|
1022
|
+
node.matrix.post_rotate(tau * 3 / 4, text_x, text_y)
|
1023
|
+
node.modified()
|
1024
|
+
text_op_y.add_reference(node, 0)
|
1025
|
+
|
1026
|
+
_p_value_1 = min_value_1
|
1027
|
+
|
1028
|
+
xx = start_x
|
1029
|
+
for idx1 in range(count_1):
|
1030
|
+
p_value_1 = _p_value_1
|
1031
|
+
if param_value_type_1 is not None:
|
1032
|
+
try:
|
1033
|
+
_pp = param_value_type_1(_p_value_1)
|
1034
|
+
p_value_1 = _pp
|
1035
|
+
except ValueError:
|
1036
|
+
pass
|
1037
|
+
pval1 = self.shortened(p_value_1, 3)
|
1038
|
+
|
1039
|
+
_p_value_2 = min_value_2
|
1040
|
+
yy = start_y
|
1041
|
+
|
1042
|
+
if display_values:
|
1043
|
+
# Add a text above for each column
|
1044
|
+
text_x = xx + 0.5 * size_x
|
1045
|
+
text_y = yy - min(float(Length("5mm")), 1.5 * gap_y)
|
1046
|
+
node = self.context.elements.elem_branch.add(
|
1047
|
+
text=f"{pval1}",
|
1048
|
+
matrix=Matrix(
|
1049
|
+
f"translate({text_x}, {text_y}) scale({text_scale_x * UNITS_PER_PIXEL})"
|
1050
|
+
),
|
1051
|
+
anchor="middle",
|
1052
|
+
fill=Color("black"),
|
1053
|
+
type="elem text",
|
1054
|
+
)
|
1055
|
+
# node.matrix.post_rotate(tau / 4, text_x, text_y)
|
1056
|
+
node.modified()
|
1057
|
+
text_op_x.add_reference(node, 0)
|
1058
|
+
|
1059
|
+
for idx2 in range(count_2):
|
1060
|
+
p_value_2 = _p_value_2
|
1061
|
+
if param_value_type_2 is not None:
|
1062
|
+
try:
|
1063
|
+
_pp = param_value_type_2(_p_value_2)
|
1064
|
+
p_value_2 = _pp
|
1065
|
+
except ValueError:
|
1066
|
+
pass
|
1067
|
+
|
1068
|
+
pval2 = self.shortened(p_value_2, 3)
|
1069
|
+
s_lbl = f"{param_type_1}={pval1}{param_unit_1}"
|
1070
|
+
s_lbl += f"- {param_type_2}={pval2}{param_unit_2}"
|
1071
|
+
if display_values and idx1 == 0: # first row, so add a text above
|
1072
|
+
text_x = xx - min(float(Length("5mm")), 1.5 * gap_x)
|
1073
|
+
text_y = yy + 0.5 * size_y
|
1074
|
+
node = self.context.elements.elem_branch.add(
|
1075
|
+
text=f"{pval2}",
|
1076
|
+
matrix=Matrix(
|
1077
|
+
f"translate({text_x}, {text_y}) scale({text_scale_y * UNITS_PER_PIXEL})"
|
1078
|
+
),
|
1079
|
+
anchor="middle",
|
1080
|
+
fill=Color("black"),
|
1081
|
+
type="elem text",
|
1082
|
+
)
|
1083
|
+
node.matrix.post_rotate(tau * 3 / 4, text_x, text_y)
|
1084
|
+
text_op_y.add_reference(node, 0)
|
1085
|
+
if optype == 0: # Cut
|
1086
|
+
this_op = copy(self.default_op[optype])
|
1087
|
+
master_op = this_op
|
1088
|
+
usefill = False
|
1089
|
+
elif optype == 1: # Engrave
|
1090
|
+
this_op = copy(self.default_op[optype])
|
1091
|
+
master_op = this_op
|
1092
|
+
usefill = False
|
1093
|
+
elif optype == 2: # Raster
|
1094
|
+
this_op = copy(self.default_op[optype])
|
1095
|
+
master_op = this_op
|
1096
|
+
usefill = True
|
1097
|
+
elif optype == 3: # Image
|
1098
|
+
this_op = copy(self.default_op[optype])
|
1099
|
+
master_op = this_op
|
1100
|
+
usefill = False
|
1101
|
+
elif optype == 4: # Hatch
|
1102
|
+
master_op = copy(self.default_op[optype])
|
1103
|
+
this_op = HatchEffectNode()
|
1104
|
+
master_op.add_node(this_op)
|
1105
|
+
|
1106
|
+
# We need to add a hatch node and make this the target for parameter application
|
1107
|
+
usefill = False
|
1108
|
+
else:
|
1109
|
+
return
|
1110
|
+
this_op.label = s_lbl
|
1111
|
+
|
1112
|
+
# Do we need to prep the op?
|
1113
|
+
if param_prepper_1 is not None:
|
1114
|
+
param_prepper_1(this_op)
|
1115
|
+
|
1116
|
+
if param_keep_unit_1:
|
1117
|
+
value = str(p_value_1) + param_unit_1
|
1118
|
+
else:
|
1119
|
+
value = p_value_1
|
1120
|
+
if param_type_1 == "power" and self.use_percent():
|
1121
|
+
value *= 10.0
|
1122
|
+
if param_type_1 == "speed" and self.use_mm_min():
|
1123
|
+
value /= 60.0
|
1124
|
+
if hasattr(master_op, param_type_1):
|
1125
|
+
# quick and dirty
|
1126
|
+
if param_type_1 == "passes":
|
1127
|
+
value = int(value)
|
1128
|
+
if param_type_1 == "hatch_distance":
|
1129
|
+
if not str(value).endswith("mm"):
|
1130
|
+
value = f"{value}mm"
|
1131
|
+
setattr(master_op, param_type_1, value)
|
1132
|
+
# else: # Try setting
|
1133
|
+
# master_op.settings[param_type_1] = value
|
1134
|
+
if hasattr(this_op, param_type_1):
|
1135
|
+
# quick and dirty
|
1136
|
+
if param_type_1 == "passes":
|
1137
|
+
value = int(value)
|
1138
|
+
if param_type_1 == "hatch_distance":
|
1139
|
+
if not str(value).endswith("mm"):
|
1140
|
+
value = f"{value}mm"
|
1141
|
+
setattr(this_op, param_type_1, value)
|
1142
|
+
elif hasattr(this_op, "settings"): # Try setting
|
1143
|
+
this_op.settings[param_type_1] = value
|
1144
|
+
|
1145
|
+
# Do we need to prep the op?
|
1146
|
+
if param_prepper_2 is not None:
|
1147
|
+
param_prepper_2(this_op)
|
1148
|
+
|
1149
|
+
if param_keep_unit_2:
|
1150
|
+
value = str(p_value_2) + param_unit_2
|
1151
|
+
else:
|
1152
|
+
value = p_value_2
|
1153
|
+
if param_type_2 == "power" and self.use_percent():
|
1154
|
+
value *= 10.0
|
1155
|
+
if param_type_2 == "speed" and self.use_mm_min():
|
1156
|
+
value /= 60.0
|
1157
|
+
if hasattr(master_op, param_type_2):
|
1158
|
+
# quick and dirty
|
1159
|
+
if param_type_2 == "passes":
|
1160
|
+
value = int(value)
|
1161
|
+
if param_type_2 == "hatch_distance":
|
1162
|
+
if not str(value).endswith("mm"):
|
1163
|
+
value = f"{value}mm"
|
1164
|
+
setattr(master_op, param_type_2, value)
|
1165
|
+
if hasattr(this_op, param_type_2):
|
1166
|
+
if param_type_2 == "passes":
|
1167
|
+
value = int(value)
|
1168
|
+
if param_type_2 == "hatch_distance":
|
1169
|
+
if not str(value).endswith("mm"):
|
1170
|
+
value = f"{value}mm"
|
1171
|
+
setattr(this_op, param_type_2, value)
|
1172
|
+
elif hasattr(this_op, "settings"): # Try setting
|
1173
|
+
this_op.settings[param_type_2] = value
|
1174
|
+
|
1175
|
+
set_color = make_color(
|
1176
|
+
idx1,
|
1177
|
+
count_1,
|
1178
|
+
idx2,
|
1179
|
+
count_2,
|
1180
|
+
color_aspect_1,
|
1181
|
+
color_growing_1,
|
1182
|
+
color_aspect_2,
|
1183
|
+
color_growing_2,
|
1184
|
+
)
|
1185
|
+
this_op.color = set_color
|
1186
|
+
# Add op to tree.
|
1187
|
+
operation_branch.add_node(master_op)
|
1188
|
+
# Now add a rectangle to the scene and assign it to the newly created op
|
1189
|
+
if usefill:
|
1190
|
+
fill_color = set_color
|
1191
|
+
else:
|
1192
|
+
fill_color = None
|
1193
|
+
if shapetype == "image":
|
1194
|
+
idx = self.combo_images.GetSelection() - 1
|
1195
|
+
if 0 <= idx < len(self.images):
|
1196
|
+
elemnode = copy(self.images[idx])
|
1197
|
+
elemnode.matrix.post_translate(xx, yy)
|
1198
|
+
elemnode.modified()
|
1199
|
+
self.context.elements.elem_branch.add_node(elemnode)
|
1200
|
+
elif shapetype == "rect":
|
1201
|
+
elemnode = self.context.elements.elem_branch.add(
|
1202
|
+
x=xx,
|
1203
|
+
y=yy,
|
1204
|
+
width=size_x,
|
1205
|
+
height=size_y,
|
1206
|
+
stroke=set_color,
|
1207
|
+
fill=fill_color,
|
1208
|
+
type="elem rect",
|
1209
|
+
)
|
1210
|
+
elif shapetype == "circle":
|
1211
|
+
elemnode = self.context.elements.elem_branch.add(
|
1212
|
+
cx=xx + size_x / 2,
|
1213
|
+
cy=yy + size_y / 2,
|
1214
|
+
rx=size_x / 2,
|
1215
|
+
ry=size_y / 2,
|
1216
|
+
stroke=set_color,
|
1217
|
+
fill=fill_color,
|
1218
|
+
type="elem ellipse",
|
1219
|
+
)
|
1220
|
+
elemnode.label = s_lbl
|
1221
|
+
this_op.add_reference(elemnode, 0)
|
1222
|
+
_p_value_2 += delta_2
|
1223
|
+
yy = yy + gap_y + size_y
|
1224
|
+
_p_value_1 += delta_1
|
1225
|
+
xx = xx + gap_x + size_x
|
1226
|
+
|
1227
|
+
# Read the parameters and user input
|
1228
|
+
optype = self.combo_ops.GetSelection()
|
1229
|
+
if optype < 0:
|
1230
|
+
return
|
1231
|
+
idx = self.combo_param_1.GetSelection()
|
1232
|
+
if idx < 0:
|
1233
|
+
return
|
1234
|
+
# 0 = internal_attribute, 1 = secondary_attribute,
|
1235
|
+
# 2 = Label, 3 = unit,
|
1236
|
+
# 4 = keep_unit, 5 = needs_to_be_positive)
|
1237
|
+
param_name_1 = self.parameters[idx][2]
|
1238
|
+
param_type_1 = self.parameters[idx][0]
|
1239
|
+
param_value_type_1 = self.parameters[idx][6]
|
1240
|
+
param_prepper_1 = self.parameters[idx][1]
|
1241
|
+
if param_prepper_1 == "":
|
1242
|
+
param_prepper_1 = None
|
1243
|
+
param_unit_1 = self.parameters[idx][3]
|
1244
|
+
param_keep_unit_1 = self.parameters[idx][4]
|
1245
|
+
param_positive_1 = self.parameters[idx][5]
|
1246
|
+
|
1247
|
+
idx = self.combo_param_2.GetSelection()
|
1248
|
+
if idx < 0:
|
1249
|
+
return
|
1250
|
+
param_name_2 = self.parameters[idx][2]
|
1251
|
+
param_type_2 = self.parameters[idx][0]
|
1252
|
+
param_value_type_2 = self.parameters[idx][6]
|
1253
|
+
param_prepper_2 = self.parameters[idx][1]
|
1254
|
+
if param_prepper_2 == "":
|
1255
|
+
param_prepper_2 = None
|
1256
|
+
param_unit_2 = self.parameters[idx][3]
|
1257
|
+
param_keep_unit_2 = self.parameters[idx][4]
|
1258
|
+
param_positive_2 = self.parameters[idx][5]
|
1259
|
+
if param_type_1 == param_type_2:
|
1260
|
+
return
|
1261
|
+
if self.text_min_1.GetValue() == "":
|
1262
|
+
return
|
1263
|
+
try:
|
1264
|
+
min_value_1 = float(self.text_min_1.GetValue())
|
1265
|
+
except ValueError:
|
1266
|
+
return
|
1267
|
+
if self.text_min_2.GetValue() == "":
|
1268
|
+
return
|
1269
|
+
try:
|
1270
|
+
min_value_2 = float(self.text_min_2.GetValue())
|
1271
|
+
except ValueError:
|
1272
|
+
return
|
1273
|
+
if self.text_max_1.GetValue() == "":
|
1274
|
+
return
|
1275
|
+
try:
|
1276
|
+
max_value_1 = float(self.text_max_1.GetValue())
|
1277
|
+
except ValueError:
|
1278
|
+
return
|
1279
|
+
if self.text_max_2.GetValue() == "":
|
1280
|
+
return
|
1281
|
+
try:
|
1282
|
+
max_value_2 = float(self.text_max_2.GetValue())
|
1283
|
+
except ValueError:
|
1284
|
+
return
|
1285
|
+
|
1286
|
+
if param_unit_1 == "deg":
|
1287
|
+
min_value_1 = Angle(self.text_min_1.GetValue()).degrees
|
1288
|
+
max_value_1 = Angle(self.text_max_1.GetValue()).degrees
|
1289
|
+
elif param_unit_1 == "ppi":
|
1290
|
+
min_value_1 = max(min_value_1, 0)
|
1291
|
+
max_value_1 = min(max_value_1, 1000)
|
1292
|
+
elif param_unit_1 == "%":
|
1293
|
+
min_value_1 = max(min_value_1, 0)
|
1294
|
+
max_value_1 = min(max_value_1, 100)
|
1295
|
+
else:
|
1296
|
+
# > 0
|
1297
|
+
if param_positive_1:
|
1298
|
+
min_value_1 = max(min_value_1, 0)
|
1299
|
+
max_value_1 = max(max_value_1, 0)
|
1300
|
+
|
1301
|
+
if param_unit_2 == "deg":
|
1302
|
+
min_value_2 = Angle(self.text_min_2.GetValue()).degrees
|
1303
|
+
max_value_2 = Angle(self.text_max_2.GetValue()).degrees
|
1304
|
+
elif param_unit_2 == "ppi":
|
1305
|
+
min_value_2 = max(min_value_2, 0)
|
1306
|
+
max_value_2 = min(max_value_2, 1000)
|
1307
|
+
elif param_unit_2 == "%":
|
1308
|
+
min_value_2 = max(min_value_2, 0)
|
1309
|
+
max_value_2 = min(max_value_2, 100)
|
1310
|
+
else:
|
1311
|
+
# > 0
|
1312
|
+
if param_positive_2:
|
1313
|
+
min_value_2 = max(min_value_2, 0)
|
1314
|
+
max_value_2 = max(max_value_2, 0)
|
1315
|
+
|
1316
|
+
count_1 = int(self.spin_count_1.GetValue())
|
1317
|
+
count_2 = int(self.spin_count_2.GetValue())
|
1318
|
+
if count_1 > 1:
|
1319
|
+
delta_1 = (max_value_1 - min_value_1) / (count_1 - 1)
|
1320
|
+
else:
|
1321
|
+
delta_1 = 0
|
1322
|
+
if count_2 > 1:
|
1323
|
+
delta_2 = (max_value_2 - min_value_2) / (count_2 - 1)
|
1324
|
+
else:
|
1325
|
+
delta_2 = 0
|
1326
|
+
try:
|
1327
|
+
dimension_1 = float(self.text_dim_1.GetValue())
|
1328
|
+
except ValueError:
|
1329
|
+
dimension_1 = -1
|
1330
|
+
try:
|
1331
|
+
dimension_2 = float(self.text_dim_2.GetValue())
|
1332
|
+
except ValueError:
|
1333
|
+
dimension_2 = -1
|
1334
|
+
if dimension_1 <= 0:
|
1335
|
+
dimension_1 = 5
|
1336
|
+
if dimension_2 <= 0:
|
1337
|
+
dimension_2 = 5
|
1338
|
+
|
1339
|
+
try:
|
1340
|
+
gap_1 = float(self.text_delta_1.GetValue())
|
1341
|
+
except ValueError:
|
1342
|
+
gap_1 = -1
|
1343
|
+
try:
|
1344
|
+
gap_2 = float(self.text_delta_2.GetValue())
|
1345
|
+
except ValueError:
|
1346
|
+
gap_2 = -1
|
1347
|
+
|
1348
|
+
if gap_1 < 0:
|
1349
|
+
gap_1 = 0
|
1350
|
+
if gap_2 < 0:
|
1351
|
+
gap_2 = 5
|
1352
|
+
|
1353
|
+
message = _("This will delete all existing operations and elements") + "\n"
|
1354
|
+
message += (
|
1355
|
+
_("and replace them by the test-pattern! Are you really sure?") + "\n"
|
1356
|
+
)
|
1357
|
+
message += _("(Yes=Empty and Create, No=Keep existing)")
|
1358
|
+
caption = _("Create Test-Pattern")
|
1359
|
+
dlg = wx.MessageDialog(
|
1360
|
+
self,
|
1361
|
+
message,
|
1362
|
+
caption,
|
1363
|
+
wx.YES_NO | wx.CANCEL | wx.ICON_WARNING,
|
1364
|
+
)
|
1365
|
+
result = dlg.ShowModal()
|
1366
|
+
dlg.Destroy()
|
1367
|
+
if result == wx.ID_YES:
|
1368
|
+
clear_all()
|
1369
|
+
elif result == wx.ID_CANCEL:
|
1370
|
+
return
|
1371
|
+
|
1372
|
+
create_operations()
|
1373
|
+
|
1374
|
+
self.context.signal("rebuild_tree")
|
1375
|
+
self.context.signal("refresh_scene", "Scene")
|
1376
|
+
self.save_settings()
|
1377
|
+
|
1378
|
+
def setup_settings(self):
|
1379
|
+
self.context.setting(int, "template_optype", 0)
|
1380
|
+
self.context.setting(int, "template_param1", 0)
|
1381
|
+
self.context.setting(int, "template_param2", 1)
|
1382
|
+
self.context.setting(str, "template_min1", "")
|
1383
|
+
self.context.setting(str, "template_max1", "")
|
1384
|
+
self.context.setting(str, "template_min2", "")
|
1385
|
+
self.context.setting(str, "template_max2", "")
|
1386
|
+
self.context.setting(int, "template_count1", 5)
|
1387
|
+
self.context.setting(int, "template_count2", 5)
|
1388
|
+
self.context.setting(str, "template_dim_1", "10")
|
1389
|
+
self.context.setting(str, "template_dim_2", "10")
|
1390
|
+
self.context.setting(str, "template_gap_1", "5")
|
1391
|
+
self.context.setting(str, "template_gap_2", "5")
|
1392
|
+
self.context.setting(bool, "template_show_labels", True)
|
1393
|
+
self.context.setting(bool, "template_show_values", True)
|
1394
|
+
self.context.setting(int, "template_color1", 0)
|
1395
|
+
self.context.setting(int, "template_color2", 2)
|
1396
|
+
self.context.setting(bool, "template_coldir1", False)
|
1397
|
+
self.context.setting(bool, "template_coldir2", False)
|
1398
|
+
|
1399
|
+
def _set_settings(self, templatename):
|
1400
|
+
info_field = (
|
1401
|
+
self.context.template_show_values,
|
1402
|
+
self.context.template_show_labels,
|
1403
|
+
self.context.template_optype,
|
1404
|
+
self.context.template_param1,
|
1405
|
+
self.context.template_param2,
|
1406
|
+
self.context.template_min1,
|
1407
|
+
self.context.template_max1,
|
1408
|
+
self.context.template_min2,
|
1409
|
+
self.context.template_max2,
|
1410
|
+
self.context.template_count1,
|
1411
|
+
self.context.template_count2,
|
1412
|
+
self.context.template_dim_1,
|
1413
|
+
self.context.template_dim_2,
|
1414
|
+
self.context.template_gap_1,
|
1415
|
+
self.context.template_gap_2,
|
1416
|
+
self.context.template_color1,
|
1417
|
+
self.context.template_color2,
|
1418
|
+
self.context.template_coldir1,
|
1419
|
+
self.context.template_coldir2,
|
1420
|
+
)
|
1421
|
+
# print (f"Save data to {templatename}, infofield-len={len(info_field)}")
|
1422
|
+
key = f"{templatename}"
|
1423
|
+
self.storage.write_persistent("materialtest", key, info_field)
|
1424
|
+
self.storage.write_configuration()
|
1425
|
+
|
1426
|
+
def _get_settings(self, templatename):
|
1427
|
+
key = f"{templatename}"
|
1428
|
+
info_field = self.storage.read_persistent(tuple, "materialtest", key, None)
|
1429
|
+
if (
|
1430
|
+
info_field is not None
|
1431
|
+
and isinstance(info_field, (tuple, list))
|
1432
|
+
and len(info_field) == 19
|
1433
|
+
):
|
1434
|
+
# print (f"Load data from {templatename}")
|
1435
|
+
self.context.template_show_values = info_field[0]
|
1436
|
+
self.context.template_show_labels = info_field[1]
|
1437
|
+
self.context.template_optype = info_field[2]
|
1438
|
+
self.context.template_param1 = info_field[3]
|
1439
|
+
self.context.template_param2 = info_field[4]
|
1440
|
+
self.context.template_min1 = info_field[5]
|
1441
|
+
self.context.template_max1 = info_field[6]
|
1442
|
+
self.context.template_min2 = info_field[7]
|
1443
|
+
self.context.template_max2 = info_field[8]
|
1444
|
+
self.context.template_count1 = info_field[9]
|
1445
|
+
self.context.template_count2 = info_field[10]
|
1446
|
+
self.context.template_dim_1 = info_field[11]
|
1447
|
+
self.context.template_dim_2 = info_field[12]
|
1448
|
+
self.context.template_gap_1 = info_field[13]
|
1449
|
+
self.context.template_gap_2 = info_field[14]
|
1450
|
+
self.context.template_color1 = info_field[15]
|
1451
|
+
self.context.template_color2 = info_field[16]
|
1452
|
+
self.context.template_coldir1 = info_field[17]
|
1453
|
+
self.context.template_coldir2 = info_field[18]
|
1454
|
+
|
1455
|
+
def save_settings(self, templatename=None):
|
1456
|
+
self.context.template_show_values = self.check_values.GetValue()
|
1457
|
+
self.context.template_show_labels = self.check_labels.GetValue()
|
1458
|
+
self.context.template_optype = self.combo_ops.GetSelection()
|
1459
|
+
self.context.template_param1 = self.combo_param_1.GetSelection()
|
1460
|
+
self.context.template_param2 = self.combo_param_2.GetSelection()
|
1461
|
+
self.context.template_min1 = self.text_min_1.GetValue()
|
1462
|
+
self.context.template_max1 = self.text_max_1.GetValue()
|
1463
|
+
self.context.template_min2 = self.text_min_2.GetValue()
|
1464
|
+
self.context.template_max2 = self.text_max_2.GetValue()
|
1465
|
+
self.context.template_count1 = self.spin_count_1.GetValue()
|
1466
|
+
self.context.template_count2 = self.spin_count_2.GetValue()
|
1467
|
+
self.context.template_dim_1 = self.text_dim_1.GetValue()
|
1468
|
+
self.context.template_dim_2 = self.text_dim_2.GetValue()
|
1469
|
+
self.context.template_gap_1 = self.text_delta_1.GetValue()
|
1470
|
+
self.context.template_gap_2 = self.text_delta_2.GetValue()
|
1471
|
+
self.context.template_color1 = self.combo_color_1.GetSelection()
|
1472
|
+
self.context.template_color2 = self.combo_color_2.GetSelection()
|
1473
|
+
self.context.template_coldir1 = self.check_color_direction_1.GetValue()
|
1474
|
+
self.context.template_coldir2 = self.check_color_direction_2.GetValue()
|
1475
|
+
if templatename:
|
1476
|
+
# let's try to restore the settings
|
1477
|
+
self._set_settings(templatename)
|
1478
|
+
|
1479
|
+
def restore_settings(self, templatename=None):
|
1480
|
+
if templatename:
|
1481
|
+
# let's try to restore the settings
|
1482
|
+
self._get_settings(templatename)
|
1483
|
+
try:
|
1484
|
+
self.check_color_direction_1.SetValue(self.context.template_coldir1)
|
1485
|
+
self.check_color_direction_2.SetValue(self.context.template_coldir2)
|
1486
|
+
self.combo_color_1.SetSelection(
|
1487
|
+
min(self.context.template_color1, self.combo_color_1.GetCount() - 1)
|
1488
|
+
)
|
1489
|
+
self.combo_color_2.SetSelection(
|
1490
|
+
min(self.context.template_color2, self.combo_color_2.GetCount() - 1)
|
1491
|
+
)
|
1492
|
+
self.check_values.SetValue(self.context.template_show_values)
|
1493
|
+
self.check_labels.SetValue(self.context.template_show_labels)
|
1494
|
+
self.combo_ops.SetSelection(
|
1495
|
+
min(self.context.template_optype, self.combo_ops.GetCount() - 1)
|
1496
|
+
)
|
1497
|
+
self.combo_param_1.SetSelection(
|
1498
|
+
min(self.context.template_param1, self.combo_param_1.GetCount() - 1)
|
1499
|
+
)
|
1500
|
+
self.combo_param_2.SetSelection(
|
1501
|
+
min(self.context.template_param2, self.combo_param_2.GetCount() - 1)
|
1502
|
+
)
|
1503
|
+
self.text_min_1.SetValue(self.context.template_min1)
|
1504
|
+
self.text_max_1.SetValue(self.context.template_max1)
|
1505
|
+
self.text_min_2.SetValue(self.context.template_min2)
|
1506
|
+
self.text_max_2.SetValue(self.context.template_max2)
|
1507
|
+
self.spin_count_1.SetValue(self.context.template_count1)
|
1508
|
+
self.spin_count_2.SetValue(self.context.template_count2)
|
1509
|
+
self.text_dim_1.SetValue(self.context.template_dim_1)
|
1510
|
+
self.text_dim_2.SetValue(self.context.template_dim_2)
|
1511
|
+
self.text_delta_1.SetValue(self.context.template_gap_1)
|
1512
|
+
self.text_delta_2.SetValue(self.context.template_gap_2)
|
1513
|
+
except (AttributeError, ValueError):
|
1514
|
+
pass
|
1515
|
+
|
1516
|
+
def sync_fields(self):
|
1517
|
+
# Repopulate combos
|
1518
|
+
self.set_param_according_to_op(None)
|
1519
|
+
# And then setting it back to the defaults...
|
1520
|
+
self.combo_param_1.SetSelection(
|
1521
|
+
min(self.context.template_param1, self.combo_param_1.GetCount() - 1)
|
1522
|
+
)
|
1523
|
+
# Make sure units appear properly
|
1524
|
+
self.on_combo_1(None)
|
1525
|
+
self.combo_param_2.SetSelection(
|
1526
|
+
min(self.context.template_param2, self.combo_param_2.GetCount() - 1)
|
1527
|
+
)
|
1528
|
+
# Make sure units appear properly
|
1529
|
+
self.on_combo_2(None)
|
1530
|
+
|
1531
|
+
@signal_listener("activate;device")
|
1532
|
+
def on_activate_device(self, origin, device):
|
1533
|
+
self.set_param_according_to_op(None)
|
1534
|
+
|
1535
|
+
|
1536
|
+
class TemplateTool(MWindow):
|
1537
|
+
"""
|
1538
|
+
Material-/Parameter Test routines
|
1539
|
+
"""
|
1540
|
+
|
1541
|
+
def __init__(self, *args, **kwds):
|
1542
|
+
super().__init__(720, 750, submenu="Laser-Tools", *args, **kwds)
|
1543
|
+
|
1544
|
+
self.storage = Settings(self.context.kernel.name, "templates.cfg")
|
1545
|
+
self.storage.read_configuration()
|
1546
|
+
self.panel_instances = list()
|
1547
|
+
self.panel_template = TemplatePanel(
|
1548
|
+
self,
|
1549
|
+
wx.ID_ANY,
|
1550
|
+
context=self.context,
|
1551
|
+
storage=self.storage,
|
1552
|
+
)
|
1553
|
+
|
1554
|
+
self.panel_saveload = SaveLoadPanel(
|
1555
|
+
self,
|
1556
|
+
wx.ID_ANY,
|
1557
|
+
context=self.context,
|
1558
|
+
)
|
1559
|
+
|
1560
|
+
self.notebook_main = aui.AuiNotebook(
|
1561
|
+
self,
|
1562
|
+
-1,
|
1563
|
+
style=aui.AUI_NB_TAB_EXTERNAL_MOVE
|
1564
|
+
| aui.AUI_NB_SCROLL_BUTTONS
|
1565
|
+
| aui.AUI_NB_TAB_SPLIT
|
1566
|
+
| aui.AUI_NB_TAB_MOVE
|
1567
|
+
| aui.AUI_NB_BOTTOM,
|
1568
|
+
)
|
1569
|
+
# ARGGH, the color setting via the ArtProvider does only work
|
1570
|
+
# if you set the tabs to the bottom! wx.aui.AUI_NB_BOTTOM
|
1571
|
+
self.window_context.themes.set_window_colors(self.notebook_main)
|
1572
|
+
bg_std = self.window_context.themes.get("win_bg")
|
1573
|
+
bg_active = self.window_context.themes.get("highlight")
|
1574
|
+
self.notebook_main.GetArtProvider().SetColour(bg_std)
|
1575
|
+
self.notebook_main.GetArtProvider().SetActiveColour(bg_active)
|
1576
|
+
self.sizer.Add(self.notebook_main, 1, wx.EXPAND, 0)
|
1577
|
+
self.notebook_main.AddPage(self.panel_template, _("Generator"))
|
1578
|
+
|
1579
|
+
self.panel_template.set_callback(self.set_node)
|
1580
|
+
self.add_module_delegate(self.panel_template)
|
1581
|
+
|
1582
|
+
self.notebook_main.AddPage(self.panel_saveload, _("Templates"))
|
1583
|
+
self.panel_saveload.set_callback(self.callback_templates)
|
1584
|
+
self.add_module_delegate(self.panel_saveload)
|
1585
|
+
|
1586
|
+
_icon = wx.NullIcon
|
1587
|
+
_icon.CopyFromBitmap(icons8_detective.GetBitmap())
|
1588
|
+
self.SetIcon(_icon)
|
1589
|
+
self.SetTitle(_("Parameter-Test"))
|
1590
|
+
self.restore_aspect()
|
1591
|
+
|
1592
|
+
def callback_templates(self, command, param):
|
1593
|
+
# print (f"callback called with {command}, {param}")
|
1594
|
+
if command == "load":
|
1595
|
+
if param:
|
1596
|
+
self.panel_template.restore_settings(param)
|
1597
|
+
self.panel_template.sync_fields()
|
1598
|
+
return True
|
1599
|
+
elif command == "save":
|
1600
|
+
if param:
|
1601
|
+
self.panel_template.save_settings(param)
|
1602
|
+
return True
|
1603
|
+
elif command == "delete":
|
1604
|
+
if param:
|
1605
|
+
key = f"{param}"
|
1606
|
+
self.storage.delete_persistent("materialtest", key)
|
1607
|
+
self.storage.write_configuration()
|
1608
|
+
return True
|
1609
|
+
elif command == "get":
|
1610
|
+
choices = []
|
1611
|
+
for section in list(self.storage.keylist("materialtest")):
|
1612
|
+
choices.append(section)
|
1613
|
+
return choices
|
1614
|
+
|
1615
|
+
return None
|
1616
|
+
|
1617
|
+
def set_node(self, node):
|
1618
|
+
def sort_priority(prop):
|
1619
|
+
prop_sheet, node = prop
|
1620
|
+
return (
|
1621
|
+
getattr(prop_sheet, "priority")
|
1622
|
+
if hasattr(prop_sheet, "priority")
|
1623
|
+
else 0
|
1624
|
+
)
|
1625
|
+
|
1626
|
+
if node is None:
|
1627
|
+
return
|
1628
|
+
busy = wx.BusyCursor()
|
1629
|
+
self.Freeze()
|
1630
|
+
pages_to_instance = []
|
1631
|
+
pages_in_node = []
|
1632
|
+
found = False
|
1633
|
+
for property_sheet in self.context.lookup_all(
|
1634
|
+
f"property/{node.__class__.__name__}/.*"
|
1635
|
+
):
|
1636
|
+
if not hasattr(property_sheet, "accepts") or property_sheet.accepts(node):
|
1637
|
+
pages_in_node.append((property_sheet, node))
|
1638
|
+
found = True
|
1639
|
+
# If we did not have any hits and the node is a reference
|
1640
|
+
# then we fall back to the master. So if in the future we
|
1641
|
+
# would have a property panel dealing with reference-nodes
|
1642
|
+
# then this would no longer apply.
|
1643
|
+
if node.type == "reference" and not found:
|
1644
|
+
snode = node.node
|
1645
|
+
found = False
|
1646
|
+
for property_sheet in self.context.lookup_all(
|
1647
|
+
f"property/{snode.__class__.__name__}/.*"
|
1648
|
+
):
|
1649
|
+
if not hasattr(property_sheet, "accepts") or property_sheet.accepts(
|
1650
|
+
snode
|
1651
|
+
):
|
1652
|
+
pages_in_node.append((property_sheet, snode))
|
1653
|
+
found = True
|
1654
|
+
|
1655
|
+
pages_in_node.sort(key=sort_priority, reverse=True)
|
1656
|
+
pages_to_instance.extend(pages_in_node)
|
1657
|
+
|
1658
|
+
for p in self.panel_instances:
|
1659
|
+
try:
|
1660
|
+
p.pane_hide()
|
1661
|
+
except AttributeError:
|
1662
|
+
pass
|
1663
|
+
self.remove_module_delegate(p)
|
1664
|
+
|
1665
|
+
# Delete all but the first and last page...
|
1666
|
+
while self.notebook_main.GetPageCount() > 2:
|
1667
|
+
self.notebook_main.DeletePage(1)
|
1668
|
+
for prop_sheet, instance in pages_to_instance:
|
1669
|
+
page_panel = prop_sheet(
|
1670
|
+
self.notebook_main, wx.ID_ANY, context=self.context, node=instance
|
1671
|
+
)
|
1672
|
+
try:
|
1673
|
+
name = prop_sheet.name
|
1674
|
+
except AttributeError:
|
1675
|
+
name = instance.__class__.__name__
|
1676
|
+
|
1677
|
+
self.notebook_main.InsertPage(1, page_panel, _(name))
|
1678
|
+
try:
|
1679
|
+
page_panel.set_widgets(instance)
|
1680
|
+
except AttributeError:
|
1681
|
+
pass
|
1682
|
+
self.add_module_delegate(page_panel)
|
1683
|
+
self.panel_instances.append(page_panel)
|
1684
|
+
try:
|
1685
|
+
page_panel.pane_show()
|
1686
|
+
except AttributeError:
|
1687
|
+
pass
|
1688
|
+
page_panel.Layout()
|
1689
|
+
try:
|
1690
|
+
page_panel.SetupScrolling()
|
1691
|
+
except AttributeError:
|
1692
|
+
pass
|
1693
|
+
|
1694
|
+
self.Layout()
|
1695
|
+
self.Thaw()
|
1696
|
+
del busy
|
1697
|
+
|
1698
|
+
def window_open(self):
|
1699
|
+
pass
|
1700
|
+
|
1701
|
+
def window_close(self):
|
1702
|
+
for p in self.panel_instances:
|
1703
|
+
try:
|
1704
|
+
p.pane_hide()
|
1705
|
+
except AttributeError:
|
1706
|
+
pass
|
1707
|
+
# We do not remove the delegates, they will detach with the closing of the module.
|
1708
|
+
self.panel_instances.clear()
|
1709
|
+
|
1710
|
+
@signal_listener("power_percent")
|
1711
|
+
@signal_listener("speed_min")
|
1712
|
+
@lookup_listener("service/device/active")
|
1713
|
+
def on_device_update(self, *args):
|
1714
|
+
self.panel_template.on_device_update()
|
1715
|
+
|
1716
|
+
@staticmethod
|
1717
|
+
def submenu():
|
1718
|
+
return "Laser-Tools", "Parameter-Test"
|
1719
|
+
|
1720
|
+
@staticmethod
|
1721
|
+
def helptext():
|
1722
|
+
return _("Figure out the right settings for your material")
|