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()
评论列表
文章目录