Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTam.py
diff options
context:
space:
mode:
authorNathanaël Lécaudé <Nat@localhost.localdomain>2007-01-29 05:32:48 (GMT)
committer Nathanaël Lécaudé <Nat@localhost.localdomain>2007-01-29 05:32:48 (GMT)
commitd1bd5c3afca2aad09701af702d018f3e99496d07 (patch)
treeb1e9a11facf7adf87eb7aec1f1e5497f89bb126f /TamTam.py
parent9b3d8e0a679913b29390fab8f2da7c68acc9bd1c (diff)
TamTam will run in non-sugar env
Diffstat (limited to 'TamTam.py')
-rwxr-xr-xTamTam.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/TamTam.py b/TamTam.py
index 4f7fa1f..9cc6dc3 100755
--- a/TamTam.py
+++ b/TamTam.py
@@ -1,6 +1,4 @@
-import signal
-import time
-import sys
+import signal , time , sys , os, shutil
import pygtk
pygtk.require( '2.0' )
import gtk
@@ -10,9 +8,17 @@ import Util.CSoundClient as CSoundClient
from Util.Profiler import TP
from Player.StandalonePlayer import StandAlonePlayer
from Edit.MainWindow import MainWindow
-
from Util.Clooper.SClient import *
+SugarMode = True
+
+try :
+ from sugar.activity.Activity import Activity
+ from sugar import env
+except ImportError:
+ print "No Sugar for you"
+ SugarMode = False
+
#csnd = CSoundClient.CSoundClientSocket( Config.SERVER_ADDRESS, Config.SERVER_PORT, os.getpid() )
#csnd = CSoundClient.CSoundClientPerf( '/usr/share/olpc-csound-server/univorc.csd' )
#csnd = CSoundClient.CSoundClientPerf( Config.TAM_TAM_ROOT + '/Resources/univorc.csd' )
@@ -22,11 +28,10 @@ csnd.connect(True)
csnd.setMasterVolume(100.0)
CSoundClient.CSoundClient = csnd #Dodgy move: TODO: remove this global variable.
-from sugar.activity.Activity import Activity
-from sugar import env
-import os, shutil
-
-home_path = env.get_profile_path() + Config.PREF_DIR
+if SugarMode == True:
+ home_path = env.get_profile_path() + Config.PREF_DIR
+else:
+ home_path = Config.SOUNDS_DIR + '/temp'
if not os.path.isdir(home_path):
os.mkdir(home_path)
os.system('chmod 0777 ' + home_path + ' &')
@@ -35,7 +40,7 @@ if not os.path.isdir(home_path):
os.system('chmod 0777 ' + home_path + '/' + snd + ' &')
if __name__ == "__main__":
- def run_sugar_mode():
+ def run_non_sugar_mode():
tamtam = StandAlonePlayer(csnd)
mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL)
color = gtk.gdk.color_parse('#FFFFFF')
@@ -77,7 +82,7 @@ if __name__ == "__main__":
else:
run_edit_mode()
else:
- run_sugar_mode()
+ run_non_sugar_mode()
csnd.connect(False)
csnd.destroy()