This commit is contained in:
Kovid Goyal 2013-08-19 10:21:13 +05:30
parent 079c685f1a
commit 6690397d1a

View File

@ -285,7 +285,7 @@ class TagsModel(QAbstractItemModel): # {{{
print ('Tag Browser build already in progress')
traceback.print_stack()
return
#traceback.print_stack()
# traceback.print_stack()
#print ()
self._build_in_progress = True
self.beginResetModel()
@ -296,7 +296,7 @@ class TagsModel(QAbstractItemModel): # {{{
def _run_rebuild(self, state_map={}):
for node in self.node_map.itervalues():
node.break_cycles()
del node #Clear reference to node in the current frame
del node # Clear reference to node in the current frame
self.node_map.clear()
self.category_nodes = []
self.root_item = self.create_node(icon_map=self.icon_state_map)
@ -489,9 +489,9 @@ class TagsModel(QAbstractItemModel): # {{{
# Formatter threw an exception. Don't create subnode
node_parent = sub_cat = category
else:
sub_cat = self.create_node(parent=category, data = name,
tooltip = None, temporary=True,
category_icon = category_node.icon,
sub_cat = self.create_node(parent=category, data=name,
tooltip=None, temporary=True,
category_icon=category_node.icon,
category_key=category_node.category_key,
icon_map=self.icon_state_map)
sub_cat.tag.is_searchable = False
@ -505,9 +505,9 @@ class TagsModel(QAbstractItemModel): # {{{
if cl != collapse_letter:
collapse_letter = cl
sub_cat = self.create_node(parent=category,
data = collapse_letter,
category_icon = category_node.icon,
tooltip = None, temporary=True,
data=collapse_letter,
category_icon=category_node.icon,
tooltip=None, temporary=True,
category_key=category_node.category_key,
icon_map=self.icon_state_map)
sub_cat.is_gst = is_gst
@ -784,7 +784,7 @@ class TagsModel(QAbstractItemModel): # {{{
self.refresh_required.emit()
def handle_drop(self, on_node, ids):
#print 'Dropped ids:', ids, on_node.tag
# print 'Dropped ids:', ids, on_node.tag
key = on_node.tag.category
if (key == 'authors' and len(ids) >= 5):
if not confirm('<p>'+_('Changing the authors for several books can '
@ -1089,7 +1089,7 @@ class TagsModel(QAbstractItemModel): # {{{
fm = self.db.metadata_for_field(node.tag.category)
if node.tag.category in \
('tags', 'series', 'authors', 'rating', 'publisher') or \
(fm['is_custom'] and \
(fm['is_custom'] and
fm['datatype'] in ['text', 'rating', 'series', 'enumeration']):
ans |= Qt.ItemIsDropEnabled
else:
@ -1193,7 +1193,8 @@ class TagsModel(QAbstractItemModel): # {{{
exclusive: clear all states before applying this one
set_to: None => advance the state, otherwise a value from TAG_SEARCH_STATES
'''
if not index.isValid(): return False
if not index.isValid():
return False
item = self.get_node(index)
item.toggle(set_to=set_to)
if exclusive: