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

Explicitly specify GObject.Property value_types in ignis widgets #155

Open
lost-melody opened this issue Feb 19, 2025 · 0 comments · May be fixed by #157
Open

Explicitly specify GObject.Property value_types in ignis widgets #155

lost-melody opened this issue Feb 19, 2025 · 0 comments · May be fixed by #157
Labels
enhancement New feature or request
Milestone

Comments

@lost-melody
Copy link

Feature Description

I'm building my UI with blueprint-compiler and Gtk.Template, and have found that properties defined by ignis cannot be bound to Gtk widgets' properties because they are defined with different value_types:

an example of blueprint
ListView {
  factory: BuilderListItemFactory {
    template ListItem {
      child: Label {
        // lookup `name` from IgnisApplication as string, while `name` is defined as GParamBoxed
        label: bind template.item as <$IgnisApplication>.name;
      }
    }
  }
}

So I suppose that properties defined by ignis should have explicit types:

list properties' names and types

def __init__(self):
  super().__init__()
  for p in self.list_properties():
    logger.info(f"property {p.name}: {p.value_type}")

# property typed GParamBoxed
@Gobject.Property
def test_boxed(self) -> str:
  return "hello"

# property typed string
@GObject.Property(type=str)
def test_string(self) -> str:
  return "hello"

will get output:

[INFO] test-boxed, <GType PyObject (108018380832032)>
[INFO] test-string, <GType gchararray (64)>

Also, when running ignis inspector, we cannot view or edit those properties because they are typed PyObject:

screenshot

Image

See also:

  1. PyGObject Properties
  2. blueprint-compiler
  3. Gtk.Builder
  4. PyGObject Gtk.Template
@lost-melody lost-melody added the enhancement New feature or request label Feb 19, 2025
@linkfrg linkfrg added this to the v0.5 milestone Feb 19, 2025
@linkfrg linkfrg linked a pull request Feb 20, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants