Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f38c87b
commit 8e24912
Showing
8 changed files
with
472 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Y2DIR=$(dirname "$0")/../src /sbin/yast2 $(dirname "$0")/popup_params.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# rubocop:disable all | ||
require "yast" | ||
|
||
require "yast2/popup" | ||
|
||
Yast.import "UI" | ||
|
||
include Yast::UIShortcuts | ||
|
||
def code(params) | ||
"Yast2::Popup.show(#{params})" | ||
end | ||
|
||
content = VBox( | ||
InputField(Id(:params), Opt(:notify), "Popup Params:"), | ||
VSpacing(1), | ||
InputField(Id(:code), Opt(:disable), "Code to run:"), | ||
VSpacing(1), | ||
PushButton(Id(:call), "Show") | ||
) | ||
|
||
Yast::UI.OpenDialog(content) | ||
loop do | ||
ret = Yast::UI.UserInput | ||
case ret | ||
when :params | ||
value = Yast::UI.QueryWidget(:params, :Value) | ||
Yast::UI.ChangeWidget(:code, :Value, code(value)) | ||
when :cancel | ||
break | ||
when :call | ||
begin | ||
value = Yast::UI.QueryWidget(:params, :Value) | ||
eval(code(value)) | ||
rescue => e | ||
Yast2::Popup.show("Failed with #{e.message}") | ||
end | ||
end | ||
end | ||
|
||
Yast::UI.CloseDialog | ||
|
||
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "yast" | ||
|
||
require "yast2/popup" | ||
|
||
Yast2::Popup.show("Simple text") | ||
|
||
Yast2::Popup.show("Long text\n" * 50) | ||
|
||
Yast2::Popup.show("Simple text with details", details: "More details here") | ||
|
||
Yast2::Popup.show("Simple text with timeout", timeout: 10) | ||
|
||
Yast2::Popup.show("Continue/Cancel buttons", buttons: :continue_cancel) | ||
|
||
Yast2::Popup.show("Yes/No buttons", buttons: :yes_no) | ||
|
||
Yast2::Popup.show("Yes/No buttons with No focused", buttons: :yes_no, focus: :no) | ||
|
||
Yast2::Popup.show("Yes/No buttons with timeout returning focused item", buttons: :yes_no, focus: :no, timeout: 10) | ||
|
||
Yast2::Popup.show("Own buttons", buttons: { button1: "button 1", button2: "button 2" }, focus: :button2) | ||
|
||
Yast2::Popup.show("Richtext is set to <b>false</b>", richtext: false) | ||
|
||
Yast2::Popup.show("Richtext is set to <b>:auto</b>", richtext: :auto) | ||
|
||
Yast2::Popup.show("Long text. Richtext is set to <b>:auto</b>\n" * 50, richtext: :auto) | ||
|
||
Yast2::Popup.show("Richtext is set to <b>true</b>", richtext: true) | ||
|
||
Yast2::Popup.show("Long text. Richtext is set to <b>true</b><br>" * 50, richtext: true) | ||
|
||
Yast2::Popup.show("Long text with newlines. Richtext is set to <b>true</b>\n" * 50, richtext: true) | ||
|
||
Yast2::Popup.show(":notice style", style: :notice) | ||
|
||
Yast2::Popup.show(":important style", style: :important) | ||
|
||
Yast2::Popup.show(":warning style", style: :warning) | ||
|
||
Yast2::Popup.show("Headline set", headline: "Headline") | ||
|
||
Yast2::Popup.show("Headline set to :error", headline: :error) | ||
|
||
Yast2::Popup.show( | ||
"All options", | ||
headline: "Headline", | ||
details: "details", | ||
timeout: 10, | ||
buttons: :yes_no, | ||
focus: :no, | ||
richtext: false, | ||
style: :important | ||
) | ||
|
||
Yast2::Popup.feedback("feedback for time consuming operation", headline: "Syncing...") { sleep(5) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Y2DIR=$(dirname "$0")/../src /sbin/yast2 $(dirname "$0")/popup_serie.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.