X-Git-Url: https://git.phdru.name/?p=m_librarian.git;a=blobdiff_plain;f=m_librarian%2Fwx%2FListBooks.py;fp=m_librarian%2Fwx%2FListBooks.py;h=63d2b7ca2bb5817375204215bb21ec2a1592900a;hp=14963c1d5d6806982b0ce06891715b18081e474a;hb=9305df13fd2c3a935b2de82a28eea4cb6989e8e8;hpb=f1e5552af5ec0775c4d3569dda92b4ac9eb41d7b diff --git a/m_librarian/wx/ListBooks.py b/m_librarian/wx/ListBooks.py index 14963c1..63d2b7c 100644 --- a/m_librarian/wx/ListBooks.py +++ b/m_librarian/wx/ListBooks.py @@ -129,9 +129,27 @@ class ListBooksPanel(GridPanel): row += 1 grid.AutoSizeColumns() grid.AutoSizeRows() + grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnClick) + + def toggleCB(self, row): + value = self.grid.GetCellValue(row, 0) + if value: + value = '' + else: + value = '1' + self.grid.SetCellValue(row, 0, value) + + def OnClick(self, event): + if event.GetCol() > 0: + return + row = event.GetRow() + self.toggleCB(row) def OnDClick(self, event): - pass + if event.GetCol() == 0: + return + row = event.GetRow() + self.toggleCB(row) def OnKeyDown(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE: