本文整理汇总了Python中python_qt_binding.QtGui.QWidget.layout方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.layout方法的具体用法?Python QWidget.layout怎么用?Python QWidget.layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QWidget
的用法示例。
在下文中一共展示了QWidget.layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: multiQuadGuiPlugin
# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import layout [as 别名]
class multiQuadGuiPlugin(Plugin):
CMD = []
CMD_LAND = ("LAND", Qt.Key_L)
CMD_QUALYSIS_CONNECT = ("QUALISYS CONNECT", Qt.Key_C)
CMD_STOP = ("STOP", Qt.Key_S)
CMD_GO_UP = ("GO UP", Qt.Key_Q)
CMD_GO_MIDDLE = ("GO MIDDLE", Qt.Key_A)
CMD_GO_DOWN = ("GO DOWN", Qt.Key_Z)
CMD_GOTO = ("GOTO", Qt.Key_G)
CMD_ARM = ("ARM", Qt.Key_T)
CMD_UNARM = ("UNARM", Qt.Key_Y)
CMD_SET_MODE = ("SET_MODE", Qt.Key_U)
CMD_SET_CONTROLLER = ("SET_CONTROLLER", Qt.Key_I)
CMD = [CMD_LAND,CMD_QUALYSIS_CONNECT,CMD_STOP,CMD_GO_UP,CMD_GO_MIDDLE,CMD_GO_DOWN,CMD_GOTO,CMD_ARM,CMD_UNARM,CMD_SET_MODE,CMD_SET_CONTROLLER]
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(multiQuadGuiPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('multiQuadGuiPlugin')
# 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__)), 'multiQuadGui.ui')
# Extend the widget with all attributes and children from UI file
loadUi(ui_file, self._widget)
# Give QObjects reasonable names
self._widget.setObjectName('multiQuadGuiUi')
# 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
self.arena = Arena(self)
self._widget.layout().addWidget(self.arena,0,1)
self._widget.keyPressEvent = self.keyPressEvent
self._widget.keyReleaseEvent = self.keyReleaseEvent
self._widget.table.keyPressEvent = self.keyPressEvent
self._widget.table.keyReleaseEvent = self.keyReleaseEvent
context.add_widget(self._widget)
# # Adding all the tabs
self.quad_ns_list = []
self.quads = {}
self.quad_select = set()
self.command = None
self.update_timer = QTimer(self)
self.update_timer.setInterval(1000)
self.update_timer.timeout.connect(self.update_quad_list)
self.update_timer.start()
self.update_draw = QTimer(self)
self.update_draw.setInterval(1000/30)
self.update_draw.timeout.connect(self.arena.repaint)
self.update_draw.timeout.connect(self.update_table)
self.update_draw.start()
table_sizes = [25,100,150,60,100,120,70,70,100]
for i in range(len(table_sizes)):
self._widget.table.setColumnWidth(i,table_sizes[i])
def _parse_args(self, argv):
parser = argparse.ArgumentParser(prog='saver', add_help=False)
# args = parser.parse_args(argv)
if argv:
namespace = argv[0]
return namespace
else:
# is argv is empty return empty string
return ""
#.........这里部分代码省略.........