本文整理汇总了Python中taurus.qt.qtgui.container.TaurusWidget.show方法的典型用法代码示例。如果您正苦于以下问题:Python TaurusWidget.show方法的具体用法?Python TaurusWidget.show怎么用?Python TaurusWidget.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taurus.qt.qtgui.container.TaurusWidget
的用法示例。
在下文中一共展示了TaurusWidget.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TaurusWidget
# 需要导入模块: from taurus.qt.qtgui.container import TaurusWidget [as 别名]
# 或者: from taurus.qt.qtgui.container.TaurusWidget import show [as 别名]
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel
from taurus.qt.qtgui.input import TaurusValueSpinBox
app = Qt.QApplication(sys.argv)
panel = TaurusWidget()
layout = Qt.QHBoxLayout()
panel.setLayout(layout)
w1 = TaurusLabel()
w2 = TaurusLabel()
w3 = TaurusValueSpinBox()
w4 = TaurusLabel()
layout.addWidget(w1)
layout.addWidget(w2)
layout.addWidget(w3)
layout.addWidget(w4)
w1.setUseParentModel(True)
w2.setUseParentModel(True)
w3.setUseParentModel(True)
w4.setUseParentModel(True)
panel.setModel('sys/taurustest/1')
w1.setModel('/position#label')
w2.setModel('/position')
w3.setModel('/position')
w4.setModel('/position#unit')
panel.show()
sys.exit(app.exec_())
示例2: called
# 需要导入模块: from taurus.qt.qtgui.container import TaurusWidget [as 别名]
# 或者: from taurus.qt.qtgui.container.TaurusWidget import show [as 别名]
# Now, by adding the widgets to the layout we are actually reparenting them.
# The order in which we reparent determines success/failure:
# if we do m-->p and then c-->m, it works, but if we do it in the opposite
# order, we trigger the error.
# (i.e., if we had called "p.layout().addWidget(m)" it would work work)
m.layout().addWidget(c)
p.layout().addWidget(m)
# the problem arises because the Taurus ancestry of c is only checked when:
# a) c.setUseParentModel() is called (and it effectively changes something) or
# b) when c is Qt-reparented
##
# In this example, c is reparented before m, so when it checks for a Taurus
# ancestor, none is found. Then m is reparented and c now would find its right
# Taurus ancestor (p)... but c never gets notified!
# Manually calling c.recheckTaurusParent() after the parenting has changed is
# another way to work around this issue (you can test by uncommenting
# the following line):
# c.recheckTaurusParent()
p.setModel('sys/tg_test/1/state')
print 'p model:', p.getModelName()
print 'c model:', c.getModelName()
p.show()
sys.exit(app.exec_())