本文整理汇总了Python中python_qt_binding.QtGui.QPushButton.setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.setFixedSize方法的具体用法?Python QPushButton.setFixedSize怎么用?Python QPushButton.setFixedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QPushButton
的用法示例。
在下文中一共展示了QPushButton.setFixedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setFixedSize [as 别名]
def __init__(self, parent = None, topic_type = str(), is_action_topic = False):
QWidget.__init__(self, parent)
if is_action_topic:
self.topic_type = topic_type + "Goal"
else:
self.topic_type = topic_type
self.is_action_topic = is_action_topic
# start widget
hbox = QHBoxLayout()
hbox.setMargin(0)
hbox.setContentsMargins(0, 0, 0, 0)
# topic combo box
self.topic_combo_box = QComboBox()
self.topic_combo_box.setEnabled(False)
self.topic_combo_box.blockSignals(True)
self.topic_combo_box.setValidator(QRegExpValidator(QRegExp('((\d|\w|/)(?!//))*'), self))
self.topic_combo_box.currentIndexChanged[str].connect(self.topic_changed)
hbox.addWidget(self.topic_combo_box)
# get system icon
icon = QIcon.fromTheme("view-refresh")
size = icon.actualSize(QSize(32, 32))
# add refresh button
refresh_topics_button = QPushButton()
refresh_topics_button.clicked.connect(self.update_topic_list)
refresh_topics_button.setIcon(icon)
refresh_topics_button.setFixedSize(size.width()+2, size.height()+2)
hbox.addWidget(refresh_topics_button)
# end widget
self.setLayout(hbox)
# init widget
self.update_topic_list()
示例2: __init__
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setFixedSize [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)
示例3: QParameterSetSelectionWidget
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setFixedSize [as 别名]
class QParameterSetSelectionWidget(QWidgetWithLogger):
NO_PARAM_SET_TEXT = "No parameters available!"
SELECT_TEXT = "<Select>"
param_cleared_signal = Signal()
param_changed_signal = Signal(str)
def __init__(self, parent = None, logger = Logger()):
QWidgetWithLogger.__init__(self, parent, logger)
# start widget
hbox = QHBoxLayout()
hbox.setMargin(0)
hbox.setContentsMargins(0, 0, 0, 0)
# get system icon
icon = QIcon.fromTheme("view-refresh")
size = icon.actualSize(QSize(32, 32))
# add combo box
self.parameter_set_names_combo_box = QComboBox()
self.parameter_set_names_combo_box.currentIndexChanged[str].connect(self.param_changed)
hbox.addWidget(self.parameter_set_names_combo_box)
# add refresh button
self.get_all_parameter_set_names_button = QPushButton()
self.get_all_parameter_set_names_button.clicked.connect(self._get_all_parameter_set_names)
self.get_all_parameter_set_names_button.setIcon(icon)
self.get_all_parameter_set_names_button.setFixedSize(size.width()+2, size.height()+2)
hbox.addWidget(self.get_all_parameter_set_names_button)
# end widget
self.setLayout(hbox)
# init widget
self.reset_parameter_set_selection()
def _init_action_client(self, topic_name):
self.get_parameter_set_names_client = actionlib.SimpleActionClient(topic_name, GetParameterSetNamesAction)
print "Parameter set topic changed: " + topic_name
@Slot(str)
def set_topic_name(self, topic_name):
if (len(topic_name) > 0):
self._init_action_client(topic_name)
self._get_all_parameter_set_names()
else:
self.reset_parameter_set_selection()
def reset_parameter_set_selection(self):
self.parameter_set_names_combo_box.setEnabled(False)
self.parameter_set_names_combo_box.blockSignals(True)
self.parameter_set_names_combo_box.clear()
self.parameter_set_names_combo_box.addItem(self.NO_PARAM_SET_TEXT)
self.get_all_parameter_set_names_button.setEnabled(False)
self.param_cleared_signal.emit()
def current_parameter_set_name(self):
if self.parameter_set_names_combo_box.currentText() == self.NO_PARAM_SET_TEXT:
return str()
else:
return self.parameter_set_names_combo_box.currentText()
@Slot(str)
def param_changed(self, name):
self.param_changed_signal.emit(name)
# parameter set names handler
def _get_all_parameter_set_names(self):
if (self.get_parameter_set_names_client.wait_for_server(rospy.Duration(0.5))):
self.logger.log_info("Requesting current list of parameter set names.")
goal = GetParameterSetNamesGoal()
self.get_parameter_set_names_client.send_goal(goal)
# waiting for getting list of parameter set names
if (self.get_parameter_set_names_client.wait_for_result(rospy.Duration(1.0))):
result = self.get_parameter_set_names_client.get_result()
self.logger.log_info("Received " + str(len(result.names)) + " parameter set names.")
self.parameter_set_names_combo_box.blockSignals(True)
self.parameter_set_names_combo_box.clear()
self.parameter_set_names_combo_box.addItem(self.SELECT_TEXT)
self.parameter_set_names_combo_box.setItemData(0, 0, Qt.UserRole-1)
self.param_cleared_signal.emit()
for name in result.names:
self.parameter_set_names_combo_box.addItem(name.data)
self.parameter_set_names_combo_box.setEnabled(True)
self.parameter_set_names_combo_box.blockSignals(False)
self.get_all_parameter_set_names_button.setEnabled(True)
else:
self.logger.log_error("Didn't received any results. Check communcation!")
self.reset_parameter_set_selection()
else:
self.logger.log_error("Can't connect to footstep planner parameter action server!")
#.........这里部分代码省略.........