Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2011-09-19 15:03:43 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2011-09-19 15:03:43 (GMT)
commit1d85755b9a93149d380a944c2c3b08ab7a384c96 (patch)
treed6990854d1f1ee53f3ffd9a3918b37ceb94febb8
parent1742303dc81b8b3872e3147f7cdbaae9490554ac (diff)
Avoid renaiming sound files
Before the sound files were renamed to have specific file names, different if the game have equals or non equals tiles, but if the user change this property had errors saving/loading the game.
-rw-r--r--activity.py13
-rw-r--r--cardlist.py16
-rw-r--r--createtoolbar.py2
3 files changed, 6 insertions, 25 deletions
diff --git a/activity.py b/activity.py
index d2db870..9bba185 100644
--- a/activity.py
+++ b/activity.py
@@ -258,23 +258,14 @@ class MemorizeActivity(Activity):
# asnd
asnd = self.game.model.pairs[pair].get_property('asnd')
if asnd != None:
- if equal_pairs:
- asndfile = 'snd' + str(pair) + '.ogg'
- else:
- asndfile = 'asnd' + str(pair) + '.ogg'
- _logger.error(asndfile + ': ' + asnd)
game_zip.write(os.path.join(temp_snd_folder, asnd),
- os.path.join('sounds', asndfile))
+ os.path.join('sounds', asnd))
# bsnd
bsnd = self.game.model.pairs[pair].get_property('bsnd')
if bsnd != None:
- if equal_pairs:
- bsndfile = 'snd' + str(pair) + '.ogg'
- else:
- bsndfile = 'bsnd' + str(pair) + '.ogg'
game_zip.write(os.path.join(temp_snd_folder, bsnd),
- os.path.join('sounds', bsndfile))
+ os.path.join('sounds', bsnd))
self.game.model.game_path = self.game.model.temp_folder
self.game.model.write()
diff --git a/cardlist.py b/cardlist.py
index d0bec83..ba126b9 100644
--- a/cardlist.py
+++ b/cardlist.py
@@ -18,7 +18,7 @@
import gtk
import svgcard
import logging
-from os.path import join
+from os.path import join, basename
import shutil
from model import Pair
@@ -156,22 +156,12 @@ class CardList(gtk.EventBox):
asnd = self.pairs[pair].get_sound(1)
logging.debug('update_model asnd %s', asnd)
if asnd != None:
- if equal_pairs:
- asndfile = 'snd' + str(pair) + '.ogg'
- else:
- asndfile = 'asnd' + str(pair) + '.ogg'
- pair_card.set_property('asnd', asndfile)
- shutil.move(asnd, join(temp_snd_folder, asndfile))
+ pair_card.set_property('asnd', basename(asnd))
# bsnd
bsnd = self.pairs[pair].get_sound(2)
logging.debug('update_model bsnd %s', bsnd)
if bsnd != None:
- if equal_pairs:
- bsndfile = 'snd' + str(pair) + '.ogg'
- else:
- bsndfile = 'bsnd' + str(pair) + '.ogg'
- shutil.move(bsnd, join(temp_snd_folder, bsndfile))
- pair_card.set_property('bsnd', bsndfile)
+ pair_card.set_property('bsnd', basename(bsnd))
game_model.pairs[pair] = pair_card
diff --git a/createtoolbar.py b/createtoolbar.py
index d9c3bc0..9f95553 100644
--- a/createtoolbar.py
+++ b/createtoolbar.py
@@ -89,7 +89,6 @@ class CreateToolbarBuilder(gobject.GObject):
self._clear_button.set_sensitive(active)
def _emit_equal_pairs(self, widget):
- self.emit('create_equal_pairs', self._equal_pairs.get_active())
if self._equal_pairs.get_active():
self._equal_pairs.set_named_icon('pair-equals')
self._equal_pairs.set_tooltip(_('Set non equal pairs'))
@@ -98,6 +97,7 @@ class CreateToolbarBuilder(gobject.GObject):
self._equal_pairs.set_named_icon('pair-non-equals')
self._equal_pairs.set_tooltip(_('Set equal pairs'))
self.activity.game.model.data['equal_pairs'] = '0'
+ self.emit('create_equal_pairs', self._equal_pairs.get_active())
def _grouped_cb(self, widget):
if self._grouped.get_active():