def scan_update(item):
 path = str(item.path())
 try:
  (title, desc, svg) = preview_parse(path)
 except SAXParseException as ex:
  log.error('%r is malformed (%r)', path, ex)
  item.setEnabled(False)
  item.setSelectable(False)
  return
 if (not svg):
  try:
   svg = scheme_svg_thumbnail(path)
  except Exception:
   log.error('Could not render scheme preview for %r', title, exc_info=True)
 if (item.name() != title):
  item.setName(title)
 if (item.description() != desc):
  item.setDescription(desc)
 if svg:
  item.setThumbnail(svg)

def scan_update ( item ) : path = str ( item . path ( ) ) try : ( title , desc , svg ) = preview_parse ( path ) except SAXParseException as ex : log . error ( '%r is malformed (%r)' , path , ex ) item . setEnabled ( False ) item . setSelectable ( False ) return if ( not svg ) : try : svg = scheme_svg_thumbnail ( path ) except Exception : log . error ( 'Could not render scheme preview for %r' , title , exc_info = True ) if ( item . name ( ) != title ) : item . setName ( title ) if ( item . description ( ) != desc ) : item . setDescription ( desc ) if svg : item . setThumbnail ( svg )
given a preview item .