Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--game.py84
1 files changed, 35 insertions, 49 deletions
diff --git a/game.py b/game.py
index 6769f2f..4f8b027 100644
--- a/game.py
+++ b/game.py
@@ -173,7 +173,7 @@ class Game():
self._new_dot(self._colors[WHITE]))
self._dots[x + y * NINE].type = DOT
self._dots[x + y * NINE].set_layer(100)
- self._lightbg.set_label('Tap on the yellow dot.')
+ self._lightbg.set_label(_('Tap on the yellow dot.'))
self._targets = [int(uniform(0, NINE * FIVE))]
self._next = self._yellow_dot_too
self._dots[self._targets[0]].set_shape(
@@ -189,8 +189,8 @@ class Game():
while i in self._targets:
i = int(uniform(0, NINE * FIVE))
self._targets.append(i)
- self._lightbg.set_label('Well done! \
-Now tap on the other yellow dot.')
+ self._lightbg.set_label(_('Well done! \
+Now tap on the other yellow dot.'))
self._next = self._yellow_dots_three
self._dots[self._targets[1]].set_shape(
self._new_dot(self._colors[YELLOW]))
@@ -201,13 +201,13 @@ Now tap on the other yellow dot.')
''' Things to reinitialize when starting up a new game. '''
if self._release == self._targets[0]:
self._yellow_dot_too(append=False)
- self._lightbg.set_label('The other yellow dot!')
+ self._lightbg.set_label(_('The other yellow dot!'))
return
i = self._targets[0]
while i in self._targets:
i = int(uniform(0, NINE * FIVE))
self._targets.append(i)
- self._lightbg.set_label('Great! Now rub on one of the yellow dots.')
+ self._lightbg.set_label(_('Great! Now rub on one of the yellow dots.'))
self._next = self._red_dot
self._dots[self._targets[2]].set_shape(
self._new_dot(self._colors[YELLOW]))
@@ -217,8 +217,8 @@ Now tap on the other yellow dot.')
def _red_dot(self):
if self._release is None:
return
- self._lightbg.set_label('Good job! \
-Now rub on another one of the yellow dots.')
+ self._lightbg.set_label(_('Good job! \
+Now rub on another one of the yellow dots.'))
self._next = self._blue_dot
self._dots[self._release].set_shape(self._new_dot(self._colors[RED]))
self._dots[self._release].type = RED
@@ -229,7 +229,8 @@ Now rub on another one of the yellow dots.')
return
if self._dots[self._release].type != YELLOW:
return
- self._lightbg.set_label('Now gently tap on the yellow dot five times.')
+ self._lightbg.set_label(
+ _('Now gently tap on the yellow dot five times.'))
self._next = self._yellow_tap
self._dots[self._release].set_shape(self._new_dot(self._colors[BLUE]))
self._dots[self._release].type = BLUE
@@ -238,15 +239,16 @@ Now rub on another one of the yellow dots.')
def _yellow_tap(self):
if self._dots[self._release].type != YELLOW:
- self._lightbg.set_label('The yellow dot!!')
+ self._lightbg.set_label(_('The yellow dot!!'))
return
self._count += 1
if self._count > 4:
self._count = 0
self._next = self._red_tap
- self._lightbg.set_label('Now gently tap on the red dot five times.')
+ self._lightbg.set_label(
+ _('Now gently tap on the red dot five times.'))
else:
- self._lightbg.set_label('Keep tapping.')
+ self._lightbg.set_label(_('Keep tapping.'))
i = self._targets[0]
while i in self._targets:
i = int(uniform(0, NINE * FIVE))
@@ -256,15 +258,16 @@ Now rub on another one of the yellow dots.')
def _red_tap(self):
if self._dots[self._release].type != RED:
- self._lightbg.set_label('The red dot!!')
+ self._lightbg.set_label(_('The red dot!!'))
return
self._count += 1
if self._count > 4:
self._count = 0
self._next = self._blue_tap
- self._lightbg.set_label('Now gently tap on the blue dot five times.')
+ self._lightbg.set_label(
+ _('Now gently tap on the blue dot five times.'))
else:
- self._lightbg.set_label('Keep tapping.')
+ self._lightbg.set_label(_('Keep tapping.'))
i = self._targets[0]
while i in self._targets:
i = int(uniform(0, NINE * FIVE))
@@ -274,17 +277,17 @@ Now rub on another one of the yellow dots.')
def _blue_tap(self):
if self._dots[self._release].type != BLUE:
- self._lightbg.set_label('The blue dot!!')
+ self._lightbg.set_label(_('The blue dot!!'))
return
self._count += 1
if self._count > 4:
self._count = 0
self._next = self._shake_it
- self._lightbg.set_label('OK. Now, shake the computer!!')
+ self._lightbg.set_label(_('OK. Now, shake the computer!!'))
# Since we don't end up in the button press
GObject.timeout_add(500, self._next)
else:
- self._lightbg.set_label('Keep tapping.')
+ self._lightbg.set_label(_('Keep tapping.'))
i = self._targets[0]
while i in self._targets:
i = int(uniform(0, NINE * FIVE))
@@ -310,26 +313,27 @@ Now rub on another one of the yellow dots.')
GObject.timeout_add(5000, self._clear_pause)
def _turn_left(self):
- self._lightbg.set_label('See what happens if you turn it to the left.')
+ self._lightbg.set_label(
+ _('See what happens if you turn it to the left.'))
self._next = self._turn_right
self._shake = 'left'
self._pausing = True
def _turn_right(self):
- self._lightbg.set_label('Now turn it to the right.')
+ self._lightbg.set_label(_('Now turn it to the right.'))
self._next = self._align
self._pausing = True
self._shake = 'right'
def _align(self):
- self._lightbg.set_label('Shake it some more.')
+ self._lightbg.set_label(_('Shake it some more.'))
self._next = self._tap_six
self._pausing = True
self._shake = 'align'
def _tap_six(self):
self._shake = None
- self._lightbg.set_label('OK. Now press each of the yellow dots.')
+ self._lightbg.set_label(_('OK. Now press each of the yellow dots.'))
if self._tapped == None:
self._tapped = []
if self._dots[self._release].type != YELLOW:
@@ -345,17 +349,15 @@ Now rub on another one of the yellow dots.')
for dot in self._dots:
if dot.type != YELLOW:
dot.set_layer(0)
- self._darkbg.set_label('Press all of the yellow dots again!')
+ self._darkbg.set_label(_('Press all of the yellow dots again!'))
self._tapped = None
self._next = self._tap_six_too
def _tap_six_too(self):
self._shake = None
- self._lightbg.set_label('Try pressing each of the yellow dots again.')
if self._tapped == None:
self._tapped = []
if self._dots[self._release].type != YELLOW:
- self._lightbg.set_label('Only press the yellow dots.')
return
else:
if not self._release in self._tapped:
@@ -372,7 +374,7 @@ Now rub on another one of the yellow dots.')
self._dots[self._targets[1]].move(pos2)
self._dots[self._targets[2]].move(pos1)
self._lightbg.set_label(
- 'Tap on the two dots that switched positions.')
+ _('Tap on the two dots that switched positions.'))
self._tapped = None
self._next = self._tap_two
@@ -381,7 +383,7 @@ Now rub on another one of the yellow dots.')
if self._tapped == None:
self._tapped = []
if not self._release in [self._targets[1], self._targets[2]]:
- self._lightbg.set_label('Keep trying.')
+ self._lightbg.set_label(_('Keep trying.'))
return
else:
if not self._release in self._tapped:
@@ -392,7 +394,7 @@ Now rub on another one of the yellow dots.')
pos2 = self._dots[self._targets[2]].get_xy()
self._dots[self._targets[1]].move(pos2)
self._dots[self._targets[2]].move(pos1)
- self._lightbg.set_label("Good job! Now let's shake again.")
+ self._lightbg.set_label(_("Good job! Now let's shake again."))
self._shake = 'random2'
self._next = self._shake_three
# Since we don't end up in the button press
@@ -400,7 +402,7 @@ Now rub on another one of the yellow dots.')
for i in self._tapped:
self._dots[i].set_label('')
elif len(self._tapped) == 1:
- self._lightbg.set_label('You found one. Now find the other one.')
+ self._lightbg.set_label(_('You found one. Now find the other one.'))
def _shake_three(self):
self._next = self._fade_it
@@ -413,7 +415,7 @@ Now rub on another one of the yellow dots.')
for dot in self._dots:
if dot.type in [RED, YELLOW, BLUE]:
self._fade_dot(dot, 1)
- self._lightbg.set_label('Going.')
+ self._lightbg.set_label(_('Going'))
self._shake = 'random2'
self._next = self._fade_it_again
self._pausing = True
@@ -423,7 +425,7 @@ Now rub on another one of the yellow dots.')
for dot in self._dots:
if dot.type in [RED, YELLOW, BLUE]:
self._fade_dot(dot, 2)
- self._lightbg.set_label('Going.' + '.')
+ self._lightbg.set_label(_('Going') + '..')
self._shake = 'random2'
self._next = self._and_again
self._pausing = True
@@ -433,7 +435,7 @@ Now rub on another one of the yellow dots.')
for dot in self._dots:
if dot.type in [RED, YELLOW, BLUE]:
self._fade_dot(dot, 3)
- self._lightbg.set_label('Going.' + '..')
+ self._lightbg.set_label(_('Going') + '...')
self._shake = 'random2'
self._next = self._one_last_time
self._pausing = True
@@ -443,7 +445,7 @@ Now rub on another one of the yellow dots.')
for dot in self._dots:
if dot.type in [RED, YELLOW, BLUE]:
self._fade_dot(dot, 4)
- self._lightbg.set_label('Gone!')
+ self._lightbg.set_label(_('Gone!'))
self._shake = None
self._next = self._yellow_dot
GObject.timeout_add(500, self._next)
@@ -602,7 +604,7 @@ Now rub on another one of the yellow dots.')
self._release = None
if self._pausing:
- self._lightbg.set_label('Rub a little longer.')
+ self._lightbg.set_label(_('Rub a little longer.'))
return True
x, y = map(int, event.get_coords())
@@ -630,22 +632,6 @@ Now rub on another one of the yellow dots.')
''' calculate the grid column and row for a dot '''
return [dot % NINE, int(dot / NINE)]
- """
- def _expose_cb(self, win, event):
- self.do_expose_event(event)
-
- def do_expose_event(self, event):
- ''' Handle the expose-event by drawing '''
- # Restrict Cairo to the exposed area
-
- cr = self._canvas.window.cairo_create()
- cr.rectangle(event.area.x, event.area.y,
- event.area.width, event.area.height)
- cr.clip()
- # Refresh sprite list
- self._sprites.redraw_sprites(cr=cr)
- """
-
def _destroy_cb(self, win, event):
Gtk.main_quit()