def __init__(self, lmparams, parent=None): self.lmparams = lmparams self.epgDialog = QtWidgets.QDialog() self.epgT2params_widget = epgT2paramsDialog.EpgT2paramsDialog(self.lmparams) self.epgT2params_widget.setupEpgT2paramsDialog(self.epgDialog) self.azzDialog = QtWidgets.QDialog() self.azzT2params_widget = azzT2paramsDialog.AzzT2paramsDialog(self.lmparams) self.azzT2params_widget.setupAzzT2paramsDialog(self.azzDialog) super(radiobuttons_EPGWidget, self).__init__(parent) hlayout = QtWidgets.QHBoxLayout(self) group_rbtns = QtWidgets.QButtonGroup() group_rbtns.exclusive() self.epg_rbtn = QtWidgets.QRadioButton("EPG T2") self.norm_rbtn = QtWidgets.QRadioButton("normal T2") self.norm_rbtn.setChecked(True); self.T2params_btn = QtWidgets.QPushButton("T2 Parameters") self.epg_rbtn.fittingParam = "epg" self.norm_rbtn.fittingParam= 'norm' self.epg_rbtn.toggled.connect(lambda:self.btnstate(self.epg_rbtn)) self.norm_rbtn.toggled.connect(lambda:self.btnstate(self.norm_rbtn)) self.T2params_btn.clicked.connect(self.T2params_btn_clicked) group_rbtns.addButton(self.epg_rbtn) group_rbtns.addButton(self.norm_rbtn) hlayout.addWidget(self.norm_rbtn) hlayout.addWidget(self.epg_rbtn) hlayout.addStretch(1) hlayout.addWidget(self.T2params_btn)
def reshape_prompt(self): dialog = QtWidgets.QDialog() layout = QtWidgets.QFormLayout() layout.addRow(QtWidgets.QLabel("Choose Plot Grid Shape")) rowbox,colbox = QtWidgets.QLineEdit(str(self.rows)),QtWidgets.QLineEdit(str(self.cols)) layout.addRow(QtWidgets.QLabel("Rows"),rowbox) layout.addRow(QtWidgets.QLabel("Cols"),colbox) buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, dialog) buttons.accepted.connect(dialog.accept) buttons.rejected.connect(dialog.reject) layout.addWidget(buttons) dialog.setLayout(layout) if dialog.exec_() == QtWidgets.QDialog.Accepted: try: r = int(rowbox.text()) c = int(colbox.text()) self.reshape(r,c) except: print('Invalid input to reshape dialog')
def _export_values(self): # Explicitly round to 3 decimals (which is also the spinbox precision) # to avoid numbers of the form 0.100...001. dialog = QtWidgets.QDialog() layout = QtWidgets.QVBoxLayout() dialog.setLayout(layout) text = QtWidgets.QPlainTextEdit() text.setReadOnly(True) layout.addWidget(text) text.setPlainText(",\n".join( "{}={:.3}".format(attr, self._widgets[attr].value()) for attr in self._attrs)) # Adjust the height of the text widget to fit the whole text, plus # some padding. size = text.maximumSize() size.setHeight( QtGui.QFontMetrics(text.document().defaultFont()).size( 0, text.toPlainText()).height() + 20) text.setMaximumSize(size) dialog.exec_()