Class: Cosmos::ScriptRunnerDialog

Inherits:
Qt::Dialog show all
Defined in:
lib/cosmos/tools/script_runner/script_runner_frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, title, default_tab_text = 'Untitled') ⇒ ScriptRunnerDialog

Constructor



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 32

def initialize(parent,
               title,
               default_tab_text = 'Untitled')
  # Call base class constructor
  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_frameObject (readonly)

Returns the value of attribute script_runner_frame.



29
30
31
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 29

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



49
50
51
52
53
54
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 49

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

#rejectObject



56
57
58
59
60
# File 'lib/cosmos/tools/script_runner/script_runner_frame.rb', line 56

def reject
  # Don't allow the dialog to close if we're running
  return if @script_runner_frame.running?
  super
end