meerk40t 0.9.7051__py2.py3-none-any.whl → 0.9.7900__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/balormk/controller.py +3 -3
- meerk40t/balormk/device.py +7 -0
- meerk40t/balormk/driver.py +23 -14
- meerk40t/balormk/galvo_commands.py +18 -3
- meerk40t/balormk/gui/balorconfig.py +6 -0
- meerk40t/balormk/livelightjob.py +36 -14
- meerk40t/camera/camera.py +1 -0
- meerk40t/camera/gui/camerapanel.py +154 -58
- meerk40t/camera/plugin.py +46 -5
- meerk40t/core/elements/branches.py +90 -20
- meerk40t/core/elements/elements.py +59 -37
- meerk40t/core/elements/trace.py +10 -6
- meerk40t/core/node/node.py +2 -0
- meerk40t/core/plotplanner.py +7 -4
- meerk40t/device/gui/defaultactions.py +78 -14
- meerk40t/dxf/dxf_io.py +42 -0
- meerk40t/grbl/controller.py +245 -35
- meerk40t/grbl/device.py +102 -26
- meerk40t/grbl/driver.py +8 -2
- meerk40t/grbl/gui/grblconfiguration.py +6 -0
- meerk40t/grbl/gui/grblcontroller.py +1 -1
- meerk40t/gui/about.py +7 -0
- meerk40t/gui/choicepropertypanel.py +20 -30
- meerk40t/gui/devicepanel.py +27 -16
- meerk40t/gui/icons.py +15 -0
- meerk40t/gui/laserpanel.py +102 -54
- meerk40t/gui/materialtest.py +10 -0
- meerk40t/gui/mkdebug.py +268 -9
- meerk40t/gui/navigationpanels.py +65 -7
- meerk40t/gui/propertypanels/operationpropertymain.py +185 -91
- meerk40t/gui/scenewidgets/elementswidget.py +7 -1
- meerk40t/gui/scenewidgets/selectionwidget.py +24 -9
- meerk40t/gui/simulation.py +1 -1
- meerk40t/gui/statusbarwidgets/shapepropwidget.py +50 -40
- meerk40t/gui/statusbarwidgets/statusbar.py +2 -2
- meerk40t/gui/toolwidgets/toolmeasure.py +1 -1
- meerk40t/gui/toolwidgets/toolnodeedit.py +4 -1
- meerk40t/gui/toolwidgets/tooltabedit.py +9 -7
- meerk40t/gui/wxmeerk40t.py +2 -0
- meerk40t/gui/wxmmain.py +23 -9
- meerk40t/gui/wxmribbon.py +36 -0
- meerk40t/gui/wxutils.py +66 -42
- meerk40t/kernel/inhibitor.py +120 -0
- meerk40t/kernel/kernel.py +38 -0
- meerk40t/lihuiyu/controller.py +33 -3
- meerk40t/lihuiyu/device.py +99 -4
- meerk40t/lihuiyu/driver.py +62 -5
- meerk40t/lihuiyu/gui/lhycontrollergui.py +69 -24
- meerk40t/lihuiyu/gui/lhydrivergui.py +6 -0
- meerk40t/lihuiyu/laserspeed.py +17 -10
- meerk40t/lihuiyu/parser.py +23 -0
- meerk40t/main.py +1 -1
- meerk40t/moshi/gui/moshidrivergui.py +7 -0
- meerk40t/newly/controller.py +3 -2
- meerk40t/newly/device.py +23 -2
- meerk40t/newly/driver.py +8 -3
- meerk40t/newly/gui/newlyconfig.py +7 -0
- meerk40t/ruida/gui/ruidaconfig.py +7 -0
- meerk40t/tools/geomstr.py +68 -48
- meerk40t/tools/rasterplotter.py +0 -5
- meerk40t/tools/ttfparser.py +155 -82
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/METADATA +1 -1
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/RECORD +68 -67
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/LICENSE +0 -0
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/WHEEL +0 -0
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/entry_points.txt +0 -0
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/top_level.txt +0 -0
- {meerk40t-0.9.7051.dist-info → meerk40t-0.9.7900.dist-info}/zip-safe +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import wx
|
2
2
|
|
3
3
|
from meerk40t.core.elements.element_types import elem_nodes
|
4
|
-
from meerk40t.core.units import
|
4
|
+
from meerk40t.core.units import UNITS_PER_PIXEL, Length
|
5
5
|
from meerk40t.gui.icons import (
|
6
6
|
icon_cap_butt,
|
7
7
|
icon_cap_round,
|
@@ -41,38 +41,40 @@ class LinecapWidget(StatusBarWidget):
|
|
41
41
|
)
|
42
42
|
)
|
43
43
|
self.btn_cap_butt = wxStaticBitmap(
|
44
|
-
self.parent,
|
44
|
+
self.parent,
|
45
|
+
id=wx.ID_ANY,
|
46
|
+
size=wx.Size(self.height, -1),
|
47
|
+
style=wx.BORDER_RAISED,
|
45
48
|
)
|
46
|
-
isize = int(
|
47
|
-
|
48
|
-
|
49
|
-
icon_cap_butt.GetBitmap(
|
50
|
-
resize=isize, buffer=1
|
51
|
-
)
|
49
|
+
isize = int(
|
50
|
+
max(20, self.parent.available_height - 4)
|
51
|
+
* self.context.root.bitmap_correction_scale
|
52
52
|
)
|
53
|
+
|
54
|
+
self.btn_cap_butt.SetBitmap(icon_cap_butt.GetBitmap(resize=isize, buffer=1))
|
53
55
|
self.btn_cap_butt.SetMaxSize(wx.Size(50, -1))
|
54
56
|
self.btn_cap_butt.SetToolTip(_("Set the end of the lines to a butt-shape"))
|
55
57
|
self.btn_cap_butt.Bind(wx.EVT_LEFT_DOWN, self.on_cap_butt)
|
56
58
|
|
57
59
|
self.btn_cap_round = wxStaticBitmap(
|
58
|
-
self.parent,
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
resize=isize, buffer=1
|
63
|
-
)
|
60
|
+
self.parent,
|
61
|
+
id=wx.ID_ANY,
|
62
|
+
size=wx.Size(self.height, -1),
|
63
|
+
style=wx.BORDER_RAISED,
|
64
64
|
)
|
65
|
+
self.btn_cap_round.SetBitmap(icon_cap_round.GetBitmap(resize=isize, buffer=1))
|
65
66
|
self.btn_cap_round.SetMaxSize(wx.Size(50, -1))
|
66
67
|
self.btn_cap_round.SetToolTip(_("Set the end of the lines to a round-shape"))
|
67
68
|
self.btn_cap_round.Bind(wx.EVT_LEFT_DOWN, self.on_cap_round)
|
68
69
|
|
69
70
|
self.btn_cap_square = wxStaticBitmap(
|
70
|
-
self.parent,
|
71
|
+
self.parent,
|
72
|
+
id=wx.ID_ANY,
|
73
|
+
size=wx.Size(self.height, -1),
|
74
|
+
style=wx.BORDER_RAISED,
|
71
75
|
)
|
72
76
|
|
73
|
-
self.btn_cap_square.SetBitmap(
|
74
|
-
icon_cap_square.GetBitmap(resize=isize, buffer=1)
|
75
|
-
)
|
77
|
+
self.btn_cap_square.SetBitmap(icon_cap_square.GetBitmap(resize=isize, buffer=1))
|
76
78
|
self.btn_cap_square.SetMaxSize(wx.Size(50, -1))
|
77
79
|
self.btn_cap_square.SetToolTip(_("Set the end of the lines to a square-shape"))
|
78
80
|
self.btn_cap_square.Bind(wx.EVT_LEFT_DOWN, self.on_cap_square)
|
@@ -116,16 +118,14 @@ class LinejoinWidget(StatusBarWidget):
|
|
116
118
|
)
|
117
119
|
)
|
118
120
|
isize = int(
|
119
|
-
max(20, self.parent.available_height - 4)
|
120
|
-
self.context.root.bitmap_correction_scale
|
121
|
+
max(20, self.parent.available_height - 4)
|
122
|
+
* self.context.root.bitmap_correction_scale
|
121
123
|
)
|
122
124
|
self.btn_join_bevel = wxStaticBitmap(
|
123
125
|
self.parent, id=wx.ID_ANY, size=wx.Size(25, -1), style=wx.BORDER_RAISED
|
124
126
|
)
|
125
127
|
|
126
|
-
self.btn_join_bevel.SetBitmap(
|
127
|
-
icon_join_bevel.GetBitmap(resize=isize, buffer=1)
|
128
|
-
)
|
128
|
+
self.btn_join_bevel.SetBitmap(icon_join_bevel.GetBitmap(resize=isize, buffer=1))
|
129
129
|
self.btn_join_bevel.SetMaxSize(wx.Size(50, -1))
|
130
130
|
self.btn_join_bevel.SetToolTip(_("Set the join of the lines to a bevel-shape"))
|
131
131
|
self.btn_join_bevel.Bind(wx.EVT_LEFT_DOWN, self.on_join_bevel)
|
@@ -133,9 +133,7 @@ class LinejoinWidget(StatusBarWidget):
|
|
133
133
|
self.btn_join_round = wxStaticBitmap(
|
134
134
|
self.parent, id=wx.ID_ANY, size=wx.Size(25, -1), style=wx.BORDER_RAISED
|
135
135
|
)
|
136
|
-
self.btn_join_round.SetBitmap(
|
137
|
-
icon_join_round.GetBitmap(resize=isize, buffer=1)
|
138
|
-
)
|
136
|
+
self.btn_join_round.SetBitmap(icon_join_round.GetBitmap(resize=isize, buffer=1))
|
139
137
|
self.btn_join_round.SetMaxSize(wx.Size(50, -1))
|
140
138
|
self.btn_join_round.SetToolTip(_("Set the join of lines to a round-shape"))
|
141
139
|
self.btn_join_round.Bind(wx.EVT_LEFT_DOWN, self.on_join_round)
|
@@ -143,9 +141,7 @@ class LinejoinWidget(StatusBarWidget):
|
|
143
141
|
self.btn_join_miter = wxStaticBitmap(
|
144
142
|
self.parent, id=wx.ID_ANY, size=wx.Size(25, -1), style=wx.BORDER_RAISED
|
145
143
|
)
|
146
|
-
self.btn_join_miter.SetBitmap(
|
147
|
-
icon_join_miter.GetBitmap(resize=isize, buffer=1)
|
148
|
-
)
|
144
|
+
self.btn_join_miter.SetBitmap(icon_join_miter.GetBitmap(resize=isize, buffer=1))
|
149
145
|
self.btn_join_miter.SetMaxSize(wx.Size(50, -1))
|
150
146
|
self.btn_join_miter.SetToolTip(_("Set the join of lines to a miter-shape"))
|
151
147
|
self.btn_join_miter.Bind(wx.EVT_LEFT_DOWN, self.on_join_miter)
|
@@ -207,12 +203,15 @@ class FillruleWidget(StatusBarWidget):
|
|
207
203
|
)
|
208
204
|
)
|
209
205
|
isize = int(
|
210
|
-
max(20, self.parent.available_height - 4)
|
211
|
-
self.context.root.bitmap_correction_scale
|
206
|
+
max(20, self.parent.available_height - 4)
|
207
|
+
* self.context.root.bitmap_correction_scale
|
212
208
|
)
|
213
209
|
|
214
210
|
self.btn_fill_nonzero = wxStaticBitmap(
|
215
|
-
self.parent,
|
211
|
+
self.parent,
|
212
|
+
id=wx.ID_ANY,
|
213
|
+
size=wx.Size(self.height, -1),
|
214
|
+
style=wx.BORDER_RAISED,
|
216
215
|
)
|
217
216
|
self.btn_fill_nonzero.SetMaxSize(wx.Size(50, -1))
|
218
217
|
self.btn_fill_nonzero.SetBitmap(
|
@@ -222,7 +221,10 @@ class FillruleWidget(StatusBarWidget):
|
|
222
221
|
self.btn_fill_nonzero.Bind(wx.EVT_LEFT_DOWN, self.on_fill_nonzero)
|
223
222
|
|
224
223
|
self.btn_fill_evenodd = wxStaticBitmap(
|
225
|
-
self.parent,
|
224
|
+
self.parent,
|
225
|
+
id=wx.ID_ANY,
|
226
|
+
size=wx.Size(self.height, -1),
|
227
|
+
style=wx.BORDER_RAISED,
|
226
228
|
)
|
227
229
|
self.btn_fill_evenodd.SetBitmap(
|
228
230
|
icon_fill_evenodd.GetBitmap(resize=isize, buffer=1)
|
@@ -289,18 +291,27 @@ class PositionWidget(StatusBarWidget):
|
|
289
291
|
self.parent, wx.ID_ANY, label=self.units[self.unit_index]
|
290
292
|
)
|
291
293
|
icon_size = int(
|
292
|
-
max(20, self.parent.available_height -
|
293
|
-
self.context.root.bitmap_correction_scale
|
294
|
+
max(20, self.parent.available_height - 8)
|
295
|
+
* self.context.root.bitmap_correction_scale
|
294
296
|
)
|
295
297
|
|
296
|
-
self.button_lock_ratio = wxStaticBitmap(
|
298
|
+
self.button_lock_ratio = wxStaticBitmap(
|
299
|
+
self.parent,
|
300
|
+
id=wx.ID_ANY,
|
301
|
+
size=wx.Size(icon_size, -1),
|
302
|
+
style=wx.BORDER_RAISED,
|
303
|
+
)
|
297
304
|
self.bitmap_locked = icons8_lock.GetBitmap(resize=icon_size, use_theme=False)
|
298
|
-
self.bitmap_unlocked = icons8_unlock.GetBitmap(
|
305
|
+
self.bitmap_unlocked = icons8_unlock.GetBitmap(
|
306
|
+
resize=icon_size, use_theme=False
|
307
|
+
)
|
299
308
|
|
300
309
|
self.offset_index = 0 # 0 to 8 tl tc tr cl cc cr bl bc br
|
301
310
|
self.offset_x = 0.0
|
302
311
|
self.offset_y = 0.0
|
303
|
-
self.button_param = wxStaticBitmap(
|
312
|
+
self.button_param = wxStaticBitmap(
|
313
|
+
self.parent, id=wx.ID_ANY, size=wx.Size(icon_size, -1), style=wx.BORDER_NONE
|
314
|
+
)
|
304
315
|
self.pos_bitmaps = self.calculate_icons(icon_size)
|
305
316
|
self.button_param.SetBitmap(self.pos_bitmaps[self.offset_index])
|
306
317
|
|
@@ -369,8 +380,7 @@ class PositionWidget(StatusBarWidget):
|
|
369
380
|
)
|
370
381
|
|
371
382
|
self._lock_ratio = True
|
372
|
-
self.lock_ratio =
|
373
|
-
|
383
|
+
self.lock_ratio = self.context.lock_active
|
374
384
|
|
375
385
|
@property
|
376
386
|
def units_name(self):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import wx
|
2
2
|
|
3
3
|
from meerk40t.gui.icons import icons8_circled_right
|
4
|
-
from meerk40t.gui.wxutils import
|
4
|
+
from meerk40t.gui.wxutils import dip_size, wxStaticBitmap
|
5
5
|
|
6
6
|
_ = wx.GetTranslation
|
7
7
|
|
@@ -61,7 +61,7 @@ class CustomStatusBar(wx.StatusBar):
|
|
61
61
|
@property
|
62
62
|
def available_height(self):
|
63
63
|
sb_size = self.GetSize()
|
64
|
-
return sb_size[1]
|
64
|
+
return max(1, sb_size[1] - 2)
|
65
65
|
|
66
66
|
def Clear(self):
|
67
67
|
"""
|
@@ -907,7 +907,10 @@ class EditTool(ToolWidget):
|
|
907
907
|
path.approximate_arcs_with_cubics()
|
908
908
|
except AttributeError:
|
909
909
|
return
|
910
|
-
|
910
|
+
try:
|
911
|
+
newnode = node.replace_node(path=path, type="elem path")
|
912
|
+
except ValueError:
|
913
|
+
return
|
911
914
|
for item in oldstuff:
|
912
915
|
setattr(newnode, item[0], item[1])
|
913
916
|
newnode.altered()
|
@@ -11,7 +11,7 @@ from meerk40t.gui.scene.sceneconst import (
|
|
11
11
|
RESPONSE_DROP,
|
12
12
|
)
|
13
13
|
from meerk40t.gui.toolwidgets.toolwidget import ToolWidget
|
14
|
-
from meerk40t.gui.wxutils import get_gc_scale
|
14
|
+
from meerk40t.gui.wxutils import get_gc_scale, dip_size
|
15
15
|
|
16
16
|
_ = wx.GetTranslation
|
17
17
|
|
@@ -35,6 +35,7 @@ class SimpleSlider:
|
|
35
35
|
trailer = ""
|
36
36
|
self.trailer = trailer
|
37
37
|
self.no_value_display = False
|
38
|
+
self.magnification = dip_size(scene.gui, 100, 100)[1] / 100
|
38
39
|
|
39
40
|
@property
|
40
41
|
def value(self):
|
@@ -77,7 +78,7 @@ class SimpleSlider:
|
|
77
78
|
"""
|
78
79
|
gc.PushState()
|
79
80
|
s = math.sqrt(abs(self.scene.widget_root.scene_widget.matrix.determinant))
|
80
|
-
offset = self.pt_offset / s
|
81
|
+
offset = self.pt_offset * self.magnification / s
|
81
82
|
|
82
83
|
mypen = wx.Pen(wx.LIGHT_GREY)
|
83
84
|
sx = get_gc_scale(gc)
|
@@ -119,7 +120,7 @@ class SimpleSlider:
|
|
119
120
|
if not self.trailer.startswith("%"):
|
120
121
|
symbol += " "
|
121
122
|
symbol += _(self.trailer)
|
122
|
-
font_size = 10 / s
|
123
|
+
font_size = 10 * self.magnification / s
|
123
124
|
if font_size < 1.0:
|
124
125
|
font_size = 1.0
|
125
126
|
try:
|
@@ -146,7 +147,7 @@ class SimpleSlider:
|
|
146
147
|
|
147
148
|
def hit(self, xpos, ypos):
|
148
149
|
s = math.sqrt(abs(self.scene.widget_root.scene_widget.matrix.determinant))
|
149
|
-
offset = self.pt_offset / s
|
150
|
+
offset = self.pt_offset * self.magnification / s
|
150
151
|
inside = bool(abs(self.ptx - xpos) <= offset and abs(self.pty - ypos) <= offset)
|
151
152
|
return inside
|
152
153
|
|
@@ -177,6 +178,7 @@ class TabEditTool(ToolWidget):
|
|
177
178
|
slider = SimpleSlider(0, self.scene, minval, maxval, 0, 0, self.slider_size, info )
|
178
179
|
slider.no_value_display = True
|
179
180
|
self.sliders.append(slider)
|
181
|
+
self.magnification = dip_size(scene.gui, 100, 100)[1] / 100
|
180
182
|
|
181
183
|
def reset(self):
|
182
184
|
self.points.clear()
|
@@ -358,7 +360,7 @@ class TabEditTool(ToolWidget):
|
|
358
360
|
if len(self.sliders) == 0:
|
359
361
|
return
|
360
362
|
s = math.sqrt(abs(self.scene.widget_root.scene_widget.matrix.determinant))
|
361
|
-
offset = self.pt_offset / s
|
363
|
+
offset = self.pt_offset * self.magnification / s
|
362
364
|
width = self.slider_size / s
|
363
365
|
x = bb[0]
|
364
366
|
y = bb[1]
|
@@ -377,7 +379,7 @@ class TabEditTool(ToolWidget):
|
|
377
379
|
"""
|
378
380
|
gc.PushState()
|
379
381
|
s = math.sqrt(abs(self.scene.widget_root.scene_widget.matrix.determinant))
|
380
|
-
offset = self.pt_offset / s
|
382
|
+
offset = self.pt_offset * self.magnification / s
|
381
383
|
gc.SetPen(wx.RED_PEN)
|
382
384
|
gc.SetBrush(wx.RED_BRUSH)
|
383
385
|
for index, g in enumerate(self.points):
|
@@ -424,7 +426,7 @@ class TabEditTool(ToolWidget):
|
|
424
426
|
return RESPONSE_CHAIN
|
425
427
|
self.scene.pane.tool_active = True
|
426
428
|
self.scene.pane.modif_active = True
|
427
|
-
offset = self.pt_offset
|
429
|
+
offset = self.pt_offset * self.magnification
|
428
430
|
s = math.sqrt(abs(self.scene.widget_root.scene_widget.matrix.determinant))
|
429
431
|
offset /= s
|
430
432
|
xp = space_pos[0]
|
meerk40t/gui/wxmeerk40t.py
CHANGED
@@ -1065,6 +1065,7 @@ class wxMeerK40t(wx.App, Module):
|
|
1065
1065
|
register_panel_debugger,
|
1066
1066
|
register_panel_icon,
|
1067
1067
|
register_panel_window,
|
1068
|
+
register_panel_plotter,
|
1068
1069
|
)
|
1069
1070
|
|
1070
1071
|
kernel.register("wxpane/debug_tree", register_panel_debugger)
|
@@ -1072,6 +1073,7 @@ class wxMeerK40t(wx.App, Module):
|
|
1072
1073
|
kernel.register("wxpane/debug_icons", register_panel_icon)
|
1073
1074
|
kernel.register("wxpane/debug_shutdown", register_panel_crash)
|
1074
1075
|
kernel.register("wxpane/debug_window", register_panel_window)
|
1076
|
+
kernel.register("wxpane/debug_plotter", register_panel_plotter)
|
1075
1077
|
|
1076
1078
|
from meerk40t.gui.utilitywidgets.debugwidgets import register_widget_icon
|
1077
1079
|
|
meerk40t/gui/wxmmain.py
CHANGED
@@ -1241,6 +1241,20 @@ class MeerK40t(MWindow):
|
|
1241
1241
|
"page": "Scene",
|
1242
1242
|
"section": "General",
|
1243
1243
|
},
|
1244
|
+
{
|
1245
|
+
"attr": "file_selection",
|
1246
|
+
"object": context.root,
|
1247
|
+
"default": True,
|
1248
|
+
"type": bool,
|
1249
|
+
"label": _("Treat file selection as group selection"),
|
1250
|
+
"tip": _(
|
1251
|
+
"Active: Single click within the boundaries of the contained elements of a filenode selects all elements within the file"
|
1252
|
+
)
|
1253
|
+
+ "\n"
|
1254
|
+
+ _("Inactive: filenodes will not be used for selection"),
|
1255
|
+
"page": "Scene",
|
1256
|
+
"section": "General",
|
1257
|
+
},
|
1244
1258
|
]
|
1245
1259
|
context.kernel.register_choices("preferences", choices)
|
1246
1260
|
|
@@ -3002,7 +3016,7 @@ class MeerK40t(MWindow):
|
|
3002
3016
|
|
3003
3017
|
@context.console_command("dialog_gear", hidden=True)
|
3004
3018
|
def gear(**kwargs):
|
3005
|
-
dlg = wx.TextEntryDialog(gui, _("Enter Forced Gear"), _("Gear Entry"), "")
|
3019
|
+
dlg = wx.TextEntryDialog(gui, _("Enter Forced Gear"), _("Gear Entry"), "0")
|
3006
3020
|
dlg.SetValue("")
|
3007
3021
|
|
3008
3022
|
if dlg.ShowModal() == wx.ID_OK:
|
@@ -3545,6 +3559,7 @@ class MeerK40t(MWindow):
|
|
3545
3559
|
if hasattr(context.kernel.busyinfo, "reparent"):
|
3546
3560
|
context.kernel.busyinfo.reparent(self)
|
3547
3561
|
|
3562
|
+
@signal_listener("pane")
|
3548
3563
|
@lookup_listener("pane")
|
3549
3564
|
def dynamic_fill_pane_menu(self, new=None, old=None):
|
3550
3565
|
def toggle_pane(pane_toggle):
|
@@ -3620,15 +3635,14 @@ class MeerK40t(MWindow):
|
|
3620
3635
|
pane_name = pane.name
|
3621
3636
|
except AttributeError:
|
3622
3637
|
pane_name = suffix_path
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3638
|
+
pane_caption = ""
|
3639
|
+
src = "default"
|
3640
|
+
if hasattr(pane, "control") and hasattr(pane.control, "caption"):
|
3641
|
+
pane_caption = pane.control.caption
|
3642
|
+
elif hasattr(pane, "caption"):
|
3626
3643
|
pane_caption = pane.caption
|
3627
|
-
except AttributeError:
|
3628
|
-
pass
|
3629
3644
|
if not pane_caption:
|
3630
3645
|
pane_caption = pane_name[0].upper() + pane_name[1:] + "."
|
3631
|
-
|
3632
3646
|
menu_item = menu_context.Append(wx.ID_ANY, pane_caption, "", wx.ITEM_CHECK)
|
3633
3647
|
menu_item.SetHelp(helptext)
|
3634
3648
|
self.Bind(
|
@@ -5611,7 +5625,7 @@ class MeerK40t(MWindow):
|
|
5611
5625
|
Zoom scene to bed size.
|
5612
5626
|
"""
|
5613
5627
|
zoom = self.context.zoom_margin
|
5614
|
-
self.context(f"scene focus -a {-zoom}% {-zoom}% {zoom+100}% {zoom+100}%\n")
|
5628
|
+
self.context(f"scene focus -a {-zoom}% {-zoom}% {zoom + 100}% {zoom + 100}%\n")
|
5615
5629
|
|
5616
5630
|
def update_statusbar(self, text):
|
5617
5631
|
self.main_statusbar.SetStatusText(text, 0)
|
@@ -5701,7 +5715,7 @@ class MeerK40t(MWindow):
|
|
5701
5715
|
return
|
5702
5716
|
helptext = menuitem.GetHelp()
|
5703
5717
|
if not helptext:
|
5704
|
-
helptext = f
|
5718
|
+
helptext = f"{menuitem.GetItemLabelText()} ({_('No help text')})"
|
5705
5719
|
self.update_statusbar(helptext)
|
5706
5720
|
except RuntimeError:
|
5707
5721
|
pass
|
meerk40t/gui/wxmribbon.py
CHANGED
@@ -678,6 +678,42 @@ class MKRibbonBarPanel(RibbonBarPanel):
|
|
678
678
|
self.apply_enable_rules()
|
679
679
|
self.redrawn()
|
680
680
|
|
681
|
+
@signal_listener("icon;label")
|
682
|
+
def on_label_update(self, origin, node=None, *args):
|
683
|
+
"""
|
684
|
+
Signal to update the icon or label of a button.
|
685
|
+
This is used to update the icon or label of a button when it changes.
|
686
|
+
"""
|
687
|
+
if node is None or len(args) == 0:
|
688
|
+
return
|
689
|
+
if not isinstance(node, (list, tuple)):
|
690
|
+
node = [node]
|
691
|
+
newlabel = None
|
692
|
+
newtooltip = None
|
693
|
+
if isinstance(args[0], (list, tuple)):
|
694
|
+
newlabel = args[0][0] if len(args[0]) > 0 else None
|
695
|
+
newtooltip = args[0][1] if len(args[0]) > 1 else None
|
696
|
+
else:
|
697
|
+
newlabel = args[0] # First argument is the new label
|
698
|
+
if newlabel is None and newtooltip is None:
|
699
|
+
return
|
700
|
+
for page in self.pages:
|
701
|
+
for panel in page.panels:
|
702
|
+
for button in panel.buttons:
|
703
|
+
if button.identifier in node:
|
704
|
+
button.label = newlabel if newlabel is not None else button.label
|
705
|
+
button.tip = (
|
706
|
+
newtooltip if newtooltip is not None else button.tip
|
707
|
+
)
|
708
|
+
if "multi" in button.button_dict:
|
709
|
+
for subbutton in button.button_dict["multi"]:
|
710
|
+
if subbutton["identifier"] in node:
|
711
|
+
if newlabel is not None:
|
712
|
+
subbutton["label"] = newlabel
|
713
|
+
if newtooltip is not None:
|
714
|
+
subbutton["tip"] = newtooltip
|
715
|
+
self.redrawn()
|
716
|
+
|
681
717
|
@signal_listener("tool_changed")
|
682
718
|
def on_tool_changed(self, origin, newtool=None, *args):
|
683
719
|
# Signal provides a tuple with (togglegroup, id)
|
meerk40t/gui/wxutils.py
CHANGED
@@ -1650,58 +1650,31 @@ class wxCheckListBox(StaticBoxSizer):
|
|
1650
1650
|
**kwargs,
|
1651
1651
|
):
|
1652
1652
|
self.parent = parent
|
1653
|
-
self.choices =
|
1653
|
+
self.choices = []
|
1654
1654
|
self._children = []
|
1655
|
-
self._tool_tip =
|
1655
|
+
self._tool_tip = ""
|
1656
1656
|
self._help = None
|
1657
1657
|
super().__init__(
|
1658
1658
|
parent=parent, id=wx.ID_ANY, label=label, orientation=wx.VERTICAL
|
1659
1659
|
)
|
1660
1660
|
self.majorDimension = majorDimension
|
1661
1661
|
self.style = style
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
"""
|
1666
|
-
Build the controls for the CheckListBox.
|
1667
|
-
This method is called during initialization to create the checkboxes.
|
1668
|
-
"""
|
1669
|
-
if self.choices is None:
|
1670
|
-
self.choices = []
|
1671
|
-
if self.majorDimension == 0 or self.style == wx.RA_SPECIFY_ROWS:
|
1672
|
-
self.majorDimension = 1000
|
1673
|
-
container = None
|
1674
|
-
for idx, c in enumerate(self.choices):
|
1675
|
-
if idx % self.majorDimension == 0:
|
1676
|
-
container = wx.BoxSizer(wx.HORIZONTAL)
|
1677
|
-
self.Add(container, 0, wx.EXPAND, 0)
|
1678
|
-
check_option = wx.CheckBox(self.parent, wx.ID_ANY, label=c)
|
1679
|
-
container.Add(check_option, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
1680
|
-
self._children.append(check_option)
|
1681
|
-
|
1682
|
-
if platform.system() == "Linux":
|
1683
|
-
|
1684
|
-
def on_mouse_over_check(ctrl):
|
1685
|
-
def mouse(event=None):
|
1686
|
-
ctrl.SetToolTip(self._tool_tip)
|
1687
|
-
event.Skip()
|
1688
|
-
|
1689
|
-
return mouse
|
1690
|
-
|
1691
|
-
for ctrl in self._children:
|
1692
|
-
ctrl.Bind(wx.EVT_MOTION, on_mouse_over_check(ctrl))
|
1693
|
-
|
1694
|
-
for ctrl in self._children:
|
1695
|
-
ctrl.Bind(wx.EVT_CHECKBOX, self.on_check)
|
1696
|
-
ctrl.Bind(wx.EVT_RIGHT_DOWN, self.on_right_click)
|
1697
|
-
|
1698
|
-
for ctrl in self._children:
|
1699
|
-
set_color_according_to_theme(ctrl, "text_bg", "text_fg")
|
1662
|
+
if choices is None:
|
1663
|
+
choices = []
|
1664
|
+
self.Set(choices)
|
1700
1665
|
|
1701
1666
|
@property
|
1702
1667
|
def Children(self):
|
1703
1668
|
return self._children
|
1704
1669
|
|
1670
|
+
def on_mouse_over_check(self, event):
|
1671
|
+
"""
|
1672
|
+
Handle mouse over events to show tooltips on Linux.
|
1673
|
+
"""
|
1674
|
+
if self._tool_tip:
|
1675
|
+
event.GetEventObject().SetToolTip(self._tool_tip)
|
1676
|
+
event.Skip()
|
1677
|
+
|
1705
1678
|
def GetParent(self):
|
1706
1679
|
return self.parent
|
1707
1680
|
|
@@ -1764,6 +1737,11 @@ class wxCheckListBox(StaticBoxSizer):
|
|
1764
1737
|
),
|
1765
1738
|
id=item.GetId(),
|
1766
1739
|
)
|
1740
|
+
# Test routines
|
1741
|
+
# item = menu.Append(wx.ID_ANY, "Test-Routine to set few items", "")
|
1742
|
+
# parent.Bind(wx.EVT_MENU, lambda e: self.Set(["A", "B", "C"]), id=item.GetId())
|
1743
|
+
# item = menu.Append(wx.ID_ANY, "Test-Routine to set many items", "")
|
1744
|
+
# parent.Bind(wx.EVT_MENU, lambda e: self.Set([f"Item {i}" for i in range(20)]), id=item.GetId())
|
1767
1745
|
parent.PopupMenu(menu)
|
1768
1746
|
menu.Destroy()
|
1769
1747
|
|
@@ -1843,9 +1821,55 @@ class wxCheckListBox(StaticBoxSizer):
|
|
1843
1821
|
:param choices: A list of strings to set as choices.
|
1844
1822
|
"""
|
1845
1823
|
# print (f"Setting choices for {self.GetLabel()}: {choices}")
|
1846
|
-
|
1824
|
+
"""
|
1825
|
+
This is more efficient than clearing and rebuilding the controls.
|
1826
|
+
Update the labels of existing controls to match new_choices.
|
1827
|
+
If there are more controls than choices, extra controls are destroyed.
|
1828
|
+
If there are fewer controls than choices, new controls are created.
|
1829
|
+
"""
|
1830
|
+
# Update existing controls
|
1831
|
+
if self.majorDimension == 0 or self.style == wx.RA_SPECIFY_ROWS:
|
1832
|
+
self.majorDimension = 1000
|
1833
|
+
last_container = None
|
1834
|
+
for idx, choice in enumerate(choices):
|
1835
|
+
if idx < len(self._children):
|
1836
|
+
self._children[idx].SetLabel(choice)
|
1837
|
+
# self._children[idx].Show(True)
|
1838
|
+
else:
|
1839
|
+
# Add new controls if needed
|
1840
|
+
check_option = wx.CheckBox(self.parent, wx.ID_ANY, label=choice)
|
1841
|
+
if self._tool_tip:
|
1842
|
+
check_option.SetToolTip(self._tool_tip)
|
1843
|
+
check_option.Bind(wx.EVT_CHECKBOX, self.on_check)
|
1844
|
+
check_option.Bind(wx.EVT_RIGHT_DOWN, self.on_right_click)
|
1845
|
+
if platform.system() == "Linux":
|
1846
|
+
check_option.Bind(wx.EVT_MOTION, self.on_mouse_over_check)
|
1847
|
+
set_color_according_to_theme(check_option, "text_bg", "text_fg")
|
1848
|
+
self._children.append(check_option)
|
1849
|
+
# Add to layout
|
1850
|
+
# Find or create the appropriate container
|
1851
|
+
if idx % self.majorDimension == 0:
|
1852
|
+
last_container = wx.BoxSizer(wx.HORIZONTAL)
|
1853
|
+
self.Add(last_container, 0, wx.EXPAND, 0)
|
1854
|
+
else:
|
1855
|
+
# Find the last container
|
1856
|
+
if last_container is None:
|
1857
|
+
for c in self.GetChildren():
|
1858
|
+
if c.IsSizer():
|
1859
|
+
last_container = c.GetSizer()
|
1860
|
+
if last_container is None:
|
1861
|
+
# fallback: create new container
|
1862
|
+
last_container = wx.BoxSizer(wx.HORIZONTAL)
|
1863
|
+
self.Add(last_container, 0, wx.EXPAND, 0)
|
1864
|
+
last_container.Add(check_option, 1, wx.ALIGN_CENTER_VERTICAL, 0)
|
1865
|
+
# Remove extra controls
|
1866
|
+
if len(self._children) > len(choices):
|
1867
|
+
for idx in range(len(choices), len(self._children)):
|
1868
|
+
self._children[idx].Destroy()
|
1869
|
+
self._children = self._children[: len(choices)]
|
1870
|
+
self.Layout()
|
1871
|
+
self.parent.Layout()
|
1847
1872
|
self.choices = list(choices)
|
1848
|
-
self._build_controls()
|
1849
1873
|
|
1850
1874
|
|
1851
1875
|
##############
|