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

Compatibility with GTK #48

@lukaskellerstein

Description

@lukaskellerstein

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions