/usr/share/qcake/data/python_stdlib.py is in qcake-data 0.7.2-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # new python file
import QCakeApi
import sys
class StdoutCatcher:
def __init__(self):
self.data = ''
def write(self, stuff):
self.data = self.data + stuff
QCakeApi.debug(self.data)
self.data = ''
sys.stdout = StdoutCatcher()
sys.stderr = StdoutCatcher()
class Vector:
def __init__(self,x, y, z):
self.x=x + 0.0
self.y=y + 0.0
self.z=z + 0.0
def __add__(self, other): # x + y -> x.__add__(y)
return Vector(self.x+other.x, self.y+other.y, self.z+other.z)
def __iadd__(self, other): # x += y -> x.__iadd__(y)
self.x += other.x
self.y += other.y
self.z += other.z
return self
__radd__ = __add__ # x + y -> y.__radd__(x)
def __sub__(self, other): # x - y -> x.__sub__(y)
return Vector(self.x-other.x, self.y-other.y, self.z-other.z)
def __isub__(self, other): # x -= y -> x.__isub__(y)
self.x -= other.x
self.y -= other.y
self.z -= other.z
return self
def __rsub__(self, other): # x - y -> y.__sub__(x)
return Vector(-self.x+other.x, -self.y+other.y, -self.z+other.z)
def add(self,b):
self.x+=b.x + 0.0
self.y+=b.y + 0.0
self.z+=b.z + 0.0
def sub(self,b):
self.x-=b.x + 0.0
self.y-=b.y + 0.0
self.z-=b.z + 0.0
class QCO:
def __init__(self,id):
self.id = id
self.ref = QCakeApi.getRef(self.id)
def getattr(self,args):
return QCakeApi.getAttribute(self.ref, args)
def setattr(self,args):
return QCakeApi.setAttribute(self.ref, args)
def getpos(self):
return Vector(QCakeApi.getPositionX(self.ref), QCakeApi.getPositionY(self.ref), QCakeApi.getPositionZ(self.ref))
def getrot(self):
return Vector(QCakeApi.getPositionH(self.ref), QCakeApi.getPositionP(self.ref), QCakeApi.getPositionR(self.ref))
def setpos(self,v):
return QCakeApi.setPosition(self.ref, v.x, v.y, v.z, QCakeApi.getPositionH(self.ref), QCakeApi.getPositionP(self.ref), QCakeApi.getPositionR(self.ref))
def setrot(self,r):
return QCakeApi.setPosition(self.ref, QCakeApi.getPositionX(self.ref), QCakeApi.getPositionY(self.ref), QCakeApi.getPositionZ(self.ref), r.x, r.y, r.z)
def rotate(self,r):
return QCakeApi.Rotate(self.ref, r.x, r.y, r.z)
def move(self,v):
return QCakeApi.setPosition(self.ref, QCakeApi.getPositionX(self.ref)+v.x,QCakeApi.getPositionY(self.ref)+v.y,QCakeApi.getPositionZ(self.ref) +v.z, QCakeApi.getPositionH(self.ref), QCakeApi.getPositionP(self.ref), QCakeApi.getPositionR(self.ref))
def getpos_x(self):
return QCakeApi.getPositionX(self.ref)
def getpos_y(self):
return QCakeApi.getPositionY(self.ref)
def getpos_z(self):
return QCakeApi.getPositionZ(self.ref)
def getpos_h(self):
return QCakeApi.getPositionH(self.ref)
def getpos_p(self):
return QCakeApi.getPositionP(self.ref)
def getpos_r(self):
return QCakeApi.getPositionR(self.ref)
def setsequence(self,s,m):
return QCakeApi.setSequence(self.ref, s, m)
def Ref(self):
return self.ref
|