Bind_property_full not supported. Options?

Hi there. In Python, I’m able to use bind_property() when setting up bindings between a model and widgets in a ColumnView. However I have a more complex requirement - I’m dealing with data from a database, and I don’t want to squash NULL values to the empty string ( which I have to do, because if I try to set eg a GtkEntry’s trext to None, it explodes ). I was hoping to use bind_property_full() with some GBindingTransformFunc(s), but I see that’s not supported:

  File "/home/dankasak/src/gtk4-db-binder/Gtk4DbBinder/Gtk4DbBinder.py", line 855, in bind
    grid_row.bind_property_full( column_name , widget , "text" , GObject.BindingFlags.SYNC_CREATE
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               , self.bind_transform_to , self.bind_transform_from , None , None )
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/gi/overrides/GObject.py", line 499, in _unsupported_method
    raise RuntimeError('This method is currently unsupported.')
RuntimeError: This method is currently unsupported.

That’s a pity, because it would have been an elegant way to handle this. The only other solution I can think of is to duplicate each GObject property to a separate one to handle the “NULL state” of each “actual” property and have complex marshaling of values between the 2. Does anyone have any other ideas? I don’t suppose bind_property_full() is about to be supported? :slight_smile:

The GObject.Object.bind_property() method includes optional named arguments for the transformation functions, and it effectively merges the bind_property() and bind_property_full() variants into one, something that C cannot do.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.