def __init__(self, parent, paramTextList, paramName, spectrumNames, currentSpectrum, returnFunc): """ Initializes the ConnectParamsWindow. Parameters ---------- parent : QWidget The parent of the ConnectParamsWindow. This value is passed to QWidget. paramTextList : list of str List with the names of all parameters. paramName : str Name of the lineedit from which this window was opened. spectrumNames : list of str A list of the names of the spectra being fit. currentSpectrum : str The name of the spectrum that is currently open. returnFunc : function The function that should be called when the ok button is pressed. """ super(ConnectParamsWindow, self).__init__(parent) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.Tool) self.setWindowTitle("Connect Parameter") self.paramTextList = paramTextList self.paramText = paramName self.spectrumNames = spectrumNames self.currentSpectrum = self.spectrumNames.index(currentSpectrum) self.returnFunc = returnFunc self.layout = QtWidgets.QGridLayout(self) self.grid = QtWidgets.QGridLayout() self.layout.addLayout(self.grid, 0, 0, 1, 2) self.grid.addWidget(QtWidgets.QLabel("Parameter:"), 0, 0) self.paramNameEntry = QtWidgets.QComboBox() self.paramNameEntry.addItems(self.paramTextList) self.paramNameEntry.setCurrentIndex(self.paramTextList.index(self.paramText)) self.grid.addWidget(self.paramNameEntry, 0, 1) self.grid.addWidget(QtWidgets.QLabel("Data:"), 1, 0) self.spectrumNameEntry = QtWidgets.QComboBox() self.spectrumNameEntry.addItems(self.spectrumNames) self.spectrumNameEntry.setCurrentIndex(self.currentSpectrum) self.grid.addWidget(self.spectrumNameEntry, 1, 1) self.grid.addWidget(QtWidgets.QLabel("Line:"), 2, 0) self.lineEntry = QtWidgets.QSpinBox() self.grid.addWidget(self.lineEntry, 2, 1) self.grid.addWidget(QtWidgets.QLabel("Multiplier:"), 3, 0) self.multEntry = QLineEdit("1.0") self.grid.addWidget(self.multEntry, 3, 1) self.grid.addWidget(QtWidgets.QLabel("Offset:"), 4, 0) self.addEntry = QLineEdit("0.0") self.grid.addWidget(self.addEntry, 4, 1) self.cancelButton = QtWidgets.QPushButton("&Cancel") self.cancelButton.clicked.connect(self.closeEvent) self.okButton = QtWidgets.QPushButton("&Ok") self.okButton.clicked.connect(self.applyAndClose) self.okButton.setFocus() self.box = QtWidgets.QDialogButtonBox() self.box.addButton(self.cancelButton, QtWidgets.QDialogButtonBox.RejectRole) self.box.addButton(self.okButton, QtWidgets.QDialogButtonBox.AcceptRole) self.layout.addWidget(self.box, 2, 0) self.show()
def __init__(self, parent): """ Initializes the legend window. Parameters ---------- parent : SaveFigureWindow The save figure window from which the legend window is called. """ super(LegendWindow, self).__init__(parent) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.Tool) self.father = parent self.setWindowTitle("Legend") layout = QtWidgets.QGridLayout(self) grid = QtWidgets.QGridLayout() layout.addLayout(grid, 0, 0, 1, 2) grid.addWidget(wc.QLabel("Legend position:"), 0, 0) self.posVal = self.father.legendPos self.posEntry = wc.QLineEdit(self.posVal, self.preview) grid.addWidget(self.posEntry, 1, 0) grid.addWidget(wc.QLabel("Legend order:"), 2, 0) self.orderVal = self.father.legendOrder self.orderEntry = wc.QLineEdit(self.orderVal, self.preview) grid.addWidget(self.orderEntry, 3, 0) grid.addWidget(wc.QLabel("Legend:"), 4, 0) self.father.legendGroup.setChecked(True) self.spinBox = QtWidgets.QSpinBox() self.spinBox.setMaximum(len(self.father.legendTextList) - 1) self.spinBox.valueChanged.connect(self.changeEdit) grid.addWidget(self.spinBox, 5, 0) self.legendEditList = [] for i in range(len(self.father.legendTextList)): self.legendEditList.append( wc.QLineEdit(self.father.legendTextList[i], self.preview)) grid.addWidget(self.legendEditList[i], 6, 0) self.legendEditList[i].setVisible(False) self.legendEditList[0].setVisible(True) cancelButton = QtWidgets.QPushButton("&Cancel") cancelButton.clicked.connect(self.closeEvent) layout.addWidget(cancelButton, 1, 0) okButton = QtWidgets.QPushButton("&Ok") okButton.clicked.connect(self.applyAndClose) layout.addWidget(okButton, 1, 1) self.show() self.setFixedSize(self.size()) self.setGeometry(self.frameSize().width() - self.geometry().width(), self.frameSize().height() - self.geometry().height(), 0, 0)
def __init__(self, parent, paramTextList, paramName, spectrumNames, currentSpectrum, returnFunc): super(ConnectParamsWindow, self).__init__(parent) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.Tool) self.setWindowTitle("Connect Parameter") self.paramTextList = paramTextList self.paramText = paramName self.spectrumNames = spectrumNames self.currentSpectrum = self.spectrumNames.index(currentSpectrum) self.returnFunc = returnFunc self.layout = QtWidgets.QGridLayout(self) self.grid = QtWidgets.QGridLayout() self.layout.addLayout(self.grid, 0, 0, 1, 2) self.grid.addWidget(QtWidgets.QLabel("Parameter:"), 0, 0) self.paramNameEntry = QtWidgets.QComboBox() self.paramNameEntry.addItems(self.paramTextList) self.paramNameEntry.setCurrentIndex( self.paramTextList.index(self.paramText)) self.grid.addWidget(self.paramNameEntry, 0, 1) self.grid.addWidget(QtWidgets.QLabel("Data:"), 1, 0) self.spectrumNameEntry = QtWidgets.QComboBox() self.spectrumNameEntry.addItems(self.spectrumNames) self.spectrumNameEntry.setCurrentIndex(self.currentSpectrum) self.grid.addWidget(self.spectrumNameEntry, 1, 1) self.grid.addWidget(QtWidgets.QLabel("Line:"), 2, 0) self.lineEntry = QtWidgets.QSpinBox() self.grid.addWidget(self.lineEntry, 2, 1) self.grid.addWidget(QtWidgets.QLabel("Multiplier:"), 3, 0) self.multEntry = QLineEdit("1.0") self.grid.addWidget(self.multEntry, 3, 1) self.grid.addWidget(QtWidgets.QLabel("Offset:"), 4, 0) self.addEntry = QLineEdit("0.0") self.grid.addWidget(self.addEntry, 4, 1) self.cancelButton = QtWidgets.QPushButton("&Cancel") self.cancelButton.clicked.connect(self.closeEvent) self.okButton = QtWidgets.QPushButton("&Ok") self.okButton.clicked.connect(self.applyAndClose) self.okButton.setFocus() self.box = QtWidgets.QDialogButtonBox() self.box.addButton(self.cancelButton, QtWidgets.QDialogButtonBox.RejectRole) self.box.addButton(self.okButton, QtWidgets.QDialogButtonBox.AcceptRole) self.layout.addWidget(self.box, 2, 0) self.show()
def __init__(self, parent, line=None): """ Initializes the line edit window. Parameters ---------- parent : SaveFigureWindow The save figure window from which the line edit window is called. line : Line2D, optional The line for which to show the line style. """ super(EditLineWindow, self).__init__(parent) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.Tool) self.father = parent self.canvas = self.father.canvas self.ax = self.father.ax self.lineList = self.ax.lines if line is None: self.line = line[0] else: self.line = line self.setWindowTitle("Line") layout = QtWidgets.QGridLayout(self) grid = QtWidgets.QGridLayout() layout.addLayout(grid, 0, 0, 1, 2) grid.addWidget(wc.QLabel("Index:"), 0, 0) self.indexSpinBox = QtWidgets.QSpinBox() self.indexSpinBox.setMaximum(len(self.lineList) - 1) self.indexSpinBox.setValue(self.lineList.index(self.line)) self.indexSpinBox.valueChanged.connect(self.setIndex) grid.addWidget(self.indexSpinBox, 1, 0) grid.addWidget(wc.QLabel("Line:"), 2, 0) colorbutton = QtWidgets.QPushButton("Color", self) colorbutton.clicked.connect(self.setColor) grid.addWidget(colorbutton, 3, 0) grid.addWidget(wc.QLabel("Linewidth:"), 4, 0) self.lwSpinBox = QtWidgets.QDoubleSpinBox() self.lwSpinBox.setSingleStep(0.1) self.lwSpinBox.valueChanged.connect(self.setLineWidth) grid.addWidget(self.lwSpinBox, 5, 0) grid.addWidget(wc.QLabel("Linestyle:"), 6, 0) self.LINESTYLES = ['-', '--', '-.', ':', 'None'] self.LINENAMES = ['solid', 'dashed', 'dashdot', 'dotted', 'none'] self.lineDrop = QtWidgets.QComboBox() self.lineDrop.addItems(self.LINENAMES) self.lineDrop.activated.connect(self.setLineStyle) grid.addWidget(self.lineDrop, 7, 0) grid.addWidget(wc.QLabel("Marker:"), 8, 0) self.MARKERSTYLES = [ 'o', 'v', '^', '<', '>', '1', '2', '3', '4', '8', 's', 'p', '*', 'h', '+', 'x', 'd', 'None' ] self.MARKERNAMES = [ 'circle', 'triangle down', 'triangle up', 'triangle left', 'triangle right', 'tri up', 'tri down', 'tri left', 'tri right', 'octagon', 'square', 'pentagon', 'star', 'hexagon', 'plus', 'x', 'diamond', 'none' ] self.markerDrop = QtWidgets.QComboBox() self.markerDrop.addItems(self.MARKERNAMES) self.markerDrop.activated.connect(self.setMarker) grid.addWidget(self.markerDrop, 9, 0) colorbutton = QtWidgets.QPushButton("Facecolor", self) colorbutton.clicked.connect(self.setFaceColor) grid.addWidget(colorbutton, 10, 0) colorbutton = QtWidgets.QPushButton("Edgecolor", self) colorbutton.clicked.connect(self.setEdgeColor) grid.addWidget(colorbutton, 11, 0) grid.addWidget(wc.QLabel("Markersize:"), 12, 0) self.msSpinBox = QtWidgets.QDoubleSpinBox() self.msSpinBox.setSingleStep(0.1) self.msSpinBox.valueChanged.connect(self.setMarkerSize) grid.addWidget(self.msSpinBox, 13, 0) cancelButton = QtWidgets.QPushButton("&Close") cancelButton.clicked.connect(self.cancelAndClose) layout.addWidget(cancelButton, 1, 0) okButton = QtWidgets.QPushButton("&Apply") okButton.clicked.connect(self.apply) layout.addWidget(okButton, 1, 1) self.setup() self.show()
def __init__(self, father, oldMainWindow): """ Initializes the SaveFigureWindow. Parameters ---------- father : MainProgram The main program of ssNake. oldMainWindow : Main1DWindow The figure window that this window replaces. """ super(SaveFigureWindow, self).__init__(father) self.father = father self.oldMainWindow = oldMainWindow self.rename = self.oldMainWindow.rename # Forward function self.get_masterData = self.oldMainWindow.get_masterData # Forward function self.get_current = self.oldMainWindow.get_current # Forward function self.fig = oldMainWindow.current.fig self.canvas = FigureCanvas(self.fig) self.canvas.mpl_connect('pick_event', self.pickHandler) self.ax = oldMainWindow.current.ax grid = QtWidgets.QGridLayout(self) scroll2 = QtWidgets.QScrollArea() grid.addWidget(scroll2, 0, 0) scroll2.setWidget(self.canvas) self.frame1 = QtWidgets.QGridLayout() grid.addLayout(self.frame1, 0, 1) scroll = QtWidgets.QScrollArea() self.frame1.addWidget(scroll, 0, 0) scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) content = QtWidgets.QWidget() self.optionFrame = QtWidgets.QGridLayout(content) self.optionFrame.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.labelGroup = QtWidgets.QGroupBox('Labels:') self.labelFrame = QtWidgets.QGridLayout() self.labelFrame.addWidget(wc.QLeftLabel('Title:'), 0, 0) self.titleBackup = oldMainWindow.get_masterData().name self.titleEntry = wc.QLineEdit(self.titleBackup, self.updatePlot) self.labelFrame.addWidget(self.titleEntry, 0, 1) self.labelFrame.addWidget(wc.QLeftLabel("x:"), 1, 0) self.xlabelBackup = self.ax.get_xlabel() self.xlabelEntry = wc.QLineEdit(self.xlabelBackup, self.updatePlot) self.labelFrame.addWidget(self.xlabelEntry, 1, 1) self.labelFrame.addWidget(wc.QLeftLabel("y:"), 2, 0) self.ylabelBackup = self.ax.get_ylabel() self.ylabelEntry = wc.QLineEdit(self.ylabelBackup, self.updatePlot) self.labelFrame.addWidget(self.ylabelEntry, 2, 1) self.labelGroup.setLayout(self.labelFrame) self.optionFrame.addWidget(self.labelGroup, 0, 0) # limits self.limitsGroup = QtWidgets.QGroupBox('Limits:') self.limitsFrame = QtWidgets.QGridLayout() self.xlimBackup = self.ax.get_xlim() self.limitsFrame.addWidget(wc.QLeftLabel("x left:"), 0, 0) self.xlimLeftEntry = wc.QLineEdit(self.xlimBackup[0], self.updatePlot) self.limitsFrame.addWidget(self.xlimLeftEntry, 0, 1) self.limitsFrame.addWidget(wc.QLeftLabel("x right:"), 1, 0) self.xlimRightEntry = wc.QLineEdit(self.xlimBackup[1], self.updatePlot) self.limitsFrame.addWidget(self.xlimRightEntry, 1, 1) self.ylimBackup = self.ax.get_ylim() self.limitsFrame.addWidget(wc.QLeftLabel("y down:"), 2, 0) self.ylimLeftEntry = wc.QLineEdit(self.ylimBackup[0], self.updatePlot) self.limitsFrame.addWidget(self.ylimLeftEntry, 2, 1) self.limitsFrame.addWidget(wc.QLeftLabel("y up:"), 3, 0) self.ylimRightEntry = wc.QLineEdit(self.ylimBackup[1], self.updatePlot) self.limitsFrame.addWidget(self.ylimRightEntry, 3, 1) self.limitsGroup.setLayout(self.limitsFrame) self.optionFrame.addWidget(self.limitsGroup, 1, 0) # Dimensions self.dimensionsGroup = QtWidgets.QGroupBox('Dimensions:') self.dimensionsFrame = QtWidgets.QGridLayout() self.widthBackup, self.heightBackup = self.fig.get_size_inches() self.widthBackup = self.widthBackup * 2.54 self.heightBackup = self.heightBackup * 2.54 self.dimensionsFrame.addWidget(wc.QLeftLabel("Width [cm]:"), 0, 0) self.widthEntry = QtWidgets.QDoubleSpinBox() self.widthEntry.setSingleStep(0.1) self.widthEntry.setMinimum(0) self.widthEntry.setMaximum(1e6) self.widthEntry.setValue(self.widthBackup) self.widthEntry.valueChanged.connect(self.updatePlot) self.dimensionsFrame.addWidget(self.widthEntry, 0, 1) self.dimensionsFrame.addWidget(wc.QLeftLabel("Height [cm]:"), 1, 0) self.heightEntry = QtWidgets.QDoubleSpinBox() self.heightEntry.setSingleStep(0.1) self.heightEntry.setMinimum(0) self.heightEntry.setMaximum(1e6) self.heightEntry.setValue(self.heightBackup) self.heightEntry.valueChanged.connect(self.updatePlot) self.dimensionsFrame.addWidget(self.heightEntry, 1, 1) self.dimensionsFrame.addWidget(wc.QLeftLabel("dpi:"), 2, 0) self.dpiEntry = QtWidgets.QSpinBox() self.dpiEntry.setSingleStep(1) self.dpiEntry.setMinimum(0) self.dpiEntry.setMaximum(1e6) self.dpiEntry.setValue(self.fig.dpi) self.dpiEntry.valueChanged.connect(self.updatePlot) self.dimensionsFrame.addWidget(self.dpiEntry, 2, 1) self.dimensionsGroup.setLayout(self.dimensionsFrame) self.optionFrame.addWidget(self.dimensionsGroup, 2, 0) # Font size self.fontGroup = QtWidgets.QGroupBox('Font sizes:') self.fontFrame = QtWidgets.QGridLayout() self.mainFontLabel = wc.QLeftLabel("Main:") self.fontFrame.addWidget(self.mainFontLabel, 0, 0) self.mainFontSizeEntry = QtWidgets.QDoubleSpinBox() self.mainFontSizeEntry.setSingleStep(0.1) self.mainFontSizeEntry.setMinimum(0) self.mainFontSizeEntry.setValue( self.ax.xaxis.get_label().get_fontsize()) self.mainFontSizeEntry.valueChanged.connect(self.updatePlot) self.fontFrame.addWidget(self.mainFontSizeEntry, 0, 1) self.fontDetailsCheck = QtWidgets.QCheckBox('Details') self.fontDetailsCheck.stateChanged.connect(self.fontCheckChanged) self.fontFrame.addWidget(self.fontDetailsCheck, 1, 0) self.titleFontSizeBackup = self.ax.title.get_fontsize() self.titleFontLabel = wc.QLeftLabel("Title:") self.titleFontLabel.hide() self.fontFrame.addWidget(self.titleFontLabel, 2, 0) self.titleFontSizeEntry = QtWidgets.QDoubleSpinBox() self.titleFontSizeEntry.setSingleStep(0.1) self.titleFontSizeEntry.setMinimum(0) self.titleFontSizeEntry.setValue(self.titleFontSizeBackup) self.titleFontSizeEntry.valueChanged.connect(self.updatePlot) self.titleFontSizeEntry.hide() self.fontFrame.addWidget(self.titleFontSizeEntry, 2, 1) self.xlabelFontSizeBackup = self.ax.xaxis.get_label().get_fontsize() self.xlabelFontLabel = wc.QLeftLabel("X-label:") self.xlabelFontLabel.hide() self.fontFrame.addWidget(self.xlabelFontLabel, 3, 0) self.xlabelFontSizeEntry = QtWidgets.QDoubleSpinBox() self.xlabelFontSizeEntry.setSingleStep(0.1) self.xlabelFontSizeEntry.setMinimum(0) self.xlabelFontSizeEntry.setValue(self.xlabelFontSizeBackup) self.xlabelFontSizeEntry.valueChanged.connect(self.updatePlot) self.xlabelFontSizeEntry.hide() self.fontFrame.addWidget(self.xlabelFontSizeEntry, 3, 1) self.ylabelFontSizeBackup = self.ax.yaxis.get_label().get_fontsize() self.ylabelFontLabel = wc.QLeftLabel("Y-label:") self.ylabelFontLabel.hide() self.fontFrame.addWidget(self.ylabelFontLabel, 4, 0) self.ylabelFontSizeEntry = QtWidgets.QDoubleSpinBox() self.ylabelFontSizeEntry.setSingleStep(0.1) self.ylabelFontSizeEntry.setMinimum(0) self.ylabelFontSizeEntry.setValue(self.ylabelFontSizeBackup) self.ylabelFontSizeEntry.valueChanged.connect(self.updatePlot) self.ylabelFontSizeEntry.hide() self.fontFrame.addWidget(self.ylabelFontSizeEntry, 4, 1) self.xtickFontSizeBackup = self.ax.xaxis.get_ticklabels( )[0].get_fontsize() self.xtickFontLabel = wc.QLeftLabel("X-ticks:") self.xtickFontLabel.hide() self.fontFrame.addWidget(self.xtickFontLabel, 5, 0) self.xtickFontSizeEntry = QtWidgets.QDoubleSpinBox() self.xtickFontSizeEntry.setSingleStep(0.1) self.xtickFontSizeEntry.setMinimum(0) self.xtickFontSizeEntry.setValue(self.xtickFontSizeBackup) self.xtickFontSizeEntry.valueChanged.connect(self.updatePlot) self.xtickFontSizeEntry.hide() self.fontFrame.addWidget(self.xtickFontSizeEntry, 5, 1) self.ytickFontSizeBackup = self.ax.yaxis.get_ticklabels( )[0].get_fontsize() self.ytickFontLabel = wc.QLeftLabel("Y-ticks:") self.ytickFontLabel.hide() self.fontFrame.addWidget(self.ytickFontLabel, 6, 0) self.ytickFontSizeEntry = QtWidgets.QDoubleSpinBox() self.ytickFontSizeEntry.setSingleStep(0.1) self.ytickFontSizeEntry.setMinimum(0) self.ytickFontSizeEntry.setValue(self.ytickFontSizeBackup) self.ytickFontSizeEntry.valueChanged.connect(self.updatePlot) self.ytickFontSizeEntry.hide() self.fontFrame.addWidget(self.ytickFontSizeEntry, 6, 1) self.legend = self.ax.legend() if self.legend is not None: # Fix for matplotlib 2.0, were for contour self.legend becomes None if not self.legend.get_texts(): self.legend.set_visible(False) self.legend = None else: self.legendFontSizeBackup = self.legend.get_texts( )[0].get_fontsize() self.legendFontLabel = wc.QLeftLabel("Legend:") self.legendFontLabel.hide() self.fontFrame.addWidget(self.legendFontLabel, 7, 0) self.legendFontSizeEntry = QtWidgets.QDoubleSpinBox() self.legendFontSizeEntry.setSingleStep(0.1) self.legendFontSizeEntry.setMinimum(0) self.legendFontSizeEntry.setValue(self.legendFontSizeBackup) self.legendFontSizeEntry.valueChanged.connect(self.updatePlot) self.legendFontSizeEntry.hide() self.fontFrame.addWidget(self.legendFontSizeEntry, 7, 1) self.fontGroup.setLayout(self.fontFrame) self.optionFrame.addWidget(self.fontGroup, 3, 0) # Legend if self.legend is not None: if self.oldMainWindow.current.__class__.__name__ == 'CurrentMulti': # If from multiplot order = list( self.oldMainWindow.current.viewSettings['extraOffset']) order.append(0) self.legendOrder = list(np.argsort(order))[::-1] elif self.oldMainWindow.current.__class__.__name__ == 'CurrentStacked': self.legendOrder = list( np.arange(0, len(self.legend.get_texts())))[::-1] else: self.legendOrder = list( np.arange(0, len(self.legend.get_texts()))) try: self.legend.set_draggable(True) except AttributeError: self.legend.draggable(True) # For older Matplotlib versions self.legendPos = 'best' self.legendTextList = [] for line in self.legend.get_texts(): self.legendTextList.append(line.get_text()) self.legend.set_visible(False) self.legendGroup = QtWidgets.QGroupBox('Legend:') self.legendGroup.setCheckable(True) self.legendGroup.setChecked(False) self.legendGroup.toggled.connect(self.updatePlot) self.legendFrame = QtWidgets.QGridLayout() legendButton = QtWidgets.QPushButton('Legend settings') legendButton.clicked.connect(lambda: LegendWindow(self)) self.legendFrame.addWidget(legendButton, 0, 0) self.legendGroup.setLayout(self.legendFrame) self.optionFrame.addWidget(self.legendGroup, 4, 0) self.xticksToggle = QtWidgets.QCheckBox('X-ticks') self.xticksToggle.setChecked(True) self.xticksToggle.stateChanged.connect(self.updatePlot) self.optionFrame.addWidget(self.xticksToggle, 5, 0) self.yticksToggle = QtWidgets.QCheckBox('Y-ticks') self.yticksToggle.setChecked(True) self.yticksToggle.stateChanged.connect(self.updatePlot) self.optionFrame.addWidget(self.yticksToggle, 6, 0) self.frameToggle = QtWidgets.QCheckBox('Box') self.frameToggle.setChecked(True) self.frameToggle.stateChanged.connect(self.updatePlot) self.optionFrame.addWidget(self.frameToggle, 7, 0) self.inFrame = QtWidgets.QGridLayout() self.frame1.addLayout(self.inFrame, 1, 0) self.inFrame.addWidget(wc.QLabel("File type:"), 0, 0, 1, 2) self.filetypeEntry = QtWidgets.QComboBox() self.fileOptions = ['svg', 'png', 'eps', 'jpg', 'pdf'] self.filetypeEntry.addItems(self.fileOptions) self.inFrame.addWidget(self.filetypeEntry, 1, 0, 1, 2) cancelButton = QtWidgets.QPushButton("&Close") cancelButton.clicked.connect(self.cancel) okButton = QtWidgets.QPushButton("&Save") okButton.clicked.connect(self.save) box = QtWidgets.QDialogButtonBox() box.setOrientation(QtCore.Qt.Horizontal) box.addButton(cancelButton, QtWidgets.QDialogButtonBox.RejectRole) box.addButton(okButton, QtWidgets.QDialogButtonBox.AcceptRole) self.inFrame.addWidget(box, 2, 0) grid.setColumnStretch(0, 1) grid.setRowStretch(0, 1) self.optionFrame.setAlignment(QtCore.Qt.AlignTop) self.grid = grid scroll.setWidget(content) scroll.setMinimumWidth(content.sizeHint().width() + scroll.verticalScrollBar().sizeHint().width()) self.updatePlot()