On Tue, 25 Jun 2013 12:28:19 +0200
Klaus Kaempf <[email protected]> wrote:

> * Josef Reidinger <[email protected]> [Jun 25. 2013 11:35]:
> > Hi,
> > I would like to discuss one think that is related to creating UI in
> > YaST in ruby. In YCP it uses terms. In ruby generic terms looks
> > like:
> > 
> > term(:VBox,...)
> > 
> > but it is not much nice for me, so I create few shortcuts for known
> > UI elements and it looks like this:
> > 
> > VBox(...)
> 
> Agreed, the latter one looks so much nicer.
> 
> > 
> > There is a problem. In UI is often used terms `id and `opts, but it
> > doesn't start with uppercase and there is high chance to collide
> > with existing methods ( beside id collide with ruby id method ).
> 
> Usage of object#id is not a problem if 'id' is defined in object's
> class.
> 
> > So I
> > propose to translate it to
> > ID(:id) and OPTS(:strechable,:notify)
> 
> Ugh, all caps is reserved for constants in Ruby.

OK, good argument.

> 
> > 
> > alternative can be Opts and Id.
> > what is your opinion?
> 
> libyui-bindings has more complete examples
> (https://github.com/kkaempf/libyui-bindings/tree/master/swig/ruby/examples)
> which could help guiding a decision.

To be honest, I don't like this examples, it looks like old C gtk where
create every element is pain. Compare this examples with elegance of
translated YCP code -
https://github.com/kobliha/yast-services-manager/blob/master/src/clients/services-manager.rb#L83

I just want to get rid of annoying id, header and opt term. So after
your comments I propose to create shortcuts
Id, Opt and Header that creates such terms.

Any objections?

Josef

> 
> 
> Klaus

-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to