Skip to content

Commit

Permalink
Mocks of remaining widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jan 12, 2017
1 parent a4dc3d0 commit dd5795b
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 12 deletions.
53 changes: 41 additions & 12 deletions src/lib/installation/clients/inst_casp_overview.rb
Expand Up @@ -23,6 +23,9 @@
require "y2country/widgets"
require "ui/widgets"

# FIXME: prototype only
require "mocked_widgets"

module Installation
# This library provides a simple dialog for setting
# - the password for the system administrator (root)
Expand All @@ -46,12 +49,14 @@ def run
# helpful when testing all manually on a running system
Yast::Wizard.CreateDialog if separate_wizard_needed?

Yast::Wizard.SetTitleIcon("yast-users")
Yast::Wizard.SetTitleIcon("yast-users") # ?
Yast::Wizard.EnableAbortButton

Yast::Wizard.SetNextButton(Id(:install), _("Install"))

ret = Yast::CWM.show(
content,
# Title for root-password dialogue
# Title for installation overview dialog
caption: _("Installation Overview")
)

Expand All @@ -64,16 +69,40 @@ def run

# Returns a UI widget-set for the dialog
def content
VBox(
VStretch(),
# use english us as default keyboard layout
::Y2Country::Widgets::KeyboardSelection.new("english-us"),
VSpacing(1),
::UI::Widgets::KeyboardLayoutTest.new,
VStretch(),
::Users::PasswordWidget.new,
VStretch(),
Label("FIXME: add other widgets")
HBox(
HWeight(
7,
VBox(
VStretch(),
Widgets::RegistrationCode.new,
VStretch(),
::Users::PasswordWidget.new, # TODO: horizontal layout
VStretch(),
# use english us as default keyboard layout
# TODO: ComboBox, not SelectionBox
::Y2Country::Widgets::KeyboardSelection.new("english-us"),
VStretch(),
Widgets::SystemRole.new,
VStretch(),
Widgets::SystemInformation.new,
VStretch()
)
),
HSpacing(1),
HWeight(
3,
VBox(
VStretch(),
Left(Widgets::PartitioningOverview.new),
VStretch(),
Left(Widgets::BootloaderOverview.new),
VStretch(),
Left(Widgets::NetworkOverview.new),
VStretch(),
Left(Widgets::KdumpOverview.new),
VStretch()
)
)
)
end

Expand Down
110 changes: 110 additions & 0 deletions src/lib/mocked_widgets.rb
@@ -0,0 +1,110 @@
require "yast"
require "cwm/widget"

# FIXME: these are mock only

# move this to: yast2-registration
module Widgets
class RegistrationCode < CWM::InputField
def initialize
textdomain "FIXME"
end

def label
_("Registration Code")
end
end
end

# move this to: stays in installation
module Widgets
class SystemRole < CWM::ComboBox
def initialize
textdomain "FIXME"
end

def label
_("System Role")
end

def items
[
["Romeo", _("Romeo")], # DUH, find the real ones
["Juliet", _("Juliet")]
]
end
end
end

module Widgets
class SystemInformation < CWM::PushButton
include Yast::Logger
def initialize
textdomain "FIXME"
end

def label
_("System Information")
end

def handle
log.info "The system is a system"
# doc?
nil
end
end
end

module Widgets
class Overview < CWM::CustomWidget
def contents
VBox(
PushButton(Id(button_id), self.label),
Label("* foo"),
Label("* bar")
)
end

private

def button_id
self.class.to_s
end
end

class PartitioningOverview < Overview
def initialize
textdomain "FIXME"
end

def label
_("Partitioning")
end
end

class BootloaderOverview < Overview
def initialize
textdomain "FIXME"
end

def label
_("Booting")
end
end
class NetworkOverview < Overview
def initialize
textdomain "FIXME"
end
def label
_("Network")
end
end
class KdumpOverview < Overview
def initialize
textdomain "FIXME"
end
def label
_("Kdump") # FIXME: spelling
end
end
end

0 comments on commit dd5795b

Please sign in to comment.