Class: Dumon::ProfileDlg

Inherits:
Object
  • Object
show all
Defined in:
lib/dumon/profile.rb

Overview

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

Direct Known Subclasses

GtkProfileDlg

Instance Method Summary collapse

Constructor Details

#initializeProfileDlg

Constructor.



10
11
12
# File 'lib/dumon/profile.rb', line 10

def initialize
  @dumon_conf = Dumon::App.instance.read_config
end

Instance Method Details

#apply_profile(prof_name) ⇒ Object

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



31
32
33
34
35
36
37
38
39
40
# 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) ⇒ Object

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



24
25
26
# File 'lib/dumon/profile.rb', line 24

def on_warn(msg)
  Dumon::logger.warn msg.join(', ')
end

#showObject

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

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/dumon/profile.rb', line 17

def show
  raise NotImplementedError, 'this should be overridden by concrete sub-class'
end