本文整理汇总了Python中python_qt_binding.QtGui.QHBoxLayout.addWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout.addWidget方法的具体用法?Python QHBoxLayout.addWidget怎么用?Python QHBoxLayout.addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QHBoxLayout
的用法示例。
在下文中一共展示了QHBoxLayout.addWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, host, masteruri=None, parent=None):
PackageDialog.__init__(self, parent)
self.host = host
self.setWindowTitle('Run')
ns_name_label = QLabel("NS/Name:", self.content)
self.ns_field = QComboBox(self.content)
self.ns_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
self.ns_field.setEditable(True)
ns_history = nm.history().cachedParamValues('run_dialog/NS')
ns_history.insert(0, '/')
self.ns_field.addItems(ns_history)
self.name_field = QLineEdit(self.content)
self.name_field.setEnabled(False)
horizontalLayout = QHBoxLayout()
horizontalLayout.addWidget(self.ns_field)
horizontalLayout.addWidget(self.name_field)
self.contentLayout.addRow(ns_name_label, horizontalLayout)
args_label = QLabel("Args:", self.content)
self.args_field = QComboBox(self.content)
self.args_field.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
self.args_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
self.args_field.setEditable(True)
self.contentLayout.addRow(args_label, self.args_field)
args_history = nm.history().cachedParamValues('run_dialog/Args')
args_history.insert(0, '')
self.args_field.addItems(args_history)
host_label = QLabel("Host:", self.content)
self.host_field = QComboBox(self.content)
# self.host_field.setSizeAdjustPolicy(QComboBox.AdjustToContents)
self.host_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
self.host_field.setEditable(True)
host_label.setBuddy(self.host_field)
self.contentLayout.addRow(host_label, self.host_field)
self.host_history = host_history = nm.history().cachedParamValues('/Host')
if self.host in host_history:
host_history.remove(self.host)
host_history.insert(0, self.host)
self.host_field.addItems(host_history)
master_label = QLabel("ROS Master URI:", self.content)
self.master_field = QComboBox(self.content)
self.master_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
self.master_field.setEditable(True)
master_label.setBuddy(self.host_field)
self.contentLayout.addRow(master_label, self.master_field)
self.master_history = master_history = nm.history().cachedParamValues('/Optional Parameter/ROS Master URI')
self.masteruri = "ROS_MASTER_URI" if masteruri is None else masteruri
if self.masteruri in master_history:
master_history.remove(self.masteruri)
master_history.insert(0, self.masteruri)
self.master_field.addItems(master_history)
# self.package_field.setFocus(QtCore.Qt.TabFocusReason)
if hasattr(self.package_field, "textChanged"): # qt compatibility
self.package_field.textChanged.connect(self.on_package_selected)
else:
self.package_field.editTextChanged.connect(self.on_package_selected)
self.binary_field.activated[str].connect(self.on_binary_selected)
示例2: addTxtInputFld
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def addTxtInputFld(self, layout):
'''
Creates text input field label and text field
in a horizontal box layout. Adds that hbox layout
to the passed-in layout.
Sets instance variables:
1. C{self.speechInputFld}
@param layout: Layout object to which the label/txt-field C{hbox} is to be added.
@type layout: QLayout
'''
speechControlsLayout = QHBoxLayout();
speechControlsLayout.addStretch(1);
speechInputFldLabel = QLabel("<b>What to say:</b>")
speechControlsLayout.addWidget(speechInputFldLabel);
self.speechInputFld = TextPanel(numLines=5);
self.speechInputFld.setStyleSheet(SpeakEasyGUI.inputFldStylesheet);
self.speechInputFld.setFontPointSize(SpeakEasyGUI.EDIT_FIELD_TEXT_SIZE);
speechControlsLayout.addWidget(self.speechInputFld);
layout.addLayout(speechControlsLayout);
# Create and hide the dialog for adding Cepstral voice modulation
# markup to text in the text input field:
self.speechControls = MarkupManagementUI(textPanel=self.speechInputFld, parent=self);
示例3: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
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()
示例4: addTitle
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def addTitle(self,layout):
title = QLabel("<H1>SpeakEasy</H1>");
hbox = QHBoxLayout();
hbox.addStretch(1);
hbox.addWidget(title);
hbox.addStretch(1);
layout.addLayout(hbox);
示例5: add_widget_with_frame
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def add_widget_with_frame(parent, widget, text = ""):
box_layout = QHBoxLayout()
box_layout.addWidget(widget)
group_box = QGroupBox()
group_box.setStyleSheet("QGroupBox { border: 1px solid gray; border-radius: 4px; margin-top: 0.5em; } QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; }")
group_box.setTitle(text)
group_box.setLayout(box_layout)
parent.addWidget(group_box)
示例6: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, editor, *args):
QFrame.__init__(self, *args)
self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
self.edit = editor
self.number_bar = self.NumberBar()
self.number_bar.set_text_edit(self.edit)
hbox = QHBoxLayout(self)
hbox.setSpacing(0)
# hbox.setMargin(0) # removed: it is not supported by Qt5
hbox.addWidget(self.number_bar)
hbox.addWidget(self.edit)
self.edit.installEventFilter(self)
self.edit.viewport().installEventFilter(self)
示例7: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent, fileName, top_widget_layout):
self.controllers = []
self.parent = parent
self.loadFile(fileName)
print "Initialize controllers..."
for controller in self.controllers:
frame = QFrame()
frame.setFrameShape(QFrame.StyledPanel);
frame.setFrameShadow(QFrame.Raised);
vbox = QVBoxLayout()
label = QLabel()
label.setText(controller.label)
vbox.addWidget(label);
print controller.name
for joint in controller.joints:
label = QLabel()
label.setText(joint.name)
vbox.addWidget(label);
#Add input for setting the biases
widget = QWidget()
hbox = QHBoxLayout()
hbox.addWidget(joint.sensor_bias_spinbox)
hbox.addWidget(joint.control_bias_spinbox)
hbox.addWidget(joint.gearing_bias_spinbox)
widget.setLayout(hbox)
vbox.addWidget(widget)
label = QLabel()
label.setText(" Sensor Control Gearing")
vbox.addWidget(label);
vbox.addStretch()
frame.setLayout(vbox)
top_widget_layout.addWidget(frame)
print "Done loading controllers"
示例8: PathEditor
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
class PathEditor(QWidget):
'''
This is a path editor used as ItemDeligate in settings view. This editor
provides an additional button for directory selection dialog.
'''
editing_finished_signal = Signal()
def __init__(self, path, parent=None):
QWidget.__init__(self, parent)
self.path = path
self._layout = QHBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._button = QPushButton('...')
self._button.setMaximumSize(QSize(24, 20))
self._button.clicked.connect(self._on_path_select_clicked)
self._layout.addWidget(self._button)
self._lineedit = QLineEdit(path)
self._lineedit.returnPressed.connect(self._on_editing_finished)
self._layout.addWidget(self._lineedit)
self.setLayout(self._layout)
self.setFocusProxy(self._button)
self.setAutoFillBackground(True)
def _on_path_select_clicked(self):
# Workaround for QFileDialog.getExistingDirectory because it do not
# select the configuration folder in the dialog
self.dialog = QFileDialog(self, caption='Select a new settings folder')
self.dialog.setOption(QFileDialog.HideNameFilterDetails, True)
self.dialog.setFileMode(QFileDialog.Directory)
self.dialog.setDirectory(self.path)
if self.dialog.exec_():
fileNames = self.dialog.selectedFiles()
path = fileNames[0]
if os.path.isfile(path):
path = os.path.basename(path)
self._lineedit.setText(path)
self.path = dir
self.editing_finished_signal.emit()
def _on_editing_finished(self):
if self._lineedit.text():
self.path = self._lineedit.text()
self.editing_finished_signal.emit()
示例9: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent = None, subscribe = False):
QWidget.__init__(self, parent)
# start widget
vbox = QVBoxLayout()
vbox.setMargin(0)
vbox.setContentsMargins(0, 0, 0, 0)
# add error status text edit
self.error_status_text_box = QErrorStatusTextBox()
self.error_status_text_box_layout = QHBoxLayout()
self.error_status_text_box_layout.addWidget(self.error_status_text_box)
vbox.addLayout(self.error_status_text_box_layout)
# add panel
hbox = QHBoxLayout()
# clear push button
self.execute_command = QPushButton("Clear")
self.execute_command.clicked.connect(self.error_status_text_box.clear)
hbox.addWidget(self.execute_command)
hbox.addStretch()
# hide window checkbox
hide_window_check_box = QCheckBox("Hide")
hide_window_check_box.stateChanged.connect(self.state_changed)
hbox.addWidget(hide_window_check_box)
# end panel
vbox.addLayout(hbox)
# end widget
self.setLayout(vbox)
#self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
# subscriber
if (subscribe):
self.error_status_sub = rospy.Subscriber("error_status", ErrorStatus, self.error_status_callback)
self.subscribed = subscribe
# connect signal slot internally to prevent crash by subscriber
self.error_status_signal.connect(self.append_error_status)
示例10: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
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)
示例11: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [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()
示例12: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent=None):
super(VisualizerWidget, self).__init__(parent)
self.setWindowTitle('Graph Profiler Visualizer')
vbox = QVBoxLayout()
self.setLayout(vbox)
toolbar_layout = QHBoxLayout()
refresh_button = QPushButton()
refresh_button.setIcon(QIcon.fromTheme('view-refresh'))
auto_refresh_checkbox = QCheckBox("Auto Refresh")
hide_disconnected_topics = QCheckBox("Hide Disconnected Topics")
topic_blacklist_button = QPushButton("Topic Blacklist")
node_blacklist_button = QPushButton("Node Blacklist")
refresh_button.clicked.connect(self._refresh)
topic_blacklist_button.clicked.connect(self._edit_topic_blacklist)
node_blacklist_button.clicked.connect(self._edit_node_blacklist)
auto_refresh_checkbox.setCheckState(2)
auto_refresh_checkbox.stateChanged.connect(self._autorefresh_changed)
hide_disconnected_topics.setCheckState(2)
hide_disconnected_topics.stateChanged.connect(self._hidedisconnectedtopics_changed)
toolbar_layout.addWidget(refresh_button)
toolbar_layout.addWidget(auto_refresh_checkbox)
toolbar_layout.addStretch(0)
toolbar_layout.addWidget(hide_disconnected_topics)
toolbar_layout.addWidget(topic_blacklist_button)
toolbar_layout.addWidget(node_blacklist_button)
vbox.addLayout(toolbar_layout)
# Initialize the Visualizer
self._view = qt_view.QtView()
self._adapter = rosprofiler_adapter.ROSProfileAdapter(self._view)
self._adapter.set_topic_quiet_list(TOPIC_BLACKLIST)
self._adapter.set_node_quiet_list(NODE_BLACKLIST)
vbox.addWidget(self._view)
示例13: joint_widget
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def joint_widget(self, main_vbox, index):
joint = self.chain[index]
frame = QFrame()
frame.setFrameShape(QFrame.StyledPanel)
frame.setFrameShadow(QFrame.Raised)
hbox = QHBoxLayout()
# hbox.addWidget(frame)
self.prior_time = 0.0
robot_joint = self.robot.joints[self.joint_list[joint.name]]
joint.lower_limit = robot_joint.limit.lower
joint.upper_limit = robot_joint.limit.upper
ramp_range = robot_joint.limit.upper - robot_joint.limit.lower
print " ", joint.name, " limits(", joint.lower_limit, ", ", joint.upper_limit, ") range=", ramp_range
self.cmd_spinbox.append(QDoubleSpinBox())
self.cmd_spinbox[index].setDecimals(5)
self.cmd_spinbox[index].setRange(joint.lower_limit, joint.upper_limit)
self.cmd_spinbox[index].setSingleStep((robot_joint.limit.upper - robot_joint.limit.lower) / 50.0)
self.cmd_spinbox[index].valueChanged.connect(joint.on_cmd_value)
self.ramp_up_spinbox.append(QDoubleSpinBox())
self.ramp_up_spinbox[index].setDecimals(5)
self.ramp_up_spinbox[index].setRange(-ramp_range, ramp_range)
self.ramp_up_spinbox[index].setSingleStep(ramp_range / 50.0)
self.ramp_up_spinbox[index].valueChanged.connect(joint.on_ramp_up_value)
self.ramp_down_spinbox.append(QDoubleSpinBox())
self.ramp_down_spinbox[index].setDecimals(5)
self.ramp_down_spinbox[index].setRange(-ramp_range, ramp_range)
self.ramp_down_spinbox[index].setSingleStep(ramp_range / 50.0)
self.ramp_down_spinbox[index].valueChanged.connect(joint.on_ramp_down_value)
hbox.addWidget(QLabel(joint.name))
hbox.addWidget(self.cmd_spinbox[index])
hbox.addWidget(self.ramp_up_spinbox[index])
hbox.addWidget(self.ramp_down_spinbox[index])
# Add horizontal layout to frame for this joint group
frame.setLayout(hbox)
# Add frame to main vertical layout
main_vbox.addWidget(frame)
示例14: addChoiceButtons
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def addChoiceButtons(self, layout):
'''
Appends the existing Next/Previous/Cancel/OK buttons
into the passed-in layout.
@param layout:
'''
choiceButtonRowLayout = QHBoxLayout();
choiceButtonRowLayout.addWidget(self.nextButton);
choiceButtonRowLayout.addWidget(self.prevButton);
choiceButtonRowLayout.addWidget(self.cancelButton);
choiceButtonRowLayout.addWidget(self.OKButton);
layout.addLayout(choiceButtonRowLayout);
示例15: __init__
# 需要导入模块: from python_qt_binding.QtGui import QHBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent = None, logger = Logger(), step_plan_topic = str()):
QWidgetWithLogger.__init__(self, parent, logger)
# start widget
vbox = QVBoxLayout()
vbox.setMargin(0)
vbox.setContentsMargins(0, 0, 0, 0)
# step plan input topic selection
if len(step_plan_topic) == 0:
step_plan_topic_widget = QTopicWidget(topic_type = 'vigir_footstep_planning_msgs/StepPlan')
step_plan_topic_widget.topic_changed_signal.connect(self._init_step_plan_subscriber)
vbox.addWidget(step_plan_topic_widget)
else:
self._init_step_plan_subscriber(step_plan_topic)
# execute action server topic selection
execute_topic_widget = QTopicWidget(topic_type = 'vigir_footstep_planning_msgs/ExecuteStepPlanAction', is_action_topic = True)
execute_topic_widget.topic_changed_signal.connect(self._init_execute_action_client)
vbox.addWidget(execute_topic_widget)
# start button part
buttons_hbox = QHBoxLayout()
buttons_hbox.setMargin(0)
# execute
self.execute_command = QPushButton("Execute (Steps: 0)")
self.execute_command.clicked.connect(self.execute_command_callback)
self.execute_command.setEnabled(False)
buttons_hbox.addWidget(self.execute_command)
# repeat
self.repeat_command = QPushButton("Repeat")
self.repeat_command.clicked.connect(self.execute_command_callback)
self.repeat_command.setEnabled(False)
buttons_hbox.addWidget(self.repeat_command)
# stop
self.stop_command = QPushButton("Stop")
self.stop_command.clicked.connect(self.stop_command_callback)
self.stop_command.setEnabled(False)
buttons_hbox.addWidget(self.stop_command)
# end button part
vbox.addLayout(buttons_hbox)
# end widget
self.setLayout(vbox)
# init widget
if len(step_plan_topic) == 0:
step_plan_topic_widget.emit_topic_name()
execute_topic_widget.emit_topic_name()