Skip to content

Commit

Permalink
bankedit.py: remove redundant memory_changed function, now that _cell…
Browse files Browse the repository at this point in the history
…_changing handles both cases
  • Loading branch information
Patronics committed Dec 16, 2024
1 parent 48c3315 commit 35e5768
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions chirp/wxui/bankedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self, radio, *a, **k):
self._memory_cache = {}

self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGING, self._cell_changing)
self._grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self._memory_changed)
self._grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self._cell_changing)
self._grid.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self._label_click)
self._grid.GetGridColLabelWindow().Bind(wx.EVT_MOTION,
self._colheader_mouseover)
Expand Down Expand Up @@ -229,6 +229,8 @@ def _cell_changing(self, event):
self._change_memory_mapping(self.row2mem(row),
self.col2bank(col),
gridCellValue != BANK_SET_VALUE)
else:
event.Skip()

def _change_memory_index(self, number, index):
for i, bank_index in enumerate(self._bank_index_order):
Expand All @@ -245,21 +247,6 @@ def _change_memory_index(self, number, index):

wx.PostEvent(self, common.EditorChanged(self.GetId()))

@common.error_proof()
def _memory_changed(self, event):
row = event.GetRow()
col = event.GetCol()
value = self._grid.GetCellValue(row, col)

if isinstance(self._col_defs[col], ChirpBankIndexColumn):
event.Skip()
elif col < self._meta_cols:
event.Skip()
else:
self._change_memory_mapping(self.row2mem(row),
self.col2bank(col),
value != BANK_SET_VALUE)

def _change_memory_mapping(self, number, bank, present):
mem = self._memory_cache[number]
bank = self._bank_indexes[self._bank_index_order[bank]]
Expand Down

0 comments on commit 35e5768

Please sign in to comment.