AGTk 2-3 Shared Applications Migration Guide

Access Grid Toolkit Documentation

 

Argonne National Lab and University of Chicago
[email protected]

5/11/2006

 

Developers may have to apply following updates to AGTk 2 shared applications in order for them to run in the AGTk 3 environment.

 

Connection ID needed for the data store

To connect to the AGTk 3 data store, you need to provide your venue client�s connection ID. If your shared application needs to use the data store, the connection ID can be retrieved by listing it in the Open line of the [commands] section in the .app file as shown for the Shared Presentation:

 

[application]

name = Shared Presentation

mimetype = application/x-ag-shared-presentation

extension = sharedpresentation

files = SharedPresentation.py, ImpressViewer.py

 

[commands]

Open = %(python)s SharedPresentation.py -v %(venueUrl)s -a %(appUrl)s -c %(connectionId)s

 

Then use the following method in the shared application python file:

ds = GetVenueDataStore(self.venueUrl, self.connectionId)

 

 

Twisted-wxPython interaction

To make sure the event client interacts correctly with wxPython, you need to add reactor imports and call reactor.interleave(wxCallAfter) in your shared application python file. Add this to your shared application imports:

 

try:

��� from twisted.internet import threadedselectreactor

��� threadedselectreactor.install()

except:

��� pass

 

from twisted.internet import reactor

 

 

In addition, call interleave before the wxPython main loop is started:

 

reactor.interleave(wxCallAfter)����


Event Data Formats

The AGTk 3 software introduces more restrictive rules on format for event data. Only primitive data types are allowed. For example, trying to send a tuple as event data will fail in AGTk 3:

self.sharedAppClient.SendEvent("ChangeColor", (self.id, "green"))

 

This works:

 

self.sharedAppClient.SendEvent("ChangeColor", "green")

 

 

Unicode

Data received from the application service when calling sharedAppClient.GetData() may be unicode. You can avoid errors by casting received data to correct python type:

 

slideNum = int(self.sharedAppClient.GetData(SharedPresKey.SLIDENUM))

 

 

Retrieving Sender ID

Instead of sending your id as event data, use the new event method event.GetSenderId() to retrieve the public id of a sender. This is an example from the Shared Browser application:

 

def BrowseCallback(self, event):

���� url = event.data

���� senderId = event.GetSenderId()

 

 

Application Package Extension

To install correctly, application packages need the agpkg3 extension instead of agpkg.