def setDtws(self): #self.dtws = obj[0] i = self.v.indexOf(self.mplWidget) self.v.removeWidget(self.mplWidget) self.mplWidget.deleteLater() self.mplWidget = MSDtwCanvas(self.dtws, parent=self) self.mplWidget.setMinimumSize(500,400) self.v.insertWidget(i, self.mplWidget) self.dtws=None
class DtwWidget(QtGui.QDialog): def __init__(self, parent=None): self.dtws, self.ref, self.others = [None]*3 QtGui.QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle("Dtw Parameters") self.v = QtGui.QVBoxLayout(self) h = QtGui.QHBoxLayout() self.derivative = QtGui.QCheckBox("Derivative DTW") h.addWidget(self.derivative) self.showImg = QtGui.QCheckBox('Show Image', self) h.addWidget(self.showImg) self.v.addLayout(h) self.mplWidget = QtGui.QLabel("Empty, no calculation done yet")#MSDtwCanvas() #self.mplWidget.setMinimumSize(400, 300) self.v.addWidget(self.mplWidget) self.calc = QtGui.QPushButton("Go...") self.v.addWidget(self.calc) self.buttons = QtGui.QDialogButtonBox() self.buttons.setStandardButtons(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) self.v.addWidget(self.buttons) def setDtws(self): #self.dtws = obj[0] i = self.v.indexOf(self.mplWidget) self.v.removeWidget(self.mplWidget) self.mplWidget.deleteLater() self.mplWidget = MSDtwCanvas(self.dtws, parent=self) self.mplWidget.setMinimumSize(500,400) self.v.insertWidget(i, self.mplWidget) self.dtws=None def compute(self): spl = [s for s in QApplication.instance().model if s.checked] self.dtws, self.ref, self.others = QApplication.instance().model.alignRawDataByDtw(spl, self.derivative.isChecked(), self.showImg.isChecked()) self.setDtws()