3 from python_qt_binding
import QtWidgets, QtCore
4 from python_qt_binding.QtWidgets
import QWidget, QPushButton, QColorDialog
5 from python_qt_binding.QtCore
import Slot
6 from python_qt_binding.QtGui
import QColor
18 self.
editor.observers.append(self)
22 self.
layout = QtWidgets.QGridLayout()
27 self.
mesh_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
80 def update(self, editor, level, elements):
90 if self.
editor.active_frame
is not None:
113 if frame
is None or frame.style ==
"none":
114 self.
widget.setEnabled(
False)
117 if frame.style ==
"mesh":
123 elif frame.style ==
"sphere":
131 if frame.style ==
"cube":
135 self.
widget.setEnabled(
True)
138 if frame
is None or frame.style ==
"none":
141 if frame.style ==
"mesh":
144 elif frame.style ==
"sphere":
149 if frame.style ==
"cube":
154 values =
"{}, {}, {}, {}".format(200, 200, 200, 255)
156 values =
"{}, {}, {}, {}".format(frame.color[0]*255, frame.color[1]*255, frame.color[2]*255, frame.color[3]*255)
157 self.
color_label.setStyleSheet(
"QLabel { background-color: rgba("+values+
"); }")
187 path = QtWidgets.QFileDialog.getOpenFileName(
None,
'Open Mesh',
'/home',
'Mesh Files (*.stl)')[0]
189 rospackage = rospkg.get_package_name(path)
190 if rospackage
is None:
191 QtWidgets.QMessageBox.warning(self.
widget,
"Saving absolute path to mesh",
192 "Cannot find rospackage with selected mesh in it!\nSaving absolute path to mesh instead!")
196 rel_path = os.path.relpath(path , rospkg.RosPack().get_path(rospackage))
197 rospy.loginfo(
"Saving: package: {} + relative path: {}".format(rospackage, rel_path))
201 QtWidgets.QMessageBox.warning(self.
widget,
"Saving absolute path to mesh",
202 "The found rospackage with selected mesh in it is not sourced in your ROS workspace!\n"+
203 "Cannot resolve the packagepath\nSaving absolute path to mesh instead!")
209 frame = self.
editor.active_frame
210 color = QtWidgets.QColorDialog.getColor(
211 QColor(frame.color[0]*255,
217 options=QtWidgets.QColorDialog.ShowAlphaChannel)