Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-12-21 18:53:32 (GMT)
committer Aneesh Dogra <lionaneesh@gmail.com>2012-12-21 18:53:32 (GMT)
commit439077ffad53b7deb11c03518bff106a2a66b491 (patch)
tree6f6e892d66cb1a449c62315e90ed7d841c2c5245
parent317653a3f8be4a99ef50322c4ee0bba972a6add8 (diff)
Complete a TODO. Remove the results toolbar instead add the labels
directly to the main toolbar.
-rw-r--r--ConstellationsFlashCards.py37
-rw-r--r--icons/ConstellationAnswer.svg13
2 files changed, 21 insertions, 29 deletions
diff --git a/ConstellationsFlashCards.py b/ConstellationsFlashCards.py
index d85d5b7..0587707 100644
--- a/ConstellationsFlashCards.py
+++ b/ConstellationsFlashCards.py
@@ -1,7 +1,5 @@
# Constellations Flash-Cards
#
-# TODO: Add a "clear results" button to the "results" toolbar.
-#
# Copyright (c) 2010 by David A. Wallace
# Copyright (c) 2012 Aneesh Dogra <lionaneesh@gmail.com>
#
@@ -90,6 +88,7 @@ from sugar3.activity import activity
from sugar3.graphics.style import Color
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.activity.widgets import StopButton
+from sugar3.graphics.toolbutton import ToolButton
from sugar3.activity.activity import get_bundle_path
from sugar3.graphics.toolbarbox import ToolbarButton
from sugar3.graphics.toolbarbox import ToolbarBox
@@ -271,6 +270,14 @@ class ChartDisplay(Gtk.DrawingArea):
labelr1.set_label(str(quiz_count) + _(" constellations seen."))
labelr3.set_label(str(correct_first_count) + _(" correct on first try."))
labelr4.set_label(str(correct_second_count) + _(" correct on second try."))
+ elif data == 'reset_results':
+ quiz_count = 0
+ correct_first_count = 0
+ correct_second_count = 0
+ # Let's update the results now
+ labelr1.set_label(str(quiz_count) + _(" constellations seen."))
+ labelr3.set_label(str(correct_first_count) + _(" correct on first try."))
+ labelr4.set_label(str(correct_second_count) + _(" correct on second try."))
else:
pass
return False
@@ -663,7 +670,7 @@ class ConstellationsFlashCards(activity.Activity):
activity.Activity.__init__(self, handle)
self.datafile = os.path.join(activity.get_activity_root(),\
"data", "C_FC.cfg")
-
+ self.chart = ChartDisplay(self)
# Build the translation from constellation name to constellation ID (needed so we can
# have a list of names to choose from). At the same time, make an array of constellation
# IDs so the randomizer can pick one.
@@ -706,32 +713,31 @@ class ConstellationsFlashCards(activity.Activity):
quiz_toolbar_button.show()
toolbar_box.toolbar.insert(quiz_toolbar_button, -1)
- # Result Toolbar
+ # Reset Results
+ reset_button = ToolButton('system-restart')
+ reset_button.set_tooltip(_('Reset Results'))
+ reset_button.connect('clicked', self.chart.callback, 'reset_results')
+ toolbar_box.toolbar.insert(reset_button, -1)
+ reset_button.show()
+ # Results
- self.result_toolbar = Gtk.Toolbar()
label_container = Gtk.ToolItem()
label_container.add(labelr1)
label_container.show_all()
- self.result_toolbar.insert(label_container, -1)
+ toolbar_box.toolbar.insert(label_container, -1)
label_container = Gtk.ToolItem()
label_container.add(labelr2)
label_container.show_all()
- self.result_toolbar.insert(label_container, -1)
+ toolbar_box.toolbar.insert(label_container, -1)
label_container = Gtk.ToolItem()
label_container.add(labelr3)
label_container.show_all()
- self.result_toolbar.insert(label_container, -1)
+ toolbar_box.toolbar.insert(label_container, -1)
label_container = Gtk.ToolItem()
label_container.add(labelr4)
label_container.show_all()
- self.result_toolbar.insert(label_container, -1)
-
- result_toolbar_button = ToolbarButton(
- page=self.result_toolbar,
- icon_name='ConstellationAnswer')
- toolbar_box.toolbar.insert(result_toolbar_button, -1)
- result_toolbar_button.show()
+ toolbar_box.toolbar.insert(label_container, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
@@ -752,7 +758,6 @@ class ConstellationsFlashCards(activity.Activity):
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
- self.chart = ChartDisplay(self)
eb = Gtk.EventBox()
vbox = Gtk.VBox()
self.identifyobject = Gtk.Label("")
diff --git a/icons/ConstellationAnswer.svg b/icons/ConstellationAnswer.svg
deleted file mode 100644
index 67be43a..0000000
--- a/icons/ConstellationAnswer.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="44" height="44" viewBox="0 0 44 44" id="svg2" xml:space="preserve"><metadata id="metadata13"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata>
-<defs id="defs4">
-</defs>
-<polygon points="34.857,39.584 32.25,39.852 30.991,42.15 29.934,39.754 27.357,39.268 29.311,37.52 28.977,34.92 31.242,36.236 33.611,35.115 33.061,37.678 33.061,37.678 " transform="translate(-9.1428571,-31.904761)" id="polygon239_1_" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/>
-
-
-<polygon points="26,40.852 24.346,41.41 23.867,43.091 22.825,41.689 21.079,41.755 22.089,40.329 21.489,38.689 23.156,39.211 24.529,38.133 24.55,39.879 24.55,39.879 " transform="translate(0.8571429,-2.2857143)" id="polygon245_1_" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/>
-
-
-<polygon points="34.857,39.584 32.25,39.852 30.991,42.15 29.934,39.754 27.357,39.268 29.311,37.52 28.977,34.92 31.242,36.236 33.611,35.115 33.061,37.678 33.061,37.678 " transform="translate(-24.059381,-26.630237)" id="polygon2388" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/><polygon points="26,40.852 24.346,41.41 23.867,43.091 22.825,41.689 21.079,41.755 22.089,40.329 21.489,38.689 23.156,39.211 24.529,38.133 24.55,39.879 24.55,39.879 " transform="translate(-15.729977,-9.4691425)" id="polygon2390" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/><polygon points="26,40.852 24.346,41.41 23.867,43.091 22.825,41.689 21.079,41.755 22.089,40.329 21.489,38.689 23.156,39.211 24.529,38.133 24.55,39.879 24.55,39.879 " transform="translate(14.555738,-23.850095)" id="polygon2392" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/><path d="M 6.542215,16.622298 6.6958803,26.806273" id="path3174" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><path d="M 10.190476,33.142857 20.761905,37.52381" id="path3182" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><polygon points="34.857,39.584 32.25,39.852 30.991,42.15 29.934,39.754 27.357,39.268 29.311,37.52 28.977,34.92 31.242,36.236 33.611,35.115 33.061,37.678 33.061,37.678 " transform="translate(6.5120481,-4.2492857)" id="polygon3184" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-opacity:1"/><path d="m 27.238095,36.952381 5.52381,-1.523809" id="path3186" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><path d="m 37.955841,20.730447 -0.197396,8.443868" id="path3188" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><path d="m 11.238095,9.9047617 5.428572,-2.190476" id="path3190" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><path d="m 27.047619,8.2857147 8.095238,5.4285713" id="path3192" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><text x="12.761905" y="30.857143" id="text2998" xml:space="preserve" style="font-size:11px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans"><tspan x="12.761905" y="30.857143" id="tspan3000" style="font-size:24px;font-weight:bold;fill:#ffffff;fill-opacity:1;stroke:none;-inkscape-font-specification:Sans Bold">✓</tspan></text>
-</svg> \ No newline at end of file