Class: Cosmos::ScriptRunnerDialog
- Defined in:
- lib/cosmos/tools/script_runner/script_runner_frame.rb
Overview
Create a dialog with an embedded ScriptRunnerFrame used to execute a snippet of code while the main script is paused.
Instance Attribute Summary collapse
-
#script_runner_frame ⇒ Object
readonly
Returns the value of attribute script_runner_frame.
Instance Method Summary collapse
-
#execute_text_and_close_on_complete(text, text_binding = nil) ⇒ Object
Executes the given text and closes when complete.
-
#initialize(parent, title, default_tab_text = 'Untitled') ⇒ ScriptRunnerDialog
constructor
A new instance of ScriptRunnerDialog.
- #reject ⇒ Object
Constructor Details
#initialize(parent, title, default_tab_text = 'Untitled') ⇒ ScriptRunnerDialog
Returns a new instance of ScriptRunnerDialog.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 42 def initialize(parent, title, default_tab_text = 'Untitled') super(parent) setWindowTitle(title) setMinimumWidth(parent.width * 0.8) setMinimumHeight(parent.height * 0.6) # Create script runner frame @script_runner_frame = ScriptRunnerFrame.new(self, default_tab_text) layout = Qt::VBoxLayout.new layout.addWidget(@script_runner_frame) setLayout(layout) end |
Instance Attribute Details
#script_runner_frame ⇒ Object (readonly)
Returns the value of attribute script_runner_frame.
40 41 42 |
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 40 def script_runner_frame @script_runner_frame end |
Instance Method Details
#execute_text_and_close_on_complete(text, text_binding = nil) ⇒ Object
Executes the given text and closes when complete
58 59 60 61 62 63 |
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 58 def execute_text_and_close_on_complete(text, text_binding = nil) @script_runner_frame.set_text(text) @script_runner_frame.run_and_close_on_complete(text_binding) exec dispose end |
#reject ⇒ Object
65 66 67 68 69 |
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 65 def reject # Don't allow the dialog to close if we're running return if @script_runner_frame.running? super end |