Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/visualmatch.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-12-05 00:49:53 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-12-05 00:49:53 (GMT)
commit3451063b07803a561a85ea69b1d2e41defde3221 (patch)
tree1c1d583676d132f6f69c94a7049ef56d67c68891 /visualmatch.py
parent87f9bb7e8968c87401bca3b4bb6d42ac56d2a222 (diff)
fixed saving low score outside of Sugar
Diffstat (limited to 'visualmatch.py')
-rwxr-xr-xvisualmatch.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/visualmatch.py b/visualmatch.py
index 7cb3aca..44902d4 100755
--- a/visualmatch.py
+++ b/visualmatch.py
@@ -39,8 +39,8 @@ class VisualMatchMain:
# create a new window
self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.win.maximize()
- self.win.set_title(_("Visual Match") + ": " +
- _("Click on cards to create sets of three."))
+ self.win.set_title("%s: %s" % (_("Visual Match"),
+ _("Click on cards to create sets of three.")))
self.win.connect("delete_event", lambda w,e: gtk.main_quit())
menu = gtk.Menu()
@@ -77,6 +77,26 @@ class VisualMatchMain:
os.path.join(os.path.abspath('.'), \
'images/card-'))
self.tw.win = self.win
+ self.tw.activity = self
+ self.load_score()
+
+ def load_score(self):
+ try:
+ f = file(os.path.join(os.path.abspath('.'),
+ 'visualmatch.score'),"r")
+ s = f.read().split(":")
+ f.close
+ self.tw.low_score = int(s[1])
+ print "low score is: %d" % (self.tw.low_score)
+ except:
+ print "low score is: %d" % (self.tw.low_score)
+ self.tw.low_score = -1
+
+ def save_score(self):
+ print "saving low score: %d" % (int(self.tw.low_score))
+ f = file(os.path.join(os.path.abspath('.'),'visualmatch.score'),"w")
+ f.write("low_score:%s" % str(self.tw.low_score))
+ f.close
def set_title(self, title):
self.win.set_title(title)