Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2014-02-04 21:06:57 (GMT)
committer Walter Bender <walter@sugarlabs.org>2014-02-04 21:06:57 (GMT)
commitdbd7908aaf2c0ad38dbe4ea9415d720cf8190452 (patch)
tree44b45e4b7c5f1897c3478509c25bc4ae634e7b68 /library
parentd543dbd3c1a761876efda2220345117e1aefd624 (diff)
fix several issues with sound: workaround for import sugar3.activity error; don't load sound examples if tamtam suite is not installed
Diffstat (limited to 'library')
-rw-r--r--library/pippy/sound.py53
1 files changed, 27 insertions, 26 deletions
diff --git a/library/pippy/sound.py b/library/pippy/sound.py
index b758a2a..0e3cf03 100644
--- a/library/pippy/sound.py
+++ b/library/pippy/sound.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2007,2008 One Laptop per Child Association, Inc.
+# Copyright (C) 2013,14 Walter Bender (walter@sugarlabs.org)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,29 +21,6 @@ import os
from gettext import gettext as _
from sugar3 import env
-from sugar3.activity import activity
-
-path = activity.get_bundle_path()
-path = path.split('/')[0:-1]
-path = '/'.join(path)
-
-for f in os.listdir(path):
-
- if f in ['TamTamMini.activity', 'TamTamJam.activity',
- 'TamTamEdit.activity', 'TamTamSynthLab.activity']:
- bundle_dir = os.path.join(path, f)
- tamtam_subdir = str(
- os.path.join(bundle_dir, 'common', 'Resources', 'Sounds'))
- sound_candidate_dirs = [
- os.path.expandvars('$SUGAR_PATH/activities') + tamtam_subdir,
- tamtam_subdir
- ]
- orchlines = []
- scorelines = []
- instrlist = []
- fnum = [100]
- else:
- sound_candidates_dir = None
'''XXX: This function seems to be broken. (CSA)
def quit(self):
@@ -52,6 +30,11 @@ cs.Reset()
cs = None
'''
+orchlines = []
+scorelines = []
+instrlist = []
+fnum = [100]
+
class SoundLibraryNotFoundError(Exception):
def __init__(self):
@@ -60,9 +43,27 @@ class SoundLibraryNotFoundError(Exception):
def finddir():
- for directory in sound_candidate_dirs:
- if os.path.isdir(directory):
- return directory
+ paths = ['/usr/share/sugar/activities', '/home/olpc/Activities']
+ paths.append(os.path.join(os.path.expanduser('~'), 'Activities'))
+
+ sound_candidate_dirs = None
+ for path in paths:
+ for f in os.listdir(path):
+ if f in ['TamTamMini.activity', 'TamTamJam.activity',
+ 'TamTamEdit.activity', 'TamTamSynthLab.activity']:
+ bundle_dir = os.path.join(path, f)
+ tamtam_subdir = str(
+ os.path.join(bundle_dir, 'common', 'Resources', 'Sounds'))
+ sound_candidate_dirs = [
+ os.path.expandvars('$SUGAR_PATH/activities') + \
+ tamtam_subdir,
+ tamtam_subdir
+ ]
+
+ if sound_candidate_dirs is not None:
+ for directory in sound_candidate_dirs:
+ if os.path.isdir(directory):
+ return directory
raise SoundLibraryNotFoundError()