SBrickFunctionsBox.py 文件源码

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

项目:sbrick-controller 作者: wintersandroid 项目源码 文件源码
def __init__(self, configuration, channels):
        Gtk.Frame.__init__(self)
        self.configuration = configuration
        self.channels = channels

        vbox = Gtk.Box(self, orientation=Gtk.Orientation.VERTICAL, spacing=2)
        vbox.set_homogeneous(False)
        self.add(vbox)

        self.label = Gtk.Label()
        vbox.pack_start(self.label, False, True, 0)
        if "group" in configuration:
            self.label.set_text(configuration["group"])

        hbox = Gtk.Box(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
        hbox.set_homogeneous(False)
        vbox.pack_start(hbox, False, True, 0)

        self.button_settings = Gtk.Button.new()
        self.button_settings.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.BUTTON))
        self.button_settings.connect("clicked", self.on_settings_clicked)
        hbox.pack_start(self.button_settings, False, True, 0)

        self.hbox = Gtk.Box(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
        hbox.pack_start(self.hbox, True, True, 0)

        if "functions" in configuration:
            for func in configuration["functions"]:
                button = Gtk.Button(func["label"])
                button.connect("clicked", self.on_button_clicked)
                button.brick_function = func
                self.hbox.pack_start(button, True, True, 0)

        self.sbrick = None
        self.hbox.set_sensitive(False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号