本文整理汇总了Python中spyderlib.qt.QtGui.QStackedWidget.setLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedWidget.setLayout方法的具体用法?Python QStackedWidget.setLayout怎么用?Python QStackedWidget.setLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QStackedWidget
的用法示例。
在下文中一共展示了QStackedWidget.setLayout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RateLawWidget
# 需要导入模块: from spyderlib.qt.QtGui import QStackedWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QStackedWidget import setLayout [as 别名]
class RateLawWidget(QWidget):
"""
Rate Law widget
"""
def __init__(self, parent, max_entries=100):
""" Creates a very basic window with some text """
"""
RATE_LAW_MESSAGE = \
"The Plugins for Spyder consists out of three main classes: \n\n" \
"1. HelloWorld\n\n" \
"\tThe HelloWorld class inherits all its methods from\n" \
"\tSpyderPluginMixin and the HelloWorldWidget and performs all\n" \
"\tthe processing required by the GU. \n\n" \
"2. HelloWorldConfigPage\n\n" \
"\tThe HelloWorldConfig class inherits all its methods from\n" \
"\tPluginConfigPage to create a configuration page that can be\n" \
"\tfound under Tools -> Preferences\n\n" \
"3. HelloWorldWidget\n\n" \
"\tThe HelloWorldWidget class inherits all its methods from\n" \
"\tQWidget to create the actual plugin GUI interface that \n" \
"\tdisplays this message on screen\n\n"
"""
#Testing access editor on plugin initialization
RATE_LAW_MESSAGE = ""
displaynamelist = []
#displaylist = []
infixlist = []
desclist = []
parameterstringlist = []
xmldoc = minidom.parse('\\.spyder2\\ratelaw2_0_3.xml')
#xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml')
lawlistxml = xmldoc.getElementsByTagName('law')
#i is the number of laws currently in the xml file
i = 0
for s in lawlistxml:
#RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n"
RATE_LAW_MESSAGE += s.getAttribute('display') + "\n"
#displaynamelist[i] = s.getAttribute('displayName')
#displaylist[i] = s.getAttribute('display')
displaynamelist.append(s.getAttribute('displayName'))
#displaylist.append(s.getAttribute('display'))
infixlist.append(s.getAttribute('infixExpression'))
desclist.append(s.getAttribute('description'))
parameterlist = s.getElementsByTagName('listOfParameters')[0]
#for p in parameterlist
parameters = parameterlist.getElementsByTagName('parameter')
parameterstring = ""
for param in parameters:
parametername = param.attributes['name'].value
parameterdesc = param.attributes['description'].value
parameterstring = parameterstring + '\t' + parametername + ":" + '\t' + " " + parameterdesc + "\n"
#print('\t' + parametername + ":" + '\t' + parameterdesc)
parameterstringlist.append(parameterstring)
i = i + 1
QWidget.__init__(self, parent)
self.setWindowTitle("Rate Law Library")
self.output = None
self.error_output = None
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.textlabel = QLabel(RATE_LAW_MESSAGE)
self.lawlist = QListWidget()
self.lawpage = QStackedWidget()
#Adding displayName items to lawlist
for j in range(i):
item = QListWidgetItem(displaynamelist[j])
self.lawlist.addItem(item)
self.lawdetailpage = QWidget()
# Page layout will become its own function
setup_group = QGroupBox(displaynamelist[j])
infixmod = infixlist[j].replace("___"," ")
setup_label = QLabel(infixmod)
setup_label.setWordWrap(True)
desc_group = QGroupBox("Description")
desc_label = QLabel(desclist[j])
desc_label.setWordWrap(True)
param_label = QLabel(parameterstringlist[j])
param_label.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
setup_layout = QVBoxLayout()
setup_layout.addWidget(setup_label)
setup_group.setLayout(setup_layout)
desc_layout = QVBoxLayout()
#.........这里部分代码省略.........