Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 import os
00034
00035 from python_qt_binding import loadUi
00036 from python_qt_binding.QtWidgets import QDialog
00037
00038 from rqt_logger_level.logger_level_widget import LoggerLevelWidget
00039 from rqt_logger_level.logger_level_service_caller import LoggerLevelServiceCaller
00040
00041
00042 class ConsoleSettingsDialog(QDialog):
00043
00044 """
00045 Dialog to change the subscribed topic and alter the message buffer size.
00046 """
00047
00048 def __init__(self, topics, rospack):
00049 """
00050 :param topics: list of topics to allow switching, ''list of string''
00051 :param limit: displayed in the message buffer size spin box, ''int''
00052 """
00053 super(ConsoleSettingsDialog, self).__init__()
00054 ui_file = os.path.join(
00055 rospack.get_path('rqt_console'), 'resource', 'console_settings_dialog.ui')
00056 loadUi(ui_file, self)
00057 for topic in topics:
00058 self.topic_combo.addItem(topic[0] + ' (' + topic[1] + ')', topic[0])
00059
00060 self._service_caller = LoggerLevelServiceCaller()
00061 self._logger_widget = LoggerLevelWidget(self._service_caller)
00062 self.levelsLayout.addWidget(self._logger_widget)
00063 self.adjustSize()
00064
00065 def query(self, topic, buffer_size):
00066 index = self.topic_combo.findData(topic)
00067 if index != -1:
00068 self.topic_combo.setCurrentIndex(index)
00069 self.buffer_size_spin.setValue(buffer_size)
00070 ok = self.exec_()
00071 if ok == 1:
00072 index = self.topic_combo.currentIndex()
00073 if index != -1:
00074 topic = self.topic_combo.itemData(index)
00075 buffer_size = self.buffer_size_spin.value()
00076 return topic, buffer_size