add Window.updateProjects()
This commit is contained in:
parent
cd1fbf332c
commit
3eaeaa8313
38
Window.py
38
Window.py
@ -22,21 +22,7 @@ class Window:
|
||||
self.menubar.append(mi)
|
||||
|
||||
# Projects Table
|
||||
project_table = gtk.Table(rows = 2, columns = 9)
|
||||
|
||||
new_project_combobox = gtk.combo_box_entry_new_text()
|
||||
new_project_combobox.append_text("Project1")
|
||||
new_project_combobox.append_text("Project2")
|
||||
|
||||
col_headers = ('Project',
|
||||
'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Tot')
|
||||
for i in range(len(col_headers)):
|
||||
l = gtk.Label()
|
||||
l.set_markup('<b>%s</b>' % col_headers[i])
|
||||
l.set_size_request(35 if i > 0 else 200, -1)
|
||||
project_table.attach(l, i, i + 1, 0, 1)
|
||||
|
||||
project_table.attach(new_project_combobox, 0, 1, 1, 2)
|
||||
self.updateProjects()
|
||||
|
||||
# Bottom Control Bar
|
||||
self.mark_label = gtk.Label()
|
||||
@ -52,12 +38,32 @@ class Window:
|
||||
|
||||
vbox = gtk.VBox()
|
||||
vbox.pack_start(self.menubar)
|
||||
vbox.pack_start(project_table)
|
||||
vbox.pack_start(self.projects_table)
|
||||
vbox.pack_start(gtk.HSeparator())
|
||||
vbox.pack_start(hbox)
|
||||
|
||||
self.window.add(vbox)
|
||||
|
||||
def updateProjects(self):
|
||||
self.projects = self.ds.getProjects()
|
||||
self.projects_table = gtk.Table(rows = 2, columns = 9)
|
||||
|
||||
new_project_combobox = gtk.combo_box_entry_new_text()
|
||||
project_names = self.projects.values()
|
||||
project_names.sort()
|
||||
for project in project_names:
|
||||
new_project_combobox.append_text(project)
|
||||
|
||||
col_headers = ('Project',
|
||||
'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Tot')
|
||||
for i in range(len(col_headers)):
|
||||
l = gtk.Label()
|
||||
l.set_markup('<b>%s</b>' % col_headers[i])
|
||||
l.set_size_request(35 if i > 0 else 200, -1)
|
||||
self.projects_table.attach(l, i, i + 1, 0, 1)
|
||||
|
||||
self.projects_table.attach(new_project_combobox, 0, 1, 1, 2)
|
||||
|
||||
def main(self):
|
||||
self.window.show_all()
|
||||
gtk.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user