profile_switcher.py 文件源码

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

项目:sc-controller 作者: kozec 项目源码 文件源码
def setup_widgets(self):
        # Create
        self._icon = Gtk.Image()
        self._model = Gtk.ListStore(str, object, str)
        self._combo = Gtk.ComboBox.new_with_model(self._model)
        self._box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 0)
        self._savebutton = None
        self._switch_to_button = None

        # Setup
        rend1 = Gtk.CellRendererText()
        rend2 = Gtk.CellRendererText()
        self._icon.set_margin_right(10)
        self._combo.pack_start(rend1, True)
        self._combo.pack_start(rend2, False)
        self._combo.add_attribute(rend1, "text", 0)
        self._combo.add_attribute(rend2, "text", 2)
        self._combo.set_row_separator_func(
            lambda model, iter : model.get_value(iter, 1) is None and model.get_value(iter, 0) == "-" )
        self.update_icon()

        # Signals
        self._combo.connect('changed', self.on_combo_changed)
        self.connect("button_press_event", self.on_button_press)

        # Pack
        self._box.pack_start(self._icon, False, True, 0)
        self._box.pack_start(self._combo, True, True, 0)
        self.add(self._box)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号