当前位置: 首页>>代码示例>>Python>>正文


Python QGroupBox.setFlat方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QGroupBox.setFlat方法的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox.setFlat方法的具体用法?Python QGroupBox.setFlat怎么用?Python QGroupBox.setFlat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QGroupBox的用法示例。


在下文中一共展示了QGroupBox.setFlat方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: viewDatasetAction

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
    def viewDatasetAction(self):
        #print "viewDatasetAction"
        model = self.model
        table_name = str(model.fileName(self.currentIndex))
        table_name_full = str(model.filePath(self.currentIndex))
        parentIndex = model.parent(self.currentIndex)
        parent_name = str(model.fileName(parentIndex))
        parent_name_full = str(model.filePath(parentIndex))
        storage = StorageFactory().get_storage('flt_storage', storage_location=parent_name_full)
        columns = storage.get_column_names(table_name)
        # temporarily use the table name for the dataset name
        # dataset_name = DatasetFactory().dataset_name_for_table(table_name)
        # Aaron - please check this way of getting the XMLConfiguration -- is this the best way?

#        general = self.mainwindow.toolboxBase.opus_core_xml_configuration.get_section('general')
#        # problem: this gets the package order for the current project, but the viewer shows all the data
#        package_order = general['dataset_pool_configuration'].package_order

        # PREVIOUS HACK:
        # package_order = ['seattle_parcel','urbansim_parcel', 'eugene', 'urbansim', 'opus_core']
        # temporary code: just use a generic dataset for now
        data = Dataset(in_storage=storage, dataset_name=table_name, in_table_name=table_name, id_name=[])
        # code to get a more specialized dataset if possible (doesn't work with table names not ending in 's'
        # unless they are in the exceptions list in DatasetFactory)
        # data = DatasetFactory().search_for_dataset_with_hidden_id(dataset_name, package_order,
        #    arguments={'in_storage': storage, 'in_table_name': table_name})
        # Need to add a new tab to the main tabs for display of the data
        container = QWidget()
        widgetLayout = QVBoxLayout(container)
        summaryGroupBox = QGroupBox(container)
        summaryGroupBox.setTitle(QString("Year: %s  Run name: %s" % (parent_name,table_name_full.split('/')[-3])))
        summaryGroupBox.setFlat(True)
        summaryGroupBoxLayout = QVBoxLayout(summaryGroupBox)
        # Grab the summary data
        buffer = StringIO()
        data.summary(output=buffer)
        strng = buffer.getvalue()
        buffer.close()
        textBrowser = QTextBrowser()
#        textBrowser.insertPlainText(strng)
        textBrowser.insertHtml(self.parse_dataset_summary(strng))
        summaryGroupBoxLayout.addWidget(textBrowser)

        widgetLayout.addWidget(summaryGroupBox)

        tableGroupBox = QGroupBox(container)
        tableGroupBox.setTitle(QString("Table View"))
        tableGroupBox.setFlat(True)
        tableGroupBoxLayout = QVBoxLayout(tableGroupBox)
        tv = QTableView()
        header = columns
        tabledata_tmp = []
        for column in columns:
            tabledata_tmp.append(data.get_attribute(column))

        # Transpose the lists
        tabledata = map(None,*tabledata_tmp)

        # If the table data is not empty then we display it
        if tabledata:
            #tv.resizeColumnsToContents()
            tm = TableModel(tabledata, header, container)
            tv.setModel(tm)
            tv.setSortingEnabled(True)
            tableGroupBoxLayout.addWidget(tv)

        widgetLayout.addWidget(tableGroupBox)

        container.tabIcon = IconLibrary.icon('inspect')
        container.tabLabel = QString(table_name)
        self.manager._attach_tab(container)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:73,代码来源:file_controller_opus_data.py

