Page MenuHomePhabricator

ecore: add simple logic to generate synthetic string property assembling value of other properties.
ClosedPublic

Authored by cedric on Apr 28 2019, 11:05 AM.

Details

Summary

I have choosen to use ${} as the property marker, but I am open to other suggestion. Let
me know if you have other suggestion.

This patch also fix recursion on properties changed to properly explore parents dependencies,
avoid infinite loop and emit properties changed by added property logic or property text
on the Efl.ViewModel.

Depends on D8754

Diff Detail

Repository
rEFL core/efl
Branch
T7832-devs/cedric/viewmodeltext
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 11614
cedric created this revision.Apr 28 2019, 11:05 AM
cedric requested review of this revision.Apr 28 2019, 11:05 AM
cedric updated this revision to Diff 21851.May 1 2019, 6:06 PM
cedric edited the summary of this revision. (Show Details)

Rebase, remove need for temporary array and add an error message case to the API.

cedric updated this revision to Diff 21898.May 2 2019, 9:42 AM

Rebase.

cedric updated this revision to Diff 22090.May 10 2019, 2:44 PM
cedric added a reviewer: raster.

Rebase and implement new ${} syntax.

the idea looks good but the document need to be checked by @segfaultxavi..
and I think property_string_add/del is better to avoid some confusion of text_set/get

Yes, I want to make some amendments to the docs, but if I do not make them in time and you want to push this, I can submit a patch later.

property_string_add probably is less confusing that property_text_add, I agree.

Also, the word *binded* appears in many places... in English that should be *bound*.

segfaultxavi requested changes to this revision.May 14 2019, 9:46 AM

Here are some doc suggestions.

I also prefer property_string_add over property_text_add, to avoid confusion.

src/lib/ecore/efl_view_model.eo
34

I propose this alternate text:

Adds a synthetic string property, generated from a $definition string and other properties in the model.

The $definition string, similar to how $printf works, contains ${} placeholders that are replaced by the actual value of the property inside the placeholder tags when the synthetic property is retrieved.
For example, a numeric property $length might be strange to use as a label, since it will only display a number. However, a synthetic string can be generated with the definition "Length ${length}m." which renders more nicely and does not require any more code by the user of the property.

$not_ready and $on_error strings can be given to be used when the data is not ready or there is some error, respectively. These strings do not accept placeholder tags.
36

The name for the new synthetic property.

37

The definition string for the new synthetic property.

38

The text to be used if any of the properties used in $definition is not ready yet. If set to $null, no check against EAGAIN will be done.

39

The text to be used if any of the properties used in $definition is in error. It takes precedence over $not_ready. If set to $null, no error checks are performed.

44

Delete a synthetic property previously defined by @.property_text_add.

49

The name of the synthetic property to delete.

This revision now requires changes to proceed.May 14 2019, 9:46 AM
cedric updated this revision to Diff 22423.May 23 2019, 5:32 PM
cedric retitled this revision from ecore: add simple logic to generate string property assembling value of other properties. to ecore: add simple logic to generate synthetic string property assembling value of other properties..
cedric edited the summary of this revision. (Show Details)

Rebase, rename and improve doc.

segfaultxavi resigned from this revision.May 27 2019, 3:36 AM

I have no further concerns regarding the docs. Somebody with knowledge of these internals should review them, though.

lauromoura accepted this revision.May 29 2019, 3:35 PM
This revision is now accepted and ready to land.May 29 2019, 3:35 PM
This revision was automatically updated to reflect the committed changes.