Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-07-14 09:33:52 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-07-14 09:33:52 (GMT)
commit57c2df2c5617d8f6c65e66ad2980cda681181011 (patch)
tree8f60d5eedeac48a1ee168c9545f83cebab6e1fbb /game.py
parent9b5c6711edd39ef5719da0f91c46dacba838fbe4 (diff)
Initial implementation of Speak features
Diffstat (limited to 'game.py')
-rw-r--r--game.py47
1 files changed, 26 insertions, 21 deletions
diff --git a/game.py b/game.py
index fb86c10..b33c748 100644
--- a/game.py
+++ b/game.py
@@ -40,23 +40,24 @@ PATH = '/org/laptop/Memorize'
class MemorizeGame(GObject):
__gsignals__ = {
- 'reset_scoreboard': (SIGNAL_RUN_FIRST, None, []),
- 'reset_table': (SIGNAL_RUN_FIRST, None, []),
- 'load_mode': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
- 'load_game': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'change_game': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'change_game_signal': (SIGNAL_RUN_FIRST, None, 5 * [TYPE_PYOBJECT]),
- 'set-border': (SIGNAL_RUN_FIRST, None, 3 * [TYPE_PYOBJECT]),
- 'flip-card': (SIGNAL_RUN_FIRST, None, [int]),
- 'flip-card-signal': (SIGNAL_RUN_FIRST, None, [int]),
- 'flop-card': (SIGNAL_RUN_FIRST, None, [int]),
- 'highlight-card': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'add_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'rem_buddy': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
- 'increase-score': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
- 'wait_mode_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'msg_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
- 'change-turn': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
+ 'reset_scoreboard': (SIGNAL_RUN_FIRST, None, []),
+ 'reset_table': (SIGNAL_RUN_FIRST, None, []),
+ 'load_mode': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
+ 'load_game': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'change_game': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'change_game_signal': (SIGNAL_RUN_FIRST, None, 5 * [TYPE_PYOBJECT]),
+ 'set-border': (SIGNAL_RUN_FIRST, None, 3 * [TYPE_PYOBJECT]),
+ 'flip-card': (SIGNAL_RUN_FIRST, None, [int]),
+ 'flip-card-signal': (SIGNAL_RUN_FIRST, None, [int]),
+ 'cement-card': (SIGNAL_RUN_FIRST, None, [int]),
+ 'flop-card': (SIGNAL_RUN_FIRST, None, [int]),
+ 'highlight-card': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'add_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'rem_buddy': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
+ 'increase-score': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
+ 'wait_mode_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'msg_buddy': (SIGNAL_RUN_FIRST, None, 2 * [TYPE_PYOBJECT]),
+ 'change-turn': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]),
}
def __init__(self):
@@ -68,15 +69,15 @@ class MemorizeGame(GObject):
self.current_player = None
self.last_flipped = -1
self.last_highlight = 1
- self.game_dir = join(dirname(__file__), 'games')
self.messenger = None
self.sentitive = True
- self.model = Model(dirname(__file__))
+
+ self.model = Model()
self.flip_block = False
self._flop_cards = None
- self.audio = Audio()
-
+ self.audio = Audio()
+
def load_game(self, game_name, size, mode):
self.set_load_mode('Loading game')
if self.model.read(game_name) == 0:
@@ -220,6 +221,10 @@ class MemorizeGame(GObject):
self.model.grid[id]['state'] = self.current_player.props.color
self.model.grid[self.last_flipped]['state'] = self.current_player.props.color
self.flip_block = False
+
+ self.emit('cement-card', id)
+ self.emit('cement-card', self.last_flipped)
+
# Pair didn't match
else:
self.model.grid[id]['state'] = '1'