Mailinglist Archive: yast-devel (53 mails)

< Previous Next >
Re: [yast-devel] Type of widget id
On Mon, Jan 23, 2017 at 09:30:56AM +0100, Josef Reidinger wrote:
Hi developers,
I found one design issue and I am not sure what is correct expected
usage. Problem is with id of widget used in yast. Till now I thought
that it can be any basic type, so string, symbol, number, whatever.
But during friday debugging of issue with ReplacePoint CWM widget I
found that some libraries and calls have limitation

1) CWM expects that id of widget is String, and as ID is used that
string. If not, it will abort with nil id ( as it try to get string
only )

Yes.

2) call Yast::UI.ReplaceWidget accept only symbol as id of replace
point. Nothing else is accepted.

No.

Actually in all places where YUI expects a widget
ID, you can pass a symbol, **or** a term whose value **can** be a
non-symbol. And we always pass a term whose name is `id` (written
`Id` in Ruby), and the value is typically a symbol for hand coded
widgets but string for CWM widgets.

But [the
documentation](https://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/ReplaceWidget.html)
only mentions the first of the overloaded signatures, the one with
`symbol`.

So I think now you see why CWM ReplacePoint widget have troubles, as Id
cannot be symbol and! String at same time. In the end I solve it with
some workaround, but I would like what is intended usage? Really
unlimited basic types? Or String only or Symbol only? I think it make
sense to fix such annoying expectations. We have control over both
parts, so we can change it. I just do not know all reasons behind, so
if you have idea about these two limitations, if you can write it.

And of course if you have any opinion or idea about this id and its
limitation, I will welcome it.


See also https://github.com/yast/yast-yast2/pull/535
--
Martin Vidner, YaST Team
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
< Previous Next >
References