class Dumon::ProfileDlg

This class represents a base class defining user interface (dialog window) for profile management.

Public Class Methods

new() click to toggle source

Constructor.

# File lib/dumon/profile.rb, line 10
def initialize
  @dumon_conf = Dumon::App.instance.read_config
end

Public Instance Methods

apply_profile(prof_name) click to toggle source

Applies a profile from configuration according selection in tree view. prof_name profile name

# File lib/dumon/profile.rb, line 31
def apply_profile(prof_name)
  profile = @dumon_conf[:profiles][prof_name.to_sym]
  profile[:mode] = profile[:mode].to_sym
  begin
    Dumon::App.instance.ui.omanager.switch profile
    Dumon::logger.debug "Profile applied, name=#{prof_name}"
  rescue ArgumentError => ae # BF #14
    on_warn ['Profile use failed! (unconnected output?)', "profile name=#{prof_name}", "message=#{ae.message}"]
  end
end
on_warn(msg) click to toggle source

Reacts to an problem by profile use with a warning. msg message describing the problem

# File lib/dumon/profile.rb, line 24
def on_warn(msg)
  Dumon::logger.warn msg.join(', ')
end
show() click to toggle source

Shows the dialog. Abstract method to be overridden by concrete sub-class.

# File lib/dumon/profile.rb, line 17
def show
  raise NotImplementedError, 'this should be overridden by concrete sub-class'
end