peterazmanov / enaml Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nucleic/enaml
[Python 3.4] Declarative User Interfaces for Python fork (separate branch for Qt5)
License: Other
This project forked from nucleic/enaml
[Python 3.4] Declarative User Interfaces for Python fork (separate branch for Qt5)
License: Other
$ enaml-run advanced.enaml
Traceback (most recent call last):
File "advanced.enaml", line 74, in
template FormControl(Attr, MemberType: Unicode):
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/compiler_helpers.py", line 399, in make_template
template.add_specialization(paramspec, func)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/template.py", line 138, in add_specialization
raise TypeError(msg % (params,))
TypeError: ambiguous template specialization for parameters: (None, <class 'atom.scalars.Unicode'>)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/bob/work/modernization/protoacs/env/bin/enaml-run", line 9, in <module>
load_entry_point('enaml==0.9.8', 'console_scripts', 'enaml-run')()
File "/home/bob/work/modernization/protoacs/enaml/enaml/runner.py", line 58, in main
exec(code, ns)
File "advanced.enaml", line 74, in
template FormControl(Attr, MemberType: Unicode):
TypeError
The Enaml grammar is designed as an extension of the python grammar and relies on the python compiler to process the pure python portions. This means that the pure python portions of the .enaml files must be parsed into an AST which conforms to the used python version.
The question is now, should the Enaml grammar be an extension of the python 2 or the python 3 grammar. Or should it depend on the current python version (which would mean, that .enaml files and perhaps widgets might not be compatible across python versions). An other possibility would be to define a "special" python grammar for Enaml. Basically that is what it is atm, as I'm not quite certain how faithfully the python grammar has been replicated by Enaml.
In any of the above cases the AST construction has to be modified so that it conforms to the python version which is being used to run the application.
$ enaml-run message_box.enaml
/stdlib/dialog_buttons.enaml
Traceback (most recent call last):
File "/home/bob/work/modernization/protoacs/env/bin/enaml-run", line 9, in <module>
load_entry_point('enaml==0.9.8', 'console_scripts', 'enaml-run')()
File "/home/bob/work/modernization/protoacs/enaml/enaml/runner.py", line 58, in main
exec(code, ns)
File "message_box.enaml", line 23, in
from enaml.stdlib.dialog_buttons import DialogButton
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/import_hooks.py", line 129, in load_module
code, path = self.get_code()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/import_hooks.py", line 367, in get_code
code = EnamlCompiler.compile(ast, file_info.src_path)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_compiler.py", line 176, in compile
return compiler.visit(node)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_ast.py", line 351, in visit
result = visitor(node, *args, **kwargs)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_compiler.py", line 192, in visit_Module
self.visit(item)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_ast.py", line 351, in visit
result = visitor(node, *args, **kwargs)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_compiler.py", line 210, in visit_PythonModule
cg.insert_python_block(node.ast)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/code_generator.py", line 360, in insert_python_block
code = compile(pydata, self.filename, mode='exec')
TypeError: required field "arg" missing from arg
I checked that self.filename
is /home/bob/work/modernization/protoacs/enaml/enaml
which contains keyword argument stuff --- probably kwargs handling bug in Python 3 support.
Same with examples/stdlib/task_dialog.enaml
example.
$ enaml-run examples/layout/advanced/override_layout_constraints.enaml
Traceback (most recent call last):
File "/home/bob/work/modernization/protoacs/env/bin/enaml-run", line 9, in <module>
load_entry_point('enaml==0.9.8', 'console_scripts', 'enaml-run')()
File "/home/bob/work/modernization/protoacs/enaml/enaml/runner.py", line 65, in main
window.show()
File "/home/bob/work/modernization/protoacs/enaml/enaml/widgets/window.py", line 416, in show
self.activate_proxy()
File "/home/bob/work/modernization/protoacs/enaml/enaml/widgets/toolkit_object.py", line 213, in activate_proxy
child.activate_proxy()
File "/home/bob/work/modernization/protoacs/enaml/enaml/widgets/toolkit_object.py", line 214, in activate_proxy
self.activate_bottom_up()
File "/home/bob/work/modernization/protoacs/enaml/enaml/widgets/toolkit_object.py", line 236, in activate_bottom_up
self.proxy.activate_bottom_up()
File "/home/bob/work/modernization/protoacs/enaml/enaml/qt/qt_toolkit_object.py", line 82, in activate_bottom_up
self.init_layout()
File "/home/bob/work/modernization/protoacs/enaml/enaml/qt/qt_container.py", line 334, in init_layout
self._setup_manager()
File "/home/bob/work/modernization/protoacs/enaml/enaml/qt/qt_container.py", line 528, in _setup_manager
manager.set_items(self._create_layout_items())
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/layout_manager.py", line 311, in set_items
lc = root.layout_constraints()
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/layout_manager.py", line 131, in layout_constraints
return expand_constraints(self.constrainable(), self.constraints())
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/layout_helpers.py", line 154, in expand_constraints
cns.extend(cn.create_constraints(component))
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/constraint_helper.py", line 71, in create_constraints
cns = self.constraints(component)
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/grid_helper.py", line 235, in constraints
row_spacer = FlexSpacer(self.row_spacing / 2) # floor division
File "/home/bob/work/modernization/protoacs/enaml/enaml/layout/spacers.py", line 181, in __init__
self.size = size
TypeError: The 'size' member on the 'FlexSpacer' object must be of type 'int'. Got object of type 'float' instead.
$
PyQt5 is not yet widely supported and will probably not be supported on Windows with Python 2. We could probably keep both versions running without too much trouble. Would you back a PR in that sense ?
This is probably byteplay bug.
To reproduce:
$ window_closing.enaml
Traceback (most recent call last):
File "/home/bob/work/modernization/protoacs/env/bin/enaml-run", line 9, in <module>
load_entry_point('enaml==0.9.8', 'console_scripts', 'enaml-run')()
File "/home/bob/work/modernization/protoacs/enaml/enaml/runner.py", line 58, in main
exec(code, ns)
File "window_closing.enaml", line 15, in
from enaml.stdlib.message_box import question
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/import_hooks.py", line 129, in load_module
code, path = self.get_code()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/import_hooks.py", line 367, in get_code
code = EnamlCompiler.compile(ast, file_info.src_path)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_compiler.py", line 176, in compile
return compiler.visit(node)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_ast.py", line 351, in visit
result = visitor(node, *args, **kwargs)
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/enaml_compiler.py", line 204, in visit_Module
return cg.to_code()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/code_generator.py", line 61, in to_code
return bp_code.to_code()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/byteplay.py", line 336, in to_code
arg=arg.to_code()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/byteplay.py", line 286, in to_code
co_stacksize = self._compute_stacksize()
File "/home/bob/work/modernization/protoacs/enaml/enaml/core/byteplay.py", line 253, in _compute_stacksize
se = stack_effect(o, arg)
TypeError: an integer is required (got type str)
$
Hi,
I would like to help in supporting both python 2 and 3. I have seen that you tagged some issues as being relevant for that but there are not very detailed. Can you give me some pointers about where I could start looking ?
Thanks
PS : Is your fork of Atom currently supporting both ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.