[gcompris] play_piano, now the passed/failed icon looks good.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] play_piano, now the passed/failed icon looks good.
- Date: Mon, 24 Sep 2012 23:42:39 +0000 (UTC)
commit d42f877b886b1c8d8f12cc68cd7449865c7feb24
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Tue Sep 25 01:40:38 2012 +0200
play_piano, now the passed/failed icon looks good.
This is a uggly hack because the staff being scaled by 2
we have no other choice not to draw our icon in its root item.
Here we pass a non scaled root item to draw these status icon in it.
src/piano_composition-activity/gcomprismusic.py | 24 +++++++++++++------
.../resources/piano_composition/failed.svg | 20 ++++++++--------
.../resources/piano_composition/passed.svg | 20 ++++++++--------
src/play_piano-activity/play_piano.py | 4 +-
4 files changed, 38 insertions(+), 30 deletions(-)
---
diff --git a/src/piano_composition-activity/gcomprismusic.py b/src/piano_composition-activity/gcomprismusic.py
index 38acf98..09772c0 100644
--- a/src/piano_composition-activity/gcomprismusic.py
+++ b/src/piano_composition-activity/gcomprismusic.py
@@ -910,6 +910,7 @@ class Note():
removes the note from the canvas
'''
self.rootitem.remove()
+ self.statusNone()
def drawPictureFocus(self, x, y):
'''
@@ -970,22 +971,29 @@ class Note():
height=20,
)
- def statusPassed(self):
+ # statusPassed and statusFailed requires a non scaled
+ # rootitem. Since the staff maybe scaled by 2 our icon
+ # looks terribly bad.
+ def statusPassed(self, rootitem):
''' Mark this note with a passed icon'''
+ (x, y)= self.rootitem.get_canvas().\
+ convert_from_item_space(self.rootitem, self.x, self.y)
self.success = goocanvas.Image(
- parent = self.rootitem,
+ parent = rootitem,
pixbuf = gcompris.utils.load_pixmap("piano_composition/passed.svg"),
- x = self.x,
- y = self.y,
+ x = x,
+ y = y,
)
- def statusFailed(self):
+ def statusFailed(self, rootitem):
''' Mark this note with a failed icon'''
+ (x, y)= self.rootitem.get_canvas().\
+ convert_from_item_space(self.rootitem, self.x, self.y)
self.success = goocanvas.Image(
- parent = self.rootitem,
+ parent = rootitem,
pixbuf = gcompris.utils.load_pixmap("piano_composition/failed.svg"),
- x = self.x,
- y = self.y,
+ x = x,
+ y = y,
)
def statusNone(self):
diff --git a/src/piano_composition-activity/resources/piano_composition/failed.svg b/src/piano_composition-activity/resources/piano_composition/failed.svg
index e1b143e..4bd116d 100644
--- a/src/piano_composition-activity/resources/piano_composition/failed.svg
+++ b/src/piano_composition-activity/resources/piano_composition/failed.svg
@@ -10,8 +10,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="10.000082"
- height="10.070951"
+ width="20"
+ height="20"
id="svg4191"
version="1.1"
inkscape:version="0.48.3.1 r9886"
@@ -98,16 +98,16 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="2.8"
- inkscape:cx="-31.693362"
- inkscape:cy="15.66458"
+ inkscape:zoom="11.2"
+ inkscape:cx="-8.0357778"
+ inkscape:cy="15.676832"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1210"
inkscape:window-height="871"
- inkscape:window-x="83"
- inkscape:window-y="88"
+ inkscape:window-x="290"
+ inkscape:window-y="107"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
@@ -121,7 +121,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -129,10 +129,10 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(-303.72796,-387.95169)">
+ transform="translate(-303.72363,-378.02262)">
<g
style="display:inline"
- transform="matrix(0.24390445,0,0,0.24563296,132.17167,332.1623)"
+ transform="matrix(0.48781303,0,0,0.48775515,-39.39722,267.24524)"
id="g3171">
<path
sodipodi:type="arc"
diff --git a/src/piano_composition-activity/resources/piano_composition/passed.svg b/src/piano_composition-activity/resources/piano_composition/passed.svg
index 53e0718..94e5a33 100644
--- a/src/piano_composition-activity/resources/piano_composition/passed.svg
+++ b/src/piano_composition-activity/resources/piano_composition/passed.svg
@@ -10,8 +10,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="9.9991474"
- height="10.00092"
+ width="19.99893"
+ height="20.000042"
id="svg4191"
version="1.1"
inkscape:version="0.48.3.1 r9886"
@@ -99,15 +99,15 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6"
- inkscape:cx="4.1677789"
- inkscape:cy="-12.634861"
+ inkscape:cx="4.1725396"
+ inkscape:cy="-12.633547"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1281"
- inkscape:window-height="871"
- inkscape:window-x="83"
- inkscape:window-y="88"
+ inkscape:window-width="888"
+ inkscape:window-height="865"
+ inkscape:window-x="726"
+ inkscape:window-y="66"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
@@ -129,11 +129,11 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(-289.44168,-388.10001)">
+ transform="translate(-289.43692,-378.1022)">
<g
style="display:inline"
id="CHECKED"
- transform="matrix(0.24388164,0,0,0.24392489,117.90143,307.0331)">
+ transform="matrix(0.48777877,0,0,0.4878059,-53.654473,215.98296)">
<path
transform="matrix(-0.1087594,0,0,0.1087594,688.40496,317.87405)"
d="m -157.47986,322.08786 c 0,92.94252 -75.3448,168.28732 -168.28732,168.28732 -92.94252,0 -168.28732,-75.3448 -168.28732,-168.28732 0,-92.94252 75.3448,-168.28732 168.28732,-168.28732 92.94252,0 168.28732,75.3448 168.28732,168.28732 z"
diff --git a/src/play_piano-activity/play_piano.py b/src/play_piano-activity/play_piano.py
index 995e39b..1d589e2 100644
--- a/src/play_piano-activity/play_piano.py
+++ b/src/play_piano-activity/play_piano.py
@@ -168,9 +168,9 @@ class Gcompris_play_piano:
if len(self.staff.noteList) > current_note_number:
note_on_staff = self.staff.noteList[current_note_number]
if note_played.numID == note_on_staff.numID:
- note_on_staff.statusPassed()
+ note_on_staff.statusPassed(self.rootitem)
else:
- note_on_staff.statusFailed()
+ note_on_staff.statusFailed(self.rootitem)
self.show_erase(True)
if len(self.staff.noteList) - 1 == current_note_number:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]