mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Make first-letter parition nodes in the tag browser click-searchable. Make regexp searching use unicode character classes.
This commit is contained in:
parent
16560874da
commit
5b20799629
@ -727,6 +727,15 @@ class TagTreeItem(object): # {{{
|
|||||||
else:
|
else:
|
||||||
self.tag.state = set_to
|
self.tag.state = set_to
|
||||||
|
|
||||||
|
def all_children(self):
|
||||||
|
res = []
|
||||||
|
def recurse(nodes, res):
|
||||||
|
for t in nodes:
|
||||||
|
res.append(t)
|
||||||
|
recurse(t.children, res)
|
||||||
|
recurse(self.children, res)
|
||||||
|
return res
|
||||||
|
|
||||||
def child_tags(self):
|
def child_tags(self):
|
||||||
res = []
|
res = []
|
||||||
def recurse(nodes, res):
|
def recurse(nodes, res):
|
||||||
@ -1269,6 +1278,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
category_icon = category_node.icon,
|
category_icon = category_node.icon,
|
||||||
category_key=category_node.category_key,
|
category_key=category_node.category_key,
|
||||||
icon_map=self.icon_state_map)
|
icon_map=self.icon_state_map)
|
||||||
|
sub_cat.tag.is_searchable = False
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
else: # by 'first letter'
|
else: # by 'first letter'
|
||||||
cl = cl_list[idx]
|
cl = cl_list[idx]
|
||||||
@ -1651,7 +1661,16 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
ans.append('%s:%s'%(node.category_key, node_searches[node.tag.state]))
|
ans.append('%s:%s'%(node.category_key, node_searches[node.tag.state]))
|
||||||
|
|
||||||
key = node.category_key
|
key = node.category_key
|
||||||
for tag_item in node.child_tags():
|
for tag_item in node.all_children():
|
||||||
|
if tag_item.type == TagTreeItem.CATEGORY:
|
||||||
|
if self.collapse_model == 'first letter' and \
|
||||||
|
tag_item.temporary and not key.startswith('@') \
|
||||||
|
and tag_item.tag.state:
|
||||||
|
if node_searches[tag_item.tag.state] == 'true':
|
||||||
|
ans.append('%s:~^%s'%(key, tag_item.py_name))
|
||||||
|
else:
|
||||||
|
ans.append('(not %s:~^%s )'%(key, tag_item.py_name))
|
||||||
|
continue
|
||||||
tag = tag_item.tag
|
tag = tag_item.tag
|
||||||
if tag.state != TAG_SEARCH_STATES['clear']:
|
if tag.state != TAG_SEARCH_STATES['clear']:
|
||||||
if tag.state == TAG_SEARCH_STATES['mark_minus'] or \
|
if tag.state == TAG_SEARCH_STATES['mark_minus'] or \
|
||||||
|
@ -145,7 +145,7 @@ def _match(query, value, matchkind):
|
|||||||
return True
|
return True
|
||||||
elif query == t:
|
elif query == t:
|
||||||
return True
|
return True
|
||||||
elif ((matchkind == REGEXP_MATCH and re.search(query, t, re.I)) or ### search unanchored
|
elif ((matchkind == REGEXP_MATCH and re.search(query, t, re.I|re.UNICODE)) or ### search unanchored
|
||||||
(matchkind == CONTAINS_MATCH and query in t)):
|
(matchkind == CONTAINS_MATCH and query in t)):
|
||||||
return True
|
return True
|
||||||
except re.error:
|
except re.error:
|
||||||
|
@ -131,7 +131,7 @@ Follow these steps to find the problem:
|
|||||||
* Make sure that you are connecting only a single device to your computer at a time. Do not have another |app| supported device like an iPhone/iPad etc. at the same time.
|
* Make sure that you are connecting only a single device to your computer at a time. Do not have another |app| supported device like an iPhone/iPad etc. at the same time.
|
||||||
* If you are connecting an Apple iDevice (iPad, iPod Touch, iPhone), use the 'Connect to iTunes' method in the 'Getting started' instructions in `Calibre + Apple iDevices: Start here <http://www.mobileread.com/forums/showthread.php?t=118559>`_.
|
* If you are connecting an Apple iDevice (iPad, iPod Touch, iPhone), use the 'Connect to iTunes' method in the 'Getting started' instructions in `Calibre + Apple iDevices: Start here <http://www.mobileread.com/forums/showthread.php?t=118559>`_.
|
||||||
* Make sure you are running the latest version of |app|. The latest version can always be downloaded from `the calibre website <http://calibre-ebook.com/download>`_.
|
* Make sure you are running the latest version of |app|. The latest version can always be downloaded from `the calibre website <http://calibre-ebook.com/download>`_.
|
||||||
* Ensure your operating system is seeing the device. That is, the device should be mounted as a disk that you can access using Windows explorer or whatever the file management program on your computer is.
|
* Ensure your operating system is seeing the device. That is, the device should be mounted as a disk, that you can access using Windows explorer or whatever the file management program on your computer is. On Windows your device **must have been assigned a drive letter**, like K:.
|
||||||
* In calibre, go to Preferences->Plugins->Device Interface plugin and make sure the plugin for your device is enabled, the plugin icon next to it should be green when it is enabled.
|
* In calibre, go to Preferences->Plugins->Device Interface plugin and make sure the plugin for your device is enabled, the plugin icon next to it should be green when it is enabled.
|
||||||
* If all the above steps fail, go to Preferences->Miscellaneous and click debug device detection with your device attached and post the output as a ticket on `the calibre bug tracker <http://bugs.calibre-ebook.com>`_.
|
* If all the above steps fail, go to Preferences->Miscellaneous and click debug device detection with your device attached and post the output as a ticket on `the calibre bug tracker <http://bugs.calibre-ebook.com>`_.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user