Make first-letter nodes in the tag browser click-searchable.

Make regexp searching work in unicode
This commit is contained in:
Charles Haley 2011-06-18 15:37:02 +01:00
parent ce25e1ab74
commit dbf20716ed
2 changed files with 18 additions and 2 deletions

View File

@ -727,6 +727,15 @@ class TagTreeItem(object): # {{{
else:
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):
res = []
def recurse(nodes, res):
@ -1651,7 +1660,14 @@ class TagsModel(QAbstractItemModel): # {{{
ans.append('%s:%s'%(node.category_key, node_searches[node.tag.state]))
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 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
if tag.state != TAG_SEARCH_STATES['clear']:
if tag.state == TAG_SEARCH_STATES['mark_minus'] or \

View File

@ -145,7 +145,7 @@ def _match(query, value, matchkind):
return True
elif query == t:
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)):
return True
except re.error: