Improving python wrappers?

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

GrizzLyCRO
Just popping in
Just popping in
Posts: 2
Joined: Fri Aug 05, 2011 22:49

Improving python wrappers?

Postby GrizzLyCRO » Fri Aug 05, 2011 23:19

I would like to improve python wrappers, for example

Code: Select all

xx.setPosition(PyCEGUI.UVector2(PyCEGUI.UDim(0.5,0), PyCEGUI.UDim(0.5,0)))


vs

Code: Select all

xx.setPosition( (0.5,0), (0.5,0) )


i dont have experience in this kind of stuff, so could you tell me where to start, and also do you agree with this kind of changes?

I am assuming that above method, accepts only stated variable types as arguments.

EDIT1: Proof of concept, how it can be achieved

Code: Select all

from PyCEGUI import *
import PyCEGUI

def set(self, property, val):
   
    if property == "Position":
        self.setPosition(UVector2(UDim(val[0][0], val[0][1]), UDim(val[1][0], val[1][1])))
   
    elif property == "Size":
        self.setSize(UVector2(UDim(val[0][0], val[0][1]), UDim(val[1][0], val[1][1])))
       
    else:
        self.setProperty(property,val)
       

PyCEGUI.GUISheet.set = set

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Improving python wrappers?

Postby Kulik » Wed Aug 31, 2011 13:14

Oh crap, I completely missed this :-) Sorry.

This is indeed something I had planned, I wanted to make PyCEGUI more pythonic by using monkey patching (altering __init__.py that would just import the CPython module and do some changes on it to make it more pythonic).

If you are still interested in this, join the #cegui freenode IRC channel to discuss this.


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: MSN [Bot] and 4 guests