Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Compatibility with GTK #48

Open
lukaskellerstein opened this issue Mar 19, 2020 · 0 comments
Open

Compatibility with GTK #48

lukaskellerstein opened this issue Mar 19, 2020 · 0 comments

Comments

@lukaskellerstein
Copy link

Is Pinject compatible with GTK? For me, this simple example doesn't work.

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

import pinject

class MyWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Hello World")

        self.button = Gtk.Button(label="Click Here")
        self.button.connect("clicked", self.on_button_clicked)
        self.add(self.button)

    def on_button_clicked(self, widget):
        print("Hello World")

obj_graph = pinject.new_object_graph()

Error:

Traceback (most recent call last):
  File "main.py", line 54, in <module>
    obj_graph = pinject.new_object_graph()
  File "/home/lukas/.cache/pypoetry/virtualenvs/test-di-1-QD_7cPfB-py3.7/lib/python3.7/site-packages/pinject/object_graph.py", line 100, in new_object_graph
    found_classes = finding.find_classes(modules, classes)
  File "/home/lukas/.cache/pypoetry/virtualenvs/test-di-1-QD_7cPfB-py3.7/lib/python3.7/site-packages/pinject/finding.py", line 32, in find_classes
    all_classes |= _find_classes_in_module(module)
  File "/home/lukas/.cache/pypoetry/virtualenvs/test-di-1-QD_7cPfB-py3.7/lib/python3.7/site-packages/pinject/finding.py", line 46, in _find_classes_in_module
    for member_name, member in inspect.getmembers(module):
  File "/usr/lib/python3.7/inspect.py", line 341, in getmembers
    value = getattr(object, key)
  File "/home/lukas/.cache/pypoetry/virtualenvs/test-di-1-QD_7cPfB-py3.7/lib/python3.7/site-packages/gi/module.py", line 163, in __getattr__
    setattr(wrapper, value_name, wrapper(value_info.get_value()))
ValueError: invalid enum value: 6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant