11 from .ros_masters
import RosMasterMonitor
12 import rocon_python_utils.system
17 from python_qt_binding.QtGui
import QApplication, QMessageBox
19 from python_qt_binding.QtWidgets
import QApplication, QMessageBox
21 from python_qt_binding.QtCore
import Qt, QCoreApplication, QObject, QTimer, Signal, Slot
30 signal_master_changed_state = Signal(bool)
38 self._no_ros_master_abort_button.clicked.connect(self.
shutdown)
39 self.signal_master_changed_state.connect(self.
switch_state, type=Qt.QueuedConnection)
46 :param bool new_master_found: true when a new master is detected, false when a master has disappeared. 49 self._no_ros_master_dialog.hide()
52 self._no_ros_master_dialog.show()
53 self._no_ros_master_dialog.raise_()
56 self._rqt_subprocess.send_signal(signal.SIGINT)
62 Shutdowns from external signals or the abort button while waiting for a master. 64 print(
"Shutting down the ros master monitor")
65 self._ros_master_monitor.shutdown()
67 print(
"Terminating subprocess")
68 self._rqt_subprocess.send_signal(signal.SIGINT)
71 QCoreApplication.instance().quit()
75 Shutdown handler coming from the rqt subprocess shutting down. This needs 76 to be handled differently depending on whether it's us shutting it down 77 because a ros master shut down (in which case we need to stay alive) 81 self._ros_master_monitor.shutdown()
82 QCoreApplication.instance().quit()
88 :param bool available: whether the ros master is available or not. 90 self.signal_master_changed_state.emit(available)
96 from rqt_gui.main import Main 98 sys.exit(main.main(sys.argv, standalone='%s')) 100 executable_file = tempfile.NamedTemporaryFile(mode=
'w+t', delete=
False)
101 executable_file.write(script)
102 executable_file.flush()
108 signal.signal(signal.SIGINT, self.
_shutdown)
109 self.
_app = QApplication(sys.argv)
113 self._give_signals_a_chance_timer.timeout.connect(
lambda:
None)
114 self._give_signals_a_chance_timer.start(200)
117 return self._app.exec_()
120 if signum == signal.SIGINT:
121 self._rqt_wrapper.shutdown()
def _shutdown(self, signum, f)
def _launch_rocon_remocon(self)
def _master_changed_state(self, available)
_rqt_subprocess_shutdown_by_us
_no_ros_master_abort_button
_give_signals_a_chance_timer
def __init__(self, rqt_plugin_name)
def __init__(self, rqt_plugin_name)
def switch_state(self, new_master_found)