global_settings.py 文件源码

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

项目:sc-controller 作者: kozec 项目源码 文件源码
def on_osd_color_set(self, *a):
        """
        Called when user selects color.
        """
        # Following lambdas converts Gdk.Color into #rrggbb notation.
        # Gdk.Color can do similar, except it uses #rrrrggggbbbb notation that
        # is not understood by Gdk css parser....
        cbOSDColorPreset = self.builder.get_object("cbOSDColorPreset")
        striphex = lambda a: hex(a).strip("0x").zfill(2)
        tohex = lambda a: "".join([ striphex(int(x * 0xFF)) for x in a.to_floats() ])
        for k in self.app.config["osd_colors"]:
            w = self.builder.get_object("cb%s" % (k,))
            if w:
                self.app.config["osd_colors"][k] = tohex(w.get_color())
        for k in self.app.config["osk_colors"]:
            w = self.builder.get_object("cbosk_%s" % (k,))
            if w:
                self.app.config["osk_colors"][k] = tohex(w.get_color())
        self.app.config["osd_color_theme"] = None
        self.set_cb(cbOSDColorPreset, "None")
        self.app.save_config()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号