Class: Ruber::RubyRunner::ConfigWidget

Inherits:
Qt::Widget
  • Object
show all
Defined in:
plugins/ruby_runner/config_widget.rb

Overview

Config widget for the ruby runner plugin

Instance Method Summary (collapse)

Constructor Details

- (ConfigWidget) initialize(parent = nil)

Creates a new widget

Parameters:

  • parent (Qt::Widget) (defaults to: nil)

    the widget’s parent



41
42
43
44
45
46
# File 'plugins/ruby_runner/config_widget.rb', line 41

def initialize parent = nil
  super
  @ui = Ui::RubyRunnerConfigWidget.new
  @ui.setupUi self
  connect @ui._ruby__interpreters, SIGNAL(:changed), self, SLOT(:update_default_interpreter)
end

Instance Method Details

- (nil) default_interpreter=(value)

Writer for the ruby/ruby setting

Parameters:

  • the (String)

    path of the default interpreter

Returns:

  • (nil)


73
74
75
76
77
# File 'plugins/ruby_runner/config_widget.rb', line 73

def default_interpreter= value
  it = @ui._ruby__ruby.each_with_index.find{|txt, i| txt == value}
  @ui._ruby__ruby.current_index = it ? it[1] : 0
  nil
end

- (Object) fill_interpreters(value) (private)

Fills the “Ruby interpreters widget”

Before filling the widget, clears it. After filling the widget, it updates the “Default interpreter” widget.

Parameters:

  • a (<String>)

    list of the paths of the availlable interpreters



89
90
91
92
93
# File 'plugins/ruby_runner/config_widget.rb', line 89

def fill_interpreters value
  @ui._ruby__interpreters.clear
  @ui._ruby__interpreters.insert_string_list value
  update_default_interpreter
end

- (nil) read_ruby_options(val)

Writer for the ruby/ruby_options setting

Returns:

  • (nil)


53
54
55
56
# File 'plugins/ruby_runner/config_widget.rb', line 53

def read_ruby_options val
  @ui._ruby__ruby_options.text = val.join ' '
  nil
end

- (<String>) store_ruby_options

Reader for the ruby/ruby_options setting

Returns:

  • (<String>)

    with an entry per option. Options containing spaces are quoted



63
64
65
# File 'plugins/ruby_runner/config_widget.rb', line 63

def store_ruby_options
  Shellwords.split_with_quotes @ui._ruby__ruby_options.text
end

- (nil) update_default_interpreter (private)

Fills the “Default interpreter” combo box according to the availlable interpreters

This method attempts to preserve the current entry if possible. This means that if an entry with the same text still exists, it will become current.

Returns:

  • (nil)


103
104
105
106
107
108
109
110
# File 'plugins/ruby_runner/config_widget.rb', line 103

def update_default_interpreter
  old_current = @ui._ruby__ruby.current_text
  @ui._ruby__ruby.clear
  @ui._ruby__ruby.add_items @ui._ruby__interpreters.items
  idx = @ui._ruby__ruby.items.index old_current
  @ui._ruby__ruby.current_index = idx ? idx : 0
  nil
end

Slot Signature:

update_default_interpreter()