]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/wx/ListBooks.py
Feat(wx): Wrap long lines
[m_librarian.git] / m_librarian / wx / ListBooks.py
index fcf7eab52c9b7d3d112872a5dabab0f9a58105a0..0ef918e7f3b2610d10fe1ab8dcc4f2953613aabc 100644 (file)
@@ -108,6 +108,7 @@ class ListBooksPanel(GridPanel):
         row = 1
         self.book_by_row = book_by_row = {}  # map {row: book}
         self.toggle_rows = toggle_rows = {}  # map {row: [list of subrows]}
+        autowrap_renderer = wx.grid.GridCellAutoWrapStringRenderer()
         for author in sorted(books_by_author):
             grid.SetCellAlignment(row, 1, wx.ALIGN_LEFT, wx. ALIGN_CENTRE)
             grid.SetCellSize(row, 1, 1, len(columns)-1)
@@ -134,6 +135,12 @@ class ListBooksPanel(GridPanel):
                     row += 1
                     series = book.series
                 for col, col_name in enumerate(columns[1:]):
+                    if col_name in (
+                        'author1', 'author_list', 'authors',
+                        'genre1name', 'genre1title', 'genre_name_list',
+                        'genres', 'title',
+                    ):
+                        grid.SetCellRenderer(row, col+1, autowrap_renderer)
                     value = getattr(book, col_name)
                     if value is None:
                         value = u''
@@ -193,13 +200,20 @@ class ListBooksPanel(GridPanel):
         except Exception as e:
             self.report_error(str(e))
         else:
-            if not found_books:
+            if found_books:
+                self.report_success(u'Книги сохранены.')
+            else:
                 self.report_error(u'Не выбрано книг для сохранения.')
 
+    def report_success(self, message):
+        wx.MessageBox(
+            message, caption='m_Librarian download finished',
+            style=wx.OK, parent=self.Parent)
+
     def report_error(self, error):
         wx.MessageBox(
             error, caption='m_Librarian download error',
-            style=wx.OK|wx.ICON_ERROR, parent=self.Parent)
+            style=wx.OK | wx.ICON_ERROR, parent=self.Parent)
 
 
 class ListBooksWindow(GridWindow):