meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7010__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1195 -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 +1844 -1507
- meerk40t/core/elements/clipboard.py +229 -219
- meerk40t/core/elements/element_treeops.py +4561 -2837
- meerk40t/core/elements/element_types.py +125 -105
- meerk40t/core/elements/elements.py +4329 -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 +933 -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/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 +462 -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 +198 -0
- meerk40t/extra/ezd.py +1165 -1165
- meerk40t/extra/hershey.py +835 -340
- meerk40t/extra/imageactions.py +322 -316
- meerk40t/extra/inkscape.py +630 -622
- meerk40t/extra/lbrn.py +424 -424
- meerk40t/extra/outerworld.py +284 -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 +1081 -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 +170 -133
- meerk40t/gui/choicepropertypanel.py +1673 -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 +1430 -846
- meerk40t/gui/icons.py +3422 -2747
- meerk40t/gui/imagesplitter.py +555 -508
- meerk40t/gui/keymap.py +354 -344
- meerk40t/gui/laserpanel.py +892 -806
- meerk40t/gui/laserrender.py +1470 -1232
- meerk40t/gui/lasertoolpanel.py +805 -793
- meerk40t/gui/magnetoptions.py +436 -0
- meerk40t/gui/materialmanager.py +2917 -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 +494 -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 +2468 -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 +589 -346
- meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
- meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
- meerk40t/gui/scenewidgets/selectionwidget.py +2952 -2756
- meerk40t/gui/simpleui.py +357 -333
- meerk40t/gui/simulation.py +2431 -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 +591 -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 +160 -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 +1444 -1169
- meerk40t/gui/wxmmain.py +5578 -4112
- meerk40t/gui/wxmribbon.py +1591 -1076
- meerk40t/gui/wxmscene.py +1635 -1453
- meerk40t/gui/wxmtree.py +2410 -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 +2778 -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 +3809 -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 +102 -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 +390 -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 +672 -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 +940 -940
- meerk40t/tools/rasterplotter.py +1660 -547
- meerk40t/tools/shxparser.py +989 -901
- meerk40t/tools/ttfparser.py +726 -446
- meerk40t/tools/zinglplotter.py +595 -593
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/LICENSE +21 -21
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/METADATA +150 -139
- meerk40t-0.9.7010.dist-info/RECORD +445 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/WHEEL +1 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/top_level.txt +0 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.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.7010.dist-info}/entry_points.txt +0 -0
meerk40t/extra/inkscape.py
CHANGED
@@ -1,622 +1,630 @@
|
|
1
|
-
import gzip
|
2
|
-
import os.path
|
3
|
-
import platform
|
4
|
-
from subprocess import PIPE, TimeoutExpired, run
|
5
|
-
from time import time
|
6
|
-
|
7
|
-
from meerk40t.core.exceptions import BadFileError
|
8
|
-
from meerk40t.kernel.kernel import get_safe_path
|
9
|
-
|
10
|
-
|
11
|
-
def get_inkscape(context, manual_candidate=None):
|
12
|
-
root_context = context
|
13
|
-
root_context.setting(str, "inkscape_path", "inkscape.exe")
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
system
|
20
|
-
|
21
|
-
|
22
|
-
"/Applications/Inkscape.app/Contents/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"C:/Program Files (x86)/Inkscape/inkscape.exe",
|
28
|
-
"C:/Program Files
|
29
|
-
"C:/Program Files/Inkscape/inkscape.exe",
|
30
|
-
"C:/
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"/usr/
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
f.write("
|
68
|
-
|
69
|
-
|
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
|
-
# yield "
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
"""
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
"""
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
version = "
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
"
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
cmd = [
|
172
|
-
inkscape,
|
173
|
-
"--export-plain-svg",
|
174
|
-
svg_temp_file,
|
175
|
-
pathname,
|
176
|
-
]
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
)
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
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
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
channel(
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
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
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
)
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
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
|
-
return "inkscape", (
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
if
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
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
|
-
if
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
cmd = [
|
513
|
-
inkscape,
|
514
|
-
"--export-text-to-path",
|
515
|
-
"--export-plain-svg",
|
516
|
-
svg_temp_file,
|
517
|
-
pathname,
|
518
|
-
]
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
"--export-
|
544
|
-
"--export-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
)
|
574
|
-
+ "\n"
|
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
|
-
"
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
"
|
617
|
-
"
|
618
|
-
"
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
1
|
+
import gzip
|
2
|
+
import os.path
|
3
|
+
import platform
|
4
|
+
from subprocess import PIPE, TimeoutExpired, run
|
5
|
+
from time import time
|
6
|
+
|
7
|
+
from meerk40t.core.exceptions import BadFileError
|
8
|
+
from meerk40t.kernel.kernel import get_safe_path
|
9
|
+
|
10
|
+
|
11
|
+
def get_inkscape(context, manual_candidate=None):
|
12
|
+
root_context = context
|
13
|
+
root_context.setting(str, "inkscape_path", "inkscape.exe")
|
14
|
+
try:
|
15
|
+
inkscape = root_context.inkscape_path
|
16
|
+
except AttributeError:
|
17
|
+
inkscape = ""
|
18
|
+
system = platform.system()
|
19
|
+
if system == "Darwin":
|
20
|
+
candidates = [
|
21
|
+
"/Applications/Inkscape.app/Contents/MacOS/Inkscape",
|
22
|
+
"/Applications/Inkscape.app/Contents/Resources/bin/inkscape",
|
23
|
+
]
|
24
|
+
elif system == "Windows":
|
25
|
+
candidates = [
|
26
|
+
"C:/Program Files (x86)/Inkscape/inkscape.exe",
|
27
|
+
"C:/Program Files (x86)/Inkscape/bin/inkscape.exe",
|
28
|
+
"C:/Program Files/Inkscape/inkscape.exe",
|
29
|
+
"C:/Program Files/Inkscape/bin/inkscape.exe",
|
30
|
+
"C:/inkscape/bin/inkscape.exe",
|
31
|
+
]
|
32
|
+
elif system == "Linux":
|
33
|
+
candidates = [
|
34
|
+
"/usr/local/bin/inkscape",
|
35
|
+
"/usr/bin/inkscape",
|
36
|
+
]
|
37
|
+
else:
|
38
|
+
candidates = []
|
39
|
+
if inkscape and inkscape not in candidates:
|
40
|
+
candidates.insert(0, inkscape)
|
41
|
+
if manual_candidate and manual_candidate not in candidates:
|
42
|
+
candidates.insert(0, manual_candidate)
|
43
|
+
match = None
|
44
|
+
for ink in candidates:
|
45
|
+
if os.path.exists(ink):
|
46
|
+
match = ink
|
47
|
+
root_context.inkscape_path = match
|
48
|
+
break
|
49
|
+
if match is None:
|
50
|
+
inkscape = ""
|
51
|
+
return inkscape
|
52
|
+
|
53
|
+
|
54
|
+
def run_command_and_log(command_array, logfile):
|
55
|
+
timeout_value = None
|
56
|
+
try:
|
57
|
+
f = open(logfile, "w")
|
58
|
+
except:
|
59
|
+
# Any error...
|
60
|
+
f = None
|
61
|
+
if f:
|
62
|
+
for idx, param in enumerate(command_array):
|
63
|
+
if idx == 0:
|
64
|
+
f.write(f"Executing: {param}\n")
|
65
|
+
f.write("Parameters:\n")
|
66
|
+
else:
|
67
|
+
f.write(f"{param}\n")
|
68
|
+
result = False
|
69
|
+
c = None
|
70
|
+
try:
|
71
|
+
start_time = time()
|
72
|
+
c = run(command_array, timeout=timeout_value, stdout=PIPE)
|
73
|
+
end_time = time()
|
74
|
+
if f:
|
75
|
+
f.write(
|
76
|
+
f"Executed successfully, result: {c.returncode} (execution time: {end_time-start_time:.1f} sec)\n"
|
77
|
+
)
|
78
|
+
f.write("Output:\n")
|
79
|
+
try:
|
80
|
+
f.write(c.stdout.decode("utf-8", errors="surrogateescape"))
|
81
|
+
except (UnicodeEncodeError, UnicodeDecodeError):
|
82
|
+
pass
|
83
|
+
result = True
|
84
|
+
except (
|
85
|
+
FileNotFoundError,
|
86
|
+
TimeoutExpired,
|
87
|
+
UnicodeDecodeError,
|
88
|
+
UnicodeEncodeError,
|
89
|
+
OSError,
|
90
|
+
) as e:
|
91
|
+
if f:
|
92
|
+
f.write(f"Execution failed: {str(e)}\n")
|
93
|
+
if f:
|
94
|
+
f.close()
|
95
|
+
return result, c
|
96
|
+
|
97
|
+
|
98
|
+
class MultiLoader:
|
99
|
+
"""
|
100
|
+
This module makes use of inkscape to convert a multitude of format into svg :
|
101
|
+
"""
|
102
|
+
|
103
|
+
@staticmethod
|
104
|
+
def load_types():
|
105
|
+
yield "Inkscape supported files", (
|
106
|
+
"pdf",
|
107
|
+
"pdxf",
|
108
|
+
"eps",
|
109
|
+
"cdr",
|
110
|
+
"cmx",
|
111
|
+
"ccx",
|
112
|
+
"cdt",
|
113
|
+
"wmf",
|
114
|
+
"vsd",
|
115
|
+
"ai",
|
116
|
+
), "image/svg+xml"
|
117
|
+
# yield "Portable Document Format files", ("pdf", "pdxf", "eps"), "image/svg+xml"
|
118
|
+
# yield "Corel Draw files", ("cdr", "cmx", "ccx", "cdt"), "image/svg+xml"
|
119
|
+
# yield "Windows Metafile files", ("wmf",), "image/svg+xml"
|
120
|
+
# yield "Visio files", ("vsd",), "image/svg+xml"
|
121
|
+
# yield "Adobe Illustrator files", ("ai",), "image/svg+xml"
|
122
|
+
|
123
|
+
@staticmethod
|
124
|
+
def load(kernel_service, elements_service, pathname, **kwargs):
|
125
|
+
"""
|
126
|
+
Load content by means of inkscapes ability to convert
|
127
|
+
multiple vector formats into svg.
|
128
|
+
Requires the installation of inkscape on your system.
|
129
|
+
"""
|
130
|
+
# Elemental calls this routine claiming it would be the kernel...
|
131
|
+
if hasattr(kernel_service, "kernel"):
|
132
|
+
kernel = kernel_service.kernel
|
133
|
+
else:
|
134
|
+
kernel = kernel_service
|
135
|
+
_ = kernel.translation
|
136
|
+
|
137
|
+
# Establish the standard svg-handler first
|
138
|
+
handler = None
|
139
|
+
for loader, loader_name, sname in kernel.find("load"):
|
140
|
+
for description, extensions, mimetype in loader.load_types():
|
141
|
+
if "svg" in extensions:
|
142
|
+
handler = loader
|
143
|
+
break
|
144
|
+
|
145
|
+
context_root = kernel.root
|
146
|
+
safe_dir = os.path.realpath(get_safe_path(kernel.name))
|
147
|
+
logfile = os.path.join(safe_dir, "inkscape.log")
|
148
|
+
|
149
|
+
inkscape = get_inkscape(context_root)
|
150
|
+
if not inkscape:
|
151
|
+
raise BadFileError("Inkscape not found")
|
152
|
+
|
153
|
+
result, c = run_command_and_log([inkscape, "-V"], logfile)
|
154
|
+
if not result:
|
155
|
+
return pathname
|
156
|
+
try:
|
157
|
+
version = c.stdout.decode("utf-8", errors="surrogateescape")
|
158
|
+
except UnicodeDecodeError:
|
159
|
+
version = "inkscape 1.x"
|
160
|
+
|
161
|
+
svg_temp_file = os.path.join(safe_dir, "inkscape.svg")
|
162
|
+
if os.path.exists(svg_temp_file):
|
163
|
+
try:
|
164
|
+
os.remove(svg_temp_file)
|
165
|
+
except (OSError, FileNotFoundError):
|
166
|
+
raise BadFileError("Couldn't delete temporary inkscape file")
|
167
|
+
logfile = os.path.join(safe_dir, "inkscape.log")
|
168
|
+
|
169
|
+
# Check Version of Inkscape
|
170
|
+
if "inkscape 1." in version.lower():
|
171
|
+
cmd = [
|
172
|
+
inkscape,
|
173
|
+
"--export-plain-svg",
|
174
|
+
f"--export-filename={svg_temp_file}",
|
175
|
+
pathname,
|
176
|
+
]
|
177
|
+
else:
|
178
|
+
cmd = [
|
179
|
+
inkscape,
|
180
|
+
"--export-plain-svg",
|
181
|
+
svg_temp_file,
|
182
|
+
pathname,
|
183
|
+
]
|
184
|
+
was_shown = kernel.busyinfo.shown
|
185
|
+
if was_shown:
|
186
|
+
kernel.busyinfo.change(msg=_("Calling inkscape..."))
|
187
|
+
kernel.busyinfo.show()
|
188
|
+
|
189
|
+
result, c = run_command_and_log(cmd, logfile)
|
190
|
+
if not result or c.returncode == 1:
|
191
|
+
return False
|
192
|
+
# Has an output file been created?
|
193
|
+
if not os.path.exists(svg_temp_file):
|
194
|
+
return False
|
195
|
+
|
196
|
+
def unescaped(filename):
|
197
|
+
OS_NAME = platform.system()
|
198
|
+
if OS_NAME == "Windows":
|
199
|
+
newstring = filename.replace("&", "&&")
|
200
|
+
else:
|
201
|
+
newstring = filename.replace("&", "&&")
|
202
|
+
return newstring
|
203
|
+
|
204
|
+
if was_shown:
|
205
|
+
kernel.busyinfo.change(
|
206
|
+
msg=_("Loading File...") + "\n" + unescaped(svg_temp_file)
|
207
|
+
)
|
208
|
+
kernel.busyinfo.show()
|
209
|
+
filename_to_process = svg_temp_file
|
210
|
+
preproc = elements_service.lookup("preprocessor/.svg")
|
211
|
+
if preproc is not None:
|
212
|
+
filename_to_process = preproc(filename_to_process)
|
213
|
+
results = handler.load(elements_service, elements_service, filename_to_process)
|
214
|
+
return results
|
215
|
+
|
216
|
+
|
217
|
+
def plugin(kernel, lifecycle):
|
218
|
+
if lifecycle == "register":
|
219
|
+
_ = kernel.translation
|
220
|
+
|
221
|
+
@kernel.console_command(
|
222
|
+
"load",
|
223
|
+
help=_("inkscape ... load - load the previous conversion"),
|
224
|
+
input_type="inkscape",
|
225
|
+
output_type="inkscape",
|
226
|
+
)
|
227
|
+
def inscape_load(channel, _, data=None, **kwargs):
|
228
|
+
inkscape_path, filename = data
|
229
|
+
channel(_("inkscape load - loading the previous conversion..."))
|
230
|
+
try:
|
231
|
+
kernel.elements.load(filename)
|
232
|
+
except BadFileError as e:
|
233
|
+
channel(_("File is Malformed."))
|
234
|
+
channel(str(e))
|
235
|
+
else:
|
236
|
+
kernel.elements.classify(list(kernel.elements.elems()))
|
237
|
+
return "inkscape", data
|
238
|
+
|
239
|
+
@kernel.console_command(
|
240
|
+
"simplify",
|
241
|
+
help=_("inkscape simplify - convert to plain svg"),
|
242
|
+
input_type="inkscape",
|
243
|
+
output_type="inkscape",
|
244
|
+
)
|
245
|
+
def inkscape_simplify(channel, _, data=None, **kwargs):
|
246
|
+
inkscape_path, filename = data
|
247
|
+
if not os.path.exists(inkscape_path):
|
248
|
+
channel(_("Inkscape not found. Try 'inkscape locate'"))
|
249
|
+
return
|
250
|
+
channel(_("inkscape simplify - converting to plain svg"))
|
251
|
+
c = run(
|
252
|
+
[
|
253
|
+
inkscape_path,
|
254
|
+
"--export-plain-svg",
|
255
|
+
"--export-filename=temp.svg",
|
256
|
+
filename,
|
257
|
+
],
|
258
|
+
stdout=PIPE,
|
259
|
+
)
|
260
|
+
channel(c.stdout)
|
261
|
+
return "inkscape", (inkscape_path, "temp.svg")
|
262
|
+
|
263
|
+
@kernel.console_command(
|
264
|
+
"text2path",
|
265
|
+
help=_("inkscape text2path - convert text objects to paths"),
|
266
|
+
input_type="inkscape",
|
267
|
+
output_type="inkscape",
|
268
|
+
)
|
269
|
+
def inkscape_text2path(channel, _, data=None, **kwargs):
|
270
|
+
inkscape_path, filename = data
|
271
|
+
if not os.path.exists(inkscape_path):
|
272
|
+
channel(_("Inkscape not found. Try 'inkscape locate'"))
|
273
|
+
return
|
274
|
+
channel(_("inkscape text2path - converting text objects to paths"))
|
275
|
+
c = run(
|
276
|
+
[
|
277
|
+
inkscape_path,
|
278
|
+
"--export-area-drawing",
|
279
|
+
"--export-text-to-path",
|
280
|
+
"--export-plain-svg",
|
281
|
+
"--export-filename=temp.svg",
|
282
|
+
filename,
|
283
|
+
],
|
284
|
+
stdout=PIPE,
|
285
|
+
)
|
286
|
+
channel(c.stdout)
|
287
|
+
return "inkscape", (inkscape_path, "temp.svg")
|
288
|
+
|
289
|
+
@kernel.console_option("dpi", "d", type=int, help=_("dpi to use"), default=1000)
|
290
|
+
@kernel.console_option("step", "s", type=int, help=_("step to use"))
|
291
|
+
@kernel.console_command(
|
292
|
+
"makepng",
|
293
|
+
help=_("inkscape makepng - make a png of all elements"),
|
294
|
+
input_type="inkscape",
|
295
|
+
output_type="inkscape",
|
296
|
+
)
|
297
|
+
def inkscape_png(channel, _, dpi=1000, step=None, data=None, **kwargs):
|
298
|
+
if step is not None and step > 0:
|
299
|
+
dpi = 1000 / step
|
300
|
+
inkscape_path, filename = data
|
301
|
+
if not os.path.exists(inkscape_path):
|
302
|
+
channel(_("Inkscape not found. Try 'inkscape locate'"))
|
303
|
+
return
|
304
|
+
channel(_("inkscape makepng - making a png of all elements"))
|
305
|
+
c = run(
|
306
|
+
[
|
307
|
+
inkscape_path,
|
308
|
+
"--export-background",
|
309
|
+
"white",
|
310
|
+
"--export-background-opacity",
|
311
|
+
"255",
|
312
|
+
"--export-area-drawing",
|
313
|
+
"--export-type=png",
|
314
|
+
"--export-filename=temp.png",
|
315
|
+
f"--export-dpi={dpi}",
|
316
|
+
filename,
|
317
|
+
],
|
318
|
+
stdout=PIPE,
|
319
|
+
)
|
320
|
+
channel(c.stdout)
|
321
|
+
return "inkscape", (inkscape_path, "temp.png")
|
322
|
+
|
323
|
+
@kernel.console_argument(
|
324
|
+
"filename", type=str, help=_("filename of svg to be simplified")
|
325
|
+
)
|
326
|
+
@kernel.console_command(
|
327
|
+
"input",
|
328
|
+
help=_("input filename fn ... - provide the filename to process"),
|
329
|
+
input_type="inkscape",
|
330
|
+
output_type="inkscape",
|
331
|
+
)
|
332
|
+
def inkscape_input_filename(channel, _, filename, data, **kwargs):
|
333
|
+
inkscape_path, fn = data
|
334
|
+
if filename is None:
|
335
|
+
channel(_("inkscape filename fn - filename not specified"))
|
336
|
+
if not os.path.exists(filename):
|
337
|
+
channel(
|
338
|
+
_("inkscape filename {filename} - file not found").format(
|
339
|
+
filename=filename
|
340
|
+
)
|
341
|
+
)
|
342
|
+
return
|
343
|
+
return "inkscape", (inkscape_path, filename)
|
344
|
+
|
345
|
+
@kernel.console_command(
|
346
|
+
"version",
|
347
|
+
help=_("inkscape version - get the inkscape version"),
|
348
|
+
input_type="inkscape",
|
349
|
+
output_type="inkscape",
|
350
|
+
)
|
351
|
+
def inkscape_version(channel, _, data, **kwargs):
|
352
|
+
inkscape_path, filename = data
|
353
|
+
if not os.path.exists(inkscape_path):
|
354
|
+
channel(_("Inkscape not found. Try 'inkscape locate'"))
|
355
|
+
return
|
356
|
+
c = run([inkscape_path, "-V"], stdout=PIPE)
|
357
|
+
try:
|
358
|
+
version = c.stdout.decode("utf-8", errors="surrogateescape")
|
359
|
+
except UnicodeDecodeError:
|
360
|
+
version = "unknown"
|
361
|
+
|
362
|
+
channel(
|
363
|
+
_('Inkscape executable at "{path}" is: {version}').format(
|
364
|
+
path=inkscape_path, version=version
|
365
|
+
)
|
366
|
+
)
|
367
|
+
return "inkscape", data
|
368
|
+
|
369
|
+
@kernel.console_argument(
|
370
|
+
"inkpath", type=str, help=_("Optional: location of inkscape executable")
|
371
|
+
)
|
372
|
+
@kernel.console_command(
|
373
|
+
"locate",
|
374
|
+
help=_("inkscape locate - set the path to inkscape on your computer"),
|
375
|
+
input_type="inkscape",
|
376
|
+
output_type="inkscape",
|
377
|
+
)
|
378
|
+
def inkscape_locate(channel, _, data, inkpath=None, **kwargs):
|
379
|
+
inkscape_path, filename = data
|
380
|
+
match = get_inkscape(kernel.root, inkpath)
|
381
|
+
root_context = kernel.root
|
382
|
+
root_context.setting(str, "inkscape_path", "inkscape.exe")
|
383
|
+
if match:
|
384
|
+
channel(_("Inkscape location: {match}").format(match=match))
|
385
|
+
else:
|
386
|
+
root_context.inkscape_path = "inkscape.exe"
|
387
|
+
channel(
|
388
|
+
_(
|
389
|
+
"Inkscape location: Inkscape not found in default installation directories"
|
390
|
+
)
|
391
|
+
)
|
392
|
+
|
393
|
+
return "inkscape", (match, filename)
|
394
|
+
|
395
|
+
@kernel.console_command(
|
396
|
+
"inkscape",
|
397
|
+
help=_("invoke inkscape to convert elements"),
|
398
|
+
output_type="inkscape",
|
399
|
+
)
|
400
|
+
def inkscape_base(**kwargs):
|
401
|
+
root_context = kernel.root
|
402
|
+
root_context.setting(str, "inkscape_path", "inkscape.exe")
|
403
|
+
return "inkscape", (root_context.inkscape_path, None)
|
404
|
+
|
405
|
+
def check_for_features(pathname, **kwargs):
|
406
|
+
# We try to establish if a file contains certain features...
|
407
|
+
|
408
|
+
source = pathname
|
409
|
+
if not os.path.exists(source):
|
410
|
+
return pathname
|
411
|
+
if pathname.lower().endswith("svgz"):
|
412
|
+
source = gzip.open(pathname, "rb")
|
413
|
+
METHOD_CONVERT_TO_OBJECT = 1
|
414
|
+
METHOD_CONVERT_TO_PNG = 2
|
415
|
+
features = {
|
416
|
+
"text": [False, ("<text",), METHOD_CONVERT_TO_OBJECT],
|
417
|
+
"clipping": [False, ("<clippath",), METHOD_CONVERT_TO_PNG],
|
418
|
+
"mask": [False, ("<mask",), METHOD_CONVERT_TO_PNG],
|
419
|
+
"gradient": [
|
420
|
+
False,
|
421
|
+
("<lineargradient", "<radialgradient"),
|
422
|
+
METHOD_CONVERT_TO_PNG,
|
423
|
+
],
|
424
|
+
"pattern": [False, ("<pattern",), METHOD_CONVERT_TO_PNG],
|
425
|
+
}
|
426
|
+
safe_dir = os.path.realpath(get_safe_path(kernel.name))
|
427
|
+
svg_temp_file = os.path.join(safe_dir, "temp.svg")
|
428
|
+
png_temp_file = os.path.join(safe_dir, "temp.png")
|
429
|
+
needs_conversion = 0
|
430
|
+
with open(source, mode="r", encoding="utf8", errors="surrogateescape") as f:
|
431
|
+
while True:
|
432
|
+
line = f.readline().lower()
|
433
|
+
if not line:
|
434
|
+
break
|
435
|
+
for feat, entry in features.items():
|
436
|
+
for candidate in entry[1]:
|
437
|
+
if candidate in line:
|
438
|
+
entry[0] = True
|
439
|
+
if entry[2] > needs_conversion:
|
440
|
+
needs_conversion = entry[2]
|
441
|
+
context = kernel.root
|
442
|
+
inkscape = get_inkscape(context)
|
443
|
+
if needs_conversion == 0:
|
444
|
+
return pathname
|
445
|
+
if len(inkscape) == 0:
|
446
|
+
# Inkscape not found.
|
447
|
+
return pathname
|
448
|
+
# What is our preference? Load, convert, ask?
|
449
|
+
conversion_preference = int(kernel.root.svg_not_supported)
|
450
|
+
wasbusy = kernel.busyinfo.shown
|
451
|
+
|
452
|
+
if conversion_preference == 1:
|
453
|
+
# Ask
|
454
|
+
msg = _(
|
455
|
+
"This file contains certain features that might not be fully supported by MeerK40t"
|
456
|
+
)
|
457
|
+
for feat, entry in features.items():
|
458
|
+
if entry[0]:
|
459
|
+
msg += "\n" + f" - {feat}"
|
460
|
+
if needs_conversion == METHOD_CONVERT_TO_PNG:
|
461
|
+
msg += "\n" + _(
|
462
|
+
"The complete design would be rendered into a single graphic."
|
463
|
+
)
|
464
|
+
elif needs_conversion == METHOD_CONVERT_TO_OBJECT:
|
465
|
+
msg += "\n" + _(
|
466
|
+
"Text elements would be converted into path objects."
|
467
|
+
)
|
468
|
+
|
469
|
+
msg += "\n" + _(
|
470
|
+
"Do you want to convert the file via inkscape or do you want load the unmodified file?"
|
471
|
+
)
|
472
|
+
if wasbusy:
|
473
|
+
kernel.busyinfo.hide()
|
474
|
+
response = kernel.yesno(
|
475
|
+
msg,
|
476
|
+
option_yes=_("Convert"),
|
477
|
+
option_no=_("Load original"),
|
478
|
+
caption=_("SVG-Conversion"),
|
479
|
+
)
|
480
|
+
if response:
|
481
|
+
# convert
|
482
|
+
conversion_preference = 2
|
483
|
+
else:
|
484
|
+
# Load
|
485
|
+
conversion_preference = 0
|
486
|
+
# translate = ["load", "ask", "convert"]
|
487
|
+
# print (f"Conversion preference: {translate[conversion_preference]} - {conversion_preference}")
|
488
|
+
if wasbusy:
|
489
|
+
kernel.busyinfo.show()
|
490
|
+
|
491
|
+
if conversion_preference == 0:
|
492
|
+
# Load
|
493
|
+
return pathname
|
494
|
+
|
495
|
+
if wasbusy:
|
496
|
+
kernel.busyinfo.change(msg=_("Calling inkscape..."))
|
497
|
+
kernel.busyinfo.show()
|
498
|
+
log_file = os.path.join(safe_dir, "inkscape.log")
|
499
|
+
result, c = run_command_and_log([inkscape, "-V"], log_file)
|
500
|
+
if not result:
|
501
|
+
return pathname
|
502
|
+
try:
|
503
|
+
version = c.stdout.decode(encoding="utf-8", errors="surrogateescape")
|
504
|
+
except UnicodeDecodeError:
|
505
|
+
version = "inkscape 1.x"
|
506
|
+
|
507
|
+
if needs_conversion == METHOD_CONVERT_TO_OBJECT:
|
508
|
+
# Ask inkscape to convert all text elements to paths
|
509
|
+
# slightly different invocation for different values
|
510
|
+
# Check Version of Inkscape
|
511
|
+
if "inkscape 1." in version.lower():
|
512
|
+
cmd = [
|
513
|
+
inkscape,
|
514
|
+
"--export-text-to-path",
|
515
|
+
"--export-plain-svg",
|
516
|
+
f"--export-filename={svg_temp_file}",
|
517
|
+
pathname,
|
518
|
+
]
|
519
|
+
else:
|
520
|
+
cmd = [
|
521
|
+
inkscape,
|
522
|
+
"--export-text-to-path",
|
523
|
+
"--export-plain-svg",
|
524
|
+
svg_temp_file,
|
525
|
+
pathname,
|
526
|
+
]
|
527
|
+
result, c = run_command_and_log(cmd, log_file)
|
528
|
+
if result and c.returncode == 0:
|
529
|
+
return svg_temp_file
|
530
|
+
|
531
|
+
return pathname
|
532
|
+
|
533
|
+
if needs_conversion == METHOD_CONVERT_TO_PNG:
|
534
|
+
dpi = 500
|
535
|
+
if "inkscape 1." in version.lower():
|
536
|
+
cmd = [
|
537
|
+
inkscape,
|
538
|
+
"--export-background",
|
539
|
+
"white",
|
540
|
+
"--export-background-opacity",
|
541
|
+
"255",
|
542
|
+
"--export-area-drawing",
|
543
|
+
"--export-type=png",
|
544
|
+
f"--export-filename={png_temp_file}",
|
545
|
+
f"--export-dpi={dpi}",
|
546
|
+
pathname,
|
547
|
+
]
|
548
|
+
else:
|
549
|
+
cmd = [
|
550
|
+
inkscape,
|
551
|
+
"--export-area-drawing",
|
552
|
+
"--export-dpi",
|
553
|
+
str(dpi),
|
554
|
+
"--export-background",
|
555
|
+
"rgb(255, 255, 255)",
|
556
|
+
"--export-background-opacity",
|
557
|
+
"255",
|
558
|
+
"--export-png",
|
559
|
+
png_temp_file,
|
560
|
+
pathname,
|
561
|
+
]
|
562
|
+
result, c = run_command_and_log(cmd, log_file)
|
563
|
+
if result and c.returncode == 0:
|
564
|
+
return png_temp_file
|
565
|
+
|
566
|
+
return pathname
|
567
|
+
|
568
|
+
kernel.register("preprocessor/.svg", check_for_features)
|
569
|
+
# Let's establish some settings too
|
570
|
+
stip = (
|
571
|
+
_("Meerk40t does not support all svg-features, so you might want")
|
572
|
+
+ "\n"
|
573
|
+
+ _("to preprocess the file to get a proper representation of the design.")
|
574
|
+
+ "\n"
|
575
|
+
+ _(
|
576
|
+
" - Certain subvariants of Fonts - single element will be converted to a path"
|
577
|
+
)
|
578
|
+
+ "\n"
|
579
|
+
+ _(
|
580
|
+
" - Gradient fills / patterns - the whole design will be rendered into a graphic"
|
581
|
+
)
|
582
|
+
+ "\n"
|
583
|
+
+ _(" - Clipping/Mask - the whole design will be rendered into a graphic")
|
584
|
+
)
|
585
|
+
system = platform.system()
|
586
|
+
if system == "Darwin":
|
587
|
+
wildcard = "Inkscape|(Inkscape;inkscape)|All files|*.*"
|
588
|
+
elif system == "Windows":
|
589
|
+
wildcard = "Inkscape|inkscape.exe|All files|*.*"
|
590
|
+
elif system == "Linux":
|
591
|
+
wildcard = "Inkscape|inkscape|All files|*.*"
|
592
|
+
else:
|
593
|
+
wildcard = "Inkscape|(Inkscape;inkscape)|All files|*.*"
|
594
|
+
|
595
|
+
kernel.root.setting(str, "inkscape_path", "")
|
596
|
+
choices = [
|
597
|
+
{
|
598
|
+
"attr": "inkscape_path",
|
599
|
+
"object": kernel.root,
|
600
|
+
"default": "",
|
601
|
+
"type": str,
|
602
|
+
"style": "file",
|
603
|
+
"wildcard": wildcard,
|
604
|
+
"label": _("Inkscape"),
|
605
|
+
"tip": _(
|
606
|
+
"Path to inkscape-executable. Leave empty to let Meerk40t establish standard locations"
|
607
|
+
),
|
608
|
+
"page": "Input/Output",
|
609
|
+
"section": "SVG-Features",
|
610
|
+
},
|
611
|
+
{
|
612
|
+
"attr": "svg_not_supported",
|
613
|
+
"object": kernel.root,
|
614
|
+
"default": 0,
|
615
|
+
"type": int,
|
616
|
+
"style": "option",
|
617
|
+
"label": _("Unsupported elements"),
|
618
|
+
"choices": (0, 2, 1),
|
619
|
+
"display": (
|
620
|
+
_("Always load into meerk40t"),
|
621
|
+
_("Convert with inkscape"),
|
622
|
+
_("Ask at load time"),
|
623
|
+
),
|
624
|
+
"tip": stip,
|
625
|
+
"page": "Input/Output",
|
626
|
+
"section": "SVG-Features",
|
627
|
+
},
|
628
|
+
]
|
629
|
+
kernel.register_choices("preferences", choices)
|
630
|
+
kernel.register("load/MultiLoader", MultiLoader)
|