Skip to content

Commit

Permalink
Merge branch 'develop' into elizabeth/refactor-skeletons-serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
eberrigan committed Sep 12, 2024
2 parents 884da47 + e4bb444 commit 06f18ab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
2 changes: 2 additions & 0 deletions pypi_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# These are also distributed through conda and not pip installed when using conda.
attrs>=21.2.0,<=21.4.0
cattrs==1.1.1
imageio
imageio-ffmpeg
# certifi>=2017.4.17,<=2021.10.8
jsmin
jsonpickle==1.2
Expand Down
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
15 changes: 0 additions & 15 deletions sleap/gui/dataviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,6 @@ def set_item(self, item, key, value):
elif key == "symmetry":
self.context.setNodeSymmetry(skeleton=self.obj, node=item, symmetry=value)

def get_item_color(self, item: Any, key: str):
if self.skeleton:
color = self.context.app.color_manager.get_item_color(
item, parent_skeleton=self.skeleton
)
return QtGui.QColor(*color)


class SkeletonEdgesTableModel(GenericTableModel):
"""Table model for skeleton edges."""
Expand All @@ -436,14 +429,6 @@ def object_to_items(self, skeleton: Skeleton):
]
return items

def get_item_color(self, item: Any, key: str):
if self.skeleton:
edge_pair = (item["source"], item["destination"])
color = self.context.app.color_manager.get_item_color(
edge_pair, parent_skeleton=self.skeleton
)
return QtGui.QColor(*color)


class LabeledFrameTableModel(GenericTableModel):
"""Table model for listing instances in labeled frame.
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

0 comments on commit 06f18ab

Please sign in to comment.