Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f3c7879

Browse files
authored
Fix imgui popup menus (#695)
* remove event filters attr * fix standard right click menu * fix colormap picker menu for imgui-bundle v1.6.0 * black
1 parent 0336e26 commit f3c7879

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

fastplotlib/ui/_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ def __init__(self, figure: Figure, *args, **kwargs):
248248
self._figure = figure
249249
self._fa_icons = self._figure._fa_icons
250250

251-
self._event_filter_names = set()
252-
253251
self.is_open = False
254252

255253
def open(self, pos: tuple[int, int], *args, **kwargs):

fastplotlib/ui/right_click_menus/_colormap_picker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def update(self):
153153
* imgui.get_font().font_size
154154
) - 2
155155

156-
if imgui.menu_item("Reset vmin-vmax", None, False)[0]:
156+
if imgui.menu_item("Reset vmin-vmax", "", False)[0]:
157157
self._lut_tool.image_graphic.reset_vmin_vmax()
158158

159159
# add all the cmap options

fastplotlib/ui/right_click_menus/_standard_menu.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ def update(self):
8282
imgui.separator()
8383

8484
# autoscale, center, maintain aspect
85-
if imgui.menu_item(f"Autoscale", None, False)[0]:
85+
if imgui.menu_item(f"Autoscale", "", False)[0]:
8686
self.get_subplot().auto_scale()
8787

88-
if imgui.menu_item(f"Center", None, False)[0]:
88+
if imgui.menu_item(f"Center", "", False)[0]:
8989
self.get_subplot().center_scene()
9090

9191
_, maintain_aspect = imgui.menu_item(
92-
"Maintain Aspect", None, self.get_subplot().camera.maintain_aspect
92+
"Maintain Aspect", "", self.get_subplot().camera.maintain_aspect
9393
)
9494
self.get_subplot().camera.maintain_aspect = maintain_aspect
9595

@@ -98,7 +98,9 @@ def update(self):
9898
# toggles to flip axes cameras
9999
for axis in ["x", "y", "z"]:
100100
scale = getattr(self.get_subplot().camera.local, f"scale_{axis}")
101-
changed, flip = imgui.menu_item(f"Flip {axis} axis", None, scale < 0)
101+
changed, flip = imgui.menu_item(
102+
f"Flip {axis} axis", "", bool(scale < 0)
103+
)
102104

103105
if changed:
104106
flip_axis(self.get_subplot(), axis, flip)
@@ -109,7 +111,7 @@ def update(self):
109111
for plane in ["xy", "xz", "yz"]:
110112
grid = getattr(self.get_subplot().axes.grids, plane)
111113
visible = grid.visible
112-
changed, new_visible = imgui.menu_item(f"Grid {plane}", None, visible)
114+
changed, new_visible = imgui.menu_item(f"Grid {plane}", "", visible)
113115

114116
if changed:
115117
grid.visible = new_visible
@@ -140,7 +142,7 @@ def update(self):
140142
# controller options
141143
if imgui.begin_menu("Controller"):
142144
_, enabled = imgui.menu_item(
143-
"Enabled", None, self.get_subplot().controller.enabled
145+
"Enabled", "", self.get_subplot().controller.enabled
144146
)
145147

146148
self.get_subplot().controller.enabled = enabled
@@ -163,7 +165,7 @@ def update(self):
163165

164166
clicked, _ = imgui.menu_item(
165167
label=name,
166-
shortcut=None,
168+
shortcut="",
167169
p_selected=current_type is controller_type_iter,
168170
)
169171

0 commit comments

Comments
 (0)