<commit_before>import os
os.environ['PYTHONPATH'] = '.'
print os.getenv('PYTHONPATH')
import engine.fife as fife
import time

print "Creating engine"
engine = fife.Engine()

print "Testing settings manager"
settings = engine.getSettingsManager()
print "  RenderBackend = " + settings.read_string('RenderBackend', 'none defined')

print "Testing log"
log = fife.Log.initialize(fife.Log.LEVEL_MAX, True, True)
fife.Log("Testing log...")


print "Testing timers"
class MyTimeEvent(fife.TimeEvent):
	def __init__(self, period):
		fife.TimeEvent.__init__(self, period)
		self.counter = 0
	
	def updateEvent(self, curtime):
		print "testing timer event... %d, %d" % (curtime, self.counter)
		self.counter += 1

timemanager = engine.getTimeManager()
e = MyTimeEvent(100)
timemanager.registerEvent(e)

for i in xrange(10):
	time.sleep(0.1)
	timemanager.update()

print "finishing"
timemanager.unregisterEvent(e)

eventmanager = engine.getEventManager()
class MyEventListener(fife.ICommandListener):
	def __init__(self):
		fife.ICommandListener.__init__(self)
	
	def onCommand(self, command):
		print "received command with code %d" % command.getCode()		

l = MyEventListener()
eventmanager.addCommandListener(l)
cmd = fife.Command()
cmd.setCode(0)
print "Sending commands..."
for i in xrange(20):
	eventmanager.dispatchCommand(cmd)
	cmd.setCode(i)
eventmanager.removeCommandListener(l)

print "Testing VFS"
vfs = fife.VFSUtility()
print vfs.listFiles('.')
print vfs.listDirectories('.')
print vfs.readLines('fife_engine.py')
print vfs.readBytes('fife_engine.py')

print "Testing audio"
audiomanager = engine.getAudioManager()
audiomanager.setAmbientSound('content/audio/music/maybe.ogg')
for i in xrange(8):
	audiomanager.setVolume(i % 2)
	time.sleep(0.2)

class MyExecuter(fife.ConsoleExecuter):
	def __init__(self):
		fife.ConsoleExecuter.__init__(self)
		self.quitRequested = False
		
	def onToolsClick(self):
		print "In python, tools clicked"
<commit_msg>Audiomanager takes volume from range 0-1 (float). Previously it was feed in as int (0-10) causing huge distortion on bigger levels<commit_after>import os
os.environ['PYTHONPATH'] = '.'
print os.getenv('PYTHONPATH')
import engine.fife as fife
import time

print "Creating engine"
engine = fife.Engine()

print "Testing settings manager"
settings = engine.getSettingsManager()
print "  RenderBackend = " + settings.read_string('RenderBackend', 'none defined')

print "Testing log"
log = fife.Log.initialize(fife.Log.LEVEL_MAX, True, True)
fife.Log("Testing log...")


print "Testing timers"
class MyTimeEvent(fife.TimeEvent):
	def __init__(self, period):
		fife.TimeEvent.__init__(self, period)
		self.counter = 0
	
	def updateEvent(self, curtime):
		print "testing timer event... %d, %d" % (curtime, self.counter)
		self.counter += 1

timemanager = engine.getTimeManager()
e = MyTimeEvent(100)
timemanager.registerEvent(e)

for i in xrange(10):
	time.sleep(0.1)
	timemanager.update()

print "finishing"
timemanager.unregisterEvent(e)

eventmanager = engine.getEventManager()
class MyEventListener(fife.ICommandListener):
	def __init__(self):
		fife.ICommandListener.__init__(self)
	
	def onCommand(self, command):
		print "received command with code %d" % command.getCode()		

l = MyEventListener()
eventmanager.addCommandListener(l)
cmd = fife.Command()
cmd.setCode(0)
print "Sending commands..."
for i in xrange(20):
	eventmanager.dispatchCommand(cmd)
	cmd.setCode(i)
eventmanager.removeCommandListener(l)

print "Testing VFS"
vfs = fife.VFSUtility()
print vfs.listFiles('.')
print vfs.listDirectories('.')
print vfs.readLines('fife_engine.py')
print vfs.readBytes('fife_engine.py')

print "Testing audio"
audiomanager = engine.getAudioManager()
audiomanager.setAmbientSound('content/audio/music/maybe.ogg')
for i in xrange(20):
	audiomanager.setVolume(float(i % 10) / 10)
	time.sleep(0.1)

class MyExecuter(fife.ConsoleExecuter):
	def __init__(self):
		fife.ConsoleExecuter.__init__(self)
		self.quitRequested = False
		
	def onToolsClick(self):
		print "In python, tools clicked"

{'fraction_non_alphanumeric': 0.12837670384138786, 'fraction_numerical': 0.010161090458488228, 'mean_word_length': 5.671074380165289, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5472575', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1378, 'n_words': 317}