def initialize3D(self): """Sets up the 3D world, including 3D dictionaries, a base group, and access to the panel as a 3D object""" if self.objectDictionary.has_key("___rootObject___") is False: QBaseGroup(self) QPanelGroup(self) QRootGroup(self) Proxy.send(self, "initialize3D")
def drawOffsetScaled(self, xloc, yloc, xscale, yscale, toCanvas=None): """drawOffsetScaled draws the display list at the specified offset and scale locations. If the canvas is undefined, it defaults to the main canvas""" if toCanvas is not None: targetName = toCanvas.name else: targetName = "__mainCanvas__" Proxy.send(self.panel, "drawDisplayListOS", self.name, xloc, yloc, xscale, yscale, targetName)
def draw(self, toCanvas=None): """ draw(toCanvas) draws the display list to the specified canvas. If the canvas is undefined, it defaults to the main canvas.""" if toCanvas is not None: targetName = toCanvas.name else: targetName = "__mainCanvas__" Proxy.send(self.panel, "drawDisplayListOS", self.name, 0, 0, 1, 1, targetName)
def __init__(self, panel, tClass, name=None): """Initializes the canvas for a given panel. wClass is the Teleplace class name. name is a reference id, usually None, which means this is a new object and a name will be generated. """ self.panel = panel self.tClass = tClass self.changeAction = None if (name is None): self.name = self.panel.generateName() Proxy.send(self.panel, "makeWidget", tClass, self.name) else: self.name = name panel.objectDictionary[self.name] = self
def __init__(self, panel, tClass, name = None): """Initializes the canvas for a given panel. wClass is the Teleplace class name. name is a reference id, usually None, which means this is a new object and a name will be generated. """ self.panel = panel self.tClass = tClass self.changeAction = None if(name is None): self.name = self.panel.generateName() Proxy.send(self.panel, "makeWidget", tClass, self.name) else: self.name = name panel.objectDictionary[self.name]=self
def saveFilePath(self, userID, path, data, fileDesc, fileExt, dialogLabel, callback): """ Find a file and return the file name fileDesc - describe the file type fileExt - a string with all suffexes, separated by ; dialogLabel - a string with the label for the file dialog""" self['__saveFileData__'] = data return Proxy.send(self, "saveFilePath", userID, path, fileDesc, fileExt, dialogLabel, callback)
def __init__(self, panel, name=None): """Initializes a display list""" self.panel = panel self.qClass = "PDisplayList" if (name is None): self.name = Proxy.send(self.panel, "makeNew", self.qClass) else: self.name = name panel.objectDictionary[self.name] = self
def __getitem__(self, key): """Implementer of the return value for myValue = self.panel["myKey"]""" rval = Proxy.send(self, "getItem", key) if(type(rval)==tuple): #is this a tuple? if(len(rval)==3): #of length 3? if(rval[0]=="__sharedObject__" or rval[0]=="__3DObject__"): #a shared Object? if(self.objectDictionary.has_key(rval[2])): #already loaded? rval = self.objectDictionary[rval[2]] else: rval = eval(rval[1])(self, rval[2]) return rval
def __init__(self, panel, tclass, name): """ initialization of QBasic and most of its sub-classes panel is the main shared panel object used for communication tclass is the internal class name of the object name is typically a dynamically generated shared name between Teleplace and Python """ self.panel = panel self.tClass = tclass if(name is None): self.name = Proxy.send(self.panel, "makeNew", self.tClass) else: self.name = name panel.objectDictionary[self.name]=self
def __init__(self, panel, tclass, name): """ initialization of QBasic and most of its sub-classes panel is the main shared panel object used for communication tclass is the internal class name of the object name is typically a dynamically generated shared name between Teleplace and Python """ self.panel = panel self.tClass = tclass if (name is None): self.name = Proxy.send(self.panel, "makeNew", self.tClass) else: self.name = name panel.objectDictionary[self.name] = self
def test2(self, arg1, arg2): """Simple test callback""" return Proxy.send(self, "test2", arg1, arg2)
def moveTowards(self, target, amount, distance): "Move towards the given target by the specified amount" Proxy.send(self, "moveTowards:amount:distance:", target, amount, distance)
def stopStepping(self, function): "Stop stepping the given function" Proxy.send(self, "stopStepping:", function)
def playSound(self, soundName): "Play the sound with the given name" Proxy.send(self, "playSound:", soundName)
def translateBy(self, deltaX, deltaY, deltaZ): "Translate this frame by delta X, Y, and Z" Proxy.send(self, "translateByX:y:z:", deltaX, deltaY, deltaZ)
def __getattr__(self, item): "Query Croquet about this value" value = Proxy.send(self, "pyGet:", item) if(value <> None): object.__setattr__(self, item, value) return value
def schedule(self): Proxy.send(target, "future:invoke:", msecs, self)
def println(self, obj, replicated = False): """Prints obj into the Teleplace transcript""" Proxy.send(self, "println", str(obj),replicated)
def test3(self, arg1, arg2, arg3): """Simple test callback""" return Proxy.send(self, "test3", arg1, arg2, arg3)
def getUserID(self): """Retrieves the ID for the local user""" return Proxy.send(self, "getUserID")
def getBaseUserName(self): """Retrive the _base_ user name - the guy that created and is running the doc""" return Proxy.send(self, "getBaseUserName")
def apiVersion(self): """Retrieves the Panel API version which is the version string of the Teleplace Client. """ return Proxy.send(self, "apiVersion")
def getUserColor(self, uid): """Retrieves the color for a user""" return QColor.fromRGBA(Proxy.send(self, "getUserColor", uid))
def __setattr__(self, item, value): "Inform Croquet about changing the value" Proxy.send(self, "pySet:to:", item, value) return object.__setattr__(self, item, value)
def getUserName(self, uid): """Retrieves the preferred screen name for a user""" return Proxy.send(self, "getUserName", uid)
def addRotationAroundZ(self, angle): "Add to the rotation around the y-axis" Proxy.send(self, "addRotationAroundZ:", angle)
def getUserLogin(self, uid): """Retrieves the login string for a user""" return Proxy.send(self, "getUserLogin", uid)
def colorize(self, r, g, b): "Translate this frame by delta X, Y, and Z" Proxy.send(self, "colorizeR:g:b:", r, g, b)
def getServiceURL(self, uid): self.initialize3D() return Proxy.send(self, "get", "___rootObject___", "serviceURL")
def startStepping(self, function): "Start stepping the given function" Proxy.send(self, "startStepping:", function)
def getCurrentOrgName(self): return Proxy.send(self, "getCurrentOrgName")
def random(self, maxValue): "Answer a random number between 0.0 and maxValue" return Proxy.send(self, "random:", maxValue)
def test0(self): """Simple test callback""" return Proxy.send(self, "test0")
def removeAllScripts(self): "Remove all scripts" Proxy.send(self, "removeAllScripts")
def test1(self, arg1): """Simple test callback""" return Proxy.send(self, "test1", arg1)