Method: Ruber::ExternalProgramPlugin#initialize

Defined in:
lib/ruber/external_program_plugin.rb

#initialize(pdf, line_buffered = true) ⇒ ExternalProgramPlugin

Creates a new ExternalProgramPlugin.

pdf is the plugin info object for the plugin. If line_buffered is false, buffering won’t be used (all the characters read from the process will be passed to process_standard_output or process_standard_error even if they don’t end in a newline).

Note: the process’ channel mode will be set to Qt::Process::SeparateChannels. You can set it to any value you want later



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/ruber/external_program_plugin.rb', line 108

def initialize pdf, line_buffered = true
  super pdf
  @buffer = nil
  @buffer_content_channel = nil
  @line_buffered = line_buffered
  @output_widget = nil unless defined? @output_widget
  @process = KDE::Process.new self
  @process.process_channel_mode = Qt::Process::SeparateChannels
  @process.output_channel_mode = KDE::Process::SeparateChannels
  @process.connect SIGNAL(:readyReadStandardOutput) do
    do_stdout @process.read_all_standard_output.to_s
  end
  @process.connect SIGNAL(:readyReadStandardError) do
    do_stderr @process.read_all_standard_error.to_s
  end
  connect @process, SIGNAL('finished(int, QProcess::ExitStatus)'), self, SLOT('slot_process_finished(int, QProcess::ExitStatus)')
  connect self, SIGNAL('process_finished(int, QString)'), self, SLOT('display_exit_message(int, QString)')
  @process.connect SIGNAL('error(QProcess::ProcessError)') do |e|
    failed_to_start if e == Qt::Process::FailedToStart
  end
  connect @process, SIGNAL('started()'), self, SIGNAL('process_started()')
end