Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #608 from yast/caasp_merge
Caasp merge
- Loading branch information
Showing
12 changed files
with
381 additions
and
26 deletions.
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,65 @@ | ||
# Simple example to demonstrate object oriented replace_point widget | ||
|
||
require_relative "example_helper" | ||
|
||
require "yast" | ||
|
||
require "cwm/widget" | ||
|
||
Yast.import "UI" | ||
Yast.import "CWM" | ||
Yast.import "Wizard" | ||
|
||
class SwitchWidget < CWM::PushButton | ||
def initialize(replace_point, widgets) | ||
@replace_point = replace_point | ||
@widgets = widgets | ||
end | ||
|
||
def label | ||
"Switch" | ||
end | ||
|
||
def handle | ||
@widgets.rotate! | ||
@replace_point.replace(@widgets.first) | ||
end | ||
end | ||
|
||
class PopupButtonWidget < CWM::PushButton | ||
def label | ||
"Popup" | ||
end | ||
|
||
def handle | ||
Yast::Popup.Message("Click!") | ||
end | ||
end | ||
|
||
class StoreWidget < CWM::InputField | ||
def label | ||
"write here" | ||
end | ||
|
||
def validate | ||
return true unless value.empty? | ||
|
||
Yast::Popup.Error("Empty value!") | ||
false | ||
end | ||
|
||
def store | ||
Yast::Popup.Message(value) | ||
end | ||
end | ||
|
||
widgets = [PopupButtonWidget.new, CWM::Empty.new(:empty), StoreWidget.new] | ||
replace_point = CWM::ReplacePoint.new(widget: widgets.first) | ||
|
||
content = Yast::Term.new(:VBox, | ||
SwitchWidget.new(replace_point, widgets), | ||
replace_point) | ||
|
||
Yast::Wizard.CreateDialog | ||
Yast::CWM.show(content) | ||
Yast::Wizard.CloseDialog |
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
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
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
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
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
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,39 @@ | ||
# encoding: utf-8 | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. | ||
# | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, contact Novell, Inc. | ||
# | ||
# To contact Novell about this file by physical or electronic mail, you may find | ||
# current contact information at www.novell.com. | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "yast" | ||
require "cwm/widget" | ||
|
||
module UI | ||
module Widgets | ||
# Widget representing input field for testing keyboard layout. | ||
# Its value is ignored and never used anywhere. | ||
class KeyboardLayoutTest < CWM::InputField | ||
def initialize | ||
textdomain "base" | ||
end | ||
|
||
def label | ||
_("&Test Keyboard Layout") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.