Class: Ruber::ComponentLoadingErrorDialog
- Inherits:
-
ExceptionDialog
- Object
- KDE::Dialog
- ExceptionDialog
- Ruber::ComponentLoadingErrorDialog
- Defined in:
- lib/ruber/exception_widgets.rb
Overview
ExceptionDialog specialized to display failures when loading plugins and components.
It differs from ExceptionDialog in the following aspects:
- it provides different buttons
- it provides a check box to decide whether or not to warn of subsequent errors while loading plugins
- its #exec method provides values suitable to be returned from a block passed to Ruber::ComponentManager#load_plugins
- it provides an appropriate text
The buttons on the dialog are:
- Go on:
- ignore the failure and attempt to load the remaining plugins, hoping everything goes well
- Quit:
- immediately quit Ruber
- Skip remaining:
- ignore the failure, but don’t attempt to load any other plugin
If the exception was raised while loading a core component, the dialog will behave exactly as an ExceptionDialog (since you can’t start Ruber without one of the core components, the other buttons and the checkbox would be useless).
Instance Method Summary (collapse)
-
- (Boolean, Symbol) exec
Override of ExceptionDialog#exec.
-
- (ComponentLoadingErrorDialog) initialize(plugin, ex, parent = nil, core = false)
constructor
A new instance of ComponentLoadingErrorDialog.
-
- (Boolean?) silently?
Whether or not the user checked to ignore subsequent errors.
Methods inherited from ExceptionDialog
Constructor Details
- (ComponentLoadingErrorDialog) initialize(plugin, ex, parent = nil, core = false)
A new instance of ComponentLoadingErrorDialog
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/ruber/exception_widgets.rb', line 188 def initialize plugin, ex, parent = nil, core = false msg = "An error occurred while loading the #{core ? 'component' : 'plugin' } #{plugin}. The error was:" super ex, parent, true, msg unless core label = w = Qt::Widget.new self self. = w w.layout = Qt::VBoxLayout.new w label.parent = w w.layout. label @silent = Qt::CheckBox.new "&Don't report other errors", w w.layout. @silent self. = Yes|No|Cancel|Details self. KDE::Dialog::Yes, "&Go on" self. KDE::Dialog::No, "&Quit Ruber" self. KDE::Dialog::Cancel, "&Skip remaining plugins" self. = KDE::Dialog::No end end |
Instance Method Details
- (Boolean, Symbol) exec
Override of ExceptionDialog#exec
It returns a different value according to the button pressed by the user and to whether he checked the “Don’t report other errors” checkbox. The returned values are suitable for use by a block passed to Ruber::ComponentManager#load_plugins.
- true
- if the user pressed the “Go on” button without checking the checkbox
:silent
- if the user pressed the “Go on” button and checked the checkbox
- false
- if the user pressed the “Quit” button
:skip
- if the user pressed the “Skip” button
233 234 235 236 237 238 239 240 241 |
# File 'lib/ruber/exception_widgets.rb', line 233 def exec res = super case res when KDE::Dialog::Yes then silently? ? :silent : true when KDE::Dialog::No then false when KDE::Dialog::Cancel then :skip else res end end |
- (Boolean?) silently?
Whether or not the user checked to ignore subsequent errors
215 216 217 |
# File 'lib/ruber/exception_widgets.rb', line 215 def silently? @silent.checked? rescue nil end |