def show_mods(self): # Clear the list boxes. for child in self.mods_available.get_children(): child.destroy() for child in self.mods_installed.get_children(): child.destroy() for mod in self.datadir.list_available(): # Create and add the listbox item. label = gtk.Label(mod) label.set_alignment(0, 0.5) label.show() list_item = gtk.ListItem() list_item.add(label) list_item.set_data('mod', mod) list_item.show() self.mods_available.add(list_item) for mod in self.datadir.list_installed(): # Create and add the listbox item. label = gtk.Label(mod) label.set_alignment(0, 0.5) label.show() list_item = gtk.ListItem() list_item.add(label) list_item.set_data('mod', mod) list_item.show() self.mods_installed.add(list_item)
def set_choices(self, choices): for choice, select in choices: item = gtk.ListItem(choice) item.show() self.list.add(item) if select: item.select()
def __init__(self): #Fenster erstellen self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("SVN Manager") self.window.connect("destroy", self.destroy_event, None) self.window.set_border_width(10) #VBox erstellen vbox = gtk.HBox(spacing=5, homogeneous=False) #Liste mit Repos erstellen self.repoList = gtk.List() i1 = gtk.ListItem("test") i1.show() i2 = gtk.ListItem("test2") i2.show() self.repoList.append_items([i1, i2]) self.repoList.show() vbox.add(self.repoList) #Controls erstellen control_box = gtk.VBox() add_button = gtk.Button("Add") add_button.show() add_button.connect("button-press-event", self.add_clicked, None) del_button = gtk.Button("Del") del_button.show() del_button.connect("button-press-event", self.del_clicked, None) control_box.add(add_button) control_box.add(del_button) control_box.show() remove_button = gtk.Button("Del") remove_button.show() remove_button.connect("button-press-event", self.del_clicked, None) control_box.add(remove_button) control_box.show() vbox.add(control_box) vbox.show() #Fenster anzeigen self.window.add(vbox) self.window.show() print "Test"
def update(self): self.clear() n = self.dg.n_semesters() for i in range(n): val = self.ds.season_at_index(i) + ' ' + str( self.ds.year_at_index(i)) label = gtk.Label(val) align = gtk.Alignment() align.set_padding(10, 10, 10, 10) align.add(label) item = gtk.ListItem() item.add(align) self._list.add(item) self._list.show_all()
def update(self): self.clear() n = self.dg.n_courses() for i in range(n): # left: title left = gtk.Alignment() left.set_padding(10, 10, 10, 80) left.add(gtk.Label(self.ds.title_at_index(i))) # right: grade right = gtk.Alignment() right.set_padding(10, 10, 80, 10) right.add(gtk.Label(self.ds.grade_at_index(i))) # for proper spacing... hbox = gtk.HBox() hbox.pack_start(left) hbox.pack_start(right) # add to item item = gtk.ListItem() item.add(hbox) self._list.add(item) self._list.show_all()
def add_item_to_list(self, lst, label_text, event): check_button = gtk.CheckButton("") check_button.set_active(True) check_button.unset_flags(gtk.CAN_FOCUS) check_button.show() if event != None: check_button.connect( "clicked", lambda *args: ep.push_event(event, (label_text, args))) label = gtk.Label(label_text) label.show() hbox = gtk.HBox(homogeneous=False, spacing=0) hbox.pack_start(check_button, expand=False, fill=False, padding=0) hbox.pack_start(label, expand=False, fill=False, padding=0) hbox.show() list_item = gtk.ListItem() list_item.show() list_item.add(hbox) lst.add(list_item)