__main__.py 文件源码

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

项目:razerCommander 作者: GabMus 项目源码 文件源码
def refreshProfiles(self):
        # empty list first
        for child in self.profilesListBox.get_children():
            self.profilesListBox.remove(child)

        for p in custom_profiles.profiles:
            box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
            labelName = Gtk.Label()
            labelName.set_text(p['name'])
            box.pack_start(labelName, True, True, 0)
            box.set_margin_top(6)
            box.set_margin_bottom(6)
            if not p['name'] == 'Empty':
                rmIcon = Gtk.Image()
                rmIcon.set_from_icon_name('gtk-delete', Gtk.IconSize.BUTTON)
                rmButton = Gtk.Button()
                rmButton.add(rmIcon)
                rmButton.preset = p['name']
                rmButton.connect("button-press-event", self.onRmProfile)
                box.pack_end(rmButton, False, False, 0)
            row = Gtk.ListBoxRow()
            row.add(box)
            row.value = p['name']
            self.profilesListBox.add(row)
        self.profilesListBox.unselect_all()
        if self.popoverProfiles.get_visible():
            self.popoverProfiles.show_all()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号