本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.indexOf方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.indexOf方法的具体用法?Python QVBoxLayout.indexOf怎么用?Python QVBoxLayout.indexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.indexOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InstallPage
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import indexOf [as 别名]
class InstallPage(QWidget):
"""Settings page for the installed plugins"""
def __init__(self, parent, repo):
"""QWidget Dictionary -> Void
Consumes the parent and the repository dictionary and sets up the
install page in the settings area"""
QWidget.__init__(self, parent)
self._userPlugins = helper.getPlugins()
self._repo = repo
# Add a scrollArea that if they are more plugins that fit into the
# settings page
scrollArea = QScrollArea(self)
scrollArea.setWidgetResizable(True)
scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
baseLayout = QVBoxLayout()
baseLayout.setAlignment(Qt.AlignTop)
self.setLayout(baseLayout)
baseWidget = QWidget()
scrollArea.setWidget(baseWidget)
baseLayout.addWidget(scrollArea)
self._vbox = QVBoxLayout()
baseWidget.setLayout(self._vbox)
def update(self, userPlugins):
"""ListOfUserpluginEntry -> Void
Consume a list of UserpluginEntry and repopulates the install page"""
for i in reversed(range(self._vbox.count())):
try:
self._vbox.itemAt(i).widget().setParent(None)
except AttributeError as e:
qWarning("Can't call setParent of None type")
labelText = "<h2>Install Plugins</h2>"
if (len(self._repo["plugins"]) < 1):
labelText += "<p>It seems we could not load the plugin repository.</p>"
labelText += "<p style='color:red'>Make shure your internet connection is working and restart Enki.</p><p></p>"
self._vbox.addWidget(QLabel(labelText))
for entry in self._repo["plugins"]:
isInstalled = helper.isPluginInstalled(entry["name"], userPlugins)
if isInstalled:
self._vbox.addWidget(pluginspage.PluginTitlecard(isInstalled))
else:
self._vbox.addWidget(InstallableTitlecard(entry, self))
def addPluginToUserPlugins(self, installableTitlecard):
"""InstallableTitlecard -> Void
Consumes an InstallableTitlecard and insert an PluginTitleCard instead
of itself"""
index = self._vbox.indexOf(installableTitlecard)
name = installableTitlecard.modulename()
pluginEntry = helper.initPlugin(name)
if pluginEntry:
self._userPlugins.append(pluginEntry)
self._vbox.insertWidget(index,
pluginspage.PluginTitlecard(pluginEntry))
示例2: PadCalc
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import indexOf [as 别名]
class PadCalc(QWidget):
def __init__(self):
super().__init__()
load_data()
card_tags = ['leader','sub1','sub2','sub3','sub4','friend']
self.cards = { t: CardIcon() for t in card_tags }
self.vlayout = QVBoxLayout(self)
self.vlayout.setSpacing(0)
self.setLayout(self.vlayout)
self.userbox = QHBoxLayout()
userfield = QLineEdit()
userbutton = QPushButton('Load')
userbutton.clicked.connect(lambda: self.set_user(userfield.text()))
self.userbox.addWidget(userfield)
self.userbox.addWidget(userbutton)
userfield.returnPressed.connect(userbutton.click)
self.vlayout.addLayout(self.userbox)
maxcheckbox = QCheckBox('Use maxed stats?')
maxcheckbox.stateChanged[int].connect(self.setMaxed)
self.vlayout.addWidget(maxcheckbox)
self.teamchooser = QComboBox(self)
self.teamchooser.currentIndexChanged[int].connect(self.set_team)
self.vlayout.addWidget(self.teamchooser)
teambox = QHBoxLayout()
teambox.addStretch(1)
for card in card_tags:
teambox.addWidget(self.cards[card])
teambox.setSpacing(0)
teambox.addStretch(1)
teambox.setAlignment(Qt.AlignCenter)
self.vlayout.addLayout(teambox)
self.board = Board()
self.vlayout.addWidget(self.board)
self.vlayout.itemAt(self.vlayout.indexOf(self.board)).setAlignment(Qt.AlignCenter)
self.orbchooser = QHBoxLayout()
b = OrbButton(value = 0)
b.clicked.connect(functools.partial(self.setPaintOrb,Orb.Null))
self.orbchooser.addWidget(b)
for i in ORBS:
b = OrbButton(value=i)
#print('Setting click value of button %s to %s' % (id(b),i))
b.clicked.connect(functools.partial(self.setPaintOrb,i))
self.orbchooser.addWidget(b)
self.vlayout.addLayout(self.orbchooser)
self.damagereadout = QLabel()
font = QFont()
font.setPointSize(30)
self.damagereadout.setAlignment(Qt.AlignCenter)
self.damagereadout.setFont(font)
self.vlayout.addWidget(self.damagereadout)
self.board.valueChanged.connect(self.update_damage)
labels = ['atk','combos','leaders','enhance','prongs','rows']
lfont = QFont()
lfont.setPointSize(9)
vfont = QFont()
vfont.setPointSize(12)
self.details = {key: QVBoxLayout() for key in labels}
for i in labels:
label = QLabel(i)
label.setFont(lfont)
label.setAlignment(Qt.AlignCenter)
label.setMargin(0)
label.setContentsMargins(0,0,0,0)
label.setIndent(0)
self.details[i].label = label
self.details[i].addWidget(self.details[i].label)
value = QLabel('1')
value.setFont(vfont)
value.setAlignment(Qt.AlignCenter)
value.setMargin(0)
value.setIndent(0)
value.setContentsMargins(0,0,0,0)
self.details[i].value = value
self.details[i].addWidget(self.details[i].value)
self.details[i].setContentsMargins(1,1,1,1)
self.detailreadout = QHBoxLayout()
for i in labels:
self.detailreadout.addLayout(self.details[i])
timeslabel = QLabel('\u00d7')
timeslabel.setMargin(0)
timeslabel.setIndent(0)
timeslabel.setAlignment(Qt.AlignCenter)
timeslabel.setContentsMargins(0,0,0,0)
self.detailreadout.addWidget(timeslabel)
self.detailreadout.takeAt(self.detailreadout.count()-1)
#.........这里部分代码省略.........