示例2: FeatureDlg

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
class FeatureDlg(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        # init
        # ------------------------------------------------
        self.setWindowTitle("Spatial Features")

        # widgets and layouts
        # ------------------------------------------------
        self.layout = QHBoxLayout()
        self.setLayout(self.layout)

        self.tableAndViewGroupBox = QGroupBox(" Scales and Groups")
        self.tableAndViewGroupBox.setFlat(True)
        self.featureTableWidget = featureTableWidget.FeatureTableWidget()

        self.tableAndViewLayout = QVBoxLayout()
        self.tableAndViewLayout.setSizeConstraint(QLayout.SetNoConstraint)
        self.tableAndViewLayout.addWidget(self.featureTableWidget)

        self.viewAndButtonLayout = QVBoxLayout()
        self.preView = preView.PreView()
        self.viewAndButtonLayout.addWidget(self.preView)
        self.viewAndButtonLayout.addStretch()

        self.buttonsLayout = QHBoxLayout()
        self.memReqLabel = QLabel()
        self.buttonsLayout.addWidget(self.memReqLabel)

        self.buttonsLayout.addStretch()

        # Add Cancel
        self.cancel = QToolButton()
        self.cancel.setText("Cancel")
        self.cancel.clicked.connect(self.on_cancelClicked)
        self.buttonsLayout.addWidget(self.cancel)

        # Add OK
        self.ok = QToolButton()
        self.ok.setText("OK")
        self.ok.clicked.connect(self.on_okClicked)
        self.buttonsLayout.addWidget(self.ok)

        self.buttonsLayout.addSpacerItem(QSpacerItem(10, 0))
        self.viewAndButtonLayout.addSpacerItem(QSpacerItem(0, 10))
        self.tableAndViewGroupBox.setLayout(self.tableAndViewLayout)
        self.tableAndViewLayout.addLayout(self.buttonsLayout)
        self.layout.addWidget(self.tableAndViewGroupBox)

        self.layout.setContentsMargins(0, 0, 0, 0)
        self.tableAndViewGroupBox.setContentsMargins(4, 10, 4, 4)
        self.tableAndViewLayout.setContentsMargins(0, 10, 0, 0)

        self.featureTableWidget.brushSizeChanged.connect(self.preView.setFilledBrsuh)
        self.setMemReq()

    # methods
    # ------------------------------------------------

    @property
    def selectedFeatureBoolMatrix(self):
        """Return the bool matrix of features that the user selected."""
        return self.featureTableWidget.createSelectedFeaturesBoolMatrix()

    @selectedFeatureBoolMatrix.setter
    def selectedFeatureBoolMatrix(self, newMatrix):
        """Populate the table of selected features with the provided matrix."""
        self.featureTableWidget.setSelectedFeatureBoolMatrix(newMatrix)

    def createFeatureTable(self, features, sigmas, brushNames=None):
        self.featureTableWidget.createTableForFeatureDlg(features, sigmas, brushNames)

    def setImageToPreView(self, image):
        self.preView.setVisible(image is not None)
        if image is not None:
            self.preView.setPreviewImage(qimage2ndarray.array2qimage(image))

    def setIconsToTableWidget(self, checked, partiallyChecked, unchecked):
        self.featureTableWidget.itemDelegate.setCheckBoxIcons(checked, partiallyChecked, unchecked)

    def setMemReq(self):
        #        featureSelectionList = self.featureTableWidget.createFeatureList()
        # TODO
        # memReq = self.ilastik.project.dataMgr.Classification.featureMgr.computeMemoryRequirement(featureSelectionList)
        # self.memReqLabel.setText("%8.2f MB" % memReq)
        pass

    def on_okClicked(self):
        #        featureSelectionList = self.featureTableWidget.createFeatureList()
        #        selectedFeatureList = self.featureTableWidget.createSelectedFeatureList()
        #        sigmaList = self.featureTableWidget.createSigmaList()
        #        featureMgr.ilastikFeatureGroups.newGroupScaleValues = sigmaList
        #        featureMgr.ilastikFeatureGroups.newSelection = selectedFeatureList
        #        res = self.parent().project.dataMgr.Classification.featureMgr.setFeatureItems(featureSelectionList)
        #        if res is True:
        #            self.parent().labelWidget.setBorderMargin(int(self.parent().project.dataMgr.Classification.featureMgr.maxContext))
        #            self.ilastik.project.dataMgr.Classification.featureMgr.computeMemoryRequirement(featureSelectionList)
        #            self.accept()
        #        else:
#.........这里部分代码省略.........
开发者ID:kemaleren,项目名称:ilastik,代码行数:103,代码来源:featureDlg.py

示例3: __init__

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
	def __init__(self, template, character, parent=None):
		super(SkillWidget, self).__init__(template, character, parent)

		self.__layout = QVBoxLayout()
		self.setLayout( self.__layout )

		self.__scrollArea = QScrollArea()
		## Die Auflistung der Fertigkeiten soll auch unter Windows einen transparenten Hintergrund haben.
		self.__scrollArea.setObjectName("transparentWidget")
		## \todo Sollte nicht vom Betriebssystem, sondern vom verwendeten Style abhängen.
		if os.name == "nt":
			self.__scrollArea.setStyleSheet( "QWidget#transparentWidget { background: transparent; }" )
		self.__layout.addWidget( self.__scrollArea)

		self.__scrollLayout = QVBoxLayout()

		self.__scrollWidget = QWidget()
		## Die Auflistung der Fertigkeiten soll auch unter Windows einen transparenten Hintergrund haben. Indem ich den selben Namen wie zuvor vergebe, wirkt auch das Stylsheet auf dieses Widget.
		self.__scrollWidget.setObjectName("transparentWidget")
		#self.__scrollWidget.setStyleSheet( "QWidget#transparentWidget { background-color:transparent; }" )
		#scrollWidget.setMinimumSize(this.width(), 400);
		self.__scrollWidget.setLayout(self.__scrollLayout)

		typ = "Skill"

		## Eine Liste, in der alle Eigenschafts-Widgets aufgelistet werden.
		self.__traitWidgets = []

		for item in Config.CATEGORIES_MAIN:
			#Debug.debug(self._character.traits)

			# Für jede Kategorie wird ein eigener Abschnitt erzeugt.
			widgetSkillCategory = QGroupBox()
			widgetSkillCategory.setTitle(item)
			widgetSkillCategory.setFlat(True)

			layoutSkillCategory = QVBoxLayout()
			widgetSkillCategory.setLayout( layoutSkillCategory );

			self.__scrollLayout.addWidget( widgetSkillCategory )

			__list = list( self._character.traits[typ][item].items() )
			__list.sort()
			for skill in __list:
				# Anlegen des Widgets, das diese Eigenschaft repräsentiert.
				traitWidget = CharaTrait( skill[1], self )
				traitWidget.buttonText = 0
				traitWidget.setDescriptionHidden( True )
				traitWidget.enableButton(0)	# Zu Beginn sollen die Spezailisierungen nicht enabled sein.

				# Dieses Widget auch an Liste anhängen, damit ich einfacher darauf zugreifen kann.
				traitListItem = traitWidget
				self.__traitWidgets.append(traitListItem)

				# Es werden nur Fertigkeiten der richtigen Alters- und Zeit-Kategorie angezeigt.
				self.hideReasonChanged.connect(traitWidget.hideOrShowTrait)
				# Fertigkeiten haben Spezialisierungen.
				traitWidget.specialtiesClicked.connect(self.uncheckOtherButtons)
				traitWidget.specialtiesClicked.connect(self.specialtiesActivated.emit)
				## Wenn sich die Spezialisierungen ändern, sollen die veränderten Spezialisierungen auch angezeigt werden. Das wird so gelöst, als wäre der Knopf für die Spezialisierungen erneut gedrückt worden.
				#skill.specialtiesChanged.connect(self.emitSpecialtiesActivated)

				layoutSkillCategory.addWidget( traitWidget )

				self.maxTraitChanged.connect(traitWidget.setMaximum)

			# Stretch einfügen, damit die Eigenschaften besser angeordnet sind.
			self.__scrollLayout.addStretch()

		self.__scrollArea.setWidget(self.__scrollWidget)
		self.__scrollArea.setWidgetResizable(True)
		self.__scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
		self.__scrollArea.setMinimumWidth(self.__scrollArea.viewport().minimumWidth())
开发者ID:GoliathLeviathan,项目名称:SoulCreator,代码行数:75,代码来源:SkillWidget.py

示例4: Widget

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
class Widget(QWidget):
    def __init__(self, dockwidget):
        super(Widget, self).__init__(dockwidget)
        self._document = None
        self._midiin = midiinput.MidiIn(self)
        self._dockwidget = weakref.ref(dockwidget)
        
        signals = list()
        
        self._labelmidichannel = QLabel()
        self._midichannel = QComboBox()
        signals.append(self._midichannel.currentIndexChanged)
        
        self._labelkeysignature = QLabel()
        self._keysignature = QComboBox()
        signals.append(self._keysignature.currentIndexChanged)
        
        self._labelaccidentals = QLabel()
        self._accidentalssharps = QRadioButton()
        signals.append(self._accidentalssharps.clicked)
        self._accidentalsflats = QRadioButton()
        signals.append(self._accidentalsflats.clicked)
        self._groupaccidentals = QGroupBox()
        self._groupaccidentals.setFlat(True)
        hbox = QHBoxLayout()
        self._groupaccidentals.setLayout(hbox)
        hbox.addWidget(self._accidentalssharps)
        hbox.addWidget(self._accidentalsflats)
        self._accidentalssharps.setChecked(True)
        
        self._chordmode = QCheckBox()
        signals.append(self._chordmode.clicked)
        
        self._relativemode = QCheckBox()
        signals.append(self._relativemode.clicked)

        self._labeldamper = QLabel()
        self._damper = QComboBox()
        
        self._labelsostenuto = QLabel()
        self._sostenuto = QComboBox()
        
        self._labelsoft = QLabel()
        self._soft = QComboBox()
        
        ac = self.parentWidget().actionCollection
        self._capture = QToolButton()
        self._capture.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self._capture.setDefaultAction(ac.capture_start)
        
        self._notemode = QLabel()
        
        layout = QVBoxLayout()
        self.setLayout(layout)
        grid = QGridLayout(spacing=0)
        layout.addLayout(grid)
               
        grid.addWidget(self._labelmidichannel, 0, 0)
        grid.addWidget(self._midichannel, 0, 1)
        grid.addWidget(self._labelkeysignature, 1, 0)
        grid.addWidget(self._keysignature, 1, 1)
        grid.addWidget(self._labelaccidentals, 2, 0)
        grid.addWidget(self._groupaccidentals, 2, 1)
        grid.addWidget(self._chordmode, 3, 0)
        grid.addWidget(self._relativemode, 3, 1)
        grid.addWidget(self._labeldamper, 4, 0)
        grid.addWidget(self._damper, 4, 1)
        grid.addWidget(self._labelsostenuto, 5, 0)
        grid.addWidget(self._sostenuto, 5, 1)
        grid.addWidget(self._labelsoft, 6, 0)
        grid.addWidget(self._soft, 6, 1)
        
        hbox = QHBoxLayout()
        layout.addLayout(hbox)
        hbox.addWidget(self._capture)
        hbox.addStretch()
        
        app.translateUI(self)
        
        self.loadsettings()
        for s in signals:
            s.connect(self.savesettings)
    
    def mainwindow(self):
        return self._dockwidget().mainwindow()
    
    def channel(self):
        return self._midichannel.currentIndex()
    
    def keysignature(self):
        return self._keysignature.currentIndex()
    
    def accidentals(self):
        if self._accidentalsflats.isChecked():
            return 'flats'
        else:
            return 'sharps'
    
    def chordmode(self):
        return self._chordmode.isChecked()
#.........这里部分代码省略.........
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:103,代码来源:widget.py

示例5: DAyarlar

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
class DAyarlar(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(600, 375)
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.treeWidget = QTreeWidget(self)
        self.treeWidget.setMaximumSize(200, 1500)

        self.virux = QTreeWidgetItem(self.treeWidget)
        self.virux.setExpanded(True)
        icon = QIcon()
        icon.addPixmap(QPixmap("data/logo.png"), QIcon.Normal, QIcon.On)
        self.virux.setIcon(0, icon)
        item_1 = QTreeWidgetItem(self.virux)
        item_1 = QTreeWidgetItem(self.virux)
        self.dialog = QTreeWidgetItem(self.treeWidget)
        self.dialog.setExpanded(True)
        item_1 = QTreeWidgetItem(self.dialog)
        item_1 = QTreeWidgetItem(self.dialog)
        self.treeWidget.header().setVisible(False)

        self.gridLayout.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.groupBox = QGroupBox(self)
        self.groupBox.setFlat(True)

        self.gridLayout_3 = QGridLayout(self.groupBox)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.widget = QWidget(self.groupBox)
        self.gridLayout_4 = QGridLayout(self.widget)
        self.gridLayout_4.setMargin(0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setMargin(0)
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_4.addItem(spacerItem, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 1)
        self.pButton = QPushButton(self)
        self.pButton.setText("asd")
        self.pButton.setDefault(True)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.addButton(self.pButton, QDialogButtonBox.AcceptRole)
        #self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 2)


        self.setWindowTitle("Virux Ayarlar")
        self.treeWidget.headerItem().setText(0, "")
        self.treeWidget.topLevelItem(0).setText(0, u"Virux")
        self.treeWidget.topLevelItem(0).child(0).setText(0, u"Virux1")
        self.treeWidget.topLevelItem(0).child(1).setText(0, u"Virux2")
        self.treeWidget.topLevelItem(1).setText(0, u"Dialog")
        self.treeWidget.topLevelItem(1).child(0).setText(0, u"Dialog1")
        self.treeWidget.topLevelItem(1).child(1).setText(0, u"Dialog2")
        self.groupBox.setTitle(u"GroupBox")
        self.groupYaz()

        self.treeWidget.itemPressed.connect(self.lale)

    def lale(self, item):
        print item
        self.groupBox.setTitle(item.text(0))

    def groupYaz(self):
        for option in DOptions:
            if hasattr(option, "getOption"):
                #self.gridLayout_3.addWidget(option.getOption(), 0, 0, 1, 1)
                item = QTreeWidgetItem(self.dialog)
                a = option.getOption()
                if hasattr(a, "name"):
                    item.setText(0, a.name)
                else:
                    item.setText(0, "Fuck")

        #self.gridLayout_3.addWidget(a, 0, 0, 1, 1)
开发者ID:superactive,项目名称:Virux,代码行数:79,代码来源:ayarlar.py

示例6: ConditionsDialog

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]

#.........这里部分代码省略.........
        self._endo = QRadioButton("Endothermic")
        self._exo = QRadioButton("Exothermic")
        if self._reaction.GetEndothermic():
            self._endo.setChecked(True)
        else:
            self._exo.setChecked(True)
        self._heatform.addRow(self._endo)
        self._heatform.addRow(self._exo)
        self._heatbox.setLayout(self._heatform)

        # Other conditions section: vessel volume; temperature
        self._otherbox = QGroupBox("Other conditions")
        self._otherform = QFormLayout()
        self._tempbox = QLineEdit()
        self._volbox = QLineEdit()
        self._tempbox.setText(str(self._reaction.GetTemperature()))
        self._volbox.setText(str(self._reaction.GetVolume()))
        self._otherform.addRow(QLabel("Vessel volume:"), self._volbox)
        self._otherform.addRow(QLabel("Temperature:"), self._tempbox)
        self._otherbox.setLayout(self._otherform)

        # Help text explaining how to enter super/subscript characters.
        self._scriptinfo1 = QLabel("Enter _ before a subscript character.")
        self._scriptinfo2 = QLabel("Enter ^ before a superscript one.")

        # OK and cancel buttons; checkbox so that students can try to balance the equation before it is revealed
        self._try = QCheckBox("Students attempt to balance equation")
        self._try.setChecked(False)
        self._okbtn = QPushButton("OK")
        self._okbtn.clicked.connect(self.ApplyChanges)
        self._cancelbtn = QPushButton("Cancel")

        self._rightbox = QGroupBox()
        self._rightbox.setFlat(False)
        self._rightform = QVBoxLayout()
        self._rightform.addWidget(self._catalystbox)
        self._rightform.addWidget(self._heatbox)
        self._rightform.addWidget(self._otherbox)
        self._rightbox.setLayout(self._rightform)

        # Layout of all those group boxes
        self._grid = QGridLayout()
        self._grid.addWidget(self._scriptinfo1, 0, 0)
        self._grid.addWidget(self._scriptinfo2, 1, 0)
        self._grid.addWidget(self._reactantbox, 2, 0)
        self._grid.addWidget(self._productbox, 2, 1)
        self._grid.addWidget(self._rightbox, 2, 2)
        self._grid.addWidget(self._try, 3, 0)
        self._grid.addWidget(self._okbtn, 3, 1)
        self._grid.addWidget(self._cancelbtn, 3, 2)
        self.setLayout(self._grid)

        if reaction is None:
            self._reaction = Reaction()
        else:
            self._reaction = reaction

        self._cancelbtn.clicked.connect(self.close)
        self.exec_()

    def ApplyChanges(self):
        errorlist = []
        # Validation. If invalid data has been entered, a message describing where the problem is
        # and explaining what constitutes valid data is added to errorlist.
        formularegex = "[2-9]?(\(([A-Z][a-z]?(_[0-9])*)+\)(_[0-9])*|[A-Z][a-z]?(_[0-9])*)+((\^[0-9])*\^(\+|-))?"
        molesorvolumeregex = "[0-9]?[0-9]\.[0-9][0-9]?"
开发者ID:fredtargaryen,项目名称:eqmsim2015,代码行数:70,代码来源:ConditionsDialog.py

示例7: ConditionsDialog

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setFlat [as 别名]
class ConditionsDialog(QDialog):
    def __init__(self, reaction):
        super(ConditionsDialog, self).__init__()
        self.setGeometry (300 , 300 , 700 , 350)
        self.setWindowTitle ('Edit Conditions')
        if reaction is None:
            self._reaction = Reaction()
        else:
            self._reaction = reaction
        self._CanReturnReaction = False

        # Sets up GUI widgets. Formula boxes will need to support super and subscript somehow
        # Will also need validation later

        # Reactants section
        self._reactantbox = QGroupBox("Reactants", self)
        self._reactantform = QFormLayout()
        self._reactantinfoboxes = []
        self._productinfoboxes = []
        self._catalystinfoboxes = []
        for x in range(Reaction.REACTING_SPECIES_LIMIT):
            self._reactantinfoboxes.append(QLineEdit())
            self._reactantinfoboxes[x*2].setText(self._reaction.GetReactants()[x].GetFormula())
            self._reactantinfoboxes.append(QLineEdit())
            self._reactantinfoboxes[x*2+1].setText(str(self._reaction.GetReactants()[x].GetInitialMoles()))
            self._reactantform.addRow(QLabel(str(x + 1)+".\tFormula:"), self._reactantinfoboxes[x*2])
            self._reactantform.addRow(QLabel("\tInitial Moles:"), self._reactantinfoboxes[x*2+1])
        self._reactantbox.setLayout(self._reactantform)
        # Products section
        self._productbox = QGroupBox("Products", self)
        self._productform = QFormLayout()
        for x in range(Reaction.REACTING_SPECIES_LIMIT):
            self._productinfoboxes.append(QLineEdit())
            self._productinfoboxes[x*2].setText(self._reaction.GetProducts()[x].GetFormula())
            self._productinfoboxes.append(QLineEdit())
            self._productinfoboxes[x*2+1].setText(str(self._reaction.GetProducts()[x].GetInitialMoles()))
            self._productform.addRow(QLabel(str(x + 1)+".\tFormula:"), self._productinfoboxes[x*2])
            self._productform.addRow(QLabel("\tInitial Moles:"), self._productinfoboxes[x*2+1])
        self._productbox.setLayout(self._productform)
        # Catalyst section
        self._catalystbox = QGroupBox("Catalyst", self)
        self._catalystform = QFormLayout()
        self._catalystinfoboxes.append(QLineEdit())
        self._catalystinfoboxes.append(QLineEdit())
        self._catalystinfoboxes.append(QLineEdit())
        self._catalystinfoboxes[0].setText(self._reaction.GetCatalyst().GetFormula())
        self._catalystinfoboxes[1].setText(str(self._reaction.GetCatalyst().GetInitialMoles()))
        self._catalystinfoboxes[2].setText(str(self._reaction.GetCatalyst().GetEaChangePerMole()))
        self._catalystform.addRow(QLabel("Formula:"), self._catalystinfoboxes[0])
        self._catalystform.addRow(QLabel("Moles:"), self._catalystinfoboxes[1])
        self._catalystform.addRow(QLabel("Ea change (per mole):"), self._catalystinfoboxes[2])
        self._catalystbox.setLayout(self._catalystform)
        # Forward heat transfer
        self._heatbox = QGroupBox("Forward heat transfer", self)
        self._heatform = QFormLayout()
        self._endo = QRadioButton("Endothermic")
        self._exo = QRadioButton("Exothermic")
        if self._reaction.GetEndothermic():
            self._endo.setChecked(True)
        else:
            self._exo.setChecked(True)
        self._heatform.addRow(self._endo)
        self._heatform.addRow(self._exo)
        self._heatbox.setLayout(self._heatform)
        # Other conditions section. Includes Vessel volume; Temperature.
        self._otherbox = QGroupBox("Other conditions")
        self._otherform = QFormLayout()
        self._tempbox = QLineEdit()
        self._volbox = QLineEdit()
        self._tempbox.setText(str(self._reaction.GetTemperature()))
        self._volbox.setText(str(self._reaction.GetVolume()))
        self._otherform.addRow(QLabel("Vessel volume:"), self._volbox)
        self._otherform.addRow(QLabel("Temperature:"), self._tempbox)
        self._otherbox.setLayout(self._otherform)
        # OK and Cancel buttons
        self._okbtn = QPushButton("OK")
        self._okbtn.clicked.connect(self.ApplyChanges)
        self._cancelbtn = QPushButton("Cancel")

        self._rightbox = QGroupBox()
        self._rightbox.setFlat(False)
        self._rightform = QVBoxLayout()
        self._rightform.addWidget(self._catalystbox)
        self._rightform.addWidget(self._heatbox)
        self._rightform.addWidget(self._otherbox)
        self._rightbox.setLayout(self._rightform)

        # Layout of all those group boxes
        self._grid = QGridLayout()
        self._grid.addWidget(self._reactantbox, 0, 0)
        self._grid.addWidget(self._productbox, 0, 1)
        self._grid.addWidget(self._rightbox, 0, 2)
        self._grid.addWidget(self._okbtn, 1, 1)
        self._grid.addWidget(self._cancelbtn, 1, 2)
        self.setLayout(self._grid)

        if reaction is None:
            self._reaction = Reaction()
        else:
            self._reaction = reaction
#.........这里部分代码省略.........
开发者ID:fredtargaryen,项目名称:eqmsim2015,代码行数:103,代码来源:ConditionsDialog.py


注:本文中的PyQt4.QtGui.QGroupBox.setFlat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。