From: Oleg Broytman Date: Tue, 9 Jan 2024 01:38:54 +0000 (+0300) Subject: Feat(wx/books): Display author on a separate row X-Git-Tag: 0.3.0~9^2~8 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=e98603cf1bd1a7a5ae24d96a3ad69e21a26ff67a;p=m_librarian.git Feat(wx/books): Display author on a separate row [skip ci] --- diff --git a/m_librarian/wx/ListBooks.py b/m_librarian/wx/ListBooks.py index 4cfabcd..b027de0 100644 --- a/m_librarian/wx/ListBooks.py +++ b/m_librarian/wx/ListBooks.py @@ -16,7 +16,7 @@ class ListBooksPanel(GridPanel): for author in books_by_author: books = books_by_author[author] series = {book.series for book in books} - total_rows += len(books) + len(series) + total_rows += len(books) + len(series) + 1 grid = self.grid grid.CreateGrid(total_rows, len(columns)) grid.EnableEditing(False) @@ -32,6 +32,10 @@ class ListBooksPanel(GridPanel): grid.SetColAttr(col, cell_attr) row = 0 for author in sorted(books_by_author): + grid.SetCellAlignment(row, 0, wx.ALIGN_LEFT, wx. ALIGN_CENTRE) + grid.SetCellSize(row, 0, 1, len(columns)) + grid.SetCellValue(row, 0, u'%s' % (author,)) + row += 1 books = books_by_author[author] series = None for book in books: @@ -40,9 +44,11 @@ class ListBooksPanel(GridPanel): value = book.series else: value = u'Вне серий' - grid.SetCellAlignment(row, 0, wx.ALIGN_LEFT, wx. ALIGN_CENTRE) + grid.SetCellAlignment(row, 0, + wx.ALIGN_LEFT, wx. ALIGN_CENTRE) grid.SetCellSize(row, 0, 1, len(columns)) - grid.SetCellValue(row, 0, u'%s — %s' % (book.author1, value)) + grid.SetCellValue(row, 0, + u'%s — %s' % (book.author1, value)) row += 1 series = book.series for col, col_name in enumerate(columns): @@ -65,6 +71,7 @@ class ListBooksPanel(GridPanel): else: event.Skip() + class ListBooksWindow(GridWindow): session_config_section_name = 'list_books'