mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove pointless beginInsertRows/endInsertRows calls
This commit is contained in:
parent
3873c2ad71
commit
bc48b5117a
@ -683,7 +683,6 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
|
|
||||||
def process_one_node(category, state_map): # {{{
|
def process_one_node(category, state_map): # {{{
|
||||||
collapse_letter = None
|
collapse_letter = None
|
||||||
category_index = self.createIndex(category.row(), 0, category)
|
|
||||||
category_node = category
|
category_node = category
|
||||||
key = category_node.category_key
|
key = category_node.category_key
|
||||||
if key not in data:
|
if key not in data:
|
||||||
@ -750,14 +749,12 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
d['last'] = data[key][cat_len-1]
|
d['last'] = data[key][cat_len-1]
|
||||||
name = eval_formatter.safe_format(collapse_template,
|
name = eval_formatter.safe_format(collapse_template,
|
||||||
d, 'TAG_VIEW', None)
|
d, 'TAG_VIEW', None)
|
||||||
self.beginInsertRows(category_index, 999998, 999999) #len(data[key])-1)
|
|
||||||
sub_cat = self.create_node(parent=category, data = name,
|
sub_cat = self.create_node(parent=category, data = name,
|
||||||
tooltip = None, temporary=True,
|
tooltip = None, temporary=True,
|
||||||
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
|
sub_cat.tag.is_searchable = False
|
||||||
self.endInsertRows()
|
|
||||||
else: # by 'first letter'
|
else: # by 'first letter'
|
||||||
cl = cl_list[idx]
|
cl = cl_list[idx]
|
||||||
if cl != collapse_letter:
|
if cl != collapse_letter:
|
||||||
@ -784,13 +781,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
key in ['authors', 'publisher', 'news', 'formats', 'rating'] or
|
key in ['authors', 'publisher', 'news', 'formats', 'rating'] or
|
||||||
key not in self.db.prefs.get('categories_using_hierarchy', []) or
|
key not in self.db.prefs.get('categories_using_hierarchy', []) or
|
||||||
len(components) == 1):
|
len(components) == 1):
|
||||||
self.beginInsertRows(category_index, 999998, 999999)
|
|
||||||
n = self.create_node(parent=node_parent, data=tag, tooltip=tt,
|
n = self.create_node(parent=node_parent, data=tag, tooltip=tt,
|
||||||
icon_map=self.icon_state_map)
|
icon_map=self.icon_state_map)
|
||||||
if tag.id_set is not None:
|
if tag.id_set is not None:
|
||||||
n.id_set |= tag.id_set
|
n.id_set |= tag.id_set
|
||||||
category_child_map[tag.name, tag.category] = n
|
category_child_map[tag.name, tag.category] = n
|
||||||
self.endInsertRows()
|
|
||||||
else:
|
else:
|
||||||
for i,comp in enumerate(components):
|
for i,comp in enumerate(components):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
@ -820,11 +815,9 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
t.is_hierarchical = \
|
t.is_hierarchical = \
|
||||||
'5state' if t.category != 'search' else '3state'
|
'5state' if t.category != 'search' else '3state'
|
||||||
t.name = comp
|
t.name = comp
|
||||||
self.beginInsertRows(category_index, 999998, 999999)
|
|
||||||
node_parent = self.create_node(parent=node_parent, data=t,
|
node_parent = self.create_node(parent=node_parent, data=t,
|
||||||
tooltip=tt, icon_map=self.icon_state_map)
|
tooltip=tt, icon_map=self.icon_state_map)
|
||||||
child_map[(comp,tag.category)] = node_parent
|
child_map[(comp,tag.category)] = node_parent
|
||||||
self.endInsertRows()
|
|
||||||
# This id_set must not be None
|
# This id_set must not be None
|
||||||
node_parent.id_set |= tag.id_set
|
node_parent.id_set |= tag.id_set
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user