mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
d39e1b2178
@ -13,7 +13,7 @@ from PyQt4.Qt import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt, \
|
|||||||
|
|
||||||
ORG_NAME = 'KovidsBrain'
|
ORG_NAME = 'KovidsBrain'
|
||||||
APP_UID = 'libprs500'
|
APP_UID = 'libprs500'
|
||||||
from calibre.constants import islinux, iswindows, isfreebsd, isfrozen
|
from calibre.constants import islinux, iswindows, isfreebsd, isfrozen, isosx
|
||||||
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
||||||
from calibre.utils.localization import set_qt_translator
|
from calibre.utils.localization import set_qt_translator
|
||||||
from calibre.ebooks.metadata.meta import get_metadata, metadata_from_formats
|
from calibre.ebooks.metadata.meta import get_metadata, metadata_from_formats
|
||||||
@ -23,25 +23,45 @@ from calibre.utils.date import UNDEFINED_DATE
|
|||||||
# Setup gprefs {{{
|
# Setup gprefs {{{
|
||||||
gprefs = JSONConfig('gui')
|
gprefs = JSONConfig('gui')
|
||||||
|
|
||||||
gprefs.defaults['action-layout-menubar'] = ()
|
if isosx:
|
||||||
|
gprefs.defaults['action-layout-menubar'] = (
|
||||||
gprefs.defaults['action-layout-menubar-device'] = ()
|
'Add Books', 'Edit Metadata', 'Convert Books',
|
||||||
|
'Choose Library', 'Save To Disk', 'Preferences',
|
||||||
gprefs.defaults['action-layout-toolbar'] = (
|
'Help',
|
||||||
|
)
|
||||||
|
gprefs.defaults['action-layout-menubar-device'] = (
|
||||||
|
'Add Books', 'Edit Metadata', 'Convert Books',
|
||||||
|
'Location Manager', 'Send To Device',
|
||||||
|
'Save To Disk', 'Preferences', 'Help',
|
||||||
|
)
|
||||||
|
gprefs.defaults['action-layout-toolbar'] = (
|
||||||
|
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', None,
|
||||||
|
'Choose Library', 'Donate', None, 'Fetch News', 'Save To Disk',
|
||||||
|
'Connect Share', None, 'Remove Books',
|
||||||
|
)
|
||||||
|
gprefs.defaults['action-layout-toolbar-device'] = (
|
||||||
|
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View',
|
||||||
|
'Send To Device', None, None, 'Location Manager', None, None,
|
||||||
|
'Fetch News', 'Save To Disk', 'Connect Share', None,
|
||||||
|
'Remove Books',
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
gprefs.defaults['action-layout-menubar'] = ()
|
||||||
|
gprefs.defaults['action-layout-menubar-device'] = ()
|
||||||
|
gprefs.defaults['action-layout-toolbar'] = (
|
||||||
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', None,
|
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', None,
|
||||||
'Choose Library', 'Donate', None, 'Fetch News', 'Save To Disk',
|
'Choose Library', 'Donate', None, 'Fetch News', 'Save To Disk',
|
||||||
'Connect Share', None, 'Remove Books', None, 'Help', 'Preferences',
|
'Connect Share', None, 'Remove Books', None, 'Help', 'Preferences',
|
||||||
)
|
)
|
||||||
|
gprefs.defaults['action-layout-toolbar-device'] = (
|
||||||
gprefs.defaults['action-layout-toolbar-child'] = ()
|
|
||||||
|
|
||||||
gprefs.defaults['action-layout-toolbar-device'] = (
|
|
||||||
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View',
|
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View',
|
||||||
'Send To Device', None, None, 'Location Manager', None, None,
|
'Send To Device', None, None, 'Location Manager', None, None,
|
||||||
'Fetch News', 'Save To Disk', 'Connect Share', None,
|
'Fetch News', 'Save To Disk', 'Connect Share', None,
|
||||||
'Remove Books', None, 'Help', 'Preferences',
|
'Remove Books', None, 'Help', 'Preferences',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
gprefs.defaults['action-layout-toolbar-child'] = ()
|
||||||
|
|
||||||
gprefs.defaults['action-layout-context-menu'] = (
|
gprefs.defaults['action-layout-context-menu'] = (
|
||||||
'Edit Metadata', 'Send To Device', 'Save To Disk',
|
'Edit Metadata', 'Send To Device', 'Save To Disk',
|
||||||
'Connect Share', 'Copy To Library', None,
|
'Connect Share', 'Copy To Library', None,
|
||||||
|
@ -382,16 +382,13 @@ class ToolBar(QToolBar): # {{{
|
|||||||
bar.added_actions.append(ac)
|
bar.added_actions.append(ac)
|
||||||
bar.setup_tool_button(bar, ac, QToolButton.MenuButtonPopup)
|
bar.setup_tool_button(bar, ac, QToolButton.MenuButtonPopup)
|
||||||
elif what == 'Donate':
|
elif what == 'Donate':
|
||||||
|
self.d_widget = QWidget()
|
||||||
|
self.d_widget.setLayout(QVBoxLayout())
|
||||||
|
self.d_widget.layout().addWidget(self.donate_button)
|
||||||
if isosx:
|
if isosx:
|
||||||
bar.addAction(self.gui.donate_action)
|
self.d_widget.setStyleSheet('QWidget, QToolButton {background-color: none; border: none; }')
|
||||||
ch = self.setup_tool_button(bar, self.gui.donate_action)
|
bar.addWidget(self.d_widget)
|
||||||
ch.setText(_('Donate'))
|
self.showing_donate = True
|
||||||
else:
|
|
||||||
self.d_widget = QWidget()
|
|
||||||
self.d_widget.setLayout(QVBoxLayout())
|
|
||||||
self.d_widget.layout().addWidget(self.donate_button)
|
|
||||||
bar.addWidget(self.d_widget)
|
|
||||||
self.showing_donate = True
|
|
||||||
elif what in self.gui.iactions:
|
elif what in self.gui.iactions:
|
||||||
action = self.gui.iactions[what]
|
action = self.gui.iactions[what]
|
||||||
bar.addAction(action.qaction)
|
bar.addAction(action.qaction)
|
||||||
|
@ -298,10 +298,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
# Ensure preferences are showing in either the toolbar or
|
# Ensure preferences are showing in either the toolbar or
|
||||||
# the menubar.
|
# the menubar.
|
||||||
pref_in_toolbar = self.models['toolbar'][1].has_action('Preferences')
|
pref_in_toolbar = self.models['toolbar'][1].has_action('Preferences')
|
||||||
|
pref_in_menubar = self.models['menubar'][1].has_action('Preferences')
|
||||||
lm_in_toolbar = self.models['toolbar-device'][1].has_action('Location Manager')
|
lm_in_toolbar = self.models['toolbar-device'][1].has_action('Location Manager')
|
||||||
if not pref_in_toolbar:
|
lm_in_menubar = self.models['menubar-device'][1].has_action('Location Manager')
|
||||||
|
if not pref_in_toolbar and not pref_in_menubar:
|
||||||
self.models['menubar'][1].add(['Preferences'])
|
self.models['menubar'][1].add(['Preferences'])
|
||||||
if not lm_in_toolbar:
|
if not lm_in_toolbar and not lm_in_menubar:
|
||||||
self.models['menubar-device'][1].add(['Location Manager'])
|
self.models['menubar-device'][1].add(['Location Manager'])
|
||||||
|
|
||||||
# Save data.
|
# Save data.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user