Skip to content

Commit

Permalink
Handle redraw in dependent overviews.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Feb 14, 2017
1 parent 5f0ba87 commit b111658
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/lib/installation/clients/inst_casp_overview.rb
Expand Up @@ -145,6 +145,10 @@ def quadrant_layout(upper_left:, lower_left:, upper_right:, lower_right:)
# block installation
def content
controller_node = Installation::Widgets::ControllerNodePlace.new

bootloader_overview = Installation::Widgets::Overview.new(client: "bootloader_proposal")
kdump_overview = Installation::Widgets::Overview.new(client: "kdump_proposal")

quadrant_layout(
upper_left: VBox(
::Registration::Widgets::RegistrationCode.new,
Expand All @@ -158,12 +162,12 @@ def content
Tune::Widgets::SystemInformation.new
),
upper_right: VBox(
Installation::Widgets::Overview.new(client: "partitions_proposal"),
Installation::Widgets::Overview.new(client: "bootloader_proposal")
Installation::Widgets::Overview.new(client: "partitions_proposal", on_redraw: [ kdump_overview, bootloader_overview ]),
bootloader_overview
),
lower_right: VBox(
Installation::Widgets::Overview.new(client: "network_proposal"),
Installation::Widgets::Overview.new(client: "kdump_proposal")
kdump_overview
)
)
end
Expand Down
8 changes: 7 additions & 1 deletion src/lib/installation/widgets/overview.rb
Expand Up @@ -33,14 +33,18 @@ class Overview < CWM::CustomWidget
attr_reader :proposal_client

# @param client [String] A proposal client implementing simple_mode,
# @param redraw [Array<Overview>] list of other Overview clients. In case
# of :redraw action every of these clients will be redrawn too. Caller is
# responsible for not creating circular dependencies.
# eg. "bootloader_proposal"
def initialize(client:)
def initialize(client:, on_redraw: [])
textdomain "installation"
@proposal_client = client
@replace_point = "rp_" + client
# by default widget_id is the class name; must differentiate instances
self.widget_id = "overview_" + client
@blocking = false
@overviews_for_redraw = on_redraw
end

def contents
Expand Down Expand Up @@ -82,6 +86,8 @@ def redraw
reset

Yast::UI.ReplaceWidget(Id(@replace_point), widget)

@overviews_for_redraw.each(&:redraw)
end

def handle(_event)
Expand Down

0 comments on commit b111658

Please sign in to comment.