def on_sa_profile(self, mapper, action):
profile_name = action.profile
path = find_profile(profile_name)
if path:
with self.lock:
if path != self.current_profile and not self.current_profile.endswith(".mod"):
# Switch only if target profile is not active
# and active profile is not being editted.
try:
if self.config['autoswitch_osd']:
msg = (_("Switched to profile") + " " + profile_name)
self.socket.send(b"OSD: " + msg.encode('utf-8') + b"\n")
self.socket.send(b"Profile: " + path.encode('utf-8') + b"\n")
except:
log.error("Socket write failed")
os._exit(2)
return
else:
log.error("Cannot switch to profile '%s', profile file not found", self.conds[c])
评论列表
文章目录