Class: Watobo::Plugin::Crawler::Gui::ScopeFrame

Inherits:
FXVerticalFrame
  • Object
show all
Defined in:
plugins/crawler/gui/scope_frame.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ ScopeFrame

Returns a new instance of ScopeFrame.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'plugins/crawler/gui/scope_frame.rb', line 55

def initialize(owner)
  super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  iframe = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK)
  #iframe = self
  @restrict_path_cb = FXCheckButton.new(iframe, "restrict to start path", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
  @restrict_path_cb.checkState = true

  outer_matrix = FXMatrix.new(iframe, 3, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X)
  @allowed_hosts_box = Watobo::Gui::ListBox.new(outer_matrix, "Allowed Hosts")
  @exluded_urls_box = Watobo::Gui::ListBox.new(outer_matrix, "Excluded URLs")
  @allowed_urls_box = Watobo::Gui::ListBox.new(outer_matrix, "Allowed URLs")

end

Instance Method Details

#path_restricted?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'plugins/crawler/gui/scope_frame.rb', line 38

def path_restricted?
  @restrict_path_cb.checked?
end

#set(s) ⇒ Object



42
43
44
45
46
47
# File 'plugins/crawler/gui/scope_frame.rb', line 42

def set(s)
  @allowed_hosts_box.append s[:allowed_hosts] if s.has_key? :allowed_hosts
  @exluded_urls_box.append s[:allowed_urls] if s.has_key? :allowed_urls
  @exluded_urls_box.append s[:excluded_urls] if s.has_key? :excluded_urls

end

#to_hObject



30
31
32
33
34
35
36
# File 'plugins/crawler/gui/scope_frame.rb', line 30

def to_h
  {
    :allowed_hosts => @allowed_hosts_box.to_a,
    :allowed_urls => @allowed_urls_box.to_a,
    :excluded_urls => @exluded_urls_box.to_a
  }
end

#update_formObject



49
50
51
52
53
# File 'plugins/crawler/gui/scope_frame.rb', line 49

def update_form
  @widgets.each do |e|
    e.handle(self, FXSEL(SEL_UPDATE, 0), nil)
  end
end