add Totals row and reorganize code a little
This commit is contained in:
parent
a93f550cab
commit
18984c32a0
30
Window.py
30
Window.py
@ -58,21 +58,13 @@ class Window:
|
||||
projects_to_show = {}
|
||||
for p in self.shown_projects:
|
||||
projects_to_show[p] = 1
|
||||
|
||||
# Header row
|
||||
col_headers = ('Project',
|
||||
'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Tot')
|
||||
rows = 2 + len(projects_to_show)
|
||||
rows = 3 + len(projects_to_show)
|
||||
self.projects_table = gtk.Table(rows = rows, columns = len(col_headers))
|
||||
|
||||
self.new_project_combobox = gtk.combo_box_entry_new_text()
|
||||
self.new_project_combobox.connect("key-release-event",
|
||||
self.project_key_press_event)
|
||||
self.add_project_button = gtk.Button('Add')
|
||||
self.add_project_button.connect('clicked', self.add_project_event)
|
||||
project_names = self.projects.values()
|
||||
project_names.sort()
|
||||
for project in project_names:
|
||||
self.new_project_combobox.append_text(project)
|
||||
|
||||
for i in range(len(col_headers)):
|
||||
l = gtk.Label()
|
||||
l.set_markup('<b>%s</b>' % col_headers[i])
|
||||
@ -84,12 +76,28 @@ class Window:
|
||||
self.projects_table.attach(gtk.Label(p), 0, 1, row, row + 1)
|
||||
row += 1
|
||||
|
||||
# Totals row
|
||||
l = gtk.Label()
|
||||
l.set_markup('<b>Total</b>')
|
||||
self.projects_table.attach(l, 0, 1, rows - 2, rows - 1)
|
||||
|
||||
# Add project row
|
||||
self.new_project_combobox = gtk.combo_box_entry_new_text()
|
||||
self.new_project_combobox.connect("key-release-event",
|
||||
self.project_key_press_event)
|
||||
project_names = self.projects.values()
|
||||
project_names.sort()
|
||||
for project in project_names:
|
||||
self.new_project_combobox.append_text(project)
|
||||
self.add_project_button = gtk.Button('Add')
|
||||
self.add_project_button.connect('clicked', self.add_project_event)
|
||||
self.projects_table.attach(self.new_project_combobox, 0, 1,
|
||||
rows - 1, rows)
|
||||
hbox = gtk.HBox()
|
||||
hbox.pack_start(self.add_project_button, expand = False)
|
||||
self.projects_table.attach(hbox, 1, 9, rows - 1, rows)
|
||||
self.projects_table.set_row_spacings(3)
|
||||
|
||||
self.projects_container.pack_start(self.projects_table)
|
||||
self.projects_present = True
|
||||
self.projects_table.show_all()
|
||||
|
Loading…
x
Reference in New Issue
Block a user