class Syskit::GUI::BatchManager::NewJobDialog

Attributes

editor[R]

Public Class Methods

exec(parent, text) click to toggle source
# File lib/syskit/gui/batch_manager.rb, line 192
def self.exec(parent, text)
    new(parent, text).exec
end
new(parent = nil, text = '') click to toggle source
Calls superclass method
# File lib/syskit/gui/batch_manager.rb, line 162
def initialize(parent = nil, text = '')
    super(parent)
    resize(800, 600)

    layout = Qt::VBoxLayout.new(self)
    @error_message = Qt::Label.new(self)
    @error_message.style_sheet = "QLabel { background-color: #ffb8b9; border: 1px solid #ff6567; padding: 5px; }"
    @error_message.frame_style = Qt::Frame::StyledPanel
    layout.add_widget(@error_message)
    @error_message.hide

    @editor = Qt::TextEdit.new(self)
    self.text = text
    layout.add_widget editor

    buttons = Qt::DialogButtonBox.new(Qt::DialogButtonBox::Ok | Qt::DialogButtonBox::Cancel)
    buttons.connect(SIGNAL('accepted()')) do
        begin
            @error_message.hide
            @result = Parser.parse(self.text)
            accept
        rescue Exception => e
            @error_message.text = e.message
            @error_message.show
        end
    end
    buttons.connect(SIGNAL('rejected()')) { reject }
    layout.add_widget buttons
end

Public Instance Methods

result() click to toggle source
# File lib/syskit/gui/batch_manager.rb, line 217
def result
    @result
end
text() click to toggle source
# File lib/syskit/gui/batch_manager.rb, line 225
def text
    editor.to_plain_text
end
text=(text) click to toggle source
# File lib/syskit/gui/batch_manager.rb, line 221
def text=(text)
    editor.plain_text = text
end