本文整理汇总了Python中python_qt_binding.QtGui.QWidget类的典型用法代码示例。如果您正苦于以下问题:Python QWidget类的具体用法?Python QWidget怎么用?Python QWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QWidget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setObjectName("MainBox")
self.__on_intern_change = False
boxLayout = QFormLayout()
boxLayout.setVerticalSpacing(0)
self.setLayout(boxLayout)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:7,代码来源:select_dialog.py
示例2: restore_settings
def restore_settings(self, settings):
serial_number = settings.value('parent', None)
#print 'DockWidget.restore_settings()', 'parent', serial_number, 'settings group', settings._group
if serial_number is not None:
serial_number = int(serial_number)
if self._parent_container_serial_number() != serial_number and self._container_manager is not None:
floating = self.isFloating()
pos = self.pos()
new_container = self._container_manager.get_container(serial_number)
if new_container is not None:
new_parent = new_container.main_window
else:
new_parent = self._container_manager.get_root_main_window()
area = self.parent().dockWidgetArea(self)
new_parent.addDockWidget(area, self)
if floating:
self.setFloating(floating)
self.move(pos)
title_bar = self.titleBarWidget()
title_bar.restore_settings(settings)
if title_bar.hide_title_bar and not self.features() & DockWidget.DockWidgetFloatable and \
not self.features() & DockWidget.DockWidgetMovable:
self._title_bar_backup = title_bar
title_widget = QWidget(self)
layout = QHBoxLayout(title_widget)
layout.setContentsMargins(0, 0, 0, 0)
title_widget.setLayout(layout)
self.setTitleBarWidget(title_widget)
开发者ID:ethz-asl,项目名称:qt_gui_core,代码行数:29,代码来源:dock_widget.py
示例3: __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 = ""
开发者ID:OSUrobotics,项目名称:rqt_common_plugins,代码行数:28,代码来源:export_widget.py
示例4: PropStatus
class PropStatus(Plugin):
def __init__(self, context):
super(PropStatus, self).__init__(context)
self.setObjectName('Status')
self._widget = QWidget()
loadUi(os.path.join(uipath, 'propagatorstatus.ui'), self._widget)
context.add_widget(self._widget)
rospy.Subscriber('/thrusters/info',ThrusterInfo,motordriver_callback)
rospy.Subscriber('/skytraq_serial',SerialPacket,gps_callback)
rospy.Subscriber('/imu/data_raw',Imu,imu_callback)
rospy.Subscriber('/scan',LaserScan,lidar_callback)
rospy.Subscriber('/mv_bluefox_camera_node/image_raw',Image,camera_callback)
rospy.Timer(rospy.Duration(2),kill)
self._update_timer = QTimer(self._widget)
self._update_timer.timeout.connect(self._on_update)
self._update_timer.start(100)
def _on_update(self):
self._widget.findChild(QListWidget, 'list').clear()
for i in ['FR','FL','BR','BL','GPS','IMU','LIDAR','CAMERA']:
pItem = QListWidgetItem(i);
if i in active:
pItem.setBackground(Qt.green);
else:
pItem.setBackground(Qt.red);
self._widget.findChild(QListWidget, 'list').addItem(pItem)
开发者ID:jpanikulam,项目名称:software-common,代码行数:30,代码来源:propagatorstatus.py
示例5: MyPlugin
class MyPlugin(Plugin):
def __init__(self, context):
super(MyPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('MyPlugin')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which should be in the "resource" folder of this package
ui_file = os.path.join(rospkg.RosPack().get_path('rqt_mypkg'), 'resource', 'MyPlugin.ui')
# Extend the widget with all atrributes and children from UI File
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('MyPluginUi')
# Show _widget.windowTitle on left-top of each plugin(when it's set in _widget).
# This is useful when you open multiple plugins aat once. Also if you open multiple
# instances of your plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' %d' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
self._widget.cancelButton.clicked[bool].connect(self._handle_cancel_clicked)
self._widget.okButton.clicked[bool].connect(self._handle_ok_clicked)
def shutdown_plugin(self):
# TODO unregister all publishers here
pass
def save_settings(self, plugin_settings, instance_settings):
# TODO save intrinsic configuration, usually using:
# instance_settings.get_value(k, v)
pass
def restore_settings(self, pluign_settings, instance_settings):
# TODO restore intrinsic configuration, usually using:
# v = instance_settings.value(k)
pass
def _handle_cancel_clicked(self):
print "cancelButton is clicked"
def _handle_ok_clicked(self):
print "okButton is clicked"
开发者ID:AriYu,项目名称:rqt_mypkg,代码行数:58,代码来源:my_module.py
示例6: ExampleGuiPub
class ExampleGuiPub(Plugin):
def __init__(self, context=None):
super(ExampleGuiPub, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('ExampleGuiPub')
# Create QWidget
self._widget = QWidget()
# Get path to UI file which is a sibling of this file
pkg_dir = roslib.packages.get_pkg_dir('example_gui_pub')
ui_file_path = os.path.join(pkg_dir, 'ui/example_gui_pub.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file_path, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('ExampleGuiPubUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
# Now Set up our own interface:
# ==> Connect the buttons to the functions
self._widget.btn_ok.clicked.connect(self.btn_ok_clicked)
def shutdown_plugin(self):
"""Kill all subscribers and publishers."""
pass
def save_settings(self, plugin_settings, instance_settings):
# TODO save intrinsic configuration, usually using:
# instance_settings.set_value(k, v)
pass
def restore_settings(self, plugin_settings, instance_settings):
# TODO restore intrinsic configuration, usually using:
# v = instance_settings.value(k)
pass
def btn_ok_clicked(self):
#printing the word in the ui label box
spin_speed = 3.0
self._widget.StatusReturn.setText('set LIDAR speed to ' + str(spin_speed))
#publisher the data to multisense_sl
self.pub = rospy.Publisher('multisense_sl/set_spindle_speed', Float64, queue_size=10)
self.pub.publish(spin_speed)
开发者ID:1508189250,项目名称:birl_baxter,代码行数:57,代码来源:_example_gui_pub_module.py
示例7: skeletonPlugin
class skeletonPlugin(Plugin):
def __init__(self, context):
super(skeletonPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('skeletonPlugin')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which is a sibling of this file
# in this example the .ui and .py file are in the same folder
ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'skeleton.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('skeletonUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
def shutdown_plugin(self):
# TODO unregister all publishers here
pass
def save_settings(self, plugin_settings, instance_settings):
# TODO save intrinsic configuration, usually using:
# instance_settings.set_value(k, v)
pass
def restore_settings(self, plugin_settings, instance_settings):
# TODO restore intrinsic configuration, usually using:
# v = instance_settings.value(k)
pass
开发者ID:KTH-AEROWORKS,项目名称:quad-suspended-load,代码行数:57,代码来源:skeleton.py
示例8: BalanceModeWidget
class BalanceModeWidget(Plugin):
def __init__(self, context):
super(BalanceModeWidget, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('BalanceMode')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which should be in the "resource" folder of this package
ui_file = os.path.join(rospkg.RosPack().get_path('rsv_balance_rqt'), 'resource', 'BalanceModeWidget.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('BalanceModeWidgetUI')
# Numerated windowTitle
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
self._widget.set_park.clicked[bool].connect(self.on_set_park_button)
self._widget.set_tractor.clicked[bool].connect(self.on_set_tractor_button)
self._widget.set_balance.clicked[bool].connect(self.on_set_balance_button)
self._widget.topic_line_edit.textChanged.connect(self.on_topic_changed)
# Set mode client
self.set_mode_srv = None
self.on_topic_changed()
def shutdown_plugin(self):
pass
def save_settings(self, plugin_settings, instance_settings):
instance_settings.set_value('topic', self._widget.topic_line_edit.text())
def restore_settings(self, plugin_settings, instance_settings):
value = instance_settings.value('topic', "/set_mode")
self._widget.topic_line_edit.setText(value)
def on_set_park_button(self):
try:
self.set_mode_srv(rsv_balance_msgs.srv.SetModeRequest.PARK)
except rospy.ServiceException, e:
rospy.logwarn("Service call failed: %s" % e)
开发者ID:robosavvy,项目名称:rsv_balance_desktop,代码行数:57,代码来源:balance_mode_widget.py
示例9: CalibrationControl
class CalibrationControl(Plugin):
def __init__(self, context):
super(CalibrationControl, self).__init__(context)
self.setObjectName('CalibrationControl')
# Argument parsing
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which is a sibling of this file
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('industrial_calibration_gui'), 'resource', 'calibration_control.ui')
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('calibration_control_Ui')
# Custom code begins here
self._widget.cal_button.clicked[bool].connect(self.__handle_cal_clicked)
self.cal_service = rospy.ServiceProxy('calibration_service', Empty)
# Add widget to the user interface
context.add_widget(self._widget)
def shutdown_plugin(self):
# TODO unregister all publishers here
pass
def save_settings(self, plugin_settings, instance_settings):
# TODO save intrinsic configuration, usually using:
# instance_settings.set_value(k, v)
pass
def restore_settings(self, plugin_settings, instance_settings):
# TODO restore intrinsic configuration, usually using:
# v = instance_settings.value(k)
pass
def __handle_cal_clicked(self, checked):
self.cal_service()
开发者ID:gomezc,项目名称:industrial_calibration,代码行数:53,代码来源:calibration_control.py
示例10: _add_thruster_widget
def _add_thruster_widget(self, id):
self._widget.findChild(QLabel, 'noThrustersLabel').setVisible(False)
thruster_widget = QWidget()
thruster_frame = self._widget.findChild(QFrame, 'thrusterFrame')
pos = sum(1 for existing_id in self._thruster_widgets if id > existing_id)
thruster_frame.layout().insertWidget(pos, thruster_widget)
loadUi(os.path.join(uipath, 'thruster.ui'), thruster_widget)
thruster_widget.findChild(QLabel, 'thrusterLabel').setText(id)
thruster_widget.findChild(QPushButton, 'offButton').clicked.connect(lambda: self._on_stop_clicked(id))
self._thruster_widgets[id] = thruster_widget
return thruster_widget
开发者ID:jpanikulam,项目名称:software-common,代码行数:14,代码来源:thrusterplugin.py
示例11: RunStopPlugin
class RunStopPlugin(Plugin):
def __init__(self, context):
super(RunStopPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('RunStopPlugin')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file
ui_file = os.path.join(rospkg.RosPack().get_path('rqt_runstop'), 'src', 'rqt_runstop', 'runstop.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('RunStopPluginUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
# initialize publisher to publish cancel messages
self._publisher = rospy.Publisher('move_base/cancel', GoalID, queue_size=10)
self._widget.runstopButton.clicked.connect(self.runstopButton_clicked) # button handler
# cancel all goals by sending empty goal to /move_base/cancel
def runstopButton_clicked(self):
emptyGoal = GoalID()
self._publisher.publish(emptyGoal)
return
开发者ID:OSUrobotics,项目名称:wheelchair-automation,代码行数:49,代码来源:rqt_runstop_module.py
示例12: GhostRobotControlPlugin
class GhostRobotControlPlugin(Plugin):
updateStateSignal = Signal(object)
def __init__(self, context):
super(GhostRobotControlPlugin, self).__init__(context)
self.setObjectName('GhostRobotControlPlugin')
self.joint_states_to_ghost_pub = rospy.Publisher('/joint_states_to_ghost', JointState, queue_size=10)
self.ghost_joint_states_sub = rospy.Subscriber('/ghost/joint_states', JointState, self.ghost_joint_states_cb)
self.real_joint_states_sub = rospy.Subscriber('/atlas/joint_states', JointState, self.real_joint_states_cb)
self.ghost_joint_states = JointState()
self.real_joint_states = JointState()
self.move_real_robot = False
self.widget = QWidget()
vbox = QVBoxLayout()
self.real_to_ghost_push_button = QPushButton('Set Ghost from real robot')
self.real_to_ghost_push_button.clicked.connect(self.handle_set_real_to_ghost)
vbox.addWidget(self.real_to_ghost_push_button)
self.send_motion_plan_to_real_robot_check_box = QCheckBox('Motion GUI moves real robot')
self.send_motion_plan_to_real_robot_check_box.stateChanged.connect(self.handle_send_motion_plan_to_real_robot_check_box)
vbox.addWidget(self.send_motion_plan_to_real_robot_check_box)
self.widget.setLayout(vbox)
context.add_widget(self.widget)
def ghost_joint_states_cb(self, data):
self.ghost_joint_states = data
def real_joint_states_cb(self, data):
self.real_joint_states = data
def handle_set_real_to_ghost(self):
self.joint_states_to_ghost_pub.publish(self.real_joint_states)
@Slot(bool)
def handle_send_motion_plan_to_real_robot_check_box(self, checked):
self.move_real_robot = checked
开发者ID:team-vigir,项目名称:vigir_rqt,代码行数:49,代码来源:ghost_robot_control.py
示例13: TriangleGUI
class TriangleGUI(Plugin):
def __init__(self, context):
super(TriangleGUI, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('TriangleGUI')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
self._toolbar = QToolBar()
self._toolbar.addWidget(QLabel('Triangle'))
# Create a container widget and give it a layout
self._container = QWidget()
self._layout = QVBoxLayout()
self._container.setLayout(self._layout)
self._layout.addWidget(self._toolbar)
# Add a button for killing nodes
self._go_button = QPushButton('Go')
self._go_button.clicked.connect(self._go)
self._layout.addWidget(self._go_button)
self._clear_button = QPushButton('Clear')
self._clear_button.clicked.connect(self._clear)
self._layout.addWidget(self._clear_button)
# self._step_run_button.setStyleSheet('QPushButton {color: black}')
context.add_widget(self._container)
def _go(self):
go = rospy.ServiceProxy('/triangle_screenpoint/go', Empty)
go()
def _clear(self):
clear = rospy.ServiceProxy('/triangle_screenpoint/cancel', Empty)
clear()
def shutdown_plugin(self):
pass
def save_settings(self, plugin_settings, instance_settings):
pass
def restore_settings(self, plugin_settings, instance_settings):
pass
开发者ID:YoheiKakiuchi,项目名称:rtmros_gazebo,代码行数:48,代码来源:triangle.py
示例14: __init__
def __init__(self, context):
super(LevelSelectorPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('LevelSelectorPlugin')
# Create QWidget
self._widget = QWidget()
# self._widget.setFont(QFont("Times", 15, QFont.Bold))
self._button_layout = QVBoxLayout(self._widget)
self.buttons = []
self.text_label = QLabel("Waiting for MultiLevelMapData...", self._widget)
self._button_layout.addWidget(self.text_label)
self._widget.setObjectName('LevelSelectorPluginUI')
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
context.add_widget(self._widget)
self.connect(self._widget, SIGNAL("update_buttons"), self.update_buttons)
self.connect(self._widget, SIGNAL("update_button_status"), self.update_button_status)
# Subcribe to the multi level map data to get information about all the maps.
self.multimap_subscriber = rospy.Subscriber("map_metadata", MultiLevelMapData, self.process_multimap)
self.levels = []
self.current_level = None
# Subscribe to the current level we are on.
self.status_subscriber = None
# Create a service proxy to change the current level.
self.level_selector_proxy = rospy.ServiceProxy("level_mux/change_current_level", ChangeCurrentLevel)
self.level_selector_proxy.wait_for_service()
开发者ID:nj1407,项目名称:bwi_common,代码行数:33,代码来源:plugins.py
示例15: __init__
def __init__(self, context, service_name):
self._service_name = service_name
self._service = rosservice.get_service_class_by_name(self._service_name)
self._service_proxy = rospy.ServiceProxy(self._service_name, self._service)
self._widget = QWidget()
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_copter'), 'resource', 'SrvWidget.ui')
loadUi(ui_file, self._widget)
context.addWidget(self._widget)
self._widget.service_label.setText("Service " + self._service_name)
self._request = self._service._request_class()
self._inputs = []
for slot_name, type_name in zip(self._request.__slots__, self._request._slot_types):
if type_name in ["float32", "float64"]:
self._inputs.append(FloatInputWidget(self._widget.input_container, slot_name))
elif type_name in ["int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"]:
self._inputs.append(IntInputWidget(self._widget.input_container, slot_name))
elif type_name in ["string"]:
self._inputs.append(StringInputWidget(self._widget.input_container, slot_name))
else:
print "Service input type", type_name, "needs to be implemented!"
print "Service", self._service_name, "is not available."
self._widget.close()
self._widget.apply_button.clicked.connect(self._init_msf)
开发者ID:MorS25,项目名称:rqt_copter,代码行数:29,代码来源:srv_widget.py
示例16: __init__
def __init__(self, context):
super(MyPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('MyPlugin')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which should be in the "resource" folder of this package
ui_file = os.path.join(rospkg.RosPack().get_path('my_rqt_pkg'), 'resource', 'MyPlugin.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('MyPluginUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
开发者ID:rkoyama1623,项目名称:ros_sample_pkgs,代码行数:34,代码来源:my_module.py
示例17: __init__
def __init__(self, context):
super(TriangleGUI, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('TriangleGUI')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
self._toolbar = QToolBar()
self._toolbar.addWidget(QLabel('Triangle'))
# Create a container widget and give it a layout
self._container = QWidget()
self._layout = QVBoxLayout()
self._container.setLayout(self._layout)
self._layout.addWidget(self._toolbar)
# Add a button for killing nodes
self._go_button = QPushButton('Go')
self._go_button.clicked.connect(self._go)
self._layout.addWidget(self._go_button)
self._clear_button = QPushButton('Clear')
self._clear_button.clicked.connect(self._clear)
self._layout.addWidget(self._clear_button)
# self._step_run_button.setStyleSheet('QPushButton {color: black}')
context.add_widget(self._container)
开发者ID:YoheiKakiuchi,项目名称:rtmros_gazebo,代码行数:35,代码来源:triangle.py
示例18: __init__
def __init__(self, context):
super(CapabilityGraph, self).__init__(context)
self.setObjectName('CapabilityGraph')
self.__current_dotcode = None
self.__widget = QWidget()
self.__dot_to_qt = DotToQtGenerator()
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('rqt_capabilities'), 'resources', 'CapabilityGraph.ui')
loadUi(ui_file, self.__widget, {'InteractiveGraphicsView': InteractiveGraphicsView})
self.__widget.setObjectName('CapabilityGraphUI')
if context.serial_number() > 1:
self.__widget.setWindowTitle(self.__widget.windowTitle() + (' (%d)' % context.serial_number()))
self.__scene = QGraphicsScene()
self.__scene.setBackgroundBrush(Qt.white)
self.__widget.graphics_view.setScene(self.__scene)
self.__widget.refresh_graph_push_button.setIcon(QIcon.fromTheme('view-refresh'))
self.__widget.refresh_graph_push_button.pressed.connect(self.__update_capabilities_graph)
self.__update_capabilities_graph()
self.__deferred_fit_in_view.connect(self.__fit_in_view, Qt.QueuedConnection)
self.__deferred_fit_in_view.emit()
context.add_widget(self.__widget)
开发者ID:bit-pirate,项目名称:rqt_capabilities,代码行数:29,代码来源:capability_graph.py
示例19: __init__
def __init__(self, context,namespace = None):
# it is either "" or the input given at creation of plugin
self.namespace = self._parse_args(context.argv())
super(tabbedGUIPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('tabbedGUIPlugin')
# Process standalone plugin command-line arguments
from argparse import ArgumentParser
parser = ArgumentParser()
# Add argument(s) to the parser.
parser.add_argument("-q", "--quiet", action="store_true",
dest="quiet",
help="Put plugin in silent mode")
args, unknowns = parser.parse_known_args(context.argv())
if not args.quiet:
print 'arguments: ', args
print 'unknowns: ', unknowns
# Create QWidget
self._widget = QWidget()
# Get path to UI file which is a sibling of this file
# in this example the .ui and .py file are in the same folder
ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tabbedGUI.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('tabbedGUIUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
# # Adding all the tabs
self.saver_mavros = saver_mavrosPlugin(context,self.namespace)
# self.saver = saverPlugin(context,self.namespace)
self.positionPlot = positionPlotPlugin(context,self.namespace)
self.TrajectorySelection = TrajectorySelectionPlugin(context,self.namespace)
self.ChooseController = ChooseControllerPlugin(context,self.namespace)
self.ChooseSimulator = ChooseSimulatorPlugin(context,self.namespace)
self._widget.tabWidget.addTab(self.saver_mavros._widget,'Data recorder')
# self._widget.tabWidget.addTab(self.saver._widget,'Data recorder')
self._widget.tabWidget.addTab(self.positionPlot._widget,'Check Data')
self._widget.tabWidget.addTab(self.TrajectorySelection._widget,'Select Trajectory')
self._widget.tabWidget.addTab(self.ChooseController._widget,'Select Controller')
self._widget.tabWidget.addTab(self.ChooseSimulator._widget,'Select Simulator')
self._widget.tabWidget.show()
开发者ID:KTH-AEROWORKS,项目名称:quad-suspended-load,代码行数:60,代码来源:tabbedGUI.py
示例20: __init__
def __init__(self, context):
super(Builder, self).__init__(context)
self.setObjectName('BeetreeBuilder')
# Create QWidget
self._widget = QWidget()
# Get path to UI file which is a sibling of this file
rospack = rospkg.RosPack()
ui_path = rospack.get_path('beetree_builder') + '/ui/main.ui'
# Load the ui attributes into the main widget
loadUi(ui_path, self._widget)
self._widget.setObjectName('BeetreeBuilderPluginUi')
# Show _widget.windowTitle on left-top of each plugin (when
# it's set in _widget). This is useful when you open multiple
# plugins at once. Also if you open multiple instances of your
# plugin at once, these lines add number to make it easy to
# tell from pane to pane.
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
# Add widget to the user interface
context.add_widget(self._widget)
palette = QPalette ()
palette.setColor(QPalette.Background, Qt.white)
self._widget.setPalette(palette)
# Add custom options
self._widget.node_type_list.addItems(['test1','test2'])
开发者ID:futureneer,项目名称:beetree_builder,代码行数:28,代码来源:builder.py
注:本文中的python_qt_binding.QtGui.QWidget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论