Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for methods from map.h and tileset.h for the Python plugin API. #1867

Closed
wants to merge 5 commits into from

Conversation

yashgandhe666
Copy link

Having problems with generating pythonbind.cpp

@yashgandhe666 yashgandhe666 changed the title Added support for map.h and tileset.h for the Python plugin API. Added support for methods from map.h and tileset.h for the Python plugin API. Jan 27, 2018
@bjorn
Copy link
Member

bjorn commented Jan 28, 2018

Having problems with generating pythonbind.cpp

What problems are those exactly?

On Arch Linux, I have installed python2-pybindgen and use python2 tiledbinding.py to regenerate the pythonbind.cpp file.

@harindu95
Copy link

harindu95 commented Feb 5, 2018

I have the same error. With PyBindGen (0.18.0).

> pybindgen.typehandlers.base.CodeGenerationError: Class QRgb cannot be copied

Traceback:

>python2 tiledbinding.py
Traceback (most recent call last):
  File "tiledbinding.py", line 312, in <module>
    mod.generate(fh)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/module.py", line 928, in generate
    self.do_generate(sink_manager, module_file_base_name)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/module.py", line 702, in do_generate
    submodule.do_generate(out)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/module.py", line 767, in do_generate
    class_.generate(sink, self)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/cppclass.py", line 2003, in generate
    self._generate_methods(code_sink, parent_caller_methods)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/cppclass.py", line 2394, in _generate_methods
    utils.call_with_error_handling(overload.generate, (code_sink,), {}, overload)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/utils.py", line 180, in call_with_error_handling
    return callback(*args, **kwargs)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/overloading.py", line 154, in generate
    (code_sink,), {}, self.all_wrappers[0])
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/utils.py", line 180, in call_with_error_handling
    return callback(*args, **kwargs)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/cppmethod.py", line 387, in generate
    self.generate_body(tmp_sink, gen_call_params=[class_])
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/typehandlers/base.py", line 936, in generate_body
    self.return_value.convert_c_to_python(self)
  File "/home/harindu/VirtualENVs/py2/local/lib/python2.7/site-packages/pybindgen/cppclass.py", line 3254, in convert_c_to_python
    raise CodeGenerationError("Class {0} cannot be copied".format(self.cpp_class.full_name))
pybindgen.typehandlers.base.CodeGenerationError: Class QRgb cannot be copied

@bjorn
Copy link
Member

bjorn commented Feb 6, 2018

Hmm, I get this error as well with PyBindGen 0.18.0. With 0.17 it worked fine, so you can either look for the problem or downgrade to PyBindGen 0.17. I'll try to look into this soon.

bjorn added a commit that referenced this pull request Feb 7, 2018
Added copy constructors where needed for the code generation to work
with pybindgen 0.18.0 (somehow it worked with pybindgen 0.17.0 without
these, maybe the check is new).

See pull request #1867
@bjorn
Copy link
Member

bjorn commented Feb 7, 2018

@yashgandhe666 @harindu95 Issues should be fixed in change da9ba8f.

Copy link
Member

@bjorn bjorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashgandhe666 I've rebased your change on latest master so now it contains the fix for the above problem. However, it now raises the following issue:

pybindgen.typehandlers.base.TypeLookupError: ['QPoint']

You will probably need to define this class (currently only QPointF and QSizeF are defined, which you could base QPoint and QSize on).

#cls_tileset.add_method('tileOffset', 'QPoint', [])
cls_tileset.add_method('tileOffset', 'QPoint', [])
cls_tileset.add_method('gridSize', 'Qsize', [])
cls_tileset.add_method('setGridSize', None, ('Qsize', 'gridSize'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be QSize (though currently this class is not defined, nor is QPoint, which is probably why the tileOffset method is commented out).

bjorn added a commit that referenced this pull request Feb 7, 2018
Added copy constructors where needed for the code generation to work
with pybindgen 0.18.0 (somehow it worked with pybindgen 0.17.0 without
these, maybe the check is new).

See pull request #1867

(cherry picked from commit da9ba8f)
@bjorn
Copy link
Member

bjorn commented Feb 12, 2018

@yashgandhe666 In my last update I've used PyBindGen 0.18 to update the generated file. Please make sure you're using 0.18 as well, to avoid the huge differences in the generated file between 0.17 and 0.18.

@bjorn bjorn closed this in 3cfd9ee Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants