Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove no module named work error #1956

Merged
merged 10 commits into from
Sep 11, 2024
4 changes: 3 additions & 1 deletion sleap/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ def add_menu_item(menu, key: str, name: str, action: Callable):
def connect_check(key):
self._menu_actions[key].setCheckable(True)
self._menu_actions[key].setChecked(self.state[key])
self.state.connect(key, self._menu_actions[key].setChecked)
self.state.connect(
key, lambda checked: self._menu_actions[key].setChecked(checked)
)

# add checkable menu item connected to state variable
def add_menu_check_item(menu, key: str, name: str):
Expand Down
6 changes: 6 additions & 0 deletions tests/gui/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ def toggle_and_verify_visibility(expected_visibility: bool = True):
window.showNormal()
vp = window.player

# Change state and ensure menu-item check updates
color_predicted = window.state["color predicted"]
assert window._menu_actions["color predicted"].isChecked() == color_predicted
window.state["color predicted"] = not color_predicted
assert window._menu_actions["color predicted"].isChecked() == (not color_predicted)

# Enable distinct colors
window.state["color predicted"] = True

Expand Down
Loading