Mailinglist Archive: yast-devel (45 mails)

< Previous Next >
[yast-devel] Hackweek Project - Modern Popup Class
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 20 Nov 2017 11:06:53 +0100
  • Message-id: <20171120110653.3bd178e4@linux-vvcf.privatesite>
Hi,
I would like to introduce my hackweek project ( thanks lslezak for
giving idea ). It is modern popup library, that have nice API that is
readable, extendable and well documented. At first let me show you some
comparison of old and new API calls so you get idea:

Yast::Popup.Message(text)
Yast2::Popup.show(text)

Yast::Popup.MessageDetails(text, details)
Yast2::Popup.show(text, details: details)

Yast::Popup.TimedError(text, seconds)
Yast2::Popup.show(text, headline: :error, timeout: seconds)

Yast::Popup.TimedErrorAnyQuestion("Notice", "Hi, how are you?",
"Happy", "Sad", :yes, 10)
Yast2::Popup.show("Hi, how are you?", headline: "Notice",
timeout: 10, buttons: { happy: "Happy", sad: "Sad"), focus: :happy)

Yast::Popup.TimedLongNotify(message, timeout_seconds)
Yast2::Popup.show(message, richtext: true, timeout: timeout_seconds)


So as you can see there is only one method "show" that have named
parameters with reasonable defaults. It also have proper its rspec
tests.

I also decide to split Feedback to own class as feedback is
special kind of popup window. And add one more feature that allow to
change feedback as you continue with long operation.

It is not yet merged, so you have still chance to add some notes and
improve final result as much as possible. One controversial part is
rspec helpers, which allows to specify something like

expect_to_show_popup_which_return(:test)

and it will mock what is needed at low level and at same time do all
input parameters validation, so it show wrong parameter problems. So
feel free to comment pull request at [1]

Thanks
Josef

[1] https://github.com/yast/yast-yast2/pull/639
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages