def getDateRangeWidget(self, minDate, maxDate): dateRange = QDateEdit() dateRange.setCalendarPopup(True) dateRange.setDisplayFormat('MMM d yy') dateRange.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) dateRange.setMaximumDate(maxDate) dateRange.setMinimumDate(minDate) return dateRange
def addFutureTreatment(self): row = QHBoxLayout() row.addWidget(QLabel("Wybierz punkt podania lekarstwa")) treatment_date = QDateEdit() treatment_date.setMinimumDate(self.patient.measurements[-1].date) row.addWidget(treatment_date) remove_treatment_button = QToolButton() remove_treatment_button.setIcon(QIcon("resources/icon/minus.png")) remove_treatment_button.setStatusTip("UsuĊ") row.addWidget(remove_treatment_button) self.treatments.append(treatment_date) self.form_layout.addRow(row) def remove_treatment(): self.form_layout.removeRow(row) self.treatments.remove(treatment_date) remove_treatment_button.clicked.connect(remove_treatment)