Class: ArcadiaDialogManager

Inherits:
Object
  • Object
show all
Defined in:
lib/a-core.rb

Instance Method Summary collapse

Constructor Details

#initialize(_arcadia) ⇒ ArcadiaDialogManager

Returns a new instance of ArcadiaDialogManager.



977
978
979
980
# File 'lib/a-core.rb', line 977

def initialize(_arcadia)
  @arcadia = _arcadia
  Arcadia.attach_listener(self, DialogEvent)
end

Instance Method Details

#on_dialog(_event) ⇒ Object



982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/a-core.rb', line 982

def on_dialog(_event)
  type = _event.type
  if !DialogEvent::TYPE_PATTERNS.include?(_event.type)
    type = 'ok'
  end
  res_array = type.split('_')
  icon = _event.level
  tktype = type.gsub('_','').downcase
  
  tkdialog =  Tk::BWidget::MessageDlg.new(
          'icon' => icon,
          'bg' => Arcadia.conf('background'),
          'fg' => Arcadia.conf('foreground'),
          'type' => tktype,
          'title' => _event.title, 
          'message' => _event.msg)
          
  tkdialog.configure('font'=>'courier 6')        
  res = tkdialog.create
  _event.add_result(self, 'value'=>res_array[res.to_i])
end

#on_dialog_old(_event) ⇒ Object



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
# File 'lib/a-core.rb', line 1005

def on_dialog_old(_event)
  type = _event.type
  if !DialogEvent::TYPE_PATTERNS.include?(_event.type)
    type = 'ok'
  end
  icon = _event.level
  tktype = type.gsub('_','').downcase
  
  res =  Tk.messageBox(
          'icon' => icon,
          'type' => tktype,
          'title' => _event.title, 
          'message' => _event.msg)
  _event.add_result(self, 'value'=>res)
end