mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Store: add missed files. Add more quick functions for listing stores and which ones are enabled.
This commit is contained in:
parent
894affa1b4
commit
ab55a25674
@ -216,9 +216,26 @@ def store_plugins():
|
|||||||
customization = config['plugin_customization']
|
customization = config['plugin_customization']
|
||||||
for plugin in _initialized_plugins:
|
for plugin in _initialized_plugins:
|
||||||
if isinstance(plugin, Store):
|
if isinstance(plugin, Store):
|
||||||
if not is_disabled(plugin):
|
|
||||||
plugin.site_customization = customization.get(plugin.name, '')
|
plugin.site_customization = customization.get(plugin.name, '')
|
||||||
yield plugin
|
yield plugin
|
||||||
|
|
||||||
|
def available_store_plugins():
|
||||||
|
for plugin in store_plugins():
|
||||||
|
if not is_disabled(plugin):
|
||||||
|
yield plugin
|
||||||
|
|
||||||
|
def stores():
|
||||||
|
stores = set([])
|
||||||
|
for plugin in store_plugins():
|
||||||
|
stores.add(plugin.name)
|
||||||
|
return stores
|
||||||
|
|
||||||
|
def available_stores():
|
||||||
|
stores = set([])
|
||||||
|
for plugin in available_store_plugins():
|
||||||
|
stores.add(plugin.name)
|
||||||
|
return stores
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Metadata read/write {{{
|
# Metadata read/write {{{
|
||||||
|
0
src/calibre/gui2/store/config/__init__.py
Normal file
0
src/calibre/gui2/store/config/__init__.py
Normal file
45
src/calibre/gui2/store/config/search_widget.py
Normal file
45
src/calibre/gui2/store/config/search_widget.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from PyQt4.Qt import QWidget
|
||||||
|
|
||||||
|
from calibre.gui2 import JSONConfig
|
||||||
|
from calibre.gui2.store.config.search_widget_ui import Ui_Form
|
||||||
|
|
||||||
|
class StoreConfigWidget(QWidget, Ui_Form):
|
||||||
|
|
||||||
|
def __init__(self, config=None):
|
||||||
|
QWidget.__init__(self)
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.config = JSONConfig('store/search') if not config else config
|
||||||
|
|
||||||
|
# These default values should be the same as in
|
||||||
|
# calibre.gui2.store.search.search:SearchDialog.load_settings
|
||||||
|
# Seconds
|
||||||
|
self.opt_timeout.setValue(self.config.get('timeout', 75))
|
||||||
|
self.opt_hang_time.setValue(self.config.get('hang_time', 75))
|
||||||
|
|
||||||
|
self.opt_max_results.setValue(self.config.get('max_results', 10))
|
||||||
|
self.opt_open_external.setChecked(self.config.get('open_external', True))
|
||||||
|
|
||||||
|
# Number of threads to run for each type of operation
|
||||||
|
self.opt_search_thread_count.setValue(self.config.get('search_thread_count', 4))
|
||||||
|
self.opt_cache_thread_count.setValue(self.config.get('cache_thread_count', 2))
|
||||||
|
self.opt_cover_thread_count.setValue(self.config.get('cover_thread_count', 2))
|
||||||
|
self.opt_details_thread_count.setValue(self.config.get('details_thread_count', 4))
|
||||||
|
|
||||||
|
def save_settings(self):
|
||||||
|
self.config['timeout'] = self.opt_timeout.value()
|
||||||
|
self.config['hang_time'] = self.opt_hang_time.value()
|
||||||
|
self.config['max_results'] = self.opt_max_results.value()
|
||||||
|
self.config['open_external'] = self.opt_open_external.isChecked()
|
||||||
|
self.config['search_thread_count'] = self.opt_search_thread_count.value()
|
||||||
|
self.config['cache_thread_count'] = self.opt_cache_thread_count.value()
|
||||||
|
self.config['cover_thread_count'] = self.opt_cover_thread_count.value()
|
||||||
|
self.config['details_thread_count'] = self.opt_details_thread_count.value()
|
162
src/calibre/gui2/store/config/search_widget.ui
Normal file
162
src/calibre/gui2/store/config/search_widget.ui
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>465</width>
|
||||||
|
<height>396</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Time</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of seconds to wait for a store to respond</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_timeout">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of seconds to let a store process results</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_hang_time">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>99</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Display</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Maximum number of results to show per store</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_max_results">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="opt_open_external">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open search result in system browser</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Threads</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of search threads to use</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_search_thread_count">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of cache update threads to use</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_cache_thread_count">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of conver download threads to use</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_cover_thread_count">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of details threads to use</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_details_thread_count">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
14
src/calibre/gui2/store/config/store.py
Normal file
14
src/calibre/gui2/store/config/store.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
def config_widget():
|
||||||
|
from calibre.gui2.store.config.search_widget import StoreConfigWidget
|
||||||
|
return StoreConfigWidget()
|
||||||
|
|
||||||
|
def save_settings(config_widget):
|
||||||
|
config_widget.save_settings()
|
@ -23,7 +23,7 @@ from calibre.constants import __appname__, isosx
|
|||||||
from calibre.utils.config import prefs, dynamic
|
from calibre.utils.config import prefs, dynamic
|
||||||
from calibre.utils.ipc.server import Server
|
from calibre.utils.ipc.server import Server
|
||||||
from calibre.library.database2 import LibraryDatabase2
|
from calibre.library.database2 import LibraryDatabase2
|
||||||
from calibre.customize.ui import interface_actions, store_plugins
|
from calibre.customize.ui import interface_actions, enabled_store_plugins
|
||||||
from calibre.gui2 import error_dialog, GetMetadata, open_url, \
|
from calibre.gui2 import error_dialog, GetMetadata, open_url, \
|
||||||
gprefs, max_available_height, config, info_dialog, Dispatcher, \
|
gprefs, max_available_height, config, info_dialog, Dispatcher, \
|
||||||
question_dialog
|
question_dialog
|
||||||
@ -144,7 +144,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
|||||||
|
|
||||||
def load_store_plugins(self):
|
def load_store_plugins(self):
|
||||||
self.istores = OrderedDict()
|
self.istores = OrderedDict()
|
||||||
for store in store_plugins():
|
for store in enabled_store_plugins():
|
||||||
if self.opts.ignore_plugins and store.plugin_path is not None:
|
if self.opts.ignore_plugins and store.plugin_path is not None:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user