Open guillaume-mueller opened 2 months ago
If I understand this issue correctly, I believe what you want instead is the bindProperty
function instead of bind
in tandem with the Settings.BindingDirection.BIDIRECTIONAL
attribute:
this.settings.bindProperty(Settings.BindingDirection.BIDIRECTIONAL,
'switch-master', 'master',
this.switch_master, null);
this.settings.bindProperty(Settings.BindingDirection.BIDIRECTIONAL,
'switch-slave', 'slave',
null, null);
this.settings.bindProperty(Settings.BindingDirection.BIDIRECTIONAL,
'dull-switch-show-slave', null,
this.show_slave_state, null);
switch_master() {
this.slave = this.master;
this.show_slave_state();
}
Some variant of this code should work for you if I've understood this correctly.
Are you able to make it work ? I don't.
Actually I tried a lot of things including this one before reporting the issue and it always behaved the same.
Also from Devhelp
about bindProperty
:
[…] This function is deprecaed and is now only a wrapper around bind for backward compatibility. Please use bind instead.
Are you able to make it work ? I don't.
I believe this is working on other applets currently. My assumption is that I properly understood your issue but maybe not. Would you be able to generate a video of the issue?
Also from
Devhelp
aboutbindProperty
:[…] This function is deprecaed and is now only a wrapper around bind for backward compatibility. Please use bind instead.
Well, that's unfortunate...
https://github.com/user-attachments/assets/fd0c2c74-a24b-400a-beed-f052bf7c4d96
- In the UI, any action initiated by any non-button widget cannot update another widget's value shown.
false
,true
=> slave is incorrectly not updated,true
,https://github.com/user-attachments/assets/b0fa5294-1ed1-4a95-b995-5b2e6d53eee5
- While the inner value is well changed, the UI is like a new instance of the value and any subsequent change from the UI accounts for the shown value, while any other procedure in the Applet accounts for the inner value.
https://github.com/user-attachments/assets/5cbbfe26-b074-402e-b24e-9c12de8538c1
- While a button can update another widget's shown value, if a non-button widget has set a widget's value (incl. itself), the button won't be able to control the widget's shown value anymore.
true
,true
Are you able to make it work ? I don't.
I believe this is working on other applets currently. My assumption is that I properly understood your issue but maybe not. Would you be able to generate a video of the issue?
Also from
Devhelp
aboutbindProperty
:[…] This function is deprecaed and is now only a wrapper around bind for backward compatibility. Please use bind instead.
Well, that's unfortunate...
Or maybe it is not unfortunate as the bind
method may already set as bidirectionnal but the bug I'm pointing is what prevent it to work.
Or maybe it is not unfortunate as the
bind
method may already set as bidirectionnal but the bug I'm pointing is what prevent it to work.
I'm honestly not sure. What I do know is that I've implemented these features by using the bidirectional bindings. If the documented method isn't working as intended though, it would be great to fix it properly.
Distribution
Mint 22
Package version
6.2.9
Graphics hardware in use
No response
Frequency
Always
Bug description
I will refer the settings window of an
Applet
as UI.In the UI, any action initiated by any non-
button
widget cannot update another widget'svalue
shown.While the inner
value
is well changed, the UI is like a new instance of thevalue
and any subsequent change from the UI accounts for the shownvalue
, while any other procedure in the Applet accounts for the innervalue
.While a
button
can update another widget's shownvalue
, if a non-button
widget has set a widget'svalue
(incl. itself), the button won't be able to control the widget's shownvalue
anymore.Steps to reproduce
metadata.json
:settings_schema.json
:applet.js
:Expected behavior
The UI should always have its widgets' shown
value
up to date according to the innervalue
.Additional information
No response