def _parse_profile_list(self, i, filename):
"""
Parses sharedconfig.vdf and loads game and profile IDs. That is later
decoded into name of game and profile name.
Called from _load_profiles, in thread. Exceptions are catched and logged
from there.
Calls GLib.idle_add to send loaded data into UI.
"""
data = parse_vdf(open(filename, "r"))
# Sanity check
if "userroamingconfigstore" not in data: return
if "controller_config" not in data["userroamingconfigstore"]: return
# Grab config
cc = data["userroamingconfigstore"]["controller_config"]
# Go through all games
listitems = []
for gameid in cc:
if "selected" in cc[gameid] and cc[gameid]["selected"].startswith("workshop"):
profile_id = cc[gameid]["selected"].split("/")[-1]
listitems.append(( i, gameid, profile_id, None ))
i += 1
if len(listitems) > 10:
GLib.idle_add(self.fill_list, listitems)
listitems = []
GLib.idle_add(self.fill_list, listitems)
return i
评论列表
文章目录