Skip to content

Commit

Permalink
Refactor menu actions for base orientation in RobotViewerMainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Jan 8, 2024
1 parent 6eb8c3c commit 901aa77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions robot_log_visualizer/ui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ def variableTreeWidget_on_right_click(self, item_position):
if item_path == self.robot_state_path.base_orientation_path:
menu.addAction(dont_use_as_base_orientation_str)
else:
menu.addAction(use_as_base_orientation_str)
menu.addAction(use_as_base_orientation_str + " (Roll-Pitch-Yaw)")

menu.addSeparator()

Expand All @@ -760,7 +760,7 @@ def variableTreeWidget_on_right_click(self, item_position):
if item_path == self.robot_state_path.base_orientation_path:
menu.addAction(dont_use_as_base_orientation_str)
else:
menu.addAction(use_as_base_orientation_str)
menu.addAction(use_as_base_orientation_str + " (xyzw Quaternion)")

# show the menu
action = menu.exec_(self.ui.variableTreeWidget.mapToGlobal(item_position))
Expand All @@ -786,7 +786,7 @@ def variableTreeWidget_on_right_click(self, item_position):
item.setForeground(0, QtGui.QBrush(QtGui.QColor(0, 0, 0)))

if (
action.text() == use_as_base_orientation_str
use_as_base_orientation_str in action.text()
or action.text() == use_as_base_position_str
):
item.setBackground(0, QtGui.QBrush(selected_base_color))
Expand All @@ -800,7 +800,7 @@ def variableTreeWidget_on_right_click(self, item_position):
).setBackground(0, QtGui.QBrush(deselected_base_color))
self.robot_state_path.base_position_path = item_path

if action.text() == use_as_base_orientation_str:
if use_as_base_orientation_str in action.text():
# if base orientation is already set we remove the color
if self.robot_state_path.base_orientation_path:
self.get_item_from_path(
Expand Down

0 comments on commit 901aa77

Please sign in to comment.