mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Enable adding of various actions to the toolbar when device is connected (they had been erroneously marked as being non-addable)
This commit is contained in:
parent
47efdc1d04
commit
6d825af349
@ -18,11 +18,15 @@ class GenerateCatalogAction(InterfaceAction):
|
|||||||
|
|
||||||
name = 'Generate Catalog'
|
name = 'Generate Catalog'
|
||||||
action_spec = (_('Create catalog'), 'catalog.png', 'Catalog builder', ())
|
action_spec = (_('Create catalog'), 'catalog.png', 'Catalog builder', ())
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
self.qaction.triggered.connect(self.generate_catalog)
|
self.qaction.triggered.connect(self.generate_catalog)
|
||||||
|
|
||||||
|
def location_selected(self, loc):
|
||||||
|
enabled = loc == 'library'
|
||||||
|
self.qaction.setEnabled(enabled)
|
||||||
|
|
||||||
def generate_catalog(self):
|
def generate_catalog(self):
|
||||||
rows = self.gui.library_view.selectionModel().selectedRows()
|
rows = self.gui.library_view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) < 2:
|
if not rows or len(rows) < 2:
|
||||||
|
@ -138,7 +138,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
name = 'Choose Library'
|
name = 'Choose Library'
|
||||||
action_spec = (_('Choose Library'), 'lt.png',
|
action_spec = (_('Choose Library'), 'lt.png',
|
||||||
_('Choose calibre library to work with'), None)
|
_('Choose calibre library to work with'), None)
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_add_menu = True
|
action_add_menu = True
|
||||||
action_menu_clone_qaction = _('Switch/create library...')
|
action_menu_clone_qaction = _('Switch/create library...')
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class ConvertAction(InterfaceAction):
|
|||||||
|
|
||||||
name = 'Convert Books'
|
name = 'Convert Books'
|
||||||
action_spec = (_('Convert books'), 'convert.png', None, _('C'))
|
action_spec = (_('Convert books'), 'convert.png', None, _('C'))
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
action_add_menu = True
|
action_add_menu = True
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
action_spec = (_('Copy to library'), 'lt.png',
|
action_spec = (_('Copy to library'), 'lt.png',
|
||||||
_('Copy selected books to the specified library'), None)
|
_('Copy selected books to the specified library'), None)
|
||||||
popup_type = QToolButton.InstantPopup
|
popup_type = QToolButton.InstantPopup
|
||||||
dont_add_to = frozenset(['toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
action_add_menu = True
|
action_add_menu = True
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class ShareConnMenu(QMenu): # {{{
|
|||||||
|
|
||||||
config_email = pyqtSignal()
|
config_email = pyqtSignal()
|
||||||
toggle_server = pyqtSignal()
|
toggle_server = pyqtSignal()
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QMenu.__init__(self, parent)
|
QMenu.__init__(self, parent)
|
||||||
|
@ -11,7 +11,7 @@ class NextMatchAction(InterfaceAction):
|
|||||||
name = 'Move to next highlighted book'
|
name = 'Move to next highlighted book'
|
||||||
action_spec = (_('Move to next match'), 'arrow-down.png',
|
action_spec = (_('Move to next match'), 'arrow-down.png',
|
||||||
_('Move to next highlighted match'), [_('N'), _('F3')])
|
_('Move to next highlighted match'), [_('N'), _('F3')])
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
|
@ -13,7 +13,7 @@ class OpenFolderAction(InterfaceAction):
|
|||||||
name = 'Open Folder'
|
name = 'Open Folder'
|
||||||
action_spec = (_('Open containing folder'), 'document_open.png', None,
|
action_spec = (_('Open containing folder'), 'document_open.png', None,
|
||||||
_('O'))
|
_('O'))
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
|
@ -16,11 +16,15 @@ class PickRandomAction(InterfaceAction):
|
|||||||
name = 'Pick Random Book'
|
name = 'Pick Random Book'
|
||||||
action_spec = (_('Pick a random book'), 'random.png',
|
action_spec = (_('Pick a random book'), 'random.png',
|
||||||
'Select a random book from your calibre library', ())
|
'Select a random book from your calibre library', ())
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
self.qaction.triggered.connect(self.pick_random)
|
self.qaction.triggered.connect(self.pick_random)
|
||||||
|
|
||||||
|
def location_selected(self, loc):
|
||||||
|
enabled = loc == 'library'
|
||||||
|
self.qaction.setEnabled(enabled)
|
||||||
|
|
||||||
def pick_random(self):
|
def pick_random(self):
|
||||||
pick = random.randint(0, self.gui.library_view.model().rowCount(None))
|
pick = random.randint(0, self.gui.library_view.model().rowCount(None))
|
||||||
self.gui.library_view.set_current_row(pick)
|
self.gui.library_view.set_current_row(pick)
|
||||||
|
@ -15,7 +15,7 @@ class ShowBookDetailsAction(InterfaceAction):
|
|||||||
name = 'Show Book Details'
|
name = 'Show Book Details'
|
||||||
action_spec = (_('Show book details'), 'dialog_information.png', None,
|
action_spec = (_('Show book details'), 'dialog_information.png', None,
|
||||||
_('I'))
|
_('I'))
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
|
@ -14,7 +14,7 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
|
|
||||||
name = 'Show quickview'
|
name = 'Show quickview'
|
||||||
action_spec = (_('Show quickview'), 'search.png', None, _('Q'))
|
action_spec = (_('Show quickview'), 'search.png', None, _('Q'))
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
current_instance = None
|
current_instance = None
|
||||||
|
@ -17,7 +17,7 @@ class TweakEpubAction(InterfaceAction):
|
|||||||
action_spec = (_('Tweak ePub'), 'trim.png',
|
action_spec = (_('Tweak ePub'), 'trim.png',
|
||||||
_('Make small changes to ePub format books'),
|
_('Make small changes to ePub format books'),
|
||||||
_('T'))
|
_('T'))
|
||||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user