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:
Kovid Goyal 2011-10-03 11:59:35 -06:00
parent 47efdc1d04
commit 6d825af349
11 changed files with 19 additions and 11 deletions

View File

@ -18,11 +18,15 @@ class GenerateCatalogAction(InterfaceAction):
name = 'Generate Catalog'
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):
self.qaction.triggered.connect(self.generate_catalog)
def location_selected(self, loc):
enabled = loc == 'library'
self.qaction.setEnabled(enabled)
def generate_catalog(self):
rows = self.gui.library_view.selectionModel().selectedRows()
if not rows or len(rows) < 2:

View File

@ -138,7 +138,7 @@ class ChooseLibraryAction(InterfaceAction):
name = 'Choose Library'
action_spec = (_('Choose Library'), 'lt.png',
_('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_menu_clone_qaction = _('Switch/create library...')

View File

@ -20,7 +20,7 @@ class ConvertAction(InterfaceAction):
name = 'Convert Books'
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_add_menu = True

View File

@ -127,7 +127,7 @@ class CopyToLibraryAction(InterfaceAction):
action_spec = (_('Copy to library'), 'lt.png',
_('Copy selected books to the specified library'), None)
popup_type = QToolButton.InstantPopup
dont_add_to = frozenset(['toolbar-device', 'context-menu-device'])
dont_add_to = frozenset(['context-menu-device'])
action_type = 'current'
action_add_menu = True

View File

@ -24,7 +24,7 @@ class ShareConnMenu(QMenu): # {{{
config_email = 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):
QMenu.__init__(self, parent)

View File

@ -11,7 +11,7 @@ class NextMatchAction(InterfaceAction):
name = 'Move to next highlighted book'
action_spec = (_('Move to next match'), 'arrow-down.png',
_('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'
def genesis(self):

View File

@ -13,7 +13,7 @@ class OpenFolderAction(InterfaceAction):
name = 'Open Folder'
action_spec = (_('Open containing folder'), 'document_open.png', None,
_('O'))
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
dont_add_to = frozenset(['context-menu-device'])
action_type = 'current'
def genesis(self):

View File

@ -16,11 +16,15 @@ class PickRandomAction(InterfaceAction):
name = 'Pick Random Book'
action_spec = (_('Pick a random book'), 'random.png',
'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):
self.qaction.triggered.connect(self.pick_random)
def location_selected(self, loc):
enabled = loc == 'library'
self.qaction.setEnabled(enabled)
def pick_random(self):
pick = random.randint(0, self.gui.library_view.model().rowCount(None))
self.gui.library_view.set_current_row(pick)

View File

@ -15,7 +15,7 @@ class ShowBookDetailsAction(InterfaceAction):
name = 'Show Book Details'
action_spec = (_('Show book details'), 'dialog_information.png', None,
_('I'))
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
dont_add_to = frozenset(['context-menu-device'])
action_type = 'current'
def genesis(self):

View File

@ -14,7 +14,7 @@ class ShowQuickviewAction(InterfaceAction):
name = 'Show quickview'
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'
current_instance = None

View File

@ -17,7 +17,7 @@ class TweakEpubAction(InterfaceAction):
action_spec = (_('Tweak ePub'), 'trim.png',
_('Make small changes to ePub format books'),
_('T'))
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
dont_add_to = frozenset(['context-menu-device'])
action_type = 'current'
def genesis(self):