예제 #1
0
 def __init__(self,
              url,
              clip=None,
              width=640,
              height=480,
              live=False,
              title=None,
              subtitle=None,
              summary=None,
              duration=None,
              thumb=None,
              art=None,
              **kwargs):
     if isinstance(url, basestring):
         final_url = "http://www.plexapp.com/player/player.php" + \
           "?url=" + String.Quote(url) + \
           "&clip=" + String.Quote(clip) + \
           "&width=" + str(width) + \
           "&height=" + str(height) + \
           "&live="
         if live:
             final_url += "true"
         else:
             final_url += "false"
     else:
         final_url = url
     WebVideoItem.__init__(self,
                           final_url,
                           title=title,
                           subtitle=subtitle,
                           summary=summary,
                           duration=duration,
                           thumb=thumb,
                           art=art,
                           **kwargs)
예제 #2
0
class Employees(Base):
    __tablename__ = 'employees'
    emp_id = Column(Integer, primary_key=True)
    emp_name = Column(String(20))
    birth_date = Column(Date)
    email = Column(String(50))
    dep_id = Column(Integer, ForeignKey('departments.dep_id'))
예제 #3
0
class Server_info(Base):
    __tablename__ = 'server_info'
    id = Column(Integer, primary_key=True)
    server_ip = Column(String(64))
    server_port = Column(Integer)
    user_name = Column(String(64))
    server_pwd = Column(String(128))
    server_key = Column(String(128))
예제 #4
0
파일: TextField.py 프로젝트: mbaez/pydamas
class TextField:
	TEXT_ID=1
	def __init__(self,screen,focus,label,text,x,y,ancho=200,alto=20):
		self.screen=screen
		self.alto=alto
		self.ancho=ancho
		self.label=label
		self.text=String(text)
		self.rect=self.__dibujar__(x, y)
		self.print_text(30,(0,0,0))
		self.print_text(30,(255,255,255),len(self.label))
		TextField.TEXT_ID=TextField.TEXT_ID+1
		self.id =TextField.TEXT_ID
		self.focus=focus
		
	def is_selected(self,x,y):
		if(self.rect.collidepoint(x,y)):
			self.focus.set_id(self.id)
	def set_label(self, label):
		self.label=label
	def get_focus(self):
		return self.focus.id==self.id
	
	def __dibujar__(self, ptox,ptoy):
		self.x, self.y= ptox, ptoy
		puntos = [(ptox,ptoy),(ptox+self.ancho,ptoy),(ptox+self.ancho,ptoy+self.alto),(ptox,ptoy+self.alto)]
		r=Rect(pygame.draw.polygon(self.screen, (255,255,255), puntos))
		pygame.display.flip()
		return r

	def print_text (self,size=50, color=(255,255,255), label=0):
		pygame.font.init()
		fuente = pygame.font.Font(None, size)
		if(label==0):
			render = fuente.render(self.text.text, 1, color)
			x=0
		else:
			render = fuente.render(self.label, 1, color)
			x=label*10+(label//5)*10
		self.screen.blit(render, (self.x-x, self.y))
		pygame.display.flip()
		
	def set_key_presed(self,key):
		if (key>=pygame.K_0 and key<=pygame.K_9)or(key>=pygame.K_a and key<=pygame.K_z)or key==pygame.K_PERIOD:
			self.text.add(pygame.key.name(key))
		elif key==pygame.K_SPACE:
			self.text.add(" ")
		elif key==pygame.K_BACKSPACE:
			if self.text.pop()==True:
				self.__dibujar__(self.x,self.y)
		self.print_text(30,(0,0,0))
예제 #5
0
class Users(Base):
    __tablename__ = 'users'

    user_id = Column(Integer, primary_key=True)
    email = Column(String(50), unique=True)
    password = Column(String(50), unique=True)
    nickname = Column(String(50), unique=True)
    c_time = Column(TIMESTAMP, default=datetime.now)

    def __init__(self, id=None, email=None, password=None, nickname=None, c_time=None):
        self.id = id
        self.email = email
        self.password = password
        self.nickname = nickname
        self.c_time = c_time
예제 #6
0
 def __init__(self,
              url,
              title=None,
              subtitle=None,
              summary=None,
              duration=None,
              thumb=None,
              art=None,
              **kwargs):
     if Plugin.LastPrefix: prefix = Plugin.LastPrefix
     else: prefix = Plugin.Prefixes()[0]
     if isinstance(url, basestring):
         key = "plex://127.0.0.1/video/:/webkit?url=%s&prefix=%s" % (
             String.Quote(url, usePlus=True), prefix)
     else:
         key = url
     XMLObject.__init__(self,
                        key=key,
                        title=title,
                        subtitle=subtitle,
                        summary=summary,
                        duration=duration,
                        thumb=thumb,
                        art=art,
                        **kwargs)
     self.tagName = "Video"
예제 #7
0
 def __init__(self,
              url,
              width=720,
              height=576,
              title=None,
              subtitle=None,
              summary=None,
              duration=None,
              thumb=None,
              art=None,
              **kwargs):
     if isinstance(url, basestring):
         final_url = "http://www.plexapp.com/player/silverlight.php" + \
           "?stream=" + String.Quote(url) + \
           "&width=" + str(width) + \
           "&height=" + str(height)
     else:
         final_url = url
     WebVideoItem.__init__(self,
                           final_url,
                           title=title,
                           subtitle=subtitle,
                           summary=summary,
                           duration=duration,
                           thumb=thumb,
                           art=art,
                           **kwargs)
예제 #8
0
class Author(db.Model):
	id = Column(Integer, primary_key=True)
	name = Column(String(255), nullable=False) 
	books = relationship('Book')

	@staticmethod
	def search(name):
		author = Author.query.filter_by(name=name).first()
		if author is not None:
			return author
		return None

	# staticn method to return instance of unknown author - TOTO optimize to singleton
	@staticmethod
	def unknown_author():
		return Author.default('Unknown Author')

	# Check if author exists, if not create a new author
	@staticmethod
	def default(name):
		author = Author.search(name)
		if author is None:
			# Author is not known
			author = Author(name=name)
			db.session.add(author)
			db.session.commit()

		return author
			

	def as_dict(self):
		return {col.name: getattr(self, col.name) for col in self.__table__.columns}
예제 #9
0
파일: demo.py 프로젝트: chenyuchuting/Flask
class User(Base):
    __tablename__ = "user"
    id = Column(Integer, primary_key=True, autoincrement=True)
    username = Column(String(50), nullable=False)

    def __repr__(self):
        return self.username
예제 #10
0
	def __init__(self):
		self.bridge = cv_bridge.CvBridge()
		self.image_sub = rospy.Subscriber('cropTag', Image, self.image_callback)
		self.cmd_vel_pub = rospy.Publisher('cmd_vel', Twist, queue_size=1)
		self.pose_pub = rospy.Publisher('2Dpose', String, queue_size=1)
		self.twist=Twist()
		self.string=String()
		self.rate = rospy.Rate(1)		
예제 #11
0
파일: curve.py 프로젝트: jwnwilson/nw_maya
def clusterizeCurve(curve):
	curveNumber = getCurveCVNumber(curve)
	curveName = String.removeSuffix(curve)
	clusterName = (curveName + "Cluster")
	clusterList = []
	for x in range(curveNumber):
		clusterList.append( Control.createCluster( ( clusterName + str(x) ), ( curve + ".cv["+ str(x) +"]" ) ) )
	return clusterList
예제 #12
0
class Series(db.Model):
	id = Column(Integer, primary_key=True)
	name = Column(String(255), nullable=False)
	sequence = Column(Integer, default=0)
	books = relationship('Book')

	def as_dict(self):
		return {col.name: getattr(self, col.name) for col in self.__table__.columns}	
예제 #13
0
 def ToElement(self):
     el = XML.Element(self.tagName)
     for key in self.__dict__:
         if key[0] != "_" and self.__dict__[
                 key].__class__.__name__ != "function" and key != "tagName" and self.__dict__[
                     key] != None:
             value = self.__dict__[key]
             if key == "ratingKey":
                 el.set(
                     key,
                     String.Quote(String.Encode(unicode(
                         self.__dict__[key]))))
             elif value == True:
                 el.set(key, "1")
             elif value == False:
                 el.set(key, "0")
             else:
                 el.set(key, unicode(self.__dict__[key]))
     return el
예제 #14
0
class State(BaseModel):
    """
    Initialize class State with attribute
        name: (str) name of the state
    """
    __tablename__ = "states"
    name = Column(String(128), nullable="False")

    @property
    def cities(self):
예제 #15
0
파일: Control.py 프로젝트: jwnwilson/nw_rig
def createPoleVec(joints, ikHandle, position):
    """
        Creates pole vector for handle for three joints
    """
    if len(joints) != 3:
        cmds.error("Incorrect number of joints supplied to IkHandle.")
    
    # Create locator to act as pole vector
    locName = (String.removeSuffix(ikHandle) + "Pole_LOC")
    poleGrpName = (String.removeSuffix(ikHandle) + "Pole_GRP")
    poleVecName = (String.removeSuffix(ikHandle) + "Pole_PVC")
    
    loc = Lib.getFirst(cmds.spaceLocator(n = locName, p= (0,0,0) ))
    cmds.xform(loc, ws= True, t= (position[0], position[1], position[2]) )
    locGrp = cmds.group(loc, n= poleGrpName)
    cmds.poleVectorConstraint( loc , ikHandle, n= poleVecName, w=.1 )
    cmds.setAttr((loc + ".v"), 0)
    
    return locGrp
예제 #16
0
파일: RigUI.py 프로젝트: jwnwilson/nw_rig
 def renameModule(self):
     """
         Will rename current module
     """
     if self.elementExists("rigList") == False:
         cmds.warning("No modules found in scene")
         return None
     
     selectedModule = Util.getFirst(self.queryInput("rigList"))
     selectedModule = String.removeSuffix(selectedModule.strip())
     self.createValueWindow("Enter new module name", "default","NWRig.renameModule(\""+selectedModule+"\", %)")
     self.loadModules({})
예제 #17
0
파일: RigUI.py 프로젝트: jwnwilson/nw_rig
 def deleteModule(self):
     """
         Deletes module
     """
     if self.elementExists("rigList") == False:
         cmds.warning("No modules found in scene")
         return None
     
     selectedModule = Util.getFirst(self.queryInput("rigList"))
     selectedModule = String.removeSuffix(selectedModule.strip())
     self.rigInstance.deleteModule(selectedModule)
     self.loadModules({})
예제 #18
0
파일: TextField.py 프로젝트: mbaez/pydamas
	def __init__(self,screen,focus,label,text,x,y,ancho=200,alto=20):
		self.screen=screen
		self.alto=alto
		self.ancho=ancho
		self.label=label
		self.text=String(text)
		self.rect=self.__dibujar__(x, y)
		self.print_text(30,(0,0,0))
		self.print_text(30,(255,255,255),len(self.label))
		TextField.TEXT_ID=TextField.TEXT_ID+1
		self.id =TextField.TEXT_ID
		self.focus=focus
예제 #19
0
파일: py.py 프로젝트: ponyatov/pySynth
	def __init__(self, V):
		Object.__init__(self, V)
 		self['dir'] = Dir(self.val)
 		self['files'] = Vector()
  		self['exe' ] = self['dir']/String(self.val+'.exe') ; self['exe'].rm()
  		self['log' ] = self['dir']/String(self.val+'.log') ; self['files'] += self['log']
  		self['hpp'] = self['dir']/String('hpp.hpp') ; self['files'] += self['hpp']
  		self['cpp'] = self['dir']/String('cpp.cpp') ; self['files'] += self['cpp']
  		self['mk' ] = self['dir']/String('Makefile') ; self['files'] += self['mk']
		self['bat'] = self['dir']/String('bat.bat') ; self['files'] += self['bat']
  		self['git'] = self['dir']/String('.gitignore') ; self['files'] += self['git']
예제 #20
0
파일: py.py 프로젝트: ponyatov/pySynth
	def build(self):
		# Makefile
		self['mk']/(self['log'].str() + String(' : ') + self['exe'])
		self['mk']/(String('\t./')+self['exe']+String(' > $@'))
		# hpp/cpp
		self.build_cpp()
		# bat.bat
		self['bat']/( String('@gvim -p ') + (self['files']/String(' ')).str() )
		# .gitignore
		self['git']/String('*~')/String('*.swp')/self['exe']/self['log']
		return self
예제 #21
0
파일: RigUI.py 프로젝트: jwnwilson/nw_rig
 def loadAttributes(self,type, module):
     """
         Will load attributes of module in gui
     """
     if type == "blueprint":
         moduleKey = "blueprintModuleName"
         frameKey = "blueprintAttributeframe"
         formKey = "blueprintAttributeForm"
         attributeVariable  = '.blueprintAttributes'
         attrElements = self.blueprintAttributeUIElements
         attributes = eval(module + attributeVariable)
     elif type == "rig":
         moduleKey = "rigModuleName"
         frameKey = "rigAttributeframe"
         formKey = "rigAttributeForm"
         attributeVariable  = '.rigAttributes'
         attrElements = self.rigAttributeUIElements
         attributes = self.rigInstance.Modules[String.removeSuffix(module)].rigAttributes
     else:
         cmds.error("type undefined for load attributes functions")
     
     if self.windowElements.has_key(moduleKey) == False:
         self.text({"key":moduleKey,'label': module,'parent':frameKey})
     else:
         self.editElement(moduleKey,label= module)
     
     # Clear attr
     for key in attrElements.keys():
         self.removeElement(key)
         del attrElements[key]
         if self.inputs.has_key(key):
             del self.inputs[key]
     if self.windowElements.has_key(formKey):
         self.removeElement(formKey)
     attrElements.clear()
     
     # Read module attributes
     for key in attributes.keys():
         attr = attributes[key]
         # save blueprint attr UI element
         textKey = (module + attr.name + 'text').replace(' ', '')
         attrKey = (module + attr.name).replace(' ','')
         self.text({'key':textKey,'label':attr.name,'parent':frameKey})
         self.textField({'key':attrKey,'label':attr.defaultValue,'parent':frameKey})
         # save to blueprintAttrbuteUIDict
         attrElements[textKey] = self.windowElements[textKey]
         attrElements[attrKey] = self.windowElements[attrKey]
         self.inputs[attrKey] = self.windowElements[attrKey]
     
     # arrange in UI
     self.createOrganisedForm(formKey,attrElements.keys(),frameKey )
예제 #22
0
파일: RigUI.py 프로젝트: jwnwilson/nw_rig
 def mirrorBlueprint(self):
     """
         duplciates blueprint
     """
     if self.elementExists("rigList") == False:
         cmds.warning("No modules found in scene")
         return None
         
     selectedModule =self.queryInput("rigList")
     if not selectedModule:
         cmds.error("Select module to duplicate in rig menu.")
     selectedModule = Util.getFirst(selectedModule)
     selectedModule = String.removeSuffix(selectedModule.strip())
     self.createValueWindow("Enter new module name", "default","NWRig.mirrorModule(\""+selectedModule+"\", %, 'x')")
     self.loadModules({})
예제 #23
0
파일: demo.py 프로젝트: chenyuchuting/Flask
class Article(Base):
    __tablename__ = "article"
    id = Column(Integer, primary_key=True, autoincrement=True)
    title = Column(String(50), nullable=False)
    create_time = Column(DateTime, nullable=False, default=datetime.now)
    uid = Column(Integer, ForeignKey("user.id"))

    user = relationship("User", backref=backref('articles', order_by=create_time.desc()))

    # __mapper_args__ = {
    #     "order_by": create_time.desc()
    # }

    def __repr__(self):
        return self.title
예제 #24
0
class Book(db.Model):
	id = Column(Integer, primary_key=True)
	title = Column(String(255), nullable=False)

	# primary information
	description = Column(Text, nullable=True)
	isbn13 = Column(String(255), nullable=True)
	isbn10 = Column(String(255), nullable=True)
	publisher = Column(String(255), nullable=True)

	# secondary inputs
	release_date = Column(String, nullable=True)
	pagecount = Column(Integer, nullable=True)
	bindingtype = Column(String, nullable=True)
	genre = Column(String(255), nullable=True)
	image_path = Column(String(255), default='no_image_available.gif')


	# links to other fields
	author_id = Column(Integer, ForeignKey('author.id'))
	author = relationship('Author')

	series_id = Column(Integer, ForeignKey('series.id'), nullable=True)
	series_nr = Column(Integer, default=0)
	series = relationship('Series')

	# includes user scoring
	libraries = relationship('AssociationBookLibrary')

	# link to genre tags
	tags = relationship('AssociationBookTags', back_populates='book')


	def as_dict(self):
		return {col.name: getattr(self, col.name) for col in self.__table__.columns}	

	def as_dict_verbose(self):
		d = self.as_dict()
		d.pop('author_id')
		d['author'] = self.author.as_dict()
		return d

	def parse(self, d):
		self.isbn13 = d.get('isbn13')
		self.isbn10 = d.get('isbn10')
		self.description = d.get('description')
		self.publisher = d.get('publisher')

	def __str__(self):
		return self.title
예제 #25
0
class Tag(db.Model):
	id = Column(Integer, primary_key=True)
	tag = Column(String(255), nullable=False)

	@staticmethod
	def search(label):
		tag = Tag.query.filter_by(tag=label).first()
		if tag is not None:
			return tag
		return None

	# Check if tag exists, if not create a new author
	@staticmethod
	def default(label):
		tag = Tag.search(name)
		if tag is None:
			# Author is not known
			tag = Tag(tag=label)
			db.session.add(tag)
			db.session.commit()

		return tag
예제 #26
0
def constrain(*args , **kwargs):
    """
        constrains target, aim Constraint requires more flags
    """
    influenceNo = (len(args) -1)
    sources = args[:-1]
    target = args[influenceNo]
    defaultName = String.removeSuffix(target)
    
    functArgs = {"t":0, "r":0, "s":0, "all":0, "aim":0, "mo":0, "name": defaultName}
    functArgs =  dict(functArgs.items() + kwargs["args"].items())
    mainOff = functArgs["mo"]
    
    if functArgs["t"] == 1:
        constrain = cmds.pointConstraint( args, n = (functArgs["name"] + "_PNT"),  mo = mainOff )
    if functArgs["r"] == 1:
        constrain = cmds.orientConstraint( args, n = (functArgs["name"]+ "_ORC"),  mo = mainOff )
    if functArgs["s"] == 1:
        constrain = cmds.scaleConstraint(  args, n = (functArgs["name"]+ "_SCT"), mo = mainOff )
    if functArgs["all"] == 1:
        constrain = cmds.parentConstraint( args, n = (functArgs["name"]+ "_PCT"),  mo = mainOff )
    if functArgs["aim"] == 1:
        constrain = cmds.aimConstraint( args, n = (functArgs["name"]+ "_AIM"),  mo = mainOff )
    return constrain
예제 #27
0
class Departments(Base):
    __tablename__ = 'departments'  # 设置与库中的哪张表关联
    dep_id = Column(Integer, primary_key=True)
    dep_name = Column(String(20), unique=True)
from {{ cookiecutter.tool_name_slug }} import SharedConfig, String


class {{ cookiecutter.tool_name_camel_case }}DefaultModel(SharedConfig):
    target = String()
    
__all__ = ("{{ cookiecutter.tool_name_camel_case }}DefaultModel", )


예제 #29
0
 def str(self):
     S = ''
     for i in self.nest:
         S += i.str().val
     return String(S)
예제 #30
0
 def str(self):
     return String(self.val)
예제 #31
0
def E(string): return String.Encode(string)
def D(string): return String.Decode(string)
예제 #32
0
def D(string): return String.Decode(string)
def R(itemName): return Resource.ExternalPath(itemName)
예제 #33
0
def matrixConstraint(parent , child, mainOff, args):
    """
        Constraints object by a matrix Constraint
    """
    # Check plugin is loaded 
    if cmds.pluginInfo("decomposeMatrix",q= True,l=True) == 0:
        cmds.loadPlugin ("decomposeMatrix")
    functArgs = {"t":1, "r":1, "s":1, "all":0, "mo":0}
    functArgs =  dict(functArgs.items() + args.items())
    mainOff = functArgs["mo"]

    name = String.removeSuffix(child)
    
    matrixDecom = cmds.createNode( 'decomposeMatrix', n= (name + "decomMatrix") )
    offset  = None
    
    # contraint == parent world * inverse child parent
    matrixMulti1 = cmds.createNode( 'multMatrix', n=( name + "matrixMult1") )    
    
    # don't forget to freeze pivots if they are offset shit gets real
    cmds.xform( child, cp = True )
    
    offsetMat = cmds.createNode( "fourByFourMatrix", n= (name + "offsetMat" ) ) 
    matrixMulti2 = cmds.createNode( 'multMatrix', n= (name +  "matrixMult2") )

    if mainOff == 1:
        #parentCon = cmds.parentConstraint(child ,offset )
        #cmds.delete(parentCon)
        m = cmds.xform( child, q=True, ws=True, m=True  )
        cmds.setAttr( (offsetMat +".i00"), m[0])
        cmds.setAttr( (offsetMat +".i01"), m[1])
        cmds.setAttr( (offsetMat +".i02"), m[2])
        cmds.setAttr( (offsetMat +".i03"), m[3])
        cmds.setAttr( (offsetMat +".i10"), m[4])
        cmds.setAttr( (offsetMat +".i11"), m[5])
        cmds.setAttr( (offsetMat +".i12"), m[6])
        cmds.setAttr( (offsetMat +".i13"), m[7])
        cmds.setAttr( (offsetMat +".i20"), m[8])
        cmds.setAttr( (offsetMat +".i21"), m[9])
        cmds.setAttr( (offsetMat +".i22"), m[10])
        cmds.setAttr( (offsetMat +".i23"), m[11])
        cmds.setAttr( (offsetMat +".i30"), m[12])
        cmds.setAttr( (offsetMat +".i31"), m[13])
        cmds.setAttr( (offsetMat +".i32"), m[14])
        cmds.setAttr( (offsetMat +".i33"), m[15])
    
    # offset == child original world matrix * inverse parent matrix
    cmds.connectAttr( (offsetMat +  ".output"), (matrixMulti2 + ".matrixIn[0]"), f= True ) 
    cmds.connectAttr( (parent + ".worldInverseMatrix"), (matrixMulti2 + ".matrixIn[1]"), f= True )
        
    m = cmds.getAttr( (matrixMulti2 + ".matrixSum") )
        
    cmds.setAttr( (offsetMat +".i00"), m[0])
    cmds.setAttr( (offsetMat +".i01"), m[1])
    cmds.setAttr( (offsetMat +".i02"), m[2])
    cmds.setAttr( (offsetMat +".i03"), m[3])
    cmds.setAttr( (offsetMat +".i10"), m[4])
    cmds.setAttr( (offsetMat +".i11"), m[5])
    cmds.setAttr( (offsetMat +".i12"), m[6])
    cmds.setAttr( (offsetMat +".i13"), m[7])
    cmds.setAttr( (offsetMat +".i20"), m[8])
    cmds.setAttr( (offsetMat +".i21"), m[9])
    cmds.setAttr( (offsetMat +".i22"), m[10])
    cmds.setAttr( (offsetMat +".i23"), m[11])
    cmds.setAttr( (offsetMat +".i30"), m[12])
    cmds.setAttr( (offsetMat +".i31"), m[13])
    cmds.setAttr( (offsetMat +".i32"), m[14])
    cmds.setAttr( (offsetMat +".i33"), m[15])
    
    # Order of matrixs is VERY important if offset is applied last the child will not rotate around
    # the parent's origin as it's the parent pivot will not be multiplied properly
    cmds.connectAttr( (offsetMat + ".output"), (matrixMulti1 + ".matrixIn[0]"), f= True )
    cmds.connectAttr( (parent + ".worldMatrix"), (matrixMulti1 + ".matrixIn[1]"), f= True )
    cmds.connectAttr( (child + ".parentInverseMatrix"), (matrixMulti1 + ".matrixIn[2]"), f= True )
    
    # make child rotate around parent instead of copy it's rotation
    orc = cmds.createNode( "orientConstraint", n= (removeSuffix(child) + "Const_ORC"), p= child  )
    
    #final connect
    cmds.connectAttr( (matrixMulti1 + ".matrixSum") , (matrixDecom + ".inputMatrix") , f= True )
    
    # output rotation -> orient target[0] target rotation
    cmds.connectAttr( ( matrixDecom +".or") , ( orc + ".tg[0].tr") , f= True )
    # child rotation order -> orient Constraint rotation order
    cmds.connectAttr( ( child +".ro") , ( orc + ".cro") , f= True )
    
    # orient target[0] target rptation order == 0
    cmds.setAttr( ( orc +".tg[0].tro"), 0 )   
    
    # A orient const can be used to preserve clean join rotations if desired
    #cmds.connectAttr( ( orc + ".cr" ) , ( child + ".r" ) , f= True )
    if functArgs["r"] == 1 or functArgs["all"]:
        cmds.connectAttr( ( matrixDecom + ".outputRotate") , (child  + ".rotate"), f= True )
    if functArgs["t"] == 1 or functArgs["all"]:
        cmds.connectAttr( (matrixDecom + ".outputTranslate") , (child  + ".translate"), f= True)
    if functArgs["s"] == 1 or functArgs["all"]:
        cmds.connectAttr( ( matrixDecom + ".outputScale") , (child  + ".scale"), f= True )
    if functArgs["r"] == 1 or functArgs["all"]:
        cmds.connectAttr( ( matrixDecom + ".outputShear") , (child  + ".shear"), f= True )
예제 #34
0
	def _IsSimpleType(obj):
		return String.Contains(str(type(obj)).lower(),"int|boolean|char|string|float|complex|bytes|bytearray|memoryview|")#añadir todos los tipos basicos de Python!
예제 #35
0
def createAxisContols(name, args):
        """
            creates a Control with sub Controls limited to move only in one axis each
        """
        ret = {}
        X=[]
        Y=[]
        Z=[]
        functArgs = {"axis":"xyz", "size":1}
        functArgs =  dict(functArgs.items() + args.items())
        child=None
        
        xName = String.removeSuffix(name) + "X"
        yName = String.removeSuffix(name) + "Y"
        zName = String.removeSuffix(name) + "Z"
        
        topGrp = cmds.group(name=(name+"_GRP"),em=True)
        ctlGrp = cmds.group(name=(name+"Ctl_GRP"),em=True)
        
        if "x" in functArgs["axis"]:
            X = Control.arrowCtl( xName, functArgs )
            Attribute.lockHide(X[0], {"all":1, "h":1, "l":1})
            Attribute.setColour(X[0], "red")
            cmds.setAttr(( X[0] + ".tx"), lock=False, cb = True , k = True )
            child = Transform.getShape(X[0])
            cmds.rotate(0,-90,0, (child+".cv[0:7]"))
        if "y" in functArgs["axis"]:
            Y = Control.arrowCtl( yName, functArgs )
            Attribute.lockHide(Y[0], {"all":1, "h":1, "l":1})
            Attribute.setColour(Y[0], "green")
            cmds.setAttr(( Y[0] + ".ty"), lock=False, cb = True , k = True )
            child = Transform.getShape(Y[0])
            cmds.rotate(90,0,0, (child+".cv[0:7]"))
        if "z" in functArgs["axis"]:
            Z = Control.arrowCtl( zName, functArgs )
            Attribute.lockHide(Z[0], {"all":1, "h":1, "l":1})
            Attribute.setColour(Z[0], "blue")
            cmds.setAttr(( Z[0] + ".tz"), lock=False, cb = True , k = True )
            child = Transform.getShape(Z[0])
            cmds.rotate(180,0,0, (child+".cv[0:7]"))        
            
        #connect Control to group to negate movement
        XNeg = cmds.createNode("multDoubleLinear", n=(name+"X_PMA"))
        cmds.setAttr((XNeg + ".input2"), -1)
        YNeg = cmds.createNode("multDoubleLinear", n=(name+"Y_PMA"))
        cmds.setAttr((YNeg + ".input2"), -1)
        ZNeg = cmds.createNode("multDoubleLinear", n=(name+"Z_PMA"))
        cmds.setAttr((ZNeg + ".input2"), -1)
        
        cmds.connectAttr((X[0]+".tx"),(XNeg+".input1"), f=True)
        cmds.connectAttr((Y[0]+".ty"),(YNeg+".input1"), f=True)
        cmds.connectAttr((Z[0]+".tz"),(ZNeg+".input1"), f=True)
        
        cmds.connectAttr((XNeg+".output"),(X[1]+".tx"), f=True)
        cmds.connectAttr((YNeg+".output"),(Y[1]+".ty"), f=True)
        cmds.connectAttr((ZNeg+".output"),(Z[1]+".tz"), f=True)
        
        #connect Control to ctls to top grp
        cmds.connectAttr((X[0]+".tx"),(ctlGrp+".tx"), f=True)
        cmds.connectAttr((Y[0]+".ty"),(ctlGrp+".ty"), f=True)
        cmds.connectAttr((Z[0]+".tz"),(ctlGrp+".tz"), f=True)
        
        cmds.parent(ctlGrp, topGrp)
        
        if "x" in functArgs["axis"]:
            cmds.parent(X[1], ctlGrp)
        if "y" in functArgs["axis"]:
            cmds.parent(Y[1], ctlGrp)
        if "z" in functArgs["axis"]:
            cmds.parent(Z[1], ctlGrp)
            
        ret["xctl"] = X
        ret["yctl"] = Y
        ret["zctl"] = Z  
        ret["grp"] = [topGrp, ctlGrp]
        return ret
예제 #36
0
 def execInput(self, execCtX):
     text = input()
     return RTResult().success(String(text))
예제 #37
0
 def execPrintRet(self, execCtX):
     return RTResult().success(String(str(execCtX.symbTable.get('value'))))
예제 #38
0
In [20]: class User(Base):
    ...:     __tablename__ = 'user'
    ...:     id = Column(Integer, primary_key=True)
    ...:     name = Column(String)
    ...:     email = Column(String)
    ...:     def __repr__(self):
    ...:         return "<User(name=%s)>" % self.name
    ...: 

In [21]:
以上代码执行以后就成功定义了 User 类,注意 __repr__ 前后各有两个下划线,这种前后有两个下划线的函数表示一个特殊的函数,称为 Python 类的魔法方法,__init__ 也是一个魔法方法,这里 __repr__ 方法会在直接调用实例对象的时候被调用。

此时 User 有一个 __table__ 属性,记录了定义的表信息,该属性如下所示:

In [27]: User.__table__
Out[27]: Table('user', MetaData(bind=None), Column('id', Integer(), table=<user>, primary_key=True, nullable=False), Column('name', String(), table=<user>), Column('email', String(), table=<user>), schema=None)
如果想通过 User 查询数据库该怎么办呢?需要先引入 Session。Session 是映射类和数据库沟通的桥梁,包含事务管理功能。通过以下代码创建 Session:

In [30]: from sqlalchemy.orm import sessionmaker

In [31]: Session = sessionmaker(bind=engine)

In [32]: session = Session()
这里的代码先从 sqlalchemy.orm 中导入 sessionmaker,然后创建了 sessionmaker 对象 Session,其中 Session 对象中有一个魔法方法(__call__),这个魔法方法让 Session 对象可以像函数那样调用,从而使用 Session() 获得了 session 对象。

Session 创建成功以后,就可以查询用户了,主要通过 session.query 方法:

In [63]: session.query(User).all()
Out[63]: [<User(name=aiden)>, <User(name=lxttx)>]

In [65]: session.query(User).filter(User.name=='aiden').first()
예제 #39
0
def D(string):
    return String.Decode(string)
예제 #40
0
def init_chars(disp):
    global chars
    chars = String.string(disp)
예제 #41
0
square = functions.squareFunction(num)
print("square is ", square)

maximum = functions.maximumNum(list1, length)
print("maximum element is ", maximum)

minimum = functions.minimumNum(list1, length)
print("Minimum element is ", minimum)

Sum = functions.listSum(list1, length)
print("sum of elements is ", Sum)

print()

string1 = input("Enter the string")
length = String.length(string1)
print("Length of string is", length)
print()

middle = String.middleCharacter(string1, length)
print(middle)
print()

vowelsCount = String.vowels(string1)
print(vowelsCount)
print()

words = String.words(string1)
print(words)
print()
예제 #42
0
        print("Run Badge please:")
        print("    Input files appear in: %s" % path.exprdata)
        print("    Please save your file to: %s. " % path.genereport)
        print("    And set the filenames like \"grp1_grp2_selected_unsorted.txt\"")
        print("Then press Enter to continue...")
        raw_input()
        GetGenes.Sort(fps, labels)
        GetGenes.getDiff_Badge(fps, labels)
        GetGenes.nuID2enterzID(fps, labels)


    import David
    David.davidCall(fps, labels)

    import String
    String.stringCall(path, fps, labels)
    String.genEdgeList(path, fps, labels)
    String.genNetworkInput(path, fps, labels)
    String.genNetwork(path, progpath)
    String.annoNetwork(path, progpath, fps, labels)

    import CrossValidation
    CrossValidation.exprToArff(path, fps, labels)
    CrossValidation.syncArffFeatures(path, fps, labels)
    CrossValidation.callWeka(fps, labels)

    import WriteReport
    WriteReport.writeDocReport(path, IOpath, fps, labels)
    WriteReport.writeXlsReport(path, IOpath, fps, labels)

예제 #43
0
def Write(obj, *remplace, end=''):
    print(String.Format(obj, remplace), end=end)