Hi,
I agree with Thomas.. QML syntax is really simple, so you don't need to
complicate it by changing the basic syntax. It would be better to
replace javascript with python, and make python (and people's classes
and code) available to QML.
For the python-to-javascript compilation you can check pyjamas
(http://pyjs.org/). They have a very good compiler already implemented.
João Ventura
On 13-07-2011 13:00, Thomas Perl wrote:
Hi,
2011/7/12 Renato Araujo Oliveira Filho<[email protected]>:
My idea is in early stage then I would like to discuss with you is,
which is the best way to describe scenes in python?. I'm not a heavy
python user, then I'm not familiar with all python features, because
of that I want your opinions.
My first try is something like that:
class Rectangle1(Rectangle):
anchors = Anchor(centerIn = parent)
width = 800
height = 480
color = 'red'
class Rectangle2(Rectangle):
anchors = Anchor(fill = parent)
[...]
I'm not sure if this a good idea. It kind of reminds me of gtkaml
(something like QML for Gtk), which has two kinds of syntax (XML-based
and "Gtkon"). There's not really an advantage to describing the
structure in Python syntax (in reality, it seems like a disadvantage -
see "Rectangle1" and "Rectangle2"; or are these supposed to be the
object IDs?). On the other hand, a way that I see could be an
advantage for Python developers using QML is to use Python code in
code blocks, i.e.:
Rectangle {
width: 100
height: 100
MouseArea {
onClick: {
import sys
print sys.argv
}
}
}
It would be great if one could write the code like this (maybe with
all PySide types imported already for convenience) and then have some
type of "compiler" which extracts the Python blocks, puts it into a
class as member functions and replaces the code blocks in the QML with
JavaScript code that calls the slots on the Python object (which has
been exposed as context property).
Just my 2 cents ;)
HTH.
Thomas
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside