本文整理汇总了Python中python_qt_binding.QtGui.QIcon类的典型用法代码示例。如果您正苦于以下问题:Python QIcon类的具体用法?Python QIcon怎么用?Python QIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, topics):
super(HistogramPlotWidget, self).__init__()
self.setObjectName('HistogramPlotWidget')
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('jsk_rqt_plugins'),
'resource', 'plot_histogram.ui')
loadUi(ui_file, self)
self.cv_bridge = CvBridge()
self.subscribe_topic_button.setIcon(QIcon.fromTheme('add'))
self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
self.data_plot = MatHistogramPlot(self)
self.data_plot_layout.addWidget(self.data_plot)
self._topic_completer = TopicCompleter(self.topic_edit)
self._topic_completer.update_topics()
self.topic_edit.setCompleter(self._topic_completer)
self.data_plot.dropEvent = self.dropEvent
self.data_plot.dragEnterEvent = self.dragEnterEvent
self._start_time = rospy.get_time()
self._rosdata = None
if len(topics) != 0:
self.subscribe_topic(topics)
self._update_plot_timer = QTimer(self)
self._update_plot_timer.timeout.connect(self.update_plot)
self._update_plot_timer.start(self._redraw_interval)
示例2: __init__
def __init__(self, url=None):
"""
Class to load a webpage in a widget.
:param url: If url is empty then a navigation bar is shown otherwise the url is loaded and the navigation bar is hidden, ''str''
"""
super(WebWidget, self).__init__()
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_web'), 'resource', 'web_widget.ui')
loadUi(ui_file, self)
self.setObjectName('WebWidget')
self._loading = False
self._stop_icon = QIcon.fromTheme('process-stop')
self._reload_icon = QIcon.fromTheme('view-refresh')
self._working_icon = QIcon.fromTheme('process-working')
self._completer_word_list = ['']
self._view = QWebView()
self.verticalLayout.addWidget(self._view)
if url is None:
self.set_url("http://ros.org", True)
else:
self.set_url(url, False)
self.url_lineedit.returnPressed.connect(self._handle_url_change)
self._view.loadFinished[bool].connect(self._handle_load_finished)
self.reload_button.clicked.connect(self._handle_reload_clicked)
self._view.linkClicked.connect(self._handle_link_clicked)
self._view.urlChanged[QUrl].connect(self._handle_url_changed)
示例3: __init__
def __init__(self, parent=None, current_values=None):
super(BlacklistDialog, self).__init__(parent)
self.setWindowTitle("Blacklist")
vbox = QVBoxLayout()
self.setLayout(vbox)
self._blacklist = Blacklist()
if isinstance(current_values, list):
for val in current_values:
self._blacklist.append(val)
vbox.addWidget(self._blacklist)
controls_layout = QHBoxLayout()
add_button = QPushButton(icon=QIcon.fromTheme('list-add'))
rem_button = QPushButton(icon=QIcon.fromTheme('list-remove'))
ok_button = QPushButton("Ok")
cancel_button = QPushButton("Cancel")
add_button.clicked.connect(self._add_item)
rem_button.clicked.connect(self._remove_item)
ok_button.clicked.connect(self.accept)
cancel_button.clicked.connect(self.reject)
controls_layout.addWidget(add_button)
controls_layout.addWidget(rem_button)
controls_layout.addStretch(0)
controls_layout.addWidget(ok_button)
controls_layout.addWidget(cancel_button)
vbox.addLayout(controls_layout)
示例4: __init__
def __init__(self):
super(MessageDataModel, self).__init__()
self._messages = MessageList()
self._message_limit = 20000
self._info_icon = QIcon.fromTheme('dialog-information')
self._warning_icon = QIcon.fromTheme('dialog-warning')
self._error_icon = QIcon.fromTheme('dialog-error')
示例5: __init__
def __init__(self, ros_package):
super(GraphWidget, self).__init__()
self._current_graph = None
self._lock = Lock()
self._load_ui(ros_package)
self._scene = QGraphicsScene()
self._scene.setBackgroundBrush(Qt.white)
factory = DmgItemFactory()
factory.set_color(QColor(50, 50, 50))
factory.set_highlighted_color(QColor(0, 150, 0))
self._dot_to_qt = DotToQtGenerator(factory)
self.initialized = False
self.setObjectName('GraphWidget')
self.graphics_view.setScene(self._scene)
self.open_button.setIcon(QIcon.fromTheme('document-open'))
self.open_button.pressed.connect(self._import)
self.export_button.setIcon(QIcon.fromTheme('document-export'))
self.export_button.pressed.connect(self._export)
self.fit_to_view_button.setIcon(QIcon.fromTheme('zoom-fit-best'))
self.fit_to_view_button.pressed.connect(self._fit_to_view)
self.decision_graphs_combo_box.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
self.decision_graphs_combo_box.currentIndexChanged['QString'].connect(self._graph_item_changed)
self._dot_processor = DotProcessor(self._dot_to_qt)
self.decision_graphs = dict()
self.states = dict()
示例6: set_menu
def set_menu(self, menu):
self._menu_manager = MenuManager(menu)
self._perspective_mapper = QSignalMapper(menu)
self._perspective_mapper.mapped[str].connect(self.switch_perspective)
# generate menu
create_action = QAction('&Create perspective...', self._menu_manager.menu)
create_action.setIcon(QIcon.fromTheme('list-add'))
create_action.triggered.connect(self._on_create_perspective)
self._menu_manager.add_suffix(create_action)
self._remove_action = QAction('&Remove perspective...', self._menu_manager.menu)
self._remove_action.setEnabled(False)
self._remove_action.setIcon(QIcon.fromTheme('list-remove'))
self._remove_action.triggered.connect(self._on_remove_perspective)
self._menu_manager.add_suffix(self._remove_action)
self._menu_manager.add_suffix(None)
import_action = QAction('&Import...', self._menu_manager.menu)
import_action.setIcon(QIcon.fromTheme('document-open'))
import_action.triggered.connect(self._on_import_perspective)
self._menu_manager.add_suffix(import_action)
export_action = QAction('&Export...', self._menu_manager.menu)
export_action.setIcon(QIcon.fromTheme('document-save-as'))
export_action.triggered.connect(self._on_export_perspective)
self._menu_manager.add_suffix(export_action)
# add perspectives to menu
for name in self.perspectives:
if not name.startswith(self.HIDDEN_PREFIX):
self._add_perspective_action(name)
示例7: on_ctrl_list_tree_widget_customContextMenuRequested
def on_ctrl_list_tree_widget_customContextMenuRequested(self, pos):
ctrlman_ns = self.cm_namespace_combo.currentText()
item = self.ctrl_list_tree_widget.itemAt(pos)
if item is None:
return
ctrl_name = item.data(0, Qt.UserRole)
ctrl_state = self._ctrlers[ctrl_name]['state']
# show context menu
menu = QMenu(self)
if ctrl_state == 'running':
action_stop = menu.addAction(
QIcon.fromTheme('media-playback-stop'), 'Stop Controller')
action_kill = menu.addAction(
QIcon.fromTheme('list-remove'), 'Stop and Unload Controller')
elif ctrl_state == 'stopped':
action_start = menu.addAction(
QIcon.fromTheme('media-playback-start'), 'Start Controller')
action_unload = menu.addAction(
QIcon.fromTheme('list-remove'), 'Unload Controller')
action = menu.exec_(self.ctrl_list_tree_widget.mapToGlobal(pos))
# evaluate user action
if ctrl_state == 'running':
if action is action_stop:
self.start_stop_controller(ctrlman_ns, ctrl_name, False)
elif action is action_kill:
self.start_stop_controller(ctrlman_ns, ctrl_name, False)
self.unload_controller(ctrlman_ns, ctrl_name)
elif ctrl_state == 'stopped':
if action is action_start:
self.start_stop_controller(ctrlman_ns, ctrl_name, True)
elif action is action_unload:
self.unload_controller(ctrlman_ns, ctrl_name)
示例8: __init__
def __init__(self):
QWidget.__init__(self)
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_bag_annotation'), 'resource', 'export_widget.ui')
loadUi(ui_file, self)
self.add_topic_button.setIcon(QIcon.fromTheme('list-add'))
self.remove_topic_button.setIcon(QIcon.fromTheme('list-remove'))
self.refresh_button.setIcon(QIcon.fromTheme('view-refresh'))
self.add_topic_button.clicked[bool].connect(self._handle_add_topic_clicked)
self.remove_topic_button.clicked[bool].connect(self._handle_remove_topic_clicked)
self.refresh_button.clicked[bool].connect(self._handle_refresh_clicked)
self.export_button.clicked[bool].connect(self._handle_export_clicked)
self.export_location_edit.setPlainText("./export_file.txt")
self.rospack = rospkg.RosPack()
self._exported_topics = list()
self._exported_publisher_info = list()
self._annotations = list()
self._active_topics = list()
self._dt = 0.1
self._current_topic_paths = dict()
self._current_msg_paths = dict()
self._id_counter = 0
self.current_output = ""
示例9: __init__
def __init__(self, reconf, node_name):
"""
:type reconf: dynamic_reconfigure.client
:type node_name: str
"""
group_desc = reconf.get_group_descriptions()
rospy.logdebug('DynreconfClientWidget.group_desc=%s', group_desc)
super(DynreconfClientWidget, self).__init__(ParamUpdater(reconf),
group_desc, node_name)
# Save and load buttons
self.button_widget = QWidget(self)
self.button_header = QHBoxLayout(self.button_widget)
self.button_header.setContentsMargins(QMargins(0, 0, 0, 0))
self.load_button = QPushButton()
self.save_button = QPushButton()
self.load_button.setIcon(QIcon.fromTheme('document-open'))
self.save_button.setIcon(QIcon.fromTheme('document-save'))
self.load_button.clicked[bool].connect(self._handle_load_clicked)
self.save_button.clicked[bool].connect(self._handle_save_clicked)
self.button_header.addWidget(self.save_button)
self.button_header.addWidget(self.load_button)
self.setMinimumWidth(150)
self.reconf = reconf
self.updater.start()
self.reconf.config_callback = self.config_callback
self._node_grn = node_name
示例10: on_pushButton_calibrate_clicked
def on_pushButton_calibrate_clicked(self):
self._widget.pushButton_calibrate.setEnabled(False)
status_icon = QIcon.fromTheme('stock_no')
# Fill request information
request = self._selected_service['service_class']._request_class()
request.target_hue.data = self._widget.spinBox_hue.value()
request.mult_diffs.data = self._widget.spinBox_diff.value()
request.mult_sat.data = self._widget.spinBox_sat.value()
try:
# Call service
response = self._selected_service['service_proxy'](request)
except rospy.ServiceException as e:
qWarning('on_pushButton_calibrate_clicked(): error calling service "%s":\n%s' % (self._selected_service['service_name'], e))
else:
# Get debug image and show
img = response.image_debug
qImage = QImage(img.data, img.width, img.height, img.step, QImage.Format_RGB888)
qPixmap = QPixmap()
qPixmap.convertFromImage(qImage)
pixmapItem = QGraphicsPixmapItem(qPixmap)
self._qGraphicsScene.clear()
self._qGraphicsScene.addItem(pixmapItem)
self._widget.graphicsView.fitInView(QRectF(qPixmap.rect()), Qt.KeepAspectRatio)
if response.success.data == True:
status_icon = QIcon.fromTheme('stock_yes')
self._widget.label_status.setPixmap(status_icon.pixmap(status_icon.actualSize(QSize(24, 24))))
self._widget.pushButton_calibrate.setEnabled(True)
示例11: __init__
def __init__(self):
super(MainWidget, self).__init__()
self.setObjectName('MainWidget')
rospack = rospkg.RosPack()
ui_file = rospack.get_path('rqt_joint_trajectory_plot')+'/resource/JointTrajectoryPlot.ui'
loadUi(ui_file, self)
self.refresh_button.setIcon(QIcon.fromTheme('reload'))
self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
self.handler = None
self.joint_names = []
self.timer = QTimer(self)
self.timer.timeout.connect(self.update)
self.plot_widget = PlotWidget(self)
self.plot_layout.addWidget(self.plot_widget)
self.draw_curves.connect(self.plot_widget.draw_curves)
self.time = None
(self.dis, self.vel, self.acc, self.eff) = ({}, {}, {}, {})
# refresh topics list in the combobox
self.refresh_topics()
self.change_topic()
self.refresh_button.clicked.connect(self.refresh_topics)
self.topic_combox.currentIndexChanged.connect(self.change_topic)
self.select_tree.itemChanged.connect(self.update_checkbox)
示例12: __init__
def __init__(self, initial_topics=None, start_paused=False):
super(PlotWidget, self).__init__()
self.setObjectName('PlotWidget')
self._initial_topics = initial_topics
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_plot'), 'resource', 'plot.ui')
loadUi(ui_file, self)
self.subscribe_topic_button.setIcon(QIcon.fromTheme('list-add'))
self.remove_topic_button.setIcon(QIcon.fromTheme('list-remove'))
self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
self.data_plot = None
self.subscribe_topic_button.setEnabled(False)
if start_paused:
self.pause_button.setChecked(True)
self._topic_completer = TopicCompleter(self.topic_edit)
self._topic_completer.update_topics()
self.topic_edit.setCompleter(self._topic_completer)
self._start_time = rospy.get_time()
self._rosdata = {}
self._remove_topic_menu = QMenu()
# init and start update timer for plot
self._update_plot_timer = QTimer(self)
self._update_plot_timer.timeout.connect(self.update_plot)
示例13: __init__
def __init__(self):
super(ServiceCallerWidget, self).__init__()
self.setObjectName('ServiceCallerWidget')
# create context for the expression eval statement
self._eval_locals = {}
for module in (math, random, time):
self._eval_locals.update(module.__dict__)
self._eval_locals['genpy'] = genpy
del self._eval_locals['__name__']
del self._eval_locals['__doc__']
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_service_caller'), 'resource', 'ServiceCaller.ui')
loadUi(ui_file, self, {'ExtendedComboBox': ExtendedComboBox})
self.refresh_services_button.setIcon(QIcon.fromTheme('view-refresh'))
self.call_service_button.setIcon(QIcon.fromTheme('call-start'))
self._column_index = {}
for column_name in self.column_names:
self._column_index[column_name] = len(self._column_index)
self._service_info = None
self.on_refresh_services_button_clicked()
self.request_tree_widget.itemChanged.connect(self.request_tree_widget_itemChanged)
示例14: __init__
def __init__(self, parent=None):
super(PublisherTreeWidget, self).__init__(parent)
self.setModel(PublisherTreeModel(self))
self._action_remove_publisher = QAction(QIcon.fromTheme('list-remove'), 'Remove Selected', self)
self._action_remove_publisher.triggered[bool].connect(self._handle_action_remove_publisher)
self._action_publish_once = QAction(QIcon.fromTheme('media-playback-start'), 'Publish Selected Once', self)
self._action_publish_once.triggered[bool].connect(self._handle_action_publish_once)
self.setItemDelegateForColumn(self.model()._column_index['rate'], SpinBoxDelegate(min_value=0, max_value=1000000, decimals=2))
示例15: __init__
def __init__(self, parent=None):
super(PublisherTreeWidget, self).__init__(parent)
self.setModel(PublisherTreeModel(self))
self._action_remove_publisher = QAction(QIcon.fromTheme('list-remove'), 'Remove Selected', self)
self._action_remove_publisher.triggered[bool].connect(self._handle_action_remove_publisher)
self._action_publish_once = QAction(QIcon.fromTheme('media-playback-start'), 'Publish Selected Once', self)
self._action_publish_once.triggered[bool].connect(self._handle_action_publish_once)