SBrickSequenceBox.py 文件源码

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

项目:sbrick-controller 作者: wintersandroid 项目源码 文件源码
def __init__(self, step_configuration, functions):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
        self.set_homogeneous(False)
        self.step_configuration = step_configuration
        self.functions = functions
        self.sbrick = None

        self.show_all()

        self.function_group_model = Gtk.ListStore(str, str)
        self.function_model = Gtk.ListStore(str, str)

        # function group
        self.pack_start(Gtk.Label("Function Group:"), False, True, 0)
        self.combo_function_group = Gtk.ComboBoxText()
        self.combo_function_group.set_id_column(0)
        self.combo_function_group.set_model(self.function_group_model)
        renderer_text = Gtk.CellRendererText()
        self.combo_function_group.clear()
        self.combo_function_group.pack_start(renderer_text, True)
        self.combo_function_group.add_attribute(renderer_text, "text", 1)
        self.pack_start(self.combo_function_group, False, True, 0)
        self.combo_function_group.connect("changed", self.on_group_changed)

        # function group
        self.add(Gtk.Label("Function:"))
        self.combo_function = Gtk.ComboBoxText()
        self.combo_function.set_id_column(0)
        self.combo_function.set_model(self.function_model)
        renderer_text = Gtk.CellRendererText()
        self.combo_function.clear()
        self.combo_function.pack_start(renderer_text, True)
        self.combo_function.add_attribute(renderer_text, "text", 1)
        self.pack_start(self.combo_function, False, True, 0)

        self.pack_start(Gtk.Label("MS Delay After:"), False, True, 0)
        self.timeAdjustment = Gtk.Adjustment(1000, -1, 120000, 10, 100, 0.0)
        self.spinDelayAfter = Gtk.SpinButton.new(self.timeAdjustment, 10, 0)
        self.pack_start(self.spinDelayAfter, False, True, 0)

        self.update_group_model()

        if "function_group" in self.step_configuration:
            self.combo_function_group.set_active_id(self.step_configuration["function_group"])
            self.update_function_model(self.combo_function_group.get_active_id())

        if "function" in self.step_configuration:
            self.combo_function.set_active_id(self.step_configuration["function"])

        if "delay_time" in self.step_configuration:
            self.timeAdjustment.set_value(int(step_configuration["delay_time"]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号