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.



960
961
962
963
# File 'lib/a-core.rb', line 960

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

Instance Method Details

#on_dialog(_event) ⇒ Object



964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
# File 'lib/a-core.rb', line 964

def on_dialog(_event)
  type = _event.type
  if !DialogEvent::TYPE_PATTERNS.include?(_event.type)
    type = 'ok'
  end
  icon = _event.level
#    case _event
#      when QuestionDialogEvent
#        icon = 'question'
#      when InfoDialogEvent
#        icon = 'info'
#      when WarningDialogEvent
#        icon = 'warning'
#      when ErrorDialogEvent
#        icon = 'error'
#      else
#        icon = 'info'
#    end
   
  tktype = type.gsub('_','').downcase
  
  res =  Tk.messageBox(
          'icon' => icon,
          'type' => tktype,
          'title' => _event.title, 
          'message' => _event.msg)
  _event.add_result(self, 'value'=>res)
end