mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix grid view not updated immediately when marked books changed
Also fix translations for show marked books menu item.
This commit is contained in:
parent
a939e721d1
commit
7275d89cb5
@ -72,7 +72,7 @@ class MarkBooksAction(InterfaceAction):
|
|||||||
def about_to_show_menu(self):
|
def about_to_show_menu(self):
|
||||||
db = self.gui.current_db
|
db = self.gui.current_db
|
||||||
num = len(db.data.marked_ids)
|
num = len(db.data.marked_ids)
|
||||||
text = ngettext('Show marked book', 'Show marked books (%d)' % num, num)
|
text = _('Show marked book') if num == 1 else (_('Show marked books') + (' (%d)' % num))
|
||||||
self.show_marked_action.setText(text)
|
self.show_marked_action.setText(text)
|
||||||
|
|
||||||
def location_selected(self, loc):
|
def location_selected(self, loc):
|
||||||
|
@ -300,6 +300,10 @@ class AlternateViews(object):
|
|||||||
if self.current_book_state[0] is self.current_view:
|
if self.current_book_state[0] is self.current_view:
|
||||||
self.current_view.restore_current_book_state(self.current_book_state[1])
|
self.current_view.restore_current_book_state(self.current_book_state[1])
|
||||||
self.current_book_state = None
|
self.current_book_state = None
|
||||||
|
|
||||||
|
def marked_changed(self, old_marked, current_marked):
|
||||||
|
if self.current_view is not self.main_view:
|
||||||
|
self.current_view.marked_changed(old_marked, current_marked)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Rendering of covers {{{
|
# Rendering of covers {{{
|
||||||
@ -818,4 +822,11 @@ class GridView(QListView):
|
|||||||
self.set_current_row(row)
|
self.set_current_row(row)
|
||||||
self.select_rows((row,))
|
self.select_rows((row,))
|
||||||
self.scrollTo(self.model().index(row, 0), self.PositionAtCenter)
|
self.scrollTo(self.model().index(row, 0), self.PositionAtCenter)
|
||||||
|
|
||||||
|
def marked_changed(self, old_marked, current_marked):
|
||||||
|
changed = old_marked | current_marked
|
||||||
|
m = self.model()
|
||||||
|
for book_id in changed:
|
||||||
|
self.update(m.index(m.db.data.id_to_index(book_id), 0))
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -690,6 +690,7 @@ class BooksView(QTableView): # {{{
|
|||||||
self.alternate_views.set_database(db, stage=1)
|
self.alternate_views.set_database(db, stage=1)
|
||||||
|
|
||||||
def marked_changed(self, old_marked, current_marked):
|
def marked_changed(self, old_marked, current_marked):
|
||||||
|
self.alternate_views.marked_changed(old_marked, current_marked)
|
||||||
if bool(old_marked) == bool(current_marked):
|
if bool(old_marked) == bool(current_marked):
|
||||||
changed = old_marked | current_marked
|
changed = old_marked | current_marked
|
||||||
sections = tuple(map(self.model().db.data.id_to_index, changed))
|
sections = tuple(map(self.model().db.data.id_to_index, changed))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user