本文整理汇总了Python中python_qt_binding.QtGui.QWidget.close方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.close方法的具体用法?Python QWidget.close怎么用?Python QWidget.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QWidget
的用法示例。
在下文中一共展示了QWidget.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SrvWidget
# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import close [as 别名]
class SrvWidget():
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)
def _init_msf(self):
counter = 0
for slot_name in self._request.__slots__:
while slot_name is not self._inputs[counter].getName():
counter = counter + 1
value = self._inputs[counter].getValue()
setattr(self._request, slot_name, value)
counter = 0
try:
self._response = self._service_proxy(self._request)
if hasattr(self._response, 'result'):
print self._response.result
except rospy.ServiceException:
print "Service call failed"