Class: ArcadiaDialogManager
- Inherits:
-
Object
- Object
- ArcadiaDialogManager
- Defined in:
- lib/a-core.rb
Instance Method Summary collapse
-
#initialize(_arcadia) ⇒ ArcadiaDialogManager
constructor
A new instance of ArcadiaDialogManager.
- #on_dialog(_event) ⇒ Object
- #on_dialog_old(_event) ⇒ Object
Constructor Details
#initialize(_arcadia) ⇒ ArcadiaDialogManager
Returns a new instance of ArcadiaDialogManager.
2393 2394 2395 2396 |
# File 'lib/a-core.rb', line 2393 def initialize(_arcadia) @arcadia = _arcadia Arcadia.attach_listener(self, DialogEvent) end |
Instance Method Details
#on_dialog(_event) ⇒ Object
2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 |
# File 'lib/a-core.rb', line 2398 def on_dialog(_event) type = _event.type if !DialogEvent::TYPE_PATTERNS.include?(_event.type) type = 'ok' end res_array = type.split('_') if _event.level.nil? || _event.level.length == 0 icon = 'info' else icon = _event.level end tktype = type.gsub('_','').downcase if _event.msg && _event.msg.length > 500 msg = _event.msg[0..500]+' ...' else msg = _event.msg end tkdialog = Tk::BWidget::MessageDlg.new( 'icon' => icon, 'bg' => Arcadia.conf('background'), 'fg' => Arcadia.conf('foreground'), 'type' => tktype, 'title' => _event.title, 'message' => msg) tkdialog.configure('font'=>'courier 6') res = tkdialog.create if _event.level == 'error' if _event.exception != nil Arcadia.runtime_error(_event.exception, _event.title) else Arcadia.runtime_error_msg(_event.msg, _event.title) end end _event.add_result(self, 'value'=>res_array[res.to_i]) end |
#on_dialog_old(_event) ⇒ Object
2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 |
# File 'lib/a-core.rb', line 2438 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.( 'icon' => icon, 'type' => tktype, 'title' => _event.title, 'message' => _event.msg) _event.add_result(self, 'value'=>res) end |