mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix book count in tooltip of choose library button not updating
Fixes #1208217 [library toolbar button not updated on book deletion](https://bugs.launchpad.net/calibre/+bug/1208217)
This commit is contained in:
parent
7d26a22a46
commit
2e3a0e57bf
@ -292,16 +292,22 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
path = path.replace(os.sep, '/')
|
path = path.replace(os.sep, '/')
|
||||||
return self.stats.pretty(path)
|
return self.stats.pretty(path)
|
||||||
|
|
||||||
|
def update_tooltip(self, count):
|
||||||
|
tooltip = self.action_spec[2] + '\n\n' + _('{0} [{1} books]').format(
|
||||||
|
getattr(self, 'last_lname', ''), count)
|
||||||
|
a = self.qaction
|
||||||
|
a.setToolTip(tooltip)
|
||||||
|
a.setStatusTip(tooltip)
|
||||||
|
a.setWhatsThis(tooltip)
|
||||||
|
|
||||||
def library_changed(self, db):
|
def library_changed(self, db):
|
||||||
lname = self.stats.library_used(db)
|
lname = self.stats.library_used(db)
|
||||||
tooltip = self.action_spec[2] + '\n\n' + _('{0} [{1} books]').format(lname, db.count())
|
self.last_lname = lname
|
||||||
if len(lname) > 16:
|
if len(lname) > 16:
|
||||||
lname = lname[:16] + u'…'
|
lname = lname[:16] + u'…'
|
||||||
a = self.qaction
|
a = self.qaction
|
||||||
a.setText(lname)
|
a.setText(lname)
|
||||||
a.setToolTip(tooltip)
|
self.update_tooltip(db.count())
|
||||||
a.setStatusTip(tooltip)
|
|
||||||
a.setWhatsThis(tooltip)
|
|
||||||
self.build_menus()
|
self.build_menus()
|
||||||
state = self.view_state_map.get(self.stats.canonicalize_path(
|
state = self.view_state_map.get(self.stats.canonicalize_path(
|
||||||
db.library_path), None)
|
db.library_path), None)
|
||||||
@ -557,7 +563,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
self.switch_requested(self.qs_locations[idx])
|
self.switch_requested(self.qs_locations[idx])
|
||||||
|
|
||||||
def count_changed(self, new_count):
|
def count_changed(self, new_count):
|
||||||
pass
|
self.update_tooltip(new_count)
|
||||||
|
|
||||||
def choose_library(self, *args):
|
def choose_library(self, *args):
|
||||||
if not self.change_library_allowed():
|
if not self.change_library_allowed():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user