本文整理汇总了Python中calibre.utils.search_query_parser.SearchQueryParser.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python SearchQueryParser.__init__方法的具体用法?Python SearchQueryParser.__init__怎么用?Python SearchQueryParser.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.utils.search_query_parser.SearchQueryParser
的用法示例。
在下文中一共展示了SearchQueryParser.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(
self,
dbcache,
all_book_ids,
gst,
date_search,
num_search,
bool_search,
keypair_search,
limit_search_columns,
limit_search_columns_to,
locations,
virtual_fields,
lookup_saved_search,
parse_cache,
):
self.dbcache, self.all_book_ids = dbcache, all_book_ids
self.all_search_locations = frozenset(locations)
self.grouped_search_terms = gst
self.date_search, self.num_search = date_search, num_search
self.bool_search, self.keypair_search = bool_search, keypair_search
self.limit_search_columns, self.limit_search_columns_to = (limit_search_columns, limit_search_columns_to)
self.virtual_fields = virtual_fields or {}
if "marked" not in self.virtual_fields:
self.virtual_fields["marked"] = self
SearchQueryParser.__init__(
self, locations, optimize=True, lookup_saved_search=lookup_saved_search, parse_cache=parse_cache
)
示例2: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, FIELD_MAP, field_metadata, db_prefs=None):
self.FIELD_MAP = FIELD_MAP
self.db_prefs = db_prefs
self.composites = {}
self.udc = get_udc()
for key in field_metadata:
if field_metadata[key]['datatype'] == 'composite':
self.composites[field_metadata[key]['rec_index']] = key
self.series_col = field_metadata['series']['rec_index']
self.series_sort_col = field_metadata['series_sort']['rec_index']
self._data = []
self._map = self._map_filtered = []
self.first_sort = True
self.search_restriction = self.base_restriction = ''
self.base_restriction_name = self.search_restriction_name = ''
self.search_restriction_book_count = 0
self.marked_ids_dict = {}
self.field_metadata = field_metadata
self.all_search_locations = field_metadata.get_search_terms()
SearchQueryParser.__init__(self, self.all_search_locations, optimize=True)
self.build_date_relop_dict()
self.build_numeric_relop_dict()
# Do this here so the var get updated when a library changes
global pref_use_primary_find_in_search
pref_use_primary_find_in_search = prefs['use_primary_find_in_search']
示例3: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, show_only_user_plugins=False):
QAbstractItemModel.__init__(self)
SearchQueryParser.__init__(self, ['all'])
self.show_only_user_plugins = show_only_user_plugins
self.icon = QIcon(I('plugins.png'))
p = QIcon(self.icon).pixmap(64, 64, QIcon.Disabled, QIcon.On)
self.disabled_icon = QIcon(p)
self._p = p
self.populate()
示例4: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, *args):
QAbstractItemModel.__init__(self, *args)
SearchQueryParser.__init__(self, locations=["all"])
self.default_icon = QIcon(I("news.png"))
self.custom_icon = QIcon(I("user_profile.png"))
self.builtin_recipe_collection = get_builtin_recipe_collection()
self.scheduler_config = SchedulerConfig()
try:
with zipfile.ZipFile(P("builtin_recipes.zip", allow_user_override=False), "r") as zf:
self.favicons = dict([(x.filename, x) for x in zf.infolist() if x.filename.endswith(".png")])
except:
self.favicons = {}
self.do_refresh()
示例5: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self):
QAbstractTableModel.__init__(self)
SearchQueryParser.__init__(self, ["all"])
self.wait_icon = QVariant(QIcon(I("jobs.png")))
self.running_icon = QVariant(QIcon(I("exec.png")))
self.error_icon = QVariant(QIcon(I("dialog_error.png")))
self.done_icon = QVariant(QIcon(I("ok.png")))
self.jobs = []
self.add_job = Dispatcher(self._add_job)
self.server = Server(limit=int(config["worker_limit"] / 2.0), enforce_cpu_limit=config["enforce_cpu_limit"])
self.threaded_server = ThreadedJobServer()
self.changed_queue = Queue()
self.timer = QTimer(self)
self.timer.timeout.connect(self.update, type=Qt.QueuedConnection)
self.timer.start(1000)
示例6: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, keyboard, parent=None):
QAbstractItemModel.__init__(self, parent)
SearchQueryParser.__init__(self, ["all"])
self.keyboard = keyboard
groups = sorted(keyboard.groups, key=sort_key)
shortcut_map = {k: v.copy() for k, v in self.keyboard.shortcuts.iteritems()}
for un, s in shortcut_map.iteritems():
s["keys"] = tuple(self.keyboard.keys_map.get(un, ()))
s["unique_name"] = un
s["group"] = [g for g, names in self.keyboard.groups.iteritems() if un in names][0]
group_map = {
group: sorted(names, key=lambda x: sort_key(shortcut_map[x]["name"]))
for group, names in self.keyboard.groups.iteritems()
}
self.data = [Node(group_map, shortcut_map, group) for group in groups]
示例7: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, all_plugins=[]):
SearchQueryParser.__init__(self, locations=self.USABLE_LOCATIONS)
self.srs = set(all_plugins)
示例8: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self):
SearchQueryParser.__init__(self, locations=self.USABLE_LOCATIONS)
self.srs = set([])
示例9: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
SearchQueryParser.__init__(self, ['all'])
raw_defaults, raw_custom = read_raw_tweaks()
self.parse_tweaks(raw_defaults, raw_custom)
示例10: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self):
SearchQueryParser.__init__(self, locations=self.USABLE_LOCATIONS)
self.srs = set([])
# remove joiner words surrounded by space or at string boundaries
self.joiner_pat = re.compile(r'(^|\s)(and|not|or|a|the|is|of)(\s|$)', re.IGNORECASE)
self.punctuation_table = {ord(x):' ' for x in string.punctuation}
示例11: __init__
# 需要导入模块: from calibre.utils.search_query_parser import SearchQueryParser [as 别名]
# 或者: from calibre.utils.search_query_parser.SearchQueryParser import __init__ [as 别名]
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
SearchQueryParser.__init__(self, ['all'])
self.parse_tweaks()