Class: Cosmos::Splash::SplashDialogBox
- Inherits:
-
Qt::Dialog
- Object
- Qt::Dialog
- Cosmos::Splash::SplashDialogBox
- Defined in:
- lib/cosmos/gui/dialogs/splash.rb
Instance Method Summary collapse
-
#initialize(parent) ⇒ SplashDialogBox
constructor
A new instance of SplashDialogBox.
- #keyPressEvent(event) ⇒ Object
- #message=(message) ⇒ Object
- #message_callback ⇒ Object
- #progress=(progress) ⇒ Object
- #progress_callback ⇒ Object
Methods inherited from Qt::Dialog
Constructor Details
#initialize(parent) ⇒ SplashDialogBox
Returns a new instance of SplashDialogBox.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 22 def initialize(parent) super(parent, Qt::WindowTitleHint | Qt::CustomizeWindowHint) setWindowTitle(parent.windowTitle) setModal(true) layout = Qt::VBoxLayout.new splash_image_filename = File.join(::Cosmos::USERPATH, 'config', 'data', 'splash.gif') splash_image_filename = File.join(::Cosmos::PATH, 'data', 'splash.gif') unless File.exist?(splash_image_filename) image = Qt::Pixmap.new(splash_image_filename) label = Qt::Label.new label.setPixmap(image) layout.addWidget(label) @message_box = Qt::LineEdit.new @message_box.setReadOnly(true) layout.addWidget(@message_box) @progress_bar = Qt::ProgressBar.new layout.addWidget(@progress_bar) setLayout(layout) @progress = 0 @complete = false end |
Instance Method Details
#keyPressEvent(event) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 72 def keyPressEvent(event) # Don't allow the Escape key to close this dialog if event.key == Qt::Key_Escape event.ignore else super(event) end end |
#message=(message) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 46 def () unless @complete Qt.execute_in_main_thread(false) do @message_box.setText() end end end |
#message_callback ⇒ Object
64 65 66 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 64 def method(:message=) end |
#progress=(progress) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 54 def progress=(progress) progress_int = (progress * 100).to_i if !@complete and @progress != progress_int @progress = progress_int Qt.execute_in_main_thread(false) do @progress_bar.setValue(progress_int) end end end |
#progress_callback ⇒ Object
68 69 70 |
# File 'lib/cosmos/gui/dialogs/splash.rb', line 68 def progress_callback method(:progress=) end |