@ -499,18 +499,20 @@ class ImporterWindow(ArtnetMainWindow):
: param tags :
: return :
"""
tags . sort ( )
tags . sort ( key = lambda x : x [ " name " ] )
item_model = QStandardItemModel ( self . ui . search_result_list )
for tag in tags :
item = QStandardItem ( tag )
tag_name = tag [ " name " ]
item = QStandardItem ( tag_name )
flags = Qt . ItemIsEnabled
if tag not in self . curr_implied_tags :
if tag _name not in self . curr_implied_tags :
# new tag and not implied yet
item . setData ( Qt . Unchecked , Qt . CheckStateRole )
item . setToolTip ( f " Tag ID: { tag [ ' id ' ] } \n \n " + tag [ " description " ] + f " \n Category: { tag [ ' category ' ] } " )
flags | = Qt . ItemIsUserCheckable
if self . curr_tags is not None and tag in ( self . curr_tags + self . curr_implied_tags + self . curr_tag_aliases ) :
if self . curr_tags is not None and tag _name in ( self . curr_tags + self . curr_implied_tags + self . curr_tag_aliases ) :
# already selected, implied or aliased tags
item . setCheckState ( Qt . Checked )
item . setFlags ( flags )
@ -534,28 +536,30 @@ class ImporterWindow(ArtnetMainWindow):
: param no_implication : not used
: return :
"""
tags . sort ( )
tags . sort ( key = lambda x : x [ " name " ] )
self . curr_tags = tags
item_model = QStandardItemModel ( self . ui . tag_list )
implied_tags = [ ]
for x in self . curr_tags :
# collect all implied tags into a list
implied_tags + = self . main . db_connection . get_all_tag_implications_by_name ( x )
implied_tags + = self . main . db_connection . get_all_tag_implications_by_name ( x [" name " ] )
self . set_implied_list ( implied_tags )
for tag in tags :
item = QStandardItem ( tag )
tag_name = tag [ " name " ]
item = QStandardItem ( tag_name )
flags = Qt . ItemIsEnabled
if tag not in self . curr_implied_tags :
if tag _name not in self . curr_implied_tags :
# new tag and not implied yet
item . setData ( Qt . Unchecked , Qt . CheckStateRole )
item . setToolTip ( f " Tag ID: { tag [ ' id ' ] } \n \n " + tag [ " description " ] + f " \n Category: { tag [ ' category ' ] } " )
flags | = Qt . ItemIsUserCheckable
if set_checked :
if tag not in self . curr_implied_tags :
if tag _name not in self . curr_implied_tags :
item . setCheckState ( Qt . Checked )
else :
item . setCheckState ( Qt . Unchecked )
@ -578,11 +582,13 @@ class ImporterWindow(ArtnetMainWindow):
item_model = QStandardItemModel ( self . ui . implied_tag_list )
done = [ ]
for tag in tags :
if tag in done :
tag_name = tag [ " name " ]
if tag_name in done :
continue
else :
done . append ( tag )
item = QStandardItem ( tag )
done . append ( tag_name )
item = QStandardItem ( tag_name )
item . setToolTip ( f " Tag ID: { tag [ ' id ' ] } \n \n " + tag [ " description " ] + f " \n Category: { tag [ ' category ' ] } " )
item_model . appendRow ( item )
self . ui . implied_tag_list . setModel ( item_model )
@ -1081,7 +1087,7 @@ class ImporterWindow(ArtnetMainWindow):
result = [ ]
for tag_name , tag_desc , tag_category , tag_id in tags :
result . append ( tag_name )
result . append ( { " name " : tag_name , " description " : tag_desc , " category " : tag_category , " id " : tag_id } )
self . set_tag_search_result_list ( result )