本文整理汇总了Python中python_qt_binding.QtGui.QPushButton.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.setToolTip方法的具体用法?Python QPushButton.setToolTip怎么用?Python QPushButton.setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QPushButton
的用法示例。
在下文中一共展示了QPushButton.setToolTip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_tag_button
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setToolTip [as 别名]
def _create_tag_button(self, parent=None):
btn = QPushButton(parent)
btn.setObjectName("tagButton")
btn.setText(self._translate("Add &tag"))
btn.setShortcut("Ctrl+T")
btn.setToolTip('Adds a ROS launch tag to launch file (Ctrl+T)')
btn.setMenu(self._create_tag_menu(btn))
btn.setFlat(True)
return btn
示例2: PlotWidget
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setToolTip [as 别名]
class PlotWidget(QWidget):
def __init__(self, timeline, parent, topic):
super(PlotWidget, self).__init__(parent)
self.setObjectName('PlotWidget')
self.timeline = timeline
msg_type = self.timeline.get_datatype(topic)
self.msgtopic = topic
self.start_stamp = self.timeline._get_start_stamp()
self.end_stamp = self.timeline._get_end_stamp()
# the current region-of-interest for our bag file
# all resampling and plotting is done with these limits
self.limits = [0,(self.end_stamp-self.start_stamp).to_sec()]
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_bag_plugins'), 'resource', 'plot.ui')
loadUi(ui_file, self)
self.message_tree = MessageTree(msg_type, self)
self.data_tree_layout.addWidget(self.message_tree)
# TODO: make this a dropdown with choices for "Auto", "Full" and
# "Custom"
# I continue to want a "Full" option here
self.auto_res.stateChanged.connect(self.autoChanged)
self.resolution.editingFinished.connect(self.settingsChanged)
self.resolution.setValidator(QDoubleValidator(0.0,1000.0,6,self.resolution))
self.timeline.selected_region_changed.connect(self.region_changed)
self.recompute_timestep()
self.plot = DataPlot(self)
self.plot.set_autoscale(x=False)
self.plot.set_autoscale(y=DataPlot.SCALE_VISIBLE)
self.plot.autoscroll(False)
self.plot.set_xlim(self.limits)
self.data_plot_layout.addWidget(self.plot)
self._home_button = QPushButton()
self._home_button.setToolTip("Reset View")
self._home_button.setIcon(QIcon.fromTheme('go-home'))
self._home_button.clicked.connect(self.home)
self.plot_toolbar_layout.addWidget(self._home_button)
self._config_button = QPushButton("Configure Plot")
self._config_button.clicked.connect(self.plot.doSettingsDialog)
self.plot_toolbar_layout.addWidget(self._config_button)
self.set_cursor(0)
self.paths_on = set()
self._lines = None
# get bag from timeline
bag = None
start_time = self.start_stamp
while bag is None:
bag,entry = self.timeline.get_entry(start_time, topic)
if bag is None:
start_time = self.timeline.get_entry_after(start_time)[1].time
self.bag = bag
# get first message from bag
msg = bag._read_message(entry.position)
self.message_tree.set_message(msg[1])
# state used by threaded resampling
self.resampling_active = False
self.resample_thread = None
self.resample_fields = set()
def set_cursor(self, position):
self.plot.vline(position, color=DataPlot.RED)
self.plot.redraw()
def add_plot(self, path):
self.resample_data([path])
def update_plot(self):
if len(self.paths_on)>0:
self.resample_data(self.paths_on)
def remove_plot(self, path):
self.plot.remove_curve(path)
self.paths_on.remove(path)
self.plot.redraw()
def load_data(self):
"""get a generator for the specified time range on our bag"""
return self.bag.read_messages(self.msgtopic,
self.start_stamp+rospy.Duration.from_sec(self.limits[0]),
self.start_stamp+rospy.Duration.from_sec(self.limits[1]))
def resample_data(self, fields):
if self.resample_thread:
# cancel existing thread and join
self.resampling_active = False
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setToolTip [as 别名]
def __init__(self, updater, config, nodename):
'''
:param config:
:type config: Dictionary? defined in dynamic_reconfigure.client.Client
:type nodename: str
'''
#TODO figure out what data type 'config' is. It is afterall returned
# from dynamic_reconfigure.client.get_parameter_descriptions()
# ros.org/doc/api/dynamic_reconfigure/html/dynamic_reconfigure.client-pysrc.html#Client
super(GroupWidget, self).__init__()
self.state = config['state']
self.name = config['name']
self._toplevel_treenode_name = nodename
# TODO: .ui file needs to be back into usage in later phase.
# ui_file = os.path.join(rp.get_path('rqt_reconfigure'),
# 'resource', 'singlenode_parameditor.ui')
# loadUi(ui_file, self)
verticalLayout = QVBoxLayout(self)
verticalLayout.setContentsMargins(QMargins(0, 0, 0, 0))
_widget_nodeheader = QWidget()
_h_layout_nodeheader = QHBoxLayout(_widget_nodeheader)
_h_layout_nodeheader.setContentsMargins(QMargins(0, 0, 0, 0))
self.nodename_qlabel = QLabel(self)
font = QFont('Trebuchet MS, Bold')
font.setUnderline(True)
font.setBold(True)
# Button to close a node.
_icon_disable_node = QIcon.fromTheme('window-close')
_bt_disable_node = QPushButton(_icon_disable_node, '', self)
_bt_disable_node.setToolTip('Hide this node')
_bt_disable_node_size = QSize(36, 24)
_bt_disable_node.setFixedSize(_bt_disable_node_size)
_bt_disable_node.pressed.connect(self._node_disable_bt_clicked)
_h_layout_nodeheader.addWidget(self.nodename_qlabel)
_h_layout_nodeheader.addWidget(_bt_disable_node)
self.nodename_qlabel.setAlignment(Qt.AlignCenter)
font.setPointSize(10)
self.nodename_qlabel.setFont(font)
grid_widget = QWidget(self)
self.grid = QFormLayout(grid_widget)
verticalLayout.addWidget(_widget_nodeheader)
verticalLayout.addWidget(grid_widget, 1)
# Again, these UI operation above needs to happen in .ui file.
self.tab_bar = None # Every group can have one tab bar
self.tab_bar_shown = False
self.updater = updater
self.editor_widgets = []
self._param_names = []
self._create_node_widgets(config)
rospy.logdebug('Groups node name={}'.format(nodename))
self.nodename_qlabel.setText(nodename)
示例4: Editor
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setToolTip [as 别名]
class Editor(QMainWindow):
'''
Creates a dialog to edit a launch file.
'''
finished_signal = Signal(list)
'''
finished_signal has as parameter the filenames of the initialization and is emitted, if this
dialog was closed.
'''
def __init__(self, filenames, search_text='', parent=None):
'''
@param filenames: a list with filenames. The last one will be activated.
@type filenames: C{[str, ...]}
@param search_text: if not empty, searches in new document for first occurrence of the given text
@type search_text: C{str} (Default: C{Empty String})
'''
QMainWindow.__init__(self, parent)
self.setObjectName(' - '.join(['Editor', str(filenames)]))
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowFlags(Qt.Window)
self.mIcon = QIcon(":/icons/crystal_clear_edit_launch.png")
self._error_icon = QIcon(":/icons/crystal_clear_warning.png")
self._empty_icon = QIcon()
self.setWindowIcon(self.mIcon)
window_title = "ROSLaunch Editor"
if filenames:
window_title = self.__getTabName(filenames[0])
self.setWindowTitle(window_title)
self.init_filenames = list(filenames)
self._search_thread = None
# list with all open files
self.files = []
# create tabs for files
self.main_widget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.main_widget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(1)
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidget = EditorTabWidget(self)
self.tabWidget.setTabPosition(QTabWidget.North)
self.tabWidget.setDocumentMode(True)
self.tabWidget.setTabsClosable(True)
self.tabWidget.setMovable(False)
self.tabWidget.setObjectName("tabWidget")
self.tabWidget.tabCloseRequested.connect(self.on_close_tab)
self.verticalLayout.addWidget(self.tabWidget)
self.buttons = self._create_buttons()
self.verticalLayout.addWidget(self.buttons)
self.setCentralWidget(self.main_widget)
self.find_dialog = TextSearchFrame(self.tabWidget, self)
self.find_dialog.search_result_signal.connect(self.on_search_result)
self.find_dialog.replace_signal.connect(self.on_replace)
self.addDockWidget(Qt.RightDockWidgetArea, self.find_dialog)
# open the files
for f in filenames:
if f:
self.on_load_request(os.path.normpath(f), search_text)
self.readSettings()
self.find_dialog.setVisible(False)
# def __del__(self):
# print "******** destroy", self.objectName()
def _create_buttons(self):
# create the buttons line
self.buttons = QWidget(self)
self.horizontalLayout = QHBoxLayout(self.buttons)
self.horizontalLayout.setContentsMargins(4, 0, 4, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
# add the search button
self.searchButton = QPushButton(self)
self.searchButton.setObjectName("searchButton")
# self.searchButton.clicked.connect(self.on_shortcut_find)
self.searchButton.toggled.connect(self.on_toggled_find)
self.searchButton.setText(self._translate("&Find"))
self.searchButton.setToolTip('Open a search dialog (Ctrl+F)')
self.searchButton.setFlat(True)
self.searchButton.setCheckable(True)
self.horizontalLayout.addWidget(self.searchButton)
# add the replace button
self.replaceButton = QPushButton(self)
self.replaceButton.setObjectName("replaceButton")
# self.replaceButton.clicked.connect(self.on_shortcut_replace)
self.replaceButton.toggled.connect(self.on_toggled_replace)
self.replaceButton.setText(self._translate("&Replace"))
self.replaceButton.setToolTip('Open a search&replace dialog (Ctrl+R)')
self.replaceButton.setFlat(True)
self.replaceButton.setCheckable(True)
self.horizontalLayout.addWidget(self.replaceButton)
# add the goto button
self.gotoButton = QPushButton(self)
self.gotoButton.setObjectName("gotoButton")
self.gotoButton.clicked.connect(self.on_shortcut_goto)
self.gotoButton.setText(self._translate("&Goto line"))
self.gotoButton.setShortcut("Ctrl+G")
self.gotoButton.setToolTip('Open a goto dialog (Ctrl+G)')
#.........这里部分代码省略.........