Author: remi
Date: 2008-06-23 13:06:16 +0200 (Mon, 23 Jun 2008)
New Revision: 1245
Modified:
software/tuxgi/trunk/tuxgi.py
Log:
* changed the tux api object creation.
* Added the resource access acquisition way in the "attitunes" functions
Modified: software/tuxgi/trunk/tuxgi.py
===================================================================
--- software/tuxgi/trunk/tuxgi.py 2008-06-23 08:50:09 UTC (rev 1244)
+++ software/tuxgi/trunk/tuxgi.py 2008-06-23 11:06:16 UTC (rev 1245)
@@ -30,7 +30,7 @@
import sys
import time
-from tuxisalive.api.sh import *
+from tuxisalive.api import *
# -----------------------------------------------
# Your script
# -----------------------------------------------
@@ -86,6 +86,10 @@
if xterm_cmd is None:
sys.stderr.write("Warning: couldn't find any suitable terminal"
" to use as Tux Droid shell\n")
+# Create a tux api object
+tux = TuxAPI("127.0.0.1", 81)
+# Set the auto connection
+tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, "Tuxgi", "Passwd")
#==============================================================================
# Main window class
@@ -154,13 +158,23 @@
# Attitunes
#--------------------------------------------------------------------------
def on_fileAtt_selection_changed(self, widget, *args):
- tux.attitune.load(widget.get_filename())
+ # Wait 5 seconds max that the resource can be acquired
+ # help(tux.access.waitAcquire) to see the other priority
+ # levels
+ if tux.access.waitAcquire(5.0, ACCESS_PRIORITY_NORMAL):
+ tux.attitune.load(widget.get_filename())
+ # Release the resource
+ tux.access.release()
def on_btnPlayAtt_clicked(self, widget, *args):
- tux.attitune.play()
+ if tux.access.waitAcquire(5.0):
+ tux.attitune.play()
+ tux.access.release()
def on_btnStopAtt_clicked(self, widget, *args):
- tux.attitune.stop()
+ if tux.access.waitAcquire(5.0):
+ tux.attitune.stop()
+ tux.access.release()
#--------------------------------------------------------------------------
# On window destroy
#--------------------------------------------------------------------------
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn