mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
079c685f1a
commit
6690397d1a
@ -285,7 +285,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
print ('Tag Browser build already in progress')
|
print ('Tag Browser build already in progress')
|
||||||
traceback.print_stack()
|
traceback.print_stack()
|
||||||
return
|
return
|
||||||
#traceback.print_stack()
|
# traceback.print_stack()
|
||||||
#print ()
|
#print ()
|
||||||
self._build_in_progress = True
|
self._build_in_progress = True
|
||||||
self.beginResetModel()
|
self.beginResetModel()
|
||||||
@ -296,7 +296,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
def _run_rebuild(self, state_map={}):
|
def _run_rebuild(self, state_map={}):
|
||||||
for node in self.node_map.itervalues():
|
for node in self.node_map.itervalues():
|
||||||
node.break_cycles()
|
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.node_map.clear()
|
||||||
self.category_nodes = []
|
self.category_nodes = []
|
||||||
self.root_item = self.create_node(icon_map=self.icon_state_map)
|
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
|
# Formatter threw an exception. Don't create subnode
|
||||||
node_parent = sub_cat = category
|
node_parent = sub_cat = category
|
||||||
else:
|
else:
|
||||||
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
|
||||||
@ -505,9 +505,9 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if cl != collapse_letter:
|
if cl != collapse_letter:
|
||||||
collapse_letter = cl
|
collapse_letter = cl
|
||||||
sub_cat = self.create_node(parent=category,
|
sub_cat = self.create_node(parent=category,
|
||||||
data = collapse_letter,
|
data=collapse_letter,
|
||||||
category_icon = category_node.icon,
|
category_icon=category_node.icon,
|
||||||
tooltip = None, temporary=True,
|
tooltip=None, temporary=True,
|
||||||
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.is_gst = is_gst
|
sub_cat.is_gst = is_gst
|
||||||
@ -784,7 +784,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
self.refresh_required.emit()
|
self.refresh_required.emit()
|
||||||
|
|
||||||
def handle_drop(self, on_node, ids):
|
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
|
key = on_node.tag.category
|
||||||
if (key == 'authors' and len(ids) >= 5):
|
if (key == 'authors' and len(ids) >= 5):
|
||||||
if not confirm('<p>'+_('Changing the authors for several books can '
|
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)
|
fm = self.db.metadata_for_field(node.tag.category)
|
||||||
if node.tag.category in \
|
if node.tag.category in \
|
||||||
('tags', 'series', 'authors', 'rating', 'publisher') or \
|
('tags', 'series', 'authors', 'rating', 'publisher') or \
|
||||||
(fm['is_custom'] and \
|
(fm['is_custom'] and
|
||||||
fm['datatype'] in ['text', 'rating', 'series', 'enumeration']):
|
fm['datatype'] in ['text', 'rating', 'series', 'enumeration']):
|
||||||
ans |= Qt.ItemIsDropEnabled
|
ans |= Qt.ItemIsDropEnabled
|
||||||
else:
|
else:
|
||||||
@ -1193,7 +1193,8 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
exclusive: clear all states before applying this one
|
exclusive: clear all states before applying this one
|
||||||
set_to: None => advance the state, otherwise a value from TAG_SEARCH_STATES
|
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 = self.get_node(index)
|
||||||
item.toggle(set_to=set_to)
|
item.toggle(set_to=set_to)
|
||||||
if exclusive:
|
if exclusive:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user