autoswitcher.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:sc-controller 作者: kozec 项目源码 文件源码
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])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号