3 from distutils.version
import LooseVersion
9 import python_qt_binding
10 from python_qt_binding
import loadUi
13 from jsk_gui_msgs.srv
import YesNo
14 from jsk_gui_msgs.srv
import YesNoResponse
17 if LooseVersion(python_qt_binding.QT_BINDING_VERSION).version[0] >= 5:
18 from python_qt_binding.QtWidgets
import QWidget
20 from python_qt_binding.QtGui
import QWidget
25 super(YesNoButtonWidget, self).
__init__()
27 ui_file = os.path.join(
28 rp.get_path(
'jsk_rqt_plugins'),
'resource',
'yes_no_button.ui')
30 self.setObjectName(
'YesNoButtonUi')
33 self.yes_button.setEnabled(
False)
34 self.no_button.setEnabled(
False)
36 service_name = rospy.get_namespace() +
'rqt_yn_btn' 37 if service_name
in rosservice.get_service_list():
38 rospy.logwarn(
'{} is already advertised'.format(service_name))
43 """Handle events of being clicked yes button.""" 47 """Handle events of being clicked no button.""" 51 """Callback function of service, 53 and handle enable/disable of the buttons. 55 self.message.setText(req.message)
57 self.yes_button.setEnabled(
True)
58 self.no_button.setEnabled(
True)
59 while self.
yes is None:
61 self.yes_button.setEnabled(
False)
62 self.no_button.setEnabled(
False)
63 return YesNoResponse(yes=self.
yes)
71 super(YesNoButton, self).
__init__(context)
72 self.setObjectName(
'YesNoButton')
74 context.add_widget(self.
_widget)