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
@@ -1,1131 +1,1461 @@
|
|
1
|
-
from math import sqrt
|
2
|
-
|
3
|
-
import wx
|
4
|
-
|
5
|
-
import meerk40t.gui.icons as mkicons
|
6
|
-
from meerk40t.core.units import Length
|
7
|
-
from meerk40t.gui.laserrender import swizzlecolor
|
8
|
-
from meerk40t.gui.wxutils import
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
self.
|
39
|
-
self.
|
40
|
-
self.
|
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
|
-
|
68
|
-
|
69
|
-
self.
|
70
|
-
self.btn_color
|
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
|
-
|
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
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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
|
-
if
|
210
|
-
|
211
|
-
else:
|
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.
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
self
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
self.
|
246
|
-
self.
|
247
|
-
self.
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
self.
|
252
|
-
self.
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
self.
|
260
|
-
self.
|
261
|
-
self.
|
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
|
-
self.
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
self.
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
try:
|
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
|
-
|
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
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
if
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
self.
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
self.
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
self.
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
self.
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
self.
|
510
|
-
self.
|
511
|
-
|
512
|
-
self.
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
self.
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
self.
|
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
|
-
|
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
|
-
|
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
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
)
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
self.
|
691
|
-
|
692
|
-
|
693
|
-
self.
|
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
|
-
self.
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
self.
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
#
|
751
|
-
|
752
|
-
self.
|
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
|
-
self.
|
783
|
-
self.
|
784
|
-
self.
|
785
|
-
self.
|
786
|
-
self.
|
787
|
-
|
788
|
-
|
789
|
-
self.
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
if
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
self.node.
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
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
|
-
self.
|
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
|
-
)
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
self.
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
self.
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
self,
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
)
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
self.
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
)
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
self.
|
1013
|
-
self.
|
1014
|
-
self.
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
def
|
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
|
-
self.
|
1072
|
-
if
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
self.
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
def
|
1114
|
-
if self.node
|
1115
|
-
return
|
1116
|
-
|
1117
|
-
self.
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
else:
|
1130
|
-
|
1131
|
-
|
1
|
+
from math import sqrt
|
2
|
+
|
3
|
+
import wx
|
4
|
+
|
5
|
+
import meerk40t.gui.icons as mkicons
|
6
|
+
from meerk40t.core.units import Length
|
7
|
+
from meerk40t.gui.laserrender import swizzlecolor
|
8
|
+
from meerk40t.gui.wxutils import (
|
9
|
+
StaticBoxSizer,
|
10
|
+
TextCtrl,
|
11
|
+
dip_size,
|
12
|
+
wxButton,
|
13
|
+
wxCheckBox,
|
14
|
+
wxComboBox,
|
15
|
+
wxStaticBitmap,
|
16
|
+
wxStaticText,
|
17
|
+
wxToggleButton,
|
18
|
+
)
|
19
|
+
from meerk40t.svgelements import Color
|
20
|
+
|
21
|
+
_ = wx.GetTranslation
|
22
|
+
|
23
|
+
|
24
|
+
class ColorPanel(wx.Panel):
|
25
|
+
def __init__(
|
26
|
+
self,
|
27
|
+
*args,
|
28
|
+
context=None,
|
29
|
+
label=None,
|
30
|
+
attribute=None,
|
31
|
+
callback=None,
|
32
|
+
node=None,
|
33
|
+
**kwds,
|
34
|
+
):
|
35
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
36
|
+
kwds["style"] = kwds.get("style", 0)
|
37
|
+
wx.Panel.__init__(self, *args, **kwds)
|
38
|
+
self.context = context
|
39
|
+
self.context.themes.set_window_colors(self)
|
40
|
+
self.callback = callback
|
41
|
+
if attribute is None:
|
42
|
+
attribute = "stroke"
|
43
|
+
self.attribute = attribute
|
44
|
+
self.label = label
|
45
|
+
self.node = node
|
46
|
+
|
47
|
+
self.main_sizer = StaticBoxSizer(self, wx.ID_ANY, _(self.label), wx.VERTICAL)
|
48
|
+
color_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
49
|
+
self.main_sizer.Add(color_sizer, 0, wx.EXPAND, 0)
|
50
|
+
self.btn_color = []
|
51
|
+
self.underliner = []
|
52
|
+
self.bgcolors = [
|
53
|
+
0xFFFFFF,
|
54
|
+
0x000000,
|
55
|
+
0xFF0000,
|
56
|
+
0x00FF00,
|
57
|
+
0x0000FF,
|
58
|
+
0xFFFF00,
|
59
|
+
0xFF00FF,
|
60
|
+
0x00FFFF,
|
61
|
+
0xFFFFFF,
|
62
|
+
None,
|
63
|
+
]
|
64
|
+
self.last_col_idx = len(self.bgcolors) - 1
|
65
|
+
for i in range(len(self.bgcolors)):
|
66
|
+
self.underliner.append(wxStaticBitmap(self, wx.ID_ANY))
|
67
|
+
self.underliner[i].SetBackgroundColour(wx.BLUE)
|
68
|
+
self.underliner[i].SetMaxSize(dip_size(self, -1, 3))
|
69
|
+
# self.lbl_color[i].SetMinSize(dip_size(self, -1, 20))
|
70
|
+
self.btn_color.append(wxButton(self, wx.ID_ANY, ""))
|
71
|
+
if i == 0:
|
72
|
+
self.btn_color[i].SetForegroundColour(wx.RED)
|
73
|
+
self.btn_color[i].SetLabel("X")
|
74
|
+
elif i == len(self.bgcolors) - 1:
|
75
|
+
self.btn_color[i].SetLabel(_("Custom"))
|
76
|
+
else:
|
77
|
+
self.btn_color[i].SetForegroundColour(wx.Colour(self.bgcolors[i]))
|
78
|
+
colinfo = wx.Colour(self.bgcolors[i]).GetAsString(wx.C2S_NAME)
|
79
|
+
self.btn_color[i].SetLabel(_(colinfo))
|
80
|
+
self.btn_color[i].SetMinSize(dip_size(self, 10, 23))
|
81
|
+
self.btn_color[i].SetBackgroundColour(wx.Colour(self.bgcolors[i]))
|
82
|
+
sizer = wx.BoxSizer(wx.VERTICAL)
|
83
|
+
sizer.Add(self.btn_color[i], 0, wx.EXPAND, 0)
|
84
|
+
sizer.Add(self.underliner[i], 0, wx.EXPAND, 0)
|
85
|
+
color_sizer.Add(sizer, 1, wx.EXPAND, 0)
|
86
|
+
self.btn_color[i].Bind(wx.EVT_BUTTON, self.on_button)
|
87
|
+
font = wx.Font(
|
88
|
+
7,
|
89
|
+
wx.FONTFAMILY_SWISS,
|
90
|
+
wx.FONTSTYLE_NORMAL,
|
91
|
+
wx.FONTWEIGHT_BOLD,
|
92
|
+
)
|
93
|
+
self.btn_color[self.last_col_idx].SetFont(font)
|
94
|
+
self.SetSizer(self.main_sizer)
|
95
|
+
self.main_sizer.Fit(self)
|
96
|
+
self.Layout()
|
97
|
+
self.set_widgets(self.node)
|
98
|
+
|
99
|
+
def on_button(self, event):
|
100
|
+
value = None
|
101
|
+
button = event.GetEventObject()
|
102
|
+
bidx = None
|
103
|
+
if button == self.btn_color[self.last_col_idx]:
|
104
|
+
nodecol = None
|
105
|
+
cvalue = getattr(self.node, self.attribute, None)
|
106
|
+
if cvalue == "none":
|
107
|
+
cvalue = None
|
108
|
+
if cvalue is not None:
|
109
|
+
nodecol = wx.Colour(swizzlecolor(cvalue))
|
110
|
+
color_data = wx.ColourData()
|
111
|
+
color_data.SetColour(wx.Colour(nodecol))
|
112
|
+
# We try to prepopulate user defined colors from
|
113
|
+
# the colors of the existing operations
|
114
|
+
idx = 0
|
115
|
+
for operation in self.context.elements.ops():
|
116
|
+
if hasattr(operation, "color"):
|
117
|
+
if operation.color is not None and operation.color.argb is not None:
|
118
|
+
color_data.SetCustomColour(
|
119
|
+
idx, wx.Colour(swizzlecolor(operation.color))
|
120
|
+
)
|
121
|
+
idx += 1
|
122
|
+
# There are only 16 colors available
|
123
|
+
if idx > 15:
|
124
|
+
break
|
125
|
+
dlg = wx.ColourDialog(self, color_data)
|
126
|
+
if dlg.ShowModal() == wx.ID_OK:
|
127
|
+
color_data = dlg.GetColourData()
|
128
|
+
cvalue = color_data.GetColour()
|
129
|
+
value = Color(swizzlecolor(cvalue.GetRGB()), 1.0)
|
130
|
+
button.SetBackgroundColour(cvalue)
|
131
|
+
else:
|
132
|
+
return
|
133
|
+
else:
|
134
|
+
for bidx, sbtn in enumerate(self.btn_color):
|
135
|
+
if sbtn == button:
|
136
|
+
value = None
|
137
|
+
if bidx == 0:
|
138
|
+
value = None
|
139
|
+
else:
|
140
|
+
if bidx < 0 or bidx >= len(self.btn_color):
|
141
|
+
bidx = -1
|
142
|
+
else:
|
143
|
+
bcolor = button.GetBackgroundColour()
|
144
|
+
rgb = bcolor.GetRGB()
|
145
|
+
color = swizzlecolor(rgb)
|
146
|
+
value = Color(color, 1.0)
|
147
|
+
break
|
148
|
+
setattr(self.node, self.attribute, value)
|
149
|
+
self.context.elements.signal("element_property_update", self.node)
|
150
|
+
if self.callback is not None:
|
151
|
+
self.callback()
|
152
|
+
self.mark_color(bidx)
|
153
|
+
self.node.focus()
|
154
|
+
|
155
|
+
def pane_hide(self):
|
156
|
+
pass
|
157
|
+
|
158
|
+
def pane_show(self):
|
159
|
+
pass
|
160
|
+
|
161
|
+
def accepts(self, node):
|
162
|
+
return hasattr(node, self.attribute)
|
163
|
+
|
164
|
+
def set_widgets(self, node):
|
165
|
+
self.node = node
|
166
|
+
# print(f"set_widget for {self.attribute} to {str(node)}")
|
167
|
+
if self.node is None or not self.accepts(node):
|
168
|
+
self.Hide()
|
169
|
+
return
|
170
|
+
self.mark_color(None)
|
171
|
+
self.Show()
|
172
|
+
|
173
|
+
def mark_color(self, idx):
|
174
|
+
def countercolor(bgcolor):
|
175
|
+
background = swizzlecolor(bgcolor)
|
176
|
+
c1 = Color("Black")
|
177
|
+
c2 = Color("White")
|
178
|
+
if Color.distance(background, c1) > Color.distance(background, c2):
|
179
|
+
textcolor = c1
|
180
|
+
else:
|
181
|
+
textcolor = c2
|
182
|
+
wxcolor = wx.Colour(swizzlecolor(textcolor))
|
183
|
+
return wxcolor
|
184
|
+
|
185
|
+
if self.node is None:
|
186
|
+
idx = -1
|
187
|
+
self.btn_color[self.last_col_idx].SetBackgroundColour(None)
|
188
|
+
self.bgcolors[self.last_col_idx] = None
|
189
|
+
else:
|
190
|
+
value = getattr(self.node, self.attribute, None)
|
191
|
+
nodecol = None
|
192
|
+
if value == "none":
|
193
|
+
value = None
|
194
|
+
|
195
|
+
colinfo = "None"
|
196
|
+
if value is not None:
|
197
|
+
nodecol = wx.Colour(swizzlecolor(value))
|
198
|
+
self.bgcolors[self.last_col_idx] = nodecol
|
199
|
+
self.btn_color[self.last_col_idx].SetBackgroundColour(
|
200
|
+
self.bgcolors[self.last_col_idx]
|
201
|
+
)
|
202
|
+
self.btn_color[self.last_col_idx].SetForegroundColour(
|
203
|
+
countercolor(self.bgcolors[self.last_col_idx])
|
204
|
+
)
|
205
|
+
try:
|
206
|
+
s = nodecol.GetAsString(wx.C2S_NAME)
|
207
|
+
except AssertionError:
|
208
|
+
s = ""
|
209
|
+
if s != "":
|
210
|
+
s = s + " = " + value.hexrgb
|
211
|
+
else:
|
212
|
+
s = value.hexrgb
|
213
|
+
colinfo = s
|
214
|
+
self.main_sizer.SetLabel(_(self.label) + " (" + colinfo + ")")
|
215
|
+
self.main_sizer.Refresh()
|
216
|
+
|
217
|
+
if idx is None: # Okay, we need to determine it ourselves
|
218
|
+
idx = -1
|
219
|
+
if value is None:
|
220
|
+
idx = 0
|
221
|
+
else:
|
222
|
+
for i, btn in enumerate(self.btn_color):
|
223
|
+
if i == 0: # We skip the none color...
|
224
|
+
continue
|
225
|
+
col = self.btn_color[i].GetBackgroundColour()
|
226
|
+
if nodecol == col:
|
227
|
+
idx = i
|
228
|
+
break
|
229
|
+
|
230
|
+
for i, liner in enumerate(self.underliner):
|
231
|
+
if i == idx:
|
232
|
+
liner.Show(True)
|
233
|
+
else:
|
234
|
+
liner.Show(False)
|
235
|
+
self.Layout()
|
236
|
+
|
237
|
+
|
238
|
+
class IdPanel(wx.Panel):
|
239
|
+
def __init__(
|
240
|
+
self, *args, context=None, node=None, showid=True, showlabel=True, **kwds
|
241
|
+
):
|
242
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
243
|
+
kwds["style"] = kwds.get("style", 0)
|
244
|
+
wx.Panel.__init__(self, *args, **kwds)
|
245
|
+
self.context = context
|
246
|
+
self.context.themes.set_window_colors(self)
|
247
|
+
self.node = node
|
248
|
+
# Shall we display id / label?
|
249
|
+
self.showid = showid
|
250
|
+
self.showlabel = showlabel
|
251
|
+
self.text_id = TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER)
|
252
|
+
self.text_label = TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER)
|
253
|
+
self.check_label = wxCheckBox(self, wx.ID_ANY)
|
254
|
+
self.check_hidden = wxCheckBox(self, wx.ID_ANY)
|
255
|
+
|
256
|
+
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
257
|
+
sizer_id_label = wx.BoxSizer(wx.HORIZONTAL)
|
258
|
+
self.sizer_id = StaticBoxSizer(self, wx.ID_ANY, _("Id"), wx.HORIZONTAL)
|
259
|
+
self.sizer_id.Add(self.text_id, 1, wx.EXPAND, 0)
|
260
|
+
self.sizer_id.Add(self.check_hidden, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
261
|
+
self.sizer_label = StaticBoxSizer(self, wx.ID_ANY, _("Label"), wx.VERTICAL)
|
262
|
+
h_label_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
263
|
+
h_label_sizer.Add(self.text_label, 1, wx.EXPAND, 0)
|
264
|
+
h_label_sizer.Add(self.check_label, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
265
|
+
self.sizer_label.Add(h_label_sizer, 1, wx.EXPAND, 0)
|
266
|
+
sizer_id_label.Add(self.sizer_id, 1, wx.EXPAND, 0)
|
267
|
+
sizer_id_label.Add(self.sizer_label, 1, wx.EXPAND, 0)
|
268
|
+
self.icon_display = wxStaticBitmap(self, wx.ID_ANY)
|
269
|
+
self.icon_display.SetSize(wx.Size(mkicons.STD_ICON_SIZE, mkicons.STD_ICON_SIZE))
|
270
|
+
self.icon_hidden = wxStaticBitmap(self, wx.ID_ANY)
|
271
|
+
self.icon_hidden.SetSize(wx.Size(mkicons.STD_ICON_SIZE, mkicons.STD_ICON_SIZE))
|
272
|
+
self.icon_hidden.SetBitmap(
|
273
|
+
mkicons.icons8_ghost.GetBitmap(resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale)
|
274
|
+
)
|
275
|
+
self.icon_hidden.SetToolTip(
|
276
|
+
_("Element is hidden, so it will neither be displayed nor burnt")
|
277
|
+
)
|
278
|
+
sizer_id_label.Add(self.icon_display, 0, wx.EXPAND, 0)
|
279
|
+
sizer_id_label.Add(self.icon_hidden, 0, wx.EXPAND, 0)
|
280
|
+
|
281
|
+
main_sizer.Add(sizer_id_label, 0, wx.EXPAND, 0)
|
282
|
+
|
283
|
+
self.SetSizer(main_sizer)
|
284
|
+
main_sizer.Fit(self)
|
285
|
+
self.Layout()
|
286
|
+
self.text_id.SetActionRoutine(self.on_text_id_change)
|
287
|
+
self.text_label.SetActionRoutine(self.on_text_label_change)
|
288
|
+
self.check_label.Bind(wx.EVT_CHECKBOX, self.on_check_label)
|
289
|
+
self.check_label.SetToolTip(_("Display label on screen"))
|
290
|
+
self.check_hidden.Bind(wx.EVT_CHECKBOX, self.on_check_hidden)
|
291
|
+
self.check_hidden.SetToolTip(_("Suppress object for display and burning"))
|
292
|
+
self.icon_hidden.Bind(wx.EVT_LEFT_DOWN, self.on_hidden_click)
|
293
|
+
|
294
|
+
self.set_widgets(self.node)
|
295
|
+
|
296
|
+
def on_text_id_change(self):
|
297
|
+
try:
|
298
|
+
self.node.id = self.text_id.GetValue()
|
299
|
+
self.context.elements.signal("element_property_reload", self.node)
|
300
|
+
except AttributeError:
|
301
|
+
pass
|
302
|
+
|
303
|
+
def on_text_label_change(self):
|
304
|
+
try:
|
305
|
+
self.node.label = self.text_label.GetValue()
|
306
|
+
self.context.elements.signal("element_property_reload", self.node)
|
307
|
+
self.text_label.SetToolTip(self.node.display_label())
|
308
|
+
except AttributeError:
|
309
|
+
pass
|
310
|
+
|
311
|
+
def add_node_and_children(self, node):
|
312
|
+
data = []
|
313
|
+
data.append(node)
|
314
|
+
for e in node.children:
|
315
|
+
if e.type in ("file", "group"):
|
316
|
+
data.extend(self.add_node_and_children(e))
|
317
|
+
else:
|
318
|
+
data.append(e)
|
319
|
+
return data
|
320
|
+
|
321
|
+
def on_check_label(self, event):
|
322
|
+
self.node.label_display = bool(self.check_label.GetValue())
|
323
|
+
self.context.signal("element_property_update", self.node)
|
324
|
+
self.context.signal("refresh_scene", "Scene")
|
325
|
+
|
326
|
+
def on_check_hidden(self, event):
|
327
|
+
self.node.hidden = bool(self.check_hidden.GetValue())
|
328
|
+
self.icon_hidden.Show(self.node.hidden)
|
329
|
+
self.Layout()
|
330
|
+
if self.node.type == "group":
|
331
|
+
self.context.signal("refresh_tree")
|
332
|
+
data = self.add_node_and_children(self.node)
|
333
|
+
self.context.signal("element_property_reload", data)
|
334
|
+
self.context.signal("refresh_scene", "Scene")
|
335
|
+
self.context.signal("warn_state_update")
|
336
|
+
|
337
|
+
def on_hidden_click(self, event):
|
338
|
+
self.node.hidden = False
|
339
|
+
self.check_hidden.SetValue(False)
|
340
|
+
self.icon_hidden.Show(self.node.hidden)
|
341
|
+
self.Layout()
|
342
|
+
data = self.add_node_and_children(self.node)
|
343
|
+
self.context.signal("element_property_reload", data)
|
344
|
+
self.context.signal("refresh_scene", "Scene")
|
345
|
+
self.context.signal("warn_state_update")
|
346
|
+
|
347
|
+
def pane_hide(self):
|
348
|
+
pass
|
349
|
+
|
350
|
+
def pane_show(self):
|
351
|
+
pass
|
352
|
+
|
353
|
+
def set_widgets(self, node):
|
354
|
+
def mklabel(value):
|
355
|
+
res = ""
|
356
|
+
if value is not None:
|
357
|
+
res = str(value)
|
358
|
+
return res
|
359
|
+
|
360
|
+
self.node = node
|
361
|
+
# print(f"set_widget for {self.attribute} to {str(node)}")
|
362
|
+
vis0 = False
|
363
|
+
vis1 = False
|
364
|
+
vis2 = False
|
365
|
+
vis3 = False
|
366
|
+
vis_hidden = False
|
367
|
+
try:
|
368
|
+
if hasattr(self.node, "id") and self.showid:
|
369
|
+
vis1 = True
|
370
|
+
self.text_id.SetValue(mklabel(node.id))
|
371
|
+
self.text_id.Show(vis1)
|
372
|
+
self.sizer_id.Show(vis1)
|
373
|
+
except RuntimeError:
|
374
|
+
# Could happen if the propertypanel has been destroyed
|
375
|
+
pass
|
376
|
+
try:
|
377
|
+
if hasattr(self.node, "hidden") and self.showid:
|
378
|
+
vis0 = True
|
379
|
+
self.check_hidden.SetValue(node.hidden)
|
380
|
+
vis_hidden = self.node.hidden
|
381
|
+
self.check_hidden.Show(vis0)
|
382
|
+
self.icon_hidden.Show(vis_hidden)
|
383
|
+
except RuntimeError:
|
384
|
+
# Could happen if the propertypanel has been destroyed
|
385
|
+
pass
|
386
|
+
try:
|
387
|
+
if hasattr(self.node, "label") and self.showlabel:
|
388
|
+
vis2 = True
|
389
|
+
if hasattr(self.node, "label_display"):
|
390
|
+
vis3 = True
|
391
|
+
self.check_label.SetValue(bool(self.node.label_display))
|
392
|
+
self.text_label.SetValue(mklabel(node.label))
|
393
|
+
self.text_label.SetToolTip(node.display_label())
|
394
|
+
self.text_label.Show(vis2)
|
395
|
+
self.sizer_label.Show(vis2)
|
396
|
+
self.check_label.Show(vis3)
|
397
|
+
except RuntimeError:
|
398
|
+
# Could happen if the propertypanel has been destroyed
|
399
|
+
pass
|
400
|
+
|
401
|
+
bmp = None
|
402
|
+
type_patterns = {
|
403
|
+
"util wait": mkicons.icon_timer,
|
404
|
+
"util home": mkicons.icons8_home_filled,
|
405
|
+
"util goto": mkicons.icon_return,
|
406
|
+
"util output": mkicons.icon_external,
|
407
|
+
"util input": mkicons.icon_internal,
|
408
|
+
"util console": mkicons.icon_console,
|
409
|
+
"op engrave": mkicons.icons8_laserbeam_weak,
|
410
|
+
"op cut": mkicons.icons8_laser_beam,
|
411
|
+
"op image": mkicons.icons8_image,
|
412
|
+
"op raster": mkicons.icons8_direction,
|
413
|
+
"op dots": mkicons.icon_points,
|
414
|
+
"effect hatch": mkicons.icon_effect_hatch,
|
415
|
+
"effect wobble": mkicons.icon_effect_wobble,
|
416
|
+
"effect warp": mkicons.icon_distort,
|
417
|
+
"place current": mkicons.icons8_home_filled,
|
418
|
+
"place point": mkicons.icons8_home_filled,
|
419
|
+
"elem point": mkicons.icon_points,
|
420
|
+
"file": mkicons.icons8_file,
|
421
|
+
"group": mkicons.icons8_group_objects,
|
422
|
+
"elem rect": mkicons.icon_mk_rectangular,
|
423
|
+
"elem ellipse": mkicons.icon_mk_ellipse,
|
424
|
+
"elem image": mkicons.icons8_image,
|
425
|
+
"elem path": mkicons.icon_path,
|
426
|
+
"elem line": mkicons.icon_line,
|
427
|
+
"elem polyline": mkicons.icon_mk_polyline,
|
428
|
+
"elem text": mkicons.icon_bmap_text,
|
429
|
+
"image raster": mkicons.icons8_image,
|
430
|
+
"blob": mkicons.icons8_file,
|
431
|
+
"_3d_image": mkicons.icon_image3d,
|
432
|
+
}
|
433
|
+
if hasattr(self.node, "type"):
|
434
|
+
n_type = node.type
|
435
|
+
if n_type == "elem image" and getattr(node, "is_depthmap", False):
|
436
|
+
n_type = "_3d_image"
|
437
|
+
if n_type in type_patterns:
|
438
|
+
icon = type_patterns[n_type]
|
439
|
+
bmp = icon.GetBitmap(resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale, buffer=2)
|
440
|
+
if bmp is None:
|
441
|
+
self.icon_display.Show(False)
|
442
|
+
else:
|
443
|
+
try:
|
444
|
+
self.icon_display.SetBitmap(bmp)
|
445
|
+
self.icon_display.Show(True)
|
446
|
+
except RuntimeError:
|
447
|
+
pass
|
448
|
+
|
449
|
+
if vis1 or vis2:
|
450
|
+
self.Layout()
|
451
|
+
self.Show()
|
452
|
+
else:
|
453
|
+
self.Hide()
|
454
|
+
|
455
|
+
def signal(self, signalstr, myargs):
|
456
|
+
if signalstr == "nodetype":
|
457
|
+
self.set_widgets(self.node)
|
458
|
+
|
459
|
+
class LinePropPanel(wx.Panel):
|
460
|
+
def __init__(self, *args, context=None, node=None, **kwds):
|
461
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
462
|
+
kwds["style"] = kwds.get("style", 0)
|
463
|
+
wx.Panel.__init__(self, *args, **kwds)
|
464
|
+
self.context = context
|
465
|
+
self.context.themes.set_window_colors(self)
|
466
|
+
self.node = node
|
467
|
+
capchoices = (_("Butt"), _("Round"), _("Square"))
|
468
|
+
joinchoices = (_("Arcs"), _("Bevel"), _("Miter"), _("Miter-Clip"), _("Round"))
|
469
|
+
fillchoices = (_("Non-Zero"), _("Even-Odd"))
|
470
|
+
self.dash_patterns = {
|
471
|
+
"Solid": "",
|
472
|
+
"Dot": "0.5 0.5",
|
473
|
+
"Short Dash": "2 1",
|
474
|
+
"Long Dash": "4 1",
|
475
|
+
"Dash Dot": "4 1 0.5 1",
|
476
|
+
}
|
477
|
+
linestylechoices = [_(e) for e in self.dash_patterns]
|
478
|
+
linestylechoices.append(_("User defined"))
|
479
|
+
self.combo_cap = wxComboBox(
|
480
|
+
self, wx.ID_ANY, choices=capchoices, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
481
|
+
)
|
482
|
+
self.combo_join = wxComboBox(
|
483
|
+
self, wx.ID_ANY, choices=joinchoices, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
484
|
+
)
|
485
|
+
self.combo_fill = wxComboBox(
|
486
|
+
self, wx.ID_ANY, choices=fillchoices, style=wx.CB_DROPDOWN | wx.CB_READONLY
|
487
|
+
)
|
488
|
+
self.combo_linestyle = wxComboBox(
|
489
|
+
self,
|
490
|
+
wx.ID_ANY,
|
491
|
+
choices=linestylechoices,
|
492
|
+
style=wx.CB_DROPDOWN | wx.CB_READONLY,
|
493
|
+
)
|
494
|
+
self.text_linestyle = TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER)
|
495
|
+
self.combo_cap.SetMaxSize(dip_size(self, 100, -1))
|
496
|
+
self.combo_join.SetMaxSize(dip_size(self, 100, -1))
|
497
|
+
self.combo_fill.SetMaxSize(dip_size(self, 100, -1))
|
498
|
+
self.combo_linestyle.SetMaxSize(dip_size(self, 150, -1))
|
499
|
+
|
500
|
+
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
501
|
+
sizer_attributes = wx.BoxSizer(wx.HORIZONTAL)
|
502
|
+
|
503
|
+
self.sizer_cap = StaticBoxSizer(self, wx.ID_ANY, _("Line-End"), wx.VERTICAL)
|
504
|
+
self.sizer_cap.Add(self.combo_cap, 1, wx.EXPAND, 0)
|
505
|
+
|
506
|
+
self.sizer_join = StaticBoxSizer(self, wx.ID_ANY, _("Line-Join"), wx.VERTICAL)
|
507
|
+
self.sizer_join.Add(self.combo_join, 1, wx.EXPAND, 0)
|
508
|
+
|
509
|
+
self.sizer_fill = StaticBoxSizer(self, wx.ID_ANY, _("Fillrule"), wx.VERTICAL)
|
510
|
+
self.sizer_fill.Add(self.combo_fill, 1, wx.EXPAND, 0)
|
511
|
+
|
512
|
+
self.sizer_linestyle = StaticBoxSizer(
|
513
|
+
self, wx.ID_ANY, _("Linestyle"), wx.HORIZONTAL
|
514
|
+
)
|
515
|
+
self.sizer_linestyle.Add(self.combo_linestyle, 1, wx.EXPAND, 0)
|
516
|
+
self.sizer_linestyle.Add(self.text_linestyle, 1, wx.EXPAND, 0)
|
517
|
+
|
518
|
+
self.tab_length = TextCtrl(
|
519
|
+
self,
|
520
|
+
wx.ID_ANY,
|
521
|
+
"",
|
522
|
+
style=wx.TE_PROCESS_ENTER,
|
523
|
+
limited=True,
|
524
|
+
check="length",
|
525
|
+
)
|
526
|
+
self.tab_positions = TextCtrl(
|
527
|
+
self,
|
528
|
+
wx.ID_ANY,
|
529
|
+
"",
|
530
|
+
style=wx.TE_PROCESS_ENTER,
|
531
|
+
)
|
532
|
+
self.tab_length.SetMaxSize(dip_size(self, 100, -1))
|
533
|
+
label1 = wxStaticText(self, wx.ID_ANY, _("Tab-Length"))
|
534
|
+
label2 = wxStaticText(self, wx.ID_ANY, _("Tabs"))
|
535
|
+
self.sizer_tabs = StaticBoxSizer(
|
536
|
+
self, wx.ID_ANY, _("Tabs/Bridges"), wx.HORIZONTAL
|
537
|
+
)
|
538
|
+
self.sizer_tabs.Add(label1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
539
|
+
self.sizer_tabs.Add(self.tab_length, 1, wx.EXPAND, 0)
|
540
|
+
self.sizer_tabs.Add(label2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
541
|
+
self.sizer_tabs.Add(self.tab_positions, 1, wx.EXPAND, 0)
|
542
|
+
|
543
|
+
sizer_attributes.Add(self.sizer_cap, 1, wx.EXPAND, 0)
|
544
|
+
sizer_attributes.Add(self.sizer_join, 1, wx.EXPAND, 0)
|
545
|
+
sizer_attributes.Add(self.sizer_fill, 1, wx.EXPAND, 0)
|
546
|
+
main_sizer.Add(sizer_attributes, 0, wx.EXPAND, 0)
|
547
|
+
|
548
|
+
sizer_attributes2 = wx.BoxSizer(wx.HORIZONTAL)
|
549
|
+
sizer_attributes2.Add(self.sizer_linestyle, 1, wx.EXPAND, 0)
|
550
|
+
sizer_attributes2.Add(self.sizer_tabs, 1, wx.EXPAND, 0)
|
551
|
+
main_sizer.Add(sizer_attributes2, 0, wx.EXPAND, 0)
|
552
|
+
|
553
|
+
self.SetSizer(main_sizer)
|
554
|
+
main_sizer.Fit(self)
|
555
|
+
self.Layout()
|
556
|
+
self.combo_cap.Bind(wx.EVT_COMBOBOX, self.on_cap)
|
557
|
+
self.combo_join.Bind(wx.EVT_COMBOBOX, self.on_join)
|
558
|
+
self.combo_fill.Bind(wx.EVT_COMBOBOX, self.on_fill)
|
559
|
+
self.combo_linestyle.Bind(wx.EVT_COMBOBOX, self.on_linestyle)
|
560
|
+
self.text_linestyle.SetActionRoutine(self.on_txt_linestyle)
|
561
|
+
self.tab_positions.SetActionRoutine(self.on_tab_count)
|
562
|
+
self.tab_length.SetActionRoutine(self.on_tab_length)
|
563
|
+
self.combo_linestyle.SetToolTip(_("Choose the linestyle of the shape"))
|
564
|
+
self.text_linestyle.SetToolTip(
|
565
|
+
_("Define the linestyle of the shape:") + "\n" +
|
566
|
+
_("A list of comma and/or white space separated numbers that specify the lengths of alternating dashes and gaps")
|
567
|
+
)
|
568
|
+
self.tab_positions.SetToolTip(
|
569
|
+
_("Where do you want to place tabs:") + "\n" +
|
570
|
+
_("A list of comma and/or white space separated numbers that specify the relative positions, i.e. percentage of total shape perimeter, of the tab centers.") + "\n" +
|
571
|
+
_("You may provide a placeholder for x equidistant tabs by stating '*x' e.g. '*4' for four tabs.") + "\n" +
|
572
|
+
_("An empty list stands for no tabs.")
|
573
|
+
)
|
574
|
+
self.tab_length.SetToolTip(_("How wide should the tab be?"))
|
575
|
+
self.set_widgets(self.node)
|
576
|
+
|
577
|
+
def on_cap(self, event):
|
578
|
+
if self.node is None or self.node.lock:
|
579
|
+
return
|
580
|
+
_id = self.combo_cap.GetSelection()
|
581
|
+
try:
|
582
|
+
self.node.linecap = _id
|
583
|
+
self.context.signal("element_property_update", self.node)
|
584
|
+
self.context.signal("refresh_scene", "Scene")
|
585
|
+
except AttributeError:
|
586
|
+
pass
|
587
|
+
|
588
|
+
def on_join(self, event):
|
589
|
+
if self.node is None or self.node.lock:
|
590
|
+
return
|
591
|
+
_id = self.combo_join.GetSelection()
|
592
|
+
try:
|
593
|
+
self.node.linejoin = _id
|
594
|
+
self.context.signal("element_property_update", self.node)
|
595
|
+
self.context.signal("refresh_scene", "Scene")
|
596
|
+
except AttributeError:
|
597
|
+
pass
|
598
|
+
|
599
|
+
def on_fill(self, event):
|
600
|
+
if self.node is None or self.node.lock:
|
601
|
+
return
|
602
|
+
_id = self.combo_fill.GetSelection()
|
603
|
+
try:
|
604
|
+
self.node.fillrule = _id
|
605
|
+
self.context.signal("element_property_update", self.node)
|
606
|
+
self.context.signal("refresh_scene", "Scene")
|
607
|
+
except AttributeError:
|
608
|
+
pass
|
609
|
+
|
610
|
+
def on_linestyle(self, event):
|
611
|
+
if self.node is None or self.node.lock:
|
612
|
+
return
|
613
|
+
_id = self.combo_linestyle.GetSelection()
|
614
|
+
for idx, (key, entry) in enumerate(self.dash_patterns.items()):
|
615
|
+
if idx == _id:
|
616
|
+
self.text_linestyle.SetValue(entry)
|
617
|
+
self.on_txt_linestyle()
|
618
|
+
break
|
619
|
+
|
620
|
+
def sync_linestyle_combo(self, value):
|
621
|
+
if value is None:
|
622
|
+
value = ""
|
623
|
+
index = -1
|
624
|
+
for idx, (key, entry) in enumerate(self.dash_patterns.items()):
|
625
|
+
if value == entry:
|
626
|
+
index = idx
|
627
|
+
break
|
628
|
+
if index < 0:
|
629
|
+
index = len(self.dash_patterns) # The following "user defined..."
|
630
|
+
self.combo_linestyle.SetSelection(index)
|
631
|
+
|
632
|
+
def on_txt_linestyle(self):
|
633
|
+
if self.node is None or self.node.lock:
|
634
|
+
return
|
635
|
+
value = self.text_linestyle.GetValue()
|
636
|
+
self.sync_linestyle_combo(value)
|
637
|
+
if value == "":
|
638
|
+
value = None
|
639
|
+
try:
|
640
|
+
self.node.stroke_dash = value
|
641
|
+
# We need to recalculate the appearance
|
642
|
+
self.node.empty_cache()
|
643
|
+
self.context.signal("element_property_update", self.node)
|
644
|
+
self.context.signal("refresh_scene", "Scene")
|
645
|
+
except AttributeError:
|
646
|
+
pass
|
647
|
+
|
648
|
+
def on_tab_length(self):
|
649
|
+
if self.node is None or self.node.lock:
|
650
|
+
return
|
651
|
+
try:
|
652
|
+
swidth = float(Length(self.tab_length.GetValue()))
|
653
|
+
if self.node.mktablength != swidth:
|
654
|
+
self.node.mktablength = swidth
|
655
|
+
self.node.empty_cache()
|
656
|
+
self.context.signal("refresh_scene", "Scene")
|
657
|
+
self.context.signal("element_property_update", self.node)
|
658
|
+
self.context.signal("tabs_updated")
|
659
|
+
except (ValueError, AttributeError):
|
660
|
+
pass
|
661
|
+
|
662
|
+
def on_tab_count(self):
|
663
|
+
if self.node is None or self.node.lock:
|
664
|
+
return
|
665
|
+
try:
|
666
|
+
positions = self.tab_positions.GetValue()
|
667
|
+
if self.node.mktabpositions != positions:
|
668
|
+
self.node.mktabpositions = positions
|
669
|
+
self.node.empty_cache()
|
670
|
+
self.context.signal("refresh_scene", "Scene")
|
671
|
+
self.context.signal("element_property_update", self.node)
|
672
|
+
self.context.signal("tabs_updated")
|
673
|
+
except (ValueError, AttributeError):
|
674
|
+
pass
|
675
|
+
|
676
|
+
def pane_hide(self):
|
677
|
+
pass
|
678
|
+
|
679
|
+
def pane_show(self):
|
680
|
+
pass
|
681
|
+
|
682
|
+
def set_widgets(self, node):
|
683
|
+
self.node = node
|
684
|
+
# print(f"set_widget for {self.attribute} to {str(node)}")
|
685
|
+
vis1 = False
|
686
|
+
vis2 = False
|
687
|
+
vis3 = False
|
688
|
+
vis4 = False
|
689
|
+
vis5 = False
|
690
|
+
if hasattr(self.node, "linecap"):
|
691
|
+
vis1 = True
|
692
|
+
self.combo_cap.SetSelection(int(node.linecap))
|
693
|
+
if hasattr(self.node, "linejoin"):
|
694
|
+
vis2 = True
|
695
|
+
self.combo_join.SetSelection(int(node.linejoin))
|
696
|
+
if hasattr(self.node, "fillrule"):
|
697
|
+
vis3 = True
|
698
|
+
self.combo_fill.SetSelection(int(node.fillrule))
|
699
|
+
if hasattr(self.node, "stroke_dash"):
|
700
|
+
vis4 = True
|
701
|
+
value = self.node.stroke_dash
|
702
|
+
if value is None:
|
703
|
+
value = ""
|
704
|
+
self.text_linestyle.SetValue(value)
|
705
|
+
self.sync_linestyle_combo(value)
|
706
|
+
if hasattr(self.node, "mktablength"):
|
707
|
+
vis5 = True
|
708
|
+
x = self.node.mktablength
|
709
|
+
units = self.context.units_name
|
710
|
+
if units in ("inch", "inches"):
|
711
|
+
units = "in"
|
712
|
+
self.tab_length.SetValue(
|
713
|
+
f"{Length(amount=x, preferred_units=units, digits=4).preferred_length}"
|
714
|
+
)
|
715
|
+
val = node.mktabpositions
|
716
|
+
if val is None:
|
717
|
+
val = ""
|
718
|
+
self.tab_positions.SetValue(val)
|
719
|
+
|
720
|
+
self.combo_cap.Show(vis1)
|
721
|
+
self.sizer_cap.Show(vis1)
|
722
|
+
self.combo_join.Show(vis2)
|
723
|
+
self.sizer_join.Show(vis2)
|
724
|
+
self.combo_fill.Show(vis3)
|
725
|
+
self.sizer_fill.Show(vis3)
|
726
|
+
self.combo_linestyle.Show(vis4)
|
727
|
+
self.sizer_linestyle.Show(vis4)
|
728
|
+
self.tab_length.Show(vis5)
|
729
|
+
self.tab_positions.Show(vis5)
|
730
|
+
self.sizer_tabs.Show(vis5)
|
731
|
+
|
732
|
+
if vis1 or vis2 or vis3 or vis4 or vis5:
|
733
|
+
self.Show()
|
734
|
+
else:
|
735
|
+
self.Hide()
|
736
|
+
|
737
|
+
|
738
|
+
class StrokeWidthPanel(wx.Panel):
|
739
|
+
def __init__(self, *args, context=None, node=None, **kwds):
|
740
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
741
|
+
kwds["style"] = kwds.get("style", 0)
|
742
|
+
wx.Panel.__init__(self, *args, **kwds)
|
743
|
+
self.context = context
|
744
|
+
self.context.themes.set_window_colors(self)
|
745
|
+
self.node = node
|
746
|
+
|
747
|
+
main_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
748
|
+
s_sizer = StaticBoxSizer(self, wx.ID_ANY, _("Stroke-Width"), wx.HORIZONTAL)
|
749
|
+
main_sizer.Add(s_sizer, 1, wx.EXPAND, 0)
|
750
|
+
# Plus one combobox + value field for stroke width
|
751
|
+
strokewidth_label = wxStaticText(self, wx.ID_ANY, label=_("Width:"))
|
752
|
+
self.text_width = TextCtrl(
|
753
|
+
self,
|
754
|
+
wx.ID_ANY,
|
755
|
+
value="0.10",
|
756
|
+
style=wx.TE_PROCESS_ENTER,
|
757
|
+
check="float",
|
758
|
+
limited=True,
|
759
|
+
)
|
760
|
+
self.text_width.SetMaxSize(dip_size(self, 100, -1))
|
761
|
+
|
762
|
+
self.unit_choices = ["px", "pt", "mm", "cm", "inch", "mil"]
|
763
|
+
self.combo_units = wxComboBox(
|
764
|
+
self,
|
765
|
+
wx.ID_ANY,
|
766
|
+
choices=self.unit_choices,
|
767
|
+
style=wx.CB_DROPDOWN | wx.CB_READONLY,
|
768
|
+
)
|
769
|
+
self.combo_units.SetSelection(0)
|
770
|
+
self.combo_units.SetMaxSize(dip_size(self, 100, -1))
|
771
|
+
|
772
|
+
self.chk_scale = wxCheckBox(self, wx.ID_ANY, _("Scale"))
|
773
|
+
self.chk_scale.SetToolTip(
|
774
|
+
_("Toggle the behaviour of stroke-growth.")
|
775
|
+
+ "\n"
|
776
|
+
+ _("Active: stroke width remains the same, regardless of the element size")
|
777
|
+
+ "\n"
|
778
|
+
+ _("Inactive: stroke grows/shrink with scaled element")
|
779
|
+
)
|
780
|
+
s_sizer.Add(strokewidth_label, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
781
|
+
s_sizer.Add(self.text_width, 1, wx.EXPAND, 0)
|
782
|
+
s_sizer.Add(self.combo_units, 1, wx.EXPAND, 0)
|
783
|
+
s_sizer.Add(self.chk_scale, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
784
|
+
self.Bind(wx.EVT_COMBOBOX, self.on_stroke_width_combo, self.combo_units)
|
785
|
+
self.Bind(wx.EVT_CHECKBOX, self.on_chk_scale, self.chk_scale)
|
786
|
+
self.text_width.SetActionRoutine(self.on_stroke_width)
|
787
|
+
self.SetSizer(main_sizer)
|
788
|
+
main_sizer.Fit(self)
|
789
|
+
self.Layout()
|
790
|
+
self.set_widgets(self.node)
|
791
|
+
|
792
|
+
def on_chk_scale(self, event):
|
793
|
+
if self.node is None or self.node.lock:
|
794
|
+
return
|
795
|
+
flag = self.chk_scale.GetValue()
|
796
|
+
try:
|
797
|
+
if self.node.stroke_scaled != flag:
|
798
|
+
self.node.stroke_scaled = flag
|
799
|
+
self.context.signal("refresh_scene", "Scene")
|
800
|
+
self.context.signal("element_property_update", self.node)
|
801
|
+
except (ValueError, AttributeError):
|
802
|
+
pass
|
803
|
+
|
804
|
+
def on_stroke_width_combo(self, event):
|
805
|
+
self.on_stroke_width()
|
806
|
+
|
807
|
+
def on_stroke_width(self):
|
808
|
+
if self.node is None or self.node.lock:
|
809
|
+
return
|
810
|
+
try:
|
811
|
+
swidth = float(
|
812
|
+
Length(
|
813
|
+
f"{self.text_width.GetValue()}{self.unit_choices[self.combo_units.GetSelection()]}"
|
814
|
+
)
|
815
|
+
)
|
816
|
+
stroke_scale = (
|
817
|
+
sqrt(abs(self.node.matrix.determinant))
|
818
|
+
if self.node.stroke_scaled
|
819
|
+
else 1.0
|
820
|
+
)
|
821
|
+
stroke_width = swidth / stroke_scale
|
822
|
+
if self.node.stroke_width != stroke_width:
|
823
|
+
self.node.stroke_width = stroke_width
|
824
|
+
self.node.altered()
|
825
|
+
self.context.signal("refresh_scene", "Scene")
|
826
|
+
self.context.signal("element_property_update", self.node)
|
827
|
+
except (ValueError, AttributeError):
|
828
|
+
pass
|
829
|
+
|
830
|
+
def set_widgets(self, node):
|
831
|
+
self.node = node
|
832
|
+
enable = False
|
833
|
+
if self.node is None:
|
834
|
+
self.text_width.SetValue("0")
|
835
|
+
self.combo_units.SetSelection(0)
|
836
|
+
self.chk_scale.SetValue(True)
|
837
|
+
elif hasattr(self.node, "stroke_width") and hasattr(self.node, "stroke_scaled"):
|
838
|
+
enable = True
|
839
|
+
self.chk_scale.SetValue(self.node.stroke_scaled)
|
840
|
+
# Let's establish which unit might be the best to represent the display
|
841
|
+
value = 0
|
842
|
+
idxunit = 0 # px
|
843
|
+
if self.node.stroke_width is not None and self.node.stroke_width != 0:
|
844
|
+
found_something = False
|
845
|
+
best_post = 99999999
|
846
|
+
delta = 0.99999999
|
847
|
+
best_pre = 0
|
848
|
+
# # We don't need to scale it here...
|
849
|
+
# factor = (
|
850
|
+
# sqrt(abs(self.node.matrix.determinant))
|
851
|
+
# if self.node.stroke_scaled
|
852
|
+
# else 1.0
|
853
|
+
# )
|
854
|
+
factor = 1
|
855
|
+
node_stroke_width = self.node.stroke_width * factor
|
856
|
+
# print (f"Stroke-width={self.node.stroke_width} ({node_stroke_width}), scaled={self.node.stroke_scaled}")
|
857
|
+
for idx, unit in enumerate(self.unit_choices):
|
858
|
+
std = float(Length(f"1{unit}"))
|
859
|
+
fraction = abs(round(node_stroke_width / std, 6))
|
860
|
+
if fraction == 0:
|
861
|
+
continue
|
862
|
+
curr_post = 0
|
863
|
+
curr_pre = int(fraction)
|
864
|
+
while fraction < 1:
|
865
|
+
curr_post += 1
|
866
|
+
fraction *= 10
|
867
|
+
fraction -= curr_pre
|
868
|
+
# print (f"unit={unit}, fraction={fraction}, digits={curr_post}, value={node_stroke_width / std}")
|
869
|
+
takespref = False
|
870
|
+
if fraction < delta:
|
871
|
+
takespref = True
|
872
|
+
elif fraction == delta and curr_pre > best_pre:
|
873
|
+
takespref = True
|
874
|
+
elif fraction == delta and curr_post < best_post:
|
875
|
+
takespref = True
|
876
|
+
if takespref:
|
877
|
+
best_pre = curr_pre
|
878
|
+
delta = fraction
|
879
|
+
best_post = curr_post
|
880
|
+
idxunit = idx
|
881
|
+
value = node_stroke_width / std
|
882
|
+
found_something = True
|
883
|
+
|
884
|
+
if not found_something:
|
885
|
+
std = float(Length("1mm"))
|
886
|
+
if node_stroke_width / std < 0.1:
|
887
|
+
idxunit = 0 # px
|
888
|
+
else:
|
889
|
+
idxunit = 2 # mm
|
890
|
+
unit = self.unit_choices[idxunit]
|
891
|
+
std = float(Length(f"1{unit}"))
|
892
|
+
value = node_stroke_width / std
|
893
|
+
self.text_width.SetValue(str(round(value, 6)))
|
894
|
+
self.combo_units.SetSelection(idxunit)
|
895
|
+
|
896
|
+
self.text_width.Enable(enable)
|
897
|
+
self.combo_units.Enable(enable)
|
898
|
+
self.chk_scale.Enable(enable)
|
899
|
+
|
900
|
+
def pane_hide(self):
|
901
|
+
pass
|
902
|
+
|
903
|
+
def pane_show(self):
|
904
|
+
pass
|
905
|
+
|
906
|
+
|
907
|
+
class PositionSizePanel(wx.Panel):
|
908
|
+
def __init__(self, *args, context=None, node=None, **kwds):
|
909
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
910
|
+
kwds["style"] = kwds.get("style", 0)
|
911
|
+
wx.Panel.__init__(self, *args, **kwds)
|
912
|
+
self.context = context
|
913
|
+
self.context.themes.set_window_colors(self)
|
914
|
+
self.node = node
|
915
|
+
self.text_x = TextCtrl(
|
916
|
+
self,
|
917
|
+
wx.ID_ANY,
|
918
|
+
"",
|
919
|
+
style=wx.TE_PROCESS_ENTER,
|
920
|
+
limited=True,
|
921
|
+
check="length",
|
922
|
+
)
|
923
|
+
self.text_y = TextCtrl(
|
924
|
+
self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER, limited=True, check="length"
|
925
|
+
)
|
926
|
+
self.text_w = TextCtrl(
|
927
|
+
self,
|
928
|
+
wx.ID_ANY,
|
929
|
+
"",
|
930
|
+
style=wx.TE_PROCESS_ENTER,
|
931
|
+
limited=True,
|
932
|
+
check="length",
|
933
|
+
nonzero=True,
|
934
|
+
)
|
935
|
+
self.text_h = TextCtrl(
|
936
|
+
self,
|
937
|
+
wx.ID_ANY,
|
938
|
+
"",
|
939
|
+
style=wx.TE_PROCESS_ENTER,
|
940
|
+
limited=True,
|
941
|
+
check="length",
|
942
|
+
nonzero=True,
|
943
|
+
)
|
944
|
+
self.context.setting(bool, "lock_active", True)
|
945
|
+
self.btn_lock_ratio = wxToggleButton(self, wx.ID_ANY, "")
|
946
|
+
self.bitmap_locked = mkicons.icons8_lock.GetBitmap(
|
947
|
+
resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale / 2, use_theme=False
|
948
|
+
)
|
949
|
+
self.bitmap_unlocked = mkicons.icons8_unlock.GetBitmap(
|
950
|
+
resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale/ 2, use_theme=False
|
951
|
+
)
|
952
|
+
self.btn_lock_ratio.bitmap_toggled = self.bitmap_locked
|
953
|
+
self.btn_lock_ratio.bitmap_untoggled = self.bitmap_unlocked
|
954
|
+
self.btn_lock_ratio.SetValue(self.context.lock_active)
|
955
|
+
|
956
|
+
self.__set_properties()
|
957
|
+
self.__do_layout()
|
958
|
+
|
959
|
+
self.text_x.SetActionRoutine(self.on_text_x_enter)
|
960
|
+
self.text_y.SetActionRoutine(self.on_text_y_enter)
|
961
|
+
self.text_w.SetActionRoutine(self.on_text_w_enter)
|
962
|
+
self.text_h.SetActionRoutine(self.on_text_h_enter)
|
963
|
+
self.btn_lock_ratio.Bind(wx.EVT_TOGGLEBUTTON, self.on_toggle_ratio)
|
964
|
+
|
965
|
+
self.set_widgets(self.node)
|
966
|
+
|
967
|
+
def __do_layout(self):
|
968
|
+
# begin wxGlade: PositionPanel.__do_layout
|
969
|
+
sizer_main = wx.BoxSizer(wx.VERTICAL)
|
970
|
+
sizer_h = StaticBoxSizer(self, wx.ID_ANY, _("Height:"), wx.HORIZONTAL)
|
971
|
+
sizer_w = StaticBoxSizer(self, wx.ID_ANY, _("Width:"), wx.HORIZONTAL)
|
972
|
+
sizer_opt = wx.BoxSizer(wx.VERTICAL)
|
973
|
+
sizer_y = StaticBoxSizer(self, wx.ID_ANY, "Y:", wx.HORIZONTAL)
|
974
|
+
sizer_x = StaticBoxSizer(self, wx.ID_ANY, "X:", wx.HORIZONTAL)
|
975
|
+
|
976
|
+
sizer_x.Add(self.text_x, 1, wx.EXPAND, 0)
|
977
|
+
sizer_y.Add(self.text_y, 1, wx.EXPAND, 0)
|
978
|
+
sizer_w.Add(self.text_w, 1, wx.EXPAND, 0)
|
979
|
+
sizer_h.Add(self.text_h, 1, wx.EXPAND, 0)
|
980
|
+
|
981
|
+
self.btn_lock_ratio.SetMinSize(dip_size(self, 32, 32))
|
982
|
+
self.btn_lock_ratio.SetToolTip(
|
983
|
+
_("Lock the ratio of width / height to the original values")
|
984
|
+
)
|
985
|
+
|
986
|
+
sizer_opt.Add(self.btn_lock_ratio, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
|
987
|
+
|
988
|
+
sizer_h_xy = wx.BoxSizer(wx.HORIZONTAL)
|
989
|
+
sizer_h_xy.Add(sizer_x, 1, wx.EXPAND, 0)
|
990
|
+
sizer_h_xy.Add(sizer_y, 1, wx.EXPAND, 0)
|
991
|
+
|
992
|
+
self.sizer_h_wh = wx.BoxSizer(wx.HORIZONTAL)
|
993
|
+
self.sizer_h_wh.Add(sizer_w, 1, wx.EXPAND, 0)
|
994
|
+
self.sizer_h_wh.Add(sizer_h, 1, wx.EXPAND, 0)
|
995
|
+
|
996
|
+
sizer_h_dimensions = wx.BoxSizer(wx.HORIZONTAL)
|
997
|
+
|
998
|
+
self.sizer_v_xywh = wx.BoxSizer(wx.VERTICAL)
|
999
|
+
self.sizer_v_xywh.Add(sizer_h_xy, 0, wx.EXPAND, 0)
|
1000
|
+
self.sizer_v_xywh.Add(self.sizer_h_wh, 0, wx.EXPAND, 0)
|
1001
|
+
sizer_h_dimensions.Add(self.sizer_v_xywh, 1, wx.EXPAND, 0)
|
1002
|
+
sizer_h_dimensions.Add(sizer_opt, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
1003
|
+
|
1004
|
+
sizer_main.Add(sizer_h_dimensions, 0, wx.EXPAND, 0)
|
1005
|
+
|
1006
|
+
self.SetSizer(sizer_main)
|
1007
|
+
sizer_main.Fit(self)
|
1008
|
+
self.Layout()
|
1009
|
+
|
1010
|
+
def __set_properties(self):
|
1011
|
+
# begin wxGlade: PositionPanel.__set_properties
|
1012
|
+
self.text_h.SetToolTip(_("New height (enter to apply)"))
|
1013
|
+
self.text_w.SetToolTip(_("New width (enter to apply)"))
|
1014
|
+
self.text_x.SetToolTip(
|
1015
|
+
_("New X-coordinate of left top corner (enter to apply)")
|
1016
|
+
)
|
1017
|
+
self.text_y.SetToolTip(
|
1018
|
+
_("New Y-coordinate of left top corner (enter to apply)")
|
1019
|
+
)
|
1020
|
+
|
1021
|
+
def pane_hide(self):
|
1022
|
+
pass
|
1023
|
+
|
1024
|
+
def pane_show(self):
|
1025
|
+
pass
|
1026
|
+
|
1027
|
+
def signal(self, signalstr, myargs):
|
1028
|
+
# To get updates about translation / scaling of selected elements
|
1029
|
+
if signalstr == "refresh_scene":
|
1030
|
+
if myargs[0] == "Scene":
|
1031
|
+
self.set_widgets(self.node)
|
1032
|
+
elif signalstr == "modified_by_tool":
|
1033
|
+
self.set_widgets(self.node)
|
1034
|
+
elif signalstr == "lock_active":
|
1035
|
+
if self.btn_lock_ratio.GetValue() != self.context.lock_active:
|
1036
|
+
self.btn_lock_ratio.SetValue(self.context.lock_active)
|
1037
|
+
|
1038
|
+
def _set_widgets_hidden(self):
|
1039
|
+
self.text_x.SetValue("")
|
1040
|
+
self.text_y.SetValue("")
|
1041
|
+
self.text_w.SetValue("")
|
1042
|
+
self.text_h.SetValue("")
|
1043
|
+
self.Hide()
|
1044
|
+
|
1045
|
+
def show_hide_wh(self, displaythem):
|
1046
|
+
self.text_w.Show(show=displaythem)
|
1047
|
+
self.text_h.Show(show=displaythem)
|
1048
|
+
self.sizer_h_wh.ShowItems(displaythem)
|
1049
|
+
self.sizer_v_xywh.Layout()
|
1050
|
+
self.Layout()
|
1051
|
+
|
1052
|
+
def set_widgets(self, node):
|
1053
|
+
self.node = node
|
1054
|
+
try:
|
1055
|
+
bb = node.bounds
|
1056
|
+
except:
|
1057
|
+
# Node is none or bounds threw an error.
|
1058
|
+
bb = None
|
1059
|
+
|
1060
|
+
if bb is None:
|
1061
|
+
# Bounds was genuinely none, or node threw an error.
|
1062
|
+
self._set_widgets_hidden()
|
1063
|
+
return
|
1064
|
+
|
1065
|
+
en_xy = self.node.can_move(self.context.elements.lock_allows_move)
|
1066
|
+
en_wh = self.node.can_scale
|
1067
|
+
x = bb[0]
|
1068
|
+
y = bb[1]
|
1069
|
+
w = bb[2] - bb[0]
|
1070
|
+
h = bb[3] - bb[1]
|
1071
|
+
units = self.context.units_name
|
1072
|
+
if units in ("inch", "inches"):
|
1073
|
+
units = "in"
|
1074
|
+
|
1075
|
+
self.text_x.SetValue(
|
1076
|
+
f"{Length(amount=x, preferred_units=units, digits=4).preferred_length}"
|
1077
|
+
)
|
1078
|
+
self.text_y.SetValue(
|
1079
|
+
f"{Length(amount=y, preferred_units=units, digits=4).preferred_length}"
|
1080
|
+
)
|
1081
|
+
self.text_w.SetValue(
|
1082
|
+
f"{Length(amount=w, preferred_units=units, digits=4).preferred_length}"
|
1083
|
+
)
|
1084
|
+
self.text_h.SetValue(
|
1085
|
+
f"{Length(amount=h, preferred_units=units, digits=4).preferred_length}"
|
1086
|
+
)
|
1087
|
+
self.text_x.Enable(en_xy)
|
1088
|
+
self.text_y.Enable(en_xy)
|
1089
|
+
self.text_w.Enable(en_wh)
|
1090
|
+
self.text_h.Enable(en_wh)
|
1091
|
+
self.show_hide_wh(node.type != "elem point")
|
1092
|
+
self.Refresh()
|
1093
|
+
self.Show()
|
1094
|
+
|
1095
|
+
def translate_it(self):
|
1096
|
+
if not self.node.can_move(self.context.elements.lock_allows_move):
|
1097
|
+
return
|
1098
|
+
bb = self.node.bounds
|
1099
|
+
try:
|
1100
|
+
newx = float(Length(self.text_x.GetValue()))
|
1101
|
+
newy = float(Length(self.text_y.GetValue()))
|
1102
|
+
except (ValueError, AttributeError):
|
1103
|
+
return
|
1104
|
+
dx = newx - bb[0]
|
1105
|
+
dy = newy - bb[1]
|
1106
|
+
if dx != 0 or dy != 0:
|
1107
|
+
self.node.matrix.post_translate(dx, dy)
|
1108
|
+
# self.node.modified()
|
1109
|
+
self.node.translated(dx, dy)
|
1110
|
+
self.context.elements.signal("element_property_update", self.node)
|
1111
|
+
self.context.elements.signal("refresh_scene", "Scene")
|
1112
|
+
|
1113
|
+
def scale_it(self, was_width):
|
1114
|
+
if not self.node.can_scale:
|
1115
|
+
return
|
1116
|
+
bb = self.node.bounds
|
1117
|
+
keep_ratio = self.btn_lock_ratio.GetValue()
|
1118
|
+
try:
|
1119
|
+
neww = float(Length(self.text_w.GetValue()))
|
1120
|
+
newh = float(Length(self.text_h.GetValue()))
|
1121
|
+
except (ValueError, AttributeError):
|
1122
|
+
return
|
1123
|
+
if bb[2] != bb[0]:
|
1124
|
+
sx = neww / (bb[2] - bb[0])
|
1125
|
+
else:
|
1126
|
+
sx = 1
|
1127
|
+
if bb[3] != bb[1]:
|
1128
|
+
sy = newh / (bb[3] - bb[1])
|
1129
|
+
else:
|
1130
|
+
sy = 1
|
1131
|
+
if keep_ratio:
|
1132
|
+
if was_width:
|
1133
|
+
sy = sx
|
1134
|
+
else:
|
1135
|
+
sx = sy
|
1136
|
+
if sx != 1.0 or sy != 1.0:
|
1137
|
+
self.node.matrix.post_scale(sx, sy, bb[0], bb[1])
|
1138
|
+
self.node.scaled(sx=sx, sy=sy, ox=bb[0], oy=bb[1])
|
1139
|
+
# self.node.modified()
|
1140
|
+
bb = self.node.bounds
|
1141
|
+
w = bb[2] - bb[0]
|
1142
|
+
h = bb[3] - bb[1]
|
1143
|
+
units = self.context.units_name
|
1144
|
+
if units in ("inch", "inches"):
|
1145
|
+
units = "in"
|
1146
|
+
self.text_w.SetValue(
|
1147
|
+
f"{Length(amount=w, preferred_units=units, digits=4).preferred_length}"
|
1148
|
+
)
|
1149
|
+
self.text_h.SetValue(
|
1150
|
+
f"{Length(amount=h, preferred_units=units, digits=4).preferred_length}"
|
1151
|
+
)
|
1152
|
+
|
1153
|
+
self.context.elements.signal("element_property_update", self.node)
|
1154
|
+
self.context.elements.signal("refresh_scene", "Scene")
|
1155
|
+
|
1156
|
+
def on_toggle_ratio(self, event):
|
1157
|
+
self.btn_lock_ratio.update_button(None)
|
1158
|
+
if self.context.lock_active != self.btn_lock_ratio.GetValue():
|
1159
|
+
self.context.lock_active = self.btn_lock_ratio.GetValue()
|
1160
|
+
self.context.signal("lock_active")
|
1161
|
+
|
1162
|
+
def on_text_x_enter(self):
|
1163
|
+
self.translate_it()
|
1164
|
+
|
1165
|
+
def on_text_y_enter(self):
|
1166
|
+
self.translate_it()
|
1167
|
+
|
1168
|
+
def on_text_w_enter(self):
|
1169
|
+
self.scale_it(True)
|
1170
|
+
|
1171
|
+
def on_text_h_enter(self):
|
1172
|
+
self.scale_it(False)
|
1173
|
+
|
1174
|
+
|
1175
|
+
class PreventChangePanel(wx.Panel):
|
1176
|
+
def __init__(self, *args, context=None, node=None, **kwds):
|
1177
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
1178
|
+
kwds["style"] = kwds.get("style", 0)
|
1179
|
+
wx.Panel.__init__(self, *args, **kwds)
|
1180
|
+
self.context = context
|
1181
|
+
self.context.themes.set_window_colors(self)
|
1182
|
+
self.node = node
|
1183
|
+
self.check_lock = wxCheckBox(self, wx.ID_ANY, _("Lock element"))
|
1184
|
+
self.__set_properties()
|
1185
|
+
self.__do_layout()
|
1186
|
+
self.check_lock.Bind(wx.EVT_CHECKBOX, self.on_check_lock)
|
1187
|
+
self.set_widgets(self.node)
|
1188
|
+
|
1189
|
+
def __do_layout(self):
|
1190
|
+
# begin wxGlade: PositionPanel.__do_layout
|
1191
|
+
sizer_main = wx.BoxSizer(wx.VERTICAL)
|
1192
|
+
sizer_lock = StaticBoxSizer(
|
1193
|
+
self, wx.ID_ANY, _("Prevent changes:"), wx.HORIZONTAL
|
1194
|
+
)
|
1195
|
+
sizer_lock.Add(self.check_lock, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
1196
|
+
|
1197
|
+
sizer_main.Add(sizer_lock, 0, wx.EXPAND, 0)
|
1198
|
+
|
1199
|
+
self.SetSizer(sizer_main)
|
1200
|
+
sizer_main.Fit(self)
|
1201
|
+
self.Layout()
|
1202
|
+
|
1203
|
+
def __set_properties(self):
|
1204
|
+
self.check_lock.SetToolTip(
|
1205
|
+
_(
|
1206
|
+
"If active then this element is effectively prevented from being modified"
|
1207
|
+
)
|
1208
|
+
)
|
1209
|
+
|
1210
|
+
def pane_hide(self):
|
1211
|
+
pass
|
1212
|
+
|
1213
|
+
def pane_show(self):
|
1214
|
+
pass
|
1215
|
+
|
1216
|
+
def _set_widgets_hidden(self):
|
1217
|
+
self.Hide()
|
1218
|
+
|
1219
|
+
def set_widgets(self, node):
|
1220
|
+
self.node = node
|
1221
|
+
if hasattr(self.node, "lock"):
|
1222
|
+
self.check_lock.Enable(True)
|
1223
|
+
self.check_lock.SetValue(self.node.lock)
|
1224
|
+
else:
|
1225
|
+
self.check_lock.SetValue(False)
|
1226
|
+
self.check_lock.Enable(False)
|
1227
|
+
self.Show()
|
1228
|
+
|
1229
|
+
def on_check_lock(self, event):
|
1230
|
+
flag = self.check_lock.GetValue()
|
1231
|
+
if hasattr(self.node, "lock"):
|
1232
|
+
self.node.lock = flag
|
1233
|
+
self.context.elements.signal("element_property_update", self.node)
|
1234
|
+
self.set_widgets(self.node)
|
1235
|
+
|
1236
|
+
|
1237
|
+
class RoundedRectPanel(wx.Panel):
|
1238
|
+
def __init__(
|
1239
|
+
self,
|
1240
|
+
*args,
|
1241
|
+
context=None,
|
1242
|
+
node=None,
|
1243
|
+
**kwds,
|
1244
|
+
):
|
1245
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
1246
|
+
kwds["style"] = kwds.get("style", 0)
|
1247
|
+
wx.Panel.__init__(self, *args, **kwds)
|
1248
|
+
self.context = context
|
1249
|
+
self.context.themes.set_window_colors(self)
|
1250
|
+
self.node = node
|
1251
|
+
self.fonts = []
|
1252
|
+
|
1253
|
+
main_sizer = StaticBoxSizer(
|
1254
|
+
self, wx.ID_ANY, _("Rounded Corners"), wx.HORIZONTAL
|
1255
|
+
)
|
1256
|
+
sizer_x = StaticBoxSizer(self, wx.ID_ANY, _("X:"), wx.HORIZONTAL)
|
1257
|
+
sizer_y = StaticBoxSizer(self, wx.ID_ANY, _("Y:"), wx.HORIZONTAL)
|
1258
|
+
# Wxpython seems to have issues with drawing a roundedrect with values
|
1259
|
+
# beyond 50%, so let's limit it (makes sense anyway)..
|
1260
|
+
self.slider_x = wx.Slider(
|
1261
|
+
self,
|
1262
|
+
wx.ID_ANY,
|
1263
|
+
value=0,
|
1264
|
+
minValue=0,
|
1265
|
+
maxValue=50,
|
1266
|
+
style=wx.SL_LABELS | wx.SL_HORIZONTAL,
|
1267
|
+
)
|
1268
|
+
self.slider_x.SetToolTip(_("Ratio of X-Radius compared to width (in %)"))
|
1269
|
+
|
1270
|
+
self.slider_y = wx.Slider(
|
1271
|
+
self,
|
1272
|
+
wx.ID_ANY,
|
1273
|
+
value=0,
|
1274
|
+
minValue=0,
|
1275
|
+
maxValue=50,
|
1276
|
+
style=wx.SL_LABELS | wx.SL_HORIZONTAL,
|
1277
|
+
)
|
1278
|
+
self.slider_y.SetToolTip(_("Ratio of Y-Radius compared to height (in %)"))
|
1279
|
+
self.btn_lock_ratio = wxToggleButton(self, wx.ID_ANY, "")
|
1280
|
+
self.btn_lock_ratio.SetValue(True)
|
1281
|
+
self.btn_lock_ratio.SetMinSize(dip_size(self, 32, 32))
|
1282
|
+
self.btn_lock_ratio.SetToolTip(_("Lock the radii of X- and Y-axis"))
|
1283
|
+
# Set Bitmap
|
1284
|
+
self.bitmap_locked = mkicons.icons8_lock.GetBitmap(
|
1285
|
+
resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale/ 2, use_theme=False
|
1286
|
+
)
|
1287
|
+
self.bitmap_unlocked = mkicons.icons8_unlock.GetBitmap(
|
1288
|
+
resize=mkicons.STD_ICON_SIZE * self.context.root.bitmap_correction_scale/ 2, use_theme=False
|
1289
|
+
)
|
1290
|
+
|
1291
|
+
sizer_x.Add(self.slider_x, 1, wx.EXPAND, 0)
|
1292
|
+
sizer_y.Add(self.slider_y, 1, wx.EXPAND, 0)
|
1293
|
+
sizer_y.Add(self.btn_lock_ratio, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
1294
|
+
main_sizer.Add(sizer_x, 1, wx.EXPAND, 0)
|
1295
|
+
main_sizer.Add(sizer_y, 1, wx.EXPAND, 0)
|
1296
|
+
self.SetSizer(main_sizer)
|
1297
|
+
main_sizer.Fit(self)
|
1298
|
+
self.Layout()
|
1299
|
+
self.set_widgets(self.node)
|
1300
|
+
self.slider_x.Bind(wx.EVT_SLIDER, self.on_slider_x)
|
1301
|
+
self.slider_y.Bind(wx.EVT_SLIDER, self.on_slider_y)
|
1302
|
+
self.btn_lock_ratio.Bind(wx.EVT_TOGGLEBUTTON, self.on_toggle_ratio)
|
1303
|
+
self.set_widgets(node)
|
1304
|
+
|
1305
|
+
def pane_hide(self):
|
1306
|
+
pass
|
1307
|
+
|
1308
|
+
def pane_show(self):
|
1309
|
+
pass
|
1310
|
+
|
1311
|
+
def accepts(self, node):
|
1312
|
+
if node.type == "elem rect":
|
1313
|
+
return True
|
1314
|
+
else:
|
1315
|
+
return False
|
1316
|
+
|
1317
|
+
def set_widgets(self, node):
|
1318
|
+
self.node = node
|
1319
|
+
# print(f"set_widget for {self.attribute} to {str(node)}")
|
1320
|
+
if self.node is None or not self.accepts(node):
|
1321
|
+
self.Hide()
|
1322
|
+
return
|
1323
|
+
# Set values for rx and ry
|
1324
|
+
bb = self.node.bbox()
|
1325
|
+
width = self.node.width
|
1326
|
+
height = self.node.height
|
1327
|
+
if self.node.rx is None:
|
1328
|
+
rx = 0
|
1329
|
+
else:
|
1330
|
+
rx = self.node.rx
|
1331
|
+
if self.node.ry is None:
|
1332
|
+
ry = 0
|
1333
|
+
else:
|
1334
|
+
ry = self.node.ry
|
1335
|
+
flag = bool(rx == ry)
|
1336
|
+
self.btn_lock_ratio.SetValue(flag)
|
1337
|
+
self.on_toggle_ratio(None)
|
1338
|
+
if width == 0:
|
1339
|
+
int_rx = 0
|
1340
|
+
else:
|
1341
|
+
int_rx = int(100.0 * rx / width)
|
1342
|
+
|
1343
|
+
if height == 0:
|
1344
|
+
int_ry = 0
|
1345
|
+
else:
|
1346
|
+
int_ry = int(100.0 * ry / height)
|
1347
|
+
|
1348
|
+
max_val_x = self.slider_x.GetMax()
|
1349
|
+
max_val_y = self.slider_x.GetMax()
|
1350
|
+
self.slider_x.SetValue(min(max_val_x, int_rx))
|
1351
|
+
self.slider_y.SetValue(min(max_val_y, int_ry))
|
1352
|
+
self.Show()
|
1353
|
+
|
1354
|
+
def set_values(self, axis, value):
|
1355
|
+
sync = self.btn_lock_ratio.GetValue()
|
1356
|
+
width = self.node.width
|
1357
|
+
height = self.node.height
|
1358
|
+
rx = self.node.rx
|
1359
|
+
ry = self.node.ry
|
1360
|
+
if axis == 0:
|
1361
|
+
rx = value / 100 * width
|
1362
|
+
if sync:
|
1363
|
+
ry = rx
|
1364
|
+
else:
|
1365
|
+
ry = value / 100 * height
|
1366
|
+
if sync:
|
1367
|
+
rx = ry
|
1368
|
+
# rx and ry can either both be 0 or both non-zero
|
1369
|
+
if (rx == 0 or ry == 0) and rx != ry:
|
1370
|
+
# totally fine
|
1371
|
+
if rx == 0:
|
1372
|
+
rx = 1 / 100 * width
|
1373
|
+
if ry == 0:
|
1374
|
+
ry = 1 / 100 * height
|
1375
|
+
self.node.rx = rx
|
1376
|
+
self.node.ry = ry
|
1377
|
+
max_val_x = self.slider_x.GetMax()
|
1378
|
+
max_val_y = self.slider_y.GetMax()
|
1379
|
+
int_rx = int(100.0 * rx / width)
|
1380
|
+
int_ry = int(100.0 * ry / height)
|
1381
|
+
if self.slider_x.GetValue() != int_rx:
|
1382
|
+
self.slider_x.SetValue(min(max_val_x, int_rx))
|
1383
|
+
if self.slider_y.GetValue() != int_ry:
|
1384
|
+
self.slider_y.SetValue(min(max_val_y, int_ry))
|
1385
|
+
self.node.altered()
|
1386
|
+
self.context.elements.signal("element_property_update", self.node)
|
1387
|
+
self.context.signal("refresh_scene", "Scene")
|
1388
|
+
|
1389
|
+
def on_slider_x(self, event):
|
1390
|
+
if self.node is None:
|
1391
|
+
return
|
1392
|
+
value = self.slider_x.GetValue()
|
1393
|
+
self.set_values(0, value)
|
1394
|
+
|
1395
|
+
def on_slider_y(self, event):
|
1396
|
+
if self.node is None:
|
1397
|
+
return
|
1398
|
+
value = self.slider_y.GetValue()
|
1399
|
+
self.set_values(1, value)
|
1400
|
+
|
1401
|
+
def on_toggle_ratio(self, event):
|
1402
|
+
if self.btn_lock_ratio.GetValue():
|
1403
|
+
self.btn_lock_ratio.SetBitmap(self.bitmap_locked)
|
1404
|
+
self.slider_y.Enable(False)
|
1405
|
+
else:
|
1406
|
+
self.btn_lock_ratio.SetBitmap(self.bitmap_unlocked)
|
1407
|
+
self.slider_y.Enable(True)
|
1408
|
+
|
1409
|
+
class AutoHidePanel(wx.Panel):
|
1410
|
+
def __init__(self, *args, context=None, node=None, **kwds):
|
1411
|
+
# begin wxGlade: LayerSettingPanel.__init__
|
1412
|
+
kwds["style"] = kwds.get("style", 0)
|
1413
|
+
wx.Panel.__init__(self, *args, **kwds)
|
1414
|
+
self.context = context
|
1415
|
+
self.context.themes.set_window_colors(self)
|
1416
|
+
self.node = node
|
1417
|
+
|
1418
|
+
main_sizer = StaticBoxSizer(self, wx.ID_ANY, _("Auto-Hide"), wx.HORIZONTAL)
|
1419
|
+
self.check_autohide = wxCheckBox(self, wx.ID_ANY, _("Autohide children"))
|
1420
|
+
main_sizer.Add(self.check_autohide, 1, wx.EXPAND, 0)
|
1421
|
+
self.check_autohide.SetToolTip(
|
1422
|
+
_("Toggle the adoption behaviour of the effect.")
|
1423
|
+
+ "\n"
|
1424
|
+
+ _("Active: Added children will be automatically hidden, so only the result of the effect will be seen/burned")
|
1425
|
+
+ "\n"
|
1426
|
+
+ _("Inactive: Added children remain unchanged, so both the child and the result of the effect will be seen/burned")
|
1427
|
+
)
|
1428
|
+
self.check_autohide.Bind(wx.EVT_CHECKBOX, self.on_autohide)
|
1429
|
+
self.SetSizer(main_sizer)
|
1430
|
+
main_sizer.Fit(self)
|
1431
|
+
self.Layout()
|
1432
|
+
self.set_widgets(self.node)
|
1433
|
+
|
1434
|
+
def on_autohide(self, event):
|
1435
|
+
if self.node is None:
|
1436
|
+
return
|
1437
|
+
flag = self.check_autohide.GetValue()
|
1438
|
+
self.node.autohide = flag
|
1439
|
+
for e in self.node.children:
|
1440
|
+
if hasattr(e, "hidden"):
|
1441
|
+
e.hidden = flag
|
1442
|
+
self.context.signal("refresh_scene", "Scene")
|
1443
|
+
self.context.signal("element_property_update", self.node.children)
|
1444
|
+
|
1445
|
+
def accepts(self, node):
|
1446
|
+
return hasattr(node, "autohide")
|
1447
|
+
|
1448
|
+
def set_widgets(self, node):
|
1449
|
+
self.node = node
|
1450
|
+
if node is None:
|
1451
|
+
self.check_autohide.SetValue(False)
|
1452
|
+
self.check_autohide.Enable(False)
|
1453
|
+
else:
|
1454
|
+
self.check_autohide.SetValue(self.node.autohide)
|
1455
|
+
self.check_autohide.Enable(True)
|
1456
|
+
|
1457
|
+
def pane_hide(self):
|
1458
|
+
pass
|
1459
|
+
|
1460
|
+
def pane_show(self):
|
1461
|
+
pass
|