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.
2374 2375 2376 2377 |
# File 'lib/a-core.rb', line 2374 def initialize(_arcadia) @arcadia = _arcadia Arcadia.attach_listener(self, DialogEvent) end |
Instance Method Details
#on_dialog(_event) ⇒ Object
2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 |
# File 'lib/a-core.rb', line 2379 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
2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 |
# File 'lib/a-core.rb', line 2419 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 |