update error list when report changes (esp. is viewed)
This commit is contained in:
parent
3221b14294
commit
009d0598d0
|
@ -82,7 +82,7 @@ class ErrorReport(metaclass=urwid.MetaSignals):
|
||||||
def from_file(cls, controller, fpath):
|
def from_file(cls, controller, fpath):
|
||||||
base = os.path.splitext(os.path.basename(fpath))[0]
|
base = os.path.splitext(os.path.basename(fpath))[0]
|
||||||
report = cls(
|
report = cls(
|
||||||
controller, base, pr=apport.Report(),
|
controller, base, pr=apport.Report(date='???'),
|
||||||
state=ErrorReportState.LOADING, file=open(fpath, 'rb'))
|
state=ErrorReportState.LOADING, file=open(fpath, 'rb'))
|
||||||
try:
|
try:
|
||||||
fp = open(report.meta_path, 'r')
|
fp = open(report.meta_path, 'r')
|
||||||
|
@ -179,6 +179,7 @@ class ErrorReport(metaclass=urwid.MetaSignals):
|
||||||
|
|
||||||
def mark_seen(self):
|
def mark_seen(self):
|
||||||
self.set_meta("seen", True)
|
self.set_meta("seen", True)
|
||||||
|
urwid.emit_signal(self, "changed")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def kind(self):
|
def kind(self):
|
||||||
|
|
|
@ -188,8 +188,11 @@ class ErrorReportListStretchy(Stretchy):
|
||||||
Text(_("STATUS")),
|
Text(_("STATUS")),
|
||||||
Text(""),
|
Text(""),
|
||||||
])]
|
])]
|
||||||
|
self.report_to_row = {}
|
||||||
for report in self.ec.reports:
|
for report in self.ec.reports:
|
||||||
rows.append(self.row_for_report(report))
|
connect_signal(report, "changed", self._report_changed, report)
|
||||||
|
r = self.report_to_row[report] = self.row_for_report(report)
|
||||||
|
rows.append(r)
|
||||||
self.table = TablePile(rows, colspecs={1: ColSpec(can_shrink=True)})
|
self.table = TablePile(rows, colspecs={1: ColSpec(can_shrink=True)})
|
||||||
widgets = [
|
widgets = [
|
||||||
Text(_("Select an error report to view:")),
|
Text(_("Select an error report to view:")),
|
||||||
|
@ -223,3 +226,13 @@ class ErrorReportListStretchy(Stretchy):
|
||||||
def row_for_report(self, report):
|
def row_for_report(self, report):
|
||||||
return Color.menu_button(
|
return Color.menu_button(
|
||||||
TableRow(self.cells_for_report(report)))
|
TableRow(self.cells_for_report(report)))
|
||||||
|
|
||||||
|
def _report_changed(self, report):
|
||||||
|
old_r = self.report_to_row.get(report)
|
||||||
|
if old_r is None:
|
||||||
|
return
|
||||||
|
old_r = old_r.base_widget
|
||||||
|
new_cells = self.cells_for_report(report)
|
||||||
|
for (s1, old_c), new_c in zip(old_r.cells, new_cells):
|
||||||
|
old_c.set_text(new_c.text)
|
||||||
|
self.table.invalidate()
|
||||||
|
|
Loading…
Reference in New Issue