feat(da07): wire revert writer into the four setting-history call sites
This commit is contained in:
@@ -263,13 +263,14 @@ class ChannelsTab(TableTab):
|
||||
return []
|
||||
ch = self._channels[row]
|
||||
from cim_suite.core.repository.ui.history_dialog import setting_history_action
|
||||
from ..domain.repo_snapshot import device_key, station_mac
|
||||
from ..domain.repo_snapshot import device_key, setting_writer, station_mac
|
||||
|
||||
dk = device_key(self._ctrl, ch.device)
|
||||
return [
|
||||
setting_history_action(
|
||||
self, self._repo, lambda: station_mac(self._ctrl),
|
||||
f"da07:dev:{dk}:ch:{ch.channel}:",
|
||||
writer_for=lambda key: setting_writer(self._ctrl, key),
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@@ -161,12 +161,13 @@ class DevicesTab(TableTab):
|
||||
]
|
||||
if self._repo is not None:
|
||||
from cim_suite.core.repository.ui.history_dialog import setting_history_action
|
||||
from ..domain.repo_snapshot import device_key, station_mac
|
||||
from ..domain.repo_snapshot import device_key, setting_writer, station_mac
|
||||
|
||||
actions.append(
|
||||
setting_history_action(
|
||||
self, self._repo, lambda: station_mac(self._ctrl),
|
||||
f"da07:dev:{device_key(self._ctrl, idx)}:",
|
||||
writer_for=lambda key: setting_writer(self._ctrl, key),
|
||||
)
|
||||
)
|
||||
return actions
|
||||
|
||||
@@ -166,13 +166,14 @@ class MainWindow(QMainWindow):
|
||||
def _open_setting_history(self) -> None:
|
||||
from cim_suite.core.repository.ui.history_dialog import setting_history_action
|
||||
|
||||
from ..domain.repo_snapshot import station_mac
|
||||
from ..domain.repo_snapshot import setting_writer, station_mac
|
||||
|
||||
if self._repo is None:
|
||||
return
|
||||
_label, open_dialog = setting_history_action(
|
||||
self, self._repo, lambda: station_mac(self._ctrl), None,
|
||||
title="Station setting history…",
|
||||
writer_for=lambda key: setting_writer(self._ctrl, key),
|
||||
)
|
||||
open_dialog()
|
||||
|
||||
|
||||
@@ -46,12 +46,13 @@ class StationTab(TableTab):
|
||||
return []
|
||||
setting_row = self._lines[row].row
|
||||
from cim_suite.core.repository.ui.history_dialog import setting_history_action
|
||||
from ..domain.repo_snapshot import station_mac
|
||||
from ..domain.repo_snapshot import setting_writer, station_mac
|
||||
|
||||
return [
|
||||
setting_history_action(
|
||||
self, self._repo, lambda: station_mac(self._ctrl),
|
||||
f"da07:station:{setting_row}:",
|
||||
writer_for=lambda key: setting_writer(self._ctrl, key),
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user