def __init__(self, parent, task, new=False): QWidget.__init__(self, parent) self.task = task self.new = new self.layout = QStackedLayout(self) self.label = QLabel(self) self.label.setTextFormat(Qt.RichText) self.label.setOpenExternalLinks(True) self._update() self.label.setWordWrap(True) self.layout.addWidget(self.label) self.editor = TaskEditorLineEdit(self, parent.mfile) self.layout.addWidget(self.editor) self.setLayout(self.layout) self.layout.setCurrentIndex(0) self.editor.focusOut.connect(self.editFinished) self.task.modified.connect(self._update)
def _initUI(self, values): self.setWindowTitle("Task Editor") vbox = QtWidgets.QVBoxLayout() self._label = QtWidgets.QLabel("Task:") vbox.addWidget(self._label) self._edit = TaskEditorLineEdit(values, self.autocomplete_pairs) vbox.addWidget(self._edit) hbox = QtWidgets.QHBoxLayout() okButton = QtWidgets.QPushButton("Ok") okButton.clicked.connect(self.accept) cancelButton = QtWidgets.QPushButton("Cancel") cancelButton.clicked.connect(self.reject) hbox.addStretch(1) hbox.addWidget(okButton) hbox.addWidget(cancelButton) vbox.addLayout(hbox) self.setLayout(vbox) self.resize(500, 100)