#!/usr/bin/env python

# Mandatory for openpluginlib initialisation
import platform
import sys
import os.path

if platform.system( ) == "Linux":
	import dl
	sys.setdlopenflags( dl.RTLD_NOW | dl.RTLD_GLOBAL )

# Import the player lib
import openpluginlib

class PyObserver( openpluginlib.observer ):
        def updated( self, subject ):
                print "updated: ", subject

subject = openpluginlib.subject()
print subject

observer = PyObserver()
print observer

subject.attach( observer )
subject.attach( PyObserver() )
subject.update()

fookey = openpluginlib.create_key_from_string( "foobar" )
prop = openpluginlib.property( fookey )
prop.attach( PyObserver() )
prop.set( 2.145 )
print prop.is_a_int()
print prop.is_a_string()
print prop.is_a_double()
print prop.value_as_double()

barkey = openpluginlib.create_key_from_string( "barfoo" )
prop2 = openpluginlib.property( barkey )

propContainer = openpluginlib.property_container()
propContainer.append( prop )
propContainer.append( prop2 )
propContainer.attach( PyObserver() )
prop2.set( 3.141 )
