Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CWM: Added DateField and TimeField widgets
- Loading branch information
Showing
5 changed files
with
94 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,70 @@ | ||
# Simple example to demonstrate object API for CWM | ||
|
||
require_relative "example_helper" | ||
|
||
require "cwm" | ||
require "cwm/popup" | ||
|
||
Yast.import "CWM" | ||
|
||
class Name < CWM::InputField | ||
def initialize | ||
textdomain "example" | ||
end | ||
|
||
def label | ||
_("Name") | ||
end | ||
end | ||
|
||
class EventDate < CWM::DateField | ||
def initialize | ||
textdomain "example" | ||
end | ||
|
||
def init | ||
self.value = Time.now.strftime("%Y-%m-%d") | ||
end | ||
|
||
def label | ||
_("Event date") | ||
end | ||
end | ||
|
||
class EventTime < CWM::TimeField | ||
def initialize | ||
textdomain "example" | ||
end | ||
|
||
def init | ||
self.value = Time.now.strftime("%H:%M:%S") | ||
end | ||
|
||
def label | ||
_("Event time") | ||
end | ||
end | ||
|
||
|
||
class Event < ::CWM::Popup | ||
def initialize | ||
textdomain "example" | ||
end | ||
|
||
def contents | ||
VBox( | ||
Name.new, | ||
HBox( | ||
EventDate.new, | ||
HSpacing(1), | ||
EventTime.new | ||
) | ||
) | ||
end | ||
|
||
def title | ||
_("Event Example") | ||
end | ||
end | ||
|
||
Event.new.run |
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 @@ | ||
require_relative "../../examples/date_time.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
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