def sync_from_app(app):
 try:
  modules = (frappe.get_attr((app + u'.config.desktop.get_data'))() or {})
 except ImportError:
  return []
 if isinstance(modules, dict):
  modules_list = []
  for (m, desktop_icon) in modules.iteritems():
   desktop_icon[u'module_name'] = m
   modules_list.append(desktop_icon)
 else:
  modules_list = modules
 for (i, m) in enumerate(modules_list):
  desktop_icon_name = frappe.db.get_value(u'Desktop Icon', {u'module_name': m[u'module_name'], u'app': app, u'standard': 1})
  if desktop_icon_name:
   desktop_icon = frappe.get_doc(u'Desktop Icon', desktop_icon_name)
  else:
   desktop_icon = frappe.get_doc({u'doctype': u'Desktop Icon', u'idx': i, u'standard': 1, u'app': app, u'owner': u'Administrator'})
  if (u'doctype' in m):
   m[u'_doctype'] = m.pop(u'doctype')
  desktop_icon.update(m)
  desktop_icon.save()
 return modules_list

def sync_from_app ( app ) : try : modules = ( frappe . get_attr ( ( app + u'.config.desktop.get_data' ) ) ( ) or { } ) except ImportError : return [ ] if isinstance ( modules , dict ) : modules_list = [ ] for ( m , desktop_icon ) in modules . iteritems ( ) : desktop_icon [ u'module_name' ] = m modules_list . append ( desktop_icon ) else : modules_list = modules for ( i , m ) in enumerate ( modules_list ) : desktop_icon_name = frappe . db . get_value ( u'Desktop Icon' , { u'module_name' : m [ u'module_name' ] , u'app' : app , u'standard' : 1 } ) if desktop_icon_name : desktop_icon = frappe . get_doc ( u'Desktop Icon' , desktop_icon_name ) else : desktop_icon = frappe . get_doc ( { u'doctype' : u'Desktop Icon' , u'idx' : i , u'standard' : 1 , u'app' : app , u'owner' : u'Administrator' } ) if ( u'doctype' in m ) : m [ u'_doctype' ] = m . pop ( u'doctype' ) desktop_icon . update ( m ) desktop_icon . save ( ) return modules_list
sync desktop icons from app .