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

feat: Add Poppler #180

Merged
merged 2 commits into from
Apr 1, 2024
Merged

feat: Add Poppler #180

merged 2 commits into from
Apr 1, 2024

Conversation

principis
Copy link
Contributor

I manually annotated the Action class.

@lovetox
Copy link
Collaborator

lovetox commented Mar 20, 2024

if you annoted something manually you need to mark it like this

# override
class Action(GObject.GBoxed):
...

this tells the generator to not override the class definition if we rerun it.

@principis
Copy link
Contributor Author

principis commented Mar 21, 2024

I've added the # override for the Action class and also for the Page.get_size method. The Size class I created in the second commit does still removed. Is it possible to solve that?

I also added the ellipsis' back in the Action class. I'm not sure if they are needed or not... But there is always a default value set.

@lovetox
Copy link
Collaborator

lovetox commented Mar 30, 2024

why was the Size class needed? Is it a namedtuple that is returned?

did you try to add override to the size class?

@principis
Copy link
Contributor Author

principis commented Mar 30, 2024

Yes, it returns a NamedTuple as far as I know. I used this PR as an example, because I didn't really know how to solve it.

This is what is returned by Page.get_size() :

>>> print(type(page.get_size()))
<class 'conflib.pdf.page._ResultTuple'>

>>> print(page.get_size())
(width=612.0, height=792.0)

>>> print(dir(page.get_size()))
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__repr_format', '__rmul__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__tuple_indices', '_new_type', 'count', 'height', 'index', 'width']

Edit: I also tried to add # override, which didn't work...

@lovetox
Copy link
Collaborator

lovetox commented Apr 1, 2024

Ok, i think we just have to think about it for now if we ever regenerate the stubs

@lovetox lovetox merged commit 400772c into pygobject:master Apr 1, 2024
2 checks passed
@principis
Copy link
Contributor Author

Thanks!

@principis principis deleted the poppler branch April 1, 2024 08:27
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.

2 participants