From 838a21fb998f1e9b11d480c839ebcfa93383ba5c Mon Sep 17 00:00:00 2001 From: Daniel Francis Date: Thu, 03 May 2012 23:25:32 +0000 Subject: Adding Date and Time at the Scores --- (limited to 'dialogs.py') diff --git a/dialogs.py b/dialogs.py index 6ee7888..dca35b8 100644 --- a/dialogs.py +++ b/dialogs.py @@ -18,6 +18,7 @@ from gettext import gettext as _ import os +import time import gobject import gtk @@ -119,25 +120,33 @@ class ScoreDialog(_DialogWindow): def __init__(self, scores): - super(ScoreDialog, self).__init__("score", _('Score')) + super(ScoreDialog, self).__init__("score", _('Scores')) scrollwin = gtk.ScrolledWindow() scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) self.content_vbox.pack_start(scrollwin) - - liststore = gtk.ListStore(str) + + liststore = gtk.ListStore(str, str) treeview = gtk.TreeView(liststore) - + time_cell = gtk.CellRendererText() - time_column = gtk.TreeViewColumn(_("Time")) + time_column = gtk.TreeViewColumn(_("Score")) time_column.pack_start(time_cell) time_column.set_attributes(time_cell, text=0) - + treeview.append_column(time_column) + + date_cell = gtk.CellRendererText() + date_column = gtk.TreeViewColumn(_("Date and Time")) + date_column.pack_start(date_cell) + date_column.set_attributes(date_cell, text=1) + treeview.append_column(date_column) + scores.sort() for i in scores: - liststore.append([i]) + score, date = i.split() + liststore.append([score, time.ctime(float(date))]) scrollwin.add_with_viewport(treeview) -- cgit v0.9.1