Little report refactoring.
This commit is contained in:
parent
5b62e8684d
commit
1d3f6384e2
17
report.py
17
report.py
@ -53,11 +53,14 @@ class Report(QtWidgets.QDialog):
|
||||
|
||||
def set_data(self, data):
|
||||
self._report = data
|
||||
self._report_data = self._report.report()
|
||||
self.refresh_table()
|
||||
self.update_prev_next()
|
||||
|
||||
def save(self):
|
||||
self._report.save(self._report_data)
|
||||
|
||||
def refresh_table(self):
|
||||
self._report_data = self._report.report()
|
||||
self.tableWidget.setRowCount(len(self._report_data))
|
||||
|
||||
self._changing_items = True
|
||||
@ -96,26 +99,25 @@ class Report(QtWidgets.QDialog):
|
||||
if row > len(self._report_data) - 4:
|
||||
return
|
||||
del self._report_data[row]
|
||||
self.save()
|
||||
self.refresh_table()
|
||||
|
||||
@QtCore.Slot()
|
||||
def _accept(self):
|
||||
self._report.save(self._report_data)
|
||||
self.save()
|
||||
self.accept()
|
||||
|
||||
@QtCore.Slot()
|
||||
def previous(self):
|
||||
self._report.save(self._report_data)
|
||||
self.save()
|
||||
self._report.previous()
|
||||
self._report_data = self._report.report()
|
||||
self.refresh_table()
|
||||
self.update_prev_next()
|
||||
|
||||
@QtCore.Slot()
|
||||
def next(self):
|
||||
self._report.save(self._report_data)
|
||||
self.save()
|
||||
self._report.next()
|
||||
self._report_data = self._report.report()
|
||||
self.refresh_table()
|
||||
self.update_prev_next()
|
||||
|
||||
@ -130,6 +132,5 @@ class Report(QtWidgets.QDialog):
|
||||
item.setText(self._report_data[row][column])
|
||||
return
|
||||
self._report_data[row][column] = new_time.strftime("%H:%M")
|
||||
self._report.save(self._report_data)
|
||||
self._report_data = self._report.report()
|
||||
self.save()
|
||||
self.refresh_table()
|
||||
|
Loading…
Reference in New Issue
Block a user