diff --git a/library/packages/src/modules/PackageCallbacks.rb b/library/packages/src/modules/PackageCallbacks.rb index d003981c0..eb0daa76a 100644 --- a/library/packages/src/modules/PackageCallbacks.rb +++ b/library/packages/src/modules/PackageCallbacks.rb @@ -54,7 +54,6 @@ def main Yast.import "CommandLine" Yast.import "String" Yast.import "Report" - Yast.import "Icon" Yast.import "Wizard" Yast.import "Progress" Yast.import "FileUtils" @@ -292,12 +291,7 @@ def LayoutPopup(message, button_box, vertical_size, info_on) dialog_layout = VBox( HSpacing(50), # enforce width VSpacing(0.1), - HBox( - # maybe more icon types could be used - # "info, "warning", "error" - Icon.Image("warning", "margin_right" => 2), - Left(Label(message)) - ), + Left(Label(message)), VSpacing(0.1), HBox( HSpacing(0.6), diff --git a/library/wizard/src/modules/Confirm.rb b/library/wizard/src/modules/Confirm.rb index 78c00bf6e..4d49b9b91 100644 --- a/library/wizard/src/modules/Confirm.rb +++ b/library/wizard/src/modules/Confirm.rb @@ -41,7 +41,6 @@ def main textdomain "base" - Yast.import "Icon" Yast.import "Label" Yast.import "Mode" Yast.import "Popup" @@ -55,9 +54,13 @@ def main # Confirm hardware detection (only in manual installation) # @param [String] class hardware class (network cards) - # @param [String] icon_name name of the icon. If nil, generic hardware icon will be used + # @param [String] icon_name deprecated # @return true on continue def Detection(class_, icon_name) + if !icon_name.nil? + Builtins.y2warning(-1, "Parameter 'icon_name' is deprecated.") + end + return true if Linuxrc.manual != true # L3: no interaction in AY, just re-probe (bnc#568653) @@ -65,10 +68,6 @@ def Detection(class_, icon_name) return true if Arch.s390 - icon_name = "yast-hardware" if icon_name.nil? - - icon = Icon.Image(icon_name, {}) - result = Ops.get(@detection_cache, class_) if !result.nil? Builtins.y2milestone( @@ -107,7 +106,7 @@ def Detection(class_, icon_name) HVCenter( Label(_("YaST will detect the following hardware:")) ), - HVCenter(HBox(icon, HSpacing(0.5), Heading(class_))), + HVCenter(Heading(class_)), VSpacing(0.5) ) ) diff --git a/library/wizard/src/modules/Progress.rb b/library/wizard/src/modules/Progress.rb index f04bc54d6..4f200e5fc 100644 --- a/library/wizard/src/modules/Progress.rb +++ b/library/wizard/src/modules/Progress.rb @@ -139,14 +139,6 @@ def main # stack with the running progresses # the top of the stack is the end of the list @progress_stack = [] - - @global_invisible_icons_definition = [] - @global_visible_icons_definition = [] - - @use_icons_in_progress = false - @has_icon_progress_bar = false - - @last_highlighted_icon = -1 end def IsRunning @@ -326,78 +318,6 @@ def MarkId(i) Id(Builtins.sformat("mark_stage_%1", i)) end - def IconId(i) - Builtins.sformat("mark_icon_%1", i) - end - - def FallbackIconInvisible - Ops.add(Directory.icondir, "32x32/apps/yast-sudo.png") - end - - def FallbackIconVisible - Ops.add(Directory.icondir, "32x32/apps/yast-scripts.png") - end - - def NormalizeIconPath(one_icon, visible) - if one_icon.nil? || one_icon == "" - one_icon = visible ? FallbackIconVisible() : FallbackIconInvisible() - end - - if !Builtins.regexpmatch(one_icon, ".[pP][nN][gG]$") && - !Builtins.regexpmatch(one_icon, ".[jJ][pP][gG]$") - one_icon = Ops.add(one_icon, ".png") - end - - # relative path (to Directory::icondir) - if Builtins.regexpmatch(one_icon, "/") && - !Builtins.regexpmatch(one_icon, "^/") - one_icon = Ops.add(Directory.icondir, one_icon) - # hopefully you know what you do - # just image name - elsif !Builtins.regexpmatch(one_icon, "/") - one_icon = Ops.add(Ops.add(Directory.icondir, "32x32/apps/"), one_icon) - end - - if !FileUtils.Exists(one_icon) - Builtins.y2error("Image %1 doesn't exist, using fallback", one_icon) - one_icon = visible ? FallbackIconVisible() : FallbackIconInvisible() - end - - one_icon - end - - def GenerateIdleIcons(number_of_stages) - display_info = UI.GetDisplayInfo - can_display_images = Ops.get_boolean( - display_info, - "HasImageSupport", - false - ) == true - - return Empty() if !can_display_images - - ret = HBox(HSpacing(2)) - i = -1 - - number_of_stages = Ops.subtract(number_of_stages, 1) - - while Ops.less_than(i, number_of_stages) - i = Ops.add(i, 1) - - one_icon = NormalizeIconPath( - Ops.get(@global_visible_icons_definition, i), - false - ) - ret = Builtins.add( - ret, - Image(Id(IconId(i)), Opt(:disabled), one_icon, "[X]") - ) - ret = Builtins.add(ret, HSpacing(2)) - end - - deep_copy(ret) - end - # New complex progress bar with stages. # @param [String] window_title title of the window # @param [String] progress_title title of the progress bar. Pass at least " " @@ -503,21 +423,10 @@ def New(window_title, progress_title, length, stg, tits, help_text) bar = Builtins.add(bar, Left(HBox(HSquash(items)))) if 0 != @steps - progress_icons = Empty() - if @use_icons_in_progress == true - Builtins.y2milestone("Using icons in progress") - progress_icons = GenerateIdleIcons(length) - @has_icon_progress_bar = true - else - Builtins.y2milestone("No progress icons defined") - @has_icon_progress_bar = false - end - bar = Builtins.add( bar, VBox( VStretch(), - progress_icons, ReplacePoint(Id(:subprogress_replace_point), Empty()), ReplacePoint( Id(:progress_replace_point), @@ -666,45 +575,20 @@ def SubprogressTitle(title) nil end - # Function adds icon-support to progress dialog. - # Parameters are the same as for Progress::New() function with one parameter added. - # + # @deprecated Use {#New} instead. + # Obsolete function adding icon-support to progress dialog. + # We don't use icons in popups any more. # @param [String] window_title # @param [String] progress_title # @param [Fixnum] length # @param [Array] stg # @param [Array] tits # @param [String] help_textmap - # # @param [Array>] icons_definition - # - # - # **Structure:** - # - # icons_definition = $[ - # [ // first 'visible' - # "/path/to/icon-highlighted.png" - # "/path/to/another-icon-highlighted.png", - # ] - # [ // then 'invisible' - # "/path/to/icon-gryscale.png", - # nil, // fallback icon will be used - # ], - # ] - # # @see Function Progress::New() - def NewProgressIcons(window_title, progress_title, length, stg, tits, help_textmap, icons_definition) - stg = deep_copy(stg) - tits = deep_copy(tits) - icons_definition = deep_copy(icons_definition) - @global_visible_icons_definition = Ops.get(icons_definition, 0, []) - @global_invisible_icons_definition = Ops.get(icons_definition, 1, []) - - @use_icons_in_progress = true + def NewProgressIcons(window_title, progress_title, length, stg, tits, help_textmap, _icons_definition) + Builtins.y2warning(-1, "#{__method__} is deprecated. Use Progess::New instead!") New(window_title, progress_title, length, stg, tits, help_textmap) - @use_icons_in_progress = false - - nil end # Create simple progress bar with no stages, only with progress bar. @@ -718,30 +602,6 @@ def Simple(window_title, progress_title, length, help_text) nil end - # Highlights a progress icon (changes the dimmed one - # into a normal one). - # - # @param integer current step ID - def HighlightProgressIcon(step_id) - if @has_icon_progress_bar - @last_highlighted_icon = -1 if @last_highlighted_icon.nil? - - # some steps might have been skipped, change all (not changed yet) - # icons one by one - while Ops.less_than(@last_highlighted_icon, step_id) - @last_highlighted_icon = Ops.add(@last_highlighted_icon, 1) - - icon_id = IconId(@last_highlighted_icon) - - if UI.WidgetExists(Id(icon_id)) == true - UI.ChangeWidget(Id(icon_id), :Enabled, true) - end - end - end - - nil - end - # Uses current_step def UpdateProgressBar if Ops.greater_than(@current_step, @steps) @@ -756,10 +616,7 @@ def UpdateProgressBar progress_value = @current_step - # do not change icons in a nested progress - if StackSize() == 0 - HighlightProgressIcon(@current_step) - else + if StackSize() != 0 # recalculate the progress bar value according to the parent progress prev_state = TopState() prev_step = Ops.get_integer(prev_state, "current_step", 0)