Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cardlist.py23
-rw-r--r--cardtable.py3
-rw-r--r--svgcard.py13
3 files changed, 23 insertions, 16 deletions
diff --git a/cardlist.py b/cardlist.py
index 18dee84..1e5308a 100644
--- a/cardlist.py
+++ b/cardlist.py
@@ -28,9 +28,11 @@ from os.path import join, basename
from model import Pair
from sugar3.graphics import style
+from sugar3 import profile
_logger = logging.getLogger('memorize-activity')
PAIR_SIZE = min(Gdk.Screen.width() / 7, Gdk.Screen.height() / 5)
+user_color = profile.get_color()
class CardList(Gtk.EventBox):
@@ -264,6 +266,8 @@ class CardPair(Gtk.EventBox):
aimg_name=None, bimg_name=None):
Gtk.EventBox.__init__(self)
self.bg_color = '#d7d7d7'
+ self._stroke_color = '#ffffff'
+ self._fill_color = '#4c4d4f'
self.asnd = asnd
self.bsnd = bsnd
@@ -281,8 +285,8 @@ class CardPair(Gtk.EventBox):
-1, {'front_text': {'card_text': text1,
'speak': aspeak,
'text_color': style.Color('#ffffff')},
- 'front': {'fill_color': style.Color('#4c4d4f'),
- 'stroke_color': style.Color('#ffffff')}},
+ 'front': {'fill_color': style.Color(self._fill_color),
+ 'stroke_color': style.Color(self._stroke_color)}},
None, PAIR_SIZE, self.bg_color, font_name1)
self.bcard1.flip()
self.bcard1.set_pixbuf(aimg)
@@ -293,8 +297,8 @@ class CardPair(Gtk.EventBox):
-1, {'front_text': {'card_text': text2,
'speak': bspeak,
'text_color': style.Color('#ffffff')},
- 'front': {'fill_color': style.Color('#4c4d4f'),
- 'stroke_color': style.Color('#ffffff')}},
+ 'front': {'fill_color': style.Color(self._fill_color),
+ 'stroke_color': style.Color(self._stroke_color)}},
None, PAIR_SIZE, self.bg_color, font_name2)
self.bcard2.flip()
self.bcard2.set_pixbuf(bimg)
@@ -310,13 +314,14 @@ class CardPair(Gtk.EventBox):
def set_selected(self, status):
if not status:
- self.bg_color = '#d7d7d7'
+ stroke_color = self._stroke_color
+ fill_color = self._fill_color
else:
- self.bg_color = '#b2b3b7'
+ stroke_color = user_color.get_stroke_color()
+ fill_color = user_color.get_fill_color()
- self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(self.bg_color))
- self.bcard1.set_background(self.bg_color)
- self.bcard2.set_background(self.bg_color)
+ self.bcard1.set_border(stroke_color, fill_color)
+ self.bcard2.set_border(stroke_color, fill_color)
def change_pixbuf(self, aimg, bimg):
self.bcard1.set_pixbuf(aimg)
diff --git a/cardtable.py b/cardtable.py
index f60dc9b..34cf867 100644
--- a/cardtable.py
+++ b/cardtable.py
@@ -246,7 +246,8 @@ class CardTable(Gtk.EventBox):
self.emit('card-flipped', identifer, False)
def set_border(self, widget, identifer, stroke_color, fill_color):
- self.id2cd[identifer].set_border(stroke_color, fill_color)
+ self.id2cd[identifer].set_border(stroke_color, fill_color,
+ full_animation=True)
def flop_card(self, widget, identifer):
self.id2cd.get(identifer).flop()
diff --git a/svgcard.py b/svgcard.py
index b57c0f3..fc617b7 100644
--- a/svgcard.py
+++ b/svgcard.py
@@ -180,7 +180,7 @@ class SvgCard(Gtk.EventBox):
cache_context.fill()
cache_context.restore()
- def set_border(self, stroke_color, fill_color):
+ def set_border(self, stroke_color, fill_color, full_animation=False):
"""
style_color, fill_color: str with format #RRGGBB
"""
@@ -188,13 +188,14 @@ class SvgCard(Gtk.EventBox):
'stroke_color': style.Color(stroke_color)})
self._cached_surface[True] = None
- if self.get_speak():
- # If we displayed the robot face, displayed the text
- self.jpeg = None
- self.props['front_text']['speak'] = False
+ if full_animation:
+ if self.get_speak():
+ # If we displayed the robot face, displayed the text
+ self.jpeg = None
+ self.props['front_text']['speak'] = False
if not self.is_flipped():
- self.flip(full_animation=True)
+ self.flip(full_animation)
else:
self.queue_draw()