本文整理汇总了Python中taurus.qt.qtgui.container.TaurusWidget.setLayout方法的典型用法代码示例。如果您正苦于以下问题:Python TaurusWidget.setLayout方法的具体用法?Python TaurusWidget.setLayout怎么用?Python TaurusWidget.setLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taurus.qt.qtgui.container.TaurusWidget
的用法示例。
在下文中一共展示了TaurusWidget.setLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fillWithChildren
# 需要导入模块: from taurus.qt.qtgui.container import TaurusWidget [as 别名]
# 或者: from taurus.qt.qtgui.container.TaurusWidget import setLayout [as 别名]
def fillWithChildren(self):
frame = TaurusWidget()
frame.setLayout(Qt.QGridLayout())
frame.layout().addItem(Qt.QSpacerItem(
0, 0, Qt.QSizePolicy.Minimum, Qt.QSizePolicy.MinimumExpanding))
parent_name = None
if self.getUseParentModel():
parent_model = self.getParentModelObj()
if parent_model:
parent_name = parent_model.getFullName()
for i, model in enumerate(self.getModel()):
if not model:
continue
if parent_name:
# @todo: Change this (it assumes tango model naming!)
model = "%s/%s" % (parent_name, model)
klass, args, kwargs = self.getFormWidget(model=model)
widget = klass(frame, *args, **kwargs)
# @todo UGLY... See if this can be done in other ways... (this causes trouble with widget that need more vertical space , like PoolMotorTV)
widget.setMinimumHeight(20)
try:
widget.setCompact(self.isCompact())
widget.setModel(model)
widget.setParent(frame)
except:
# raise
self.warning(
'an error occurred while adding the child "%s". Skipping' % model)
self.traceback(level=taurus.Debug)
try:
widget.setModifiableByUser(self.isModifiableByUser())
except:
pass
widget.setObjectName("__item%i" % i)
self.registerConfigDelegate(widget)
self._children.append(widget)
frame.layout().addItem(Qt.QSpacerItem(
0, 0, Qt.QSizePolicy.Minimum, Qt.QSizePolicy.MinimumExpanding))
self.scrollArea.setWidget(frame)
# self.scrollArea.setWidgetResizable(True)
self.scrollArea.setMinimumWidth(frame.layout().sizeHint().width() + 20)
示例2: TaurusDevicePanel
# 需要导入模块: from taurus.qt.qtgui.container import TaurusWidget [as 别名]
# 或者: from taurus.qt.qtgui.container.TaurusWidget import setLayout [as 别名]
class TaurusDevicePanel(TaurusWidget):
'''
TaurusDevPanel is a Taurus Application inspired in Jive and Atk Panel.
It Provides a Device selector and a panel for displaying information from
the selected device.
'''
# TODO: Tango-centric (This whole class should be called TangoDevicePanel)
# TODO: a scheme-agnostic base class should be implemented
READ_ONLY = False
# A dictionary like {device_regexp:[attribute_regexps]}
_attribute_filter = {}
# A dictionary like {device_regexp:[(command_regexp,default_args)]}
_command_filter = {}
_icon_map = {} # A dictionary like {device_regexp:pixmap_url}
@classmethod
def setIconMap(klass, filters):
"""A dictionary like {device_regexp:pixmap_url}"""
klass._icon_map = filters
@classmethod
def getIconMap(klass):
return klass._icon_map
@classmethod
def setAttributeFilters(klass, filters):
"""
It will set the attribute filters
filters will be like: {device_regexp:[attribute_regexps]}
example: {'.*/VGCT-.*': ['ChannelState','p[0-9]']}
"""
klass._attribute_filter.update(filters)
@classmethod
def getAttributeFilters(klass):
return klass._attribute_filter
@classmethod
def setCommandFilters(klass, filters):
"""
It will set the command filters
filters will be like: {device_regexp:[command_regexps]}
example::
{'.*/IPCT-.*': (
('setmode',('SERIAL','LOCAL','STEP','FIXED','START','PROTECT')),
('onhv1',()), ('offhv1',()), ('onhv2',()), ('offhv2',()),
('sendcommand',())
),}
"""
klass._command_filter.update(filters)
@classmethod
def getCommandFilters(klass):
return klass._command_filter
###########################################################################
def __init__(self, parent=None, model=None, palette=None, bound=True):
TaurusWidget.__init__(self, parent)
if palette:
self.setPalette(palette)
self.setLayout(Qt.QGridLayout())
self.bound = bound
self._dups = []
self.setWindowTitle('TaurusDevicePanel')
self._label = Qt.QLabel()
self._label.font().setBold(True)
self._stateframe = TaurusWidget(self)
self._stateframe.setLayout(Qt.QGridLayout())
self._stateframe.layout().addWidget(Qt.QLabel('State'), 0, 0, Qt.Qt.AlignCenter)
self._statelabel = TaurusLabel(self._stateframe)
self._statelabel.setMinimumWidth(100)
self._statelabel.setBgRole('state')
self._stateframe.layout().addWidget(self._statelabel, 0, 1, Qt.Qt.AlignCenter)
self._state = TaurusLed(self._stateframe)
self._state.setShowQuality(False)
self._stateframe.layout().addWidget(self._state, 0, 2, Qt.Qt.AlignCenter)
self._statusframe = Qt.QScrollArea(self)
self._status = TaurusLabel(self._statusframe)
self._status.setBgRole('none')
self._status.setAlignment(Qt.Qt.AlignLeft)
self._status.setFixedHeight(2000)
self._status.setFixedWidth(5000)
# self._statusframe.setFixedHeight(STATUS_HEIGHT)
self._statusframe.setHorizontalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
self._statusframe.setVerticalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
self._statusframe.setWidget(self._status)
self._statusframe.setPalette(get_White_palette())
self._attrsframe = Qt.QTabWidget(self)
# Horizontal will not allow to show labels of attributes!
self._splitter = Qt.QSplitter(Qt.Qt.Vertical, self)
#.........这里部分代码省略.........