Migration progressed to a point where calibre at least starts

This commit is contained in:
Kovid Goyal 2010-08-13 19:58:27 -06:00
parent 290dd86177
commit 4b8ba2c740
8 changed files with 15 additions and 12 deletions

View File

@ -662,4 +662,4 @@ plugins += [ActionAdd, ActionFetchAnnotations, ActionGenerateCatalog,
ActionFetchNews, ActionSaveToDisk, ActionShowBookDetails,
ActionRestart, ActionOpenFolder, ActionConnectShare,
ActionSendToDevice, ActionHelp, ActionPreferences, ActionSimilarBooks,
ActionAddToLibrary, ActionEditCollections]
ActionAddToLibrary, ActionEditCollections, ActionChooseLibrary]

View File

@ -16,7 +16,7 @@ class InterfaceAction(QObject):
name = 'Implement me'
priority = 1
positions = frozenset([])
popup_type = QToolButton.MenuPopup
popup_type = QToolButton.MenuButtonPopup
#: Of the form: (text, icon_path, tooltip, keyboard shortcut)
#: icon, tooltip and keybard shortcut can be None

View File

@ -10,11 +10,11 @@ from calibre.gui2.actions import InterfaceAction
class ChooseLibraryAction(InterfaceAction):
name = 'Choose Library'
action_spec = (_('%d books')%0, 'lt.png',
action_spec = (_('%d books'), 'lt.png',
_('Choose calibre library to work with'), None)
def genesis(self):
pass
self.count_changed(0)
def location_selected(self, loc):
enabled = loc == 'library'

View File

@ -11,6 +11,7 @@ from PyQt4.Qt import QToolButton, QMenu, pyqtSignal, QIcon
from calibre.gui2.actions import InterfaceAction
from calibre.utils.smtp import config as email_config
from calibre.constants import iswindows, isosx
class ShareConnMenu(QMenu): # {{{
@ -30,6 +31,8 @@ class ShareConnMenu(QMenu): # {{{
mitem.setEnabled(True)
mitem.triggered.connect(lambda x : self.connect_to_itunes.emit())
self.connect_to_itunes_action = mitem
if not (iswindows or isosx):
mitem.setVisible(False)
self.addSeparator()
self.toggle_server_action = \
self.addAction(QIcon(I('network-server.svg')),

View File

@ -21,8 +21,8 @@ class SimilarBooksAction(InterfaceAction):
for text, icon, target, shortcut in [
(_('Books by same author'), 'user_profile.svg', 'authors', _('Alt+A')),
(_('Books in this series'), 'books_in_series.svg', 'series', _('Alt+S')),
(_('Books by this publisher'), 'publisher.png', 'publisher', _('Alt+P'))
(_('Books with the same tags'), 'tags.svg', 'tag', _('Alt+T'))]:
(_('Books by this publisher'), 'publisher.png', 'publisher', _('Alt+P')),
(_('Books with the same tags'), 'tags.svg', 'tag', _('Alt+T')),]:
ac = self.create_action(spec=(text, icon, None, shortcut),
attr=target)
m.addAction(ac)

View File

@ -44,9 +44,9 @@ class LibraryViewMixin(object): # {{{
def populate_menu(m, items):
for what in items:
if what is None:
lm.addSeparator()
m.addSeparator()
elif what in self.iactions:
lm.addAction(self.iactions[what].qaction)
m.addAction(self.iactions[what].qaction)
populate_menu(lm, LIBRARY_CONTEXT_MENU)
dm = QMenu(self)
populate_menu(dm, DEVICE_CONTEXT_MENU)

View File

@ -258,7 +258,7 @@ class ToolBar(QToolBar): # {{{
elif what == 'Location Manager':
for ac in self.location_manager.available_actions:
self.addAction(ac)
self.setup_tool_button(ac, QToolButton.MenuPopup)
self.setup_tool_button(ac, QToolButton.MenuButtonPopup)
elif what == 'Donate' and config['show_donate_button']:
self.addWidget(self.d_widget)
elif what in self.gui.iactions:
@ -293,7 +293,6 @@ class ToolBar(QToolBar): # {{{
class MainWindowMixin(object):
def __init__(self, db):
self.device_connected = None
self.setObjectName('MainWindow')
self.setWindowIcon(QIcon(I('library.png')))
self.setWindowTitle(__appname__)

View File

@ -24,7 +24,7 @@ from calibre.ptempfile import PersistentTemporaryFile
from calibre.utils.config import prefs, dynamic
from calibre.utils.ipc.server import Server
from calibre.library.database2 import LibraryDatabase2
from calibre.customize import interface_actions
from calibre.customize.ui import interface_actions
from calibre.gui2 import error_dialog, GetMetadata, open_local_file, \
gprefs, max_available_height, config, info_dialog, Dispatcher
from calibre.gui2.cover_flow import CoverFlowMixin
@ -94,6 +94,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
def __init__(self, opts, parent=None):
MainWindow.__init__(self, opts, parent)
self.opts = opts
self.device_connected = None
acmap = {}
for action in interface_actions():
mod, cls = action.actual_plugin.split(':')
@ -124,9 +125,9 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
self.another_instance_wants_to_talk)
self.check_messages_timer.start(1000)
MainWindowMixin.__init__(self, db)
for ac in self.iactions.values():
ac.do_genesis()
MainWindowMixin.__init__(self, db)
# Jobs Button {{{
self.job_manager = JobManager()