mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Copy to library menu move copy by path to top for more than 50 libraries
Copy to library menu: Move the choose library by path option to the start of the menu if there are more than 50 libraries.
This commit is contained in:
parent
7e56f63c33
commit
e360e989cf
@ -280,6 +280,9 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
return
|
return
|
||||||
db = self.gui.library_view.model().db
|
db = self.gui.library_view.model().db
|
||||||
locations = list(self.stats.locations(db))
|
locations = list(self.stats.locations(db))
|
||||||
|
if len(locations) > 50:
|
||||||
|
self.menu.addAction(_('Choose library by path...'), self.choose_library)
|
||||||
|
self.menu.addSeparator()
|
||||||
for name, loc in locations:
|
for name, loc in locations:
|
||||||
self.menu.addAction(name, partial(self.copy_to_library,
|
self.menu.addAction(name, partial(self.copy_to_library,
|
||||||
loc))
|
loc))
|
||||||
@ -287,7 +290,8 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
partial(self.copy_to_library, loc, delete_after=True))
|
partial(self.copy_to_library, loc, delete_after=True))
|
||||||
self.menu.addSeparator()
|
self.menu.addSeparator()
|
||||||
|
|
||||||
self.menu.addAction(_('Choose library by path...'), self.choose_library)
|
if len(locations) <= 50:
|
||||||
|
self.menu.addAction(_('Choose library by path...'), self.choose_library)
|
||||||
self.qaction.setVisible(bool(locations))
|
self.qaction.setVisible(bool(locations))
|
||||||
|
|
||||||
def choose_library(self):
|
def choose_library(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user