def __init__(self, data, mainwindow): super(msKineticOperatorWidget, self).__init__(data,mainwindow) groupBox = QtGui.QGroupBox("Kinetic matrix") vbox = QtGui.QVBoxLayout() self.kMatrix = QtGui.QTreeView() vbox.addWidget(self.kMatrix ) hbox = QtGui.QHBoxLayout() self.labelKineticFunction = QtGui.QLabel("Kinetic function:") hbox.addWidget(self.labelKineticFunction) vbox.addLayout(hbox) hbox.addStretch(1) updateFieldBttn = QtGui.QPushButton("Recompute") updateFieldBttn.clicked.connect(self.evaluateField) hbox.addWidget(updateFieldBttn) groupBox.setLayout(vbox) self.vbox.addWidget(groupBox) self.evaluateField() groupBox = QtGui.QGroupBox("Generalized coordinates") vbox = QtGui.QVBoxLayout() self.synchronization = QtGui.QCheckBox("synchronization/coordinates") vbox.addWidget(self.synchronization) self.gencoors = msGeneralizedCoordinatesWidget(self.data.getCoordinates() , self.mainwindows ) self.gencoors.listView.clicked.connect(self.selectCoor) vbox.addWidget(self.gencoors ) try: self.gencoors.widgetScalVar.slider.valueChanged[int].connect(self.updateCoorChange) self.gencoors.widgetScalVar.valueSpinBox.valueChanged[float].connect(self.updateCoorChange) except: pass groupBox.setLayout(vbox) self.vbox.addWidget(groupBox) self.groupbox.setTitle("Kinetic operator") self.setMaximumSize(550,450)
def __init__(self,data,mainwindows): super(msScalarFunctionWidget, self).__init__(data,mainwindows) """ First create the Units group box """ hbox = QtGui.QHBoxLayout() vbox = QtGui.QVBoxLayout() vbox.addStretch(1) self.resultLabel = QtGui.QLabel("Current field value: ") vbox.addWidget(self.resultLabel) hbox1=QtGui.QHBoxLayout() self.buttonEvaluate = QtGui.QPushButton("recompute field") self.buttonEvaluate.clicked.connect(self.evaluateField) self.buttonEvaluate.setMinimumWidth(150) hbox1.addWidget(self.buttonEvaluate) hbox1.addStretch(1) hbox2=QtGui.QHBoxLayout() self.buttonPlot = QtGui.QPushButton("plot 1D") self.buttonPlot.setMinimumWidth(150) self.buttonPlot.clicked.connect(self.plot1d) self.buttonPlot.setVisible(0) hbox2.addWidget(self.buttonPlot) hbox2.addStretch(1) hbox3=QtGui.QHBoxLayout() self.buttonResetunit = QtGui.QPushButton("reset unit") self.buttonResetunit.setMinimumWidth(150) hbox3.addWidget(self.buttonResetunit) hbox3.addStretch(1) vbox.addLayout(hbox1) vbox.addLayout(hbox3) vbox.addLayout(hbox2) vbox.addStretch(1) hbox.addLayout(vbox) hbox.addSpacing(100) vbox = QtGui.QVBoxLayout() self.constantsList = QtGui.QListWidget() for constant in self.data.getConstants(): self.constantsList.addItem(constant) vbox.addWidget(self.constantsList) self.constantsList.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.constantsList.setDragEnabled(1) self.constantsList.viewport().setAcceptDrops(1) self.constantsList.setDropIndicatorShown(1) bttn = QtGui.QPushButton("define new constant") vbox.addWidget(bttn) bttn.clicked.connect(self.addConstant) hbox.addLayout(vbox) self.vbox.addLayout(hbox) self.synchronization = QtGui.QCheckBox("synchronization/coordinates") self.vbox.addWidget(self.synchronization) self.gencoors = msGeneralizedCoordinatesWidget(self.data.getCoordinates() , self.mainwindows ) self.gencoors.listView.clicked.connect(self.selectCoor) self.vbox.addWidget(self.gencoors ) try: self.gencoors.widgetScalVar.slider.valueChanged[int].connect(self.updateCoorChange) self.gencoors.widgetScalVar.valueSpinBox.valueChanged[float].connect(self.updateCoorChange) except: pass self.groupbox.setTitle("&Scalar function") self.setMinimumHeight(self.gencoors.height()+250) self.setMaximumHeight(self.gencoors.height()+250) self.setMinimumWidth(550) self.setMaximumWidth(550)