Class: Watobo::Plugin::Filefinder::Filefinder::DBSelectFrame
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Plugin::Filefinder::Filefinder::DBSelectFrame
- Defined in:
- plugins/filefinder/filefinder.rb
Instance Method Summary collapse
- #get_db_list ⇒ Object
- #get_db_name ⇒ Object
-
#initialize(parent, db_list, opts) ⇒ DBSelectFrame
constructor
A new instance of DBSelectFrame.
- #select_db(db_name) ⇒ Object
Constructor Details
#initialize(parent, db_list, opts) ⇒ DBSelectFrame
Returns a new instance of DBSelectFrame.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'plugins/filefinder/filefinder.rb', line 164 def initialize(parent, db_list, opts) super(parent, opts) @db_list = [] db_list.each do |f| @db_list << f if File.exist? f end FXLabel.new(self, "Each filename must be in a seperate line, e.g. DirBuster-DBs" ) frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X) @db_listbox = FXListBox.new(frame, :opts => LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK) @db_list.each do |db| item = @db_listbox.appendItem(db) @db_listbox.setItemData(@db_listbox.numItems-1, db ) end @db_listbox.numVisible = @db_listbox.numItems @add_db_btn = FXButton.new(frame, "add") @add_db_btn.connect(SEL_COMMAND) { add_db } end |
Instance Method Details
#get_db_list ⇒ Object
156 157 158 159 160 161 162 |
# File 'plugins/filefinder/filefinder.rb', line 156 def get_db_list l = [] @db_listbox.numItems.times do |i| l << @db_listbox.getItemData(i) end l end |
#get_db_name ⇒ Object
149 150 151 152 153 154 |
# File 'plugins/filefinder/filefinder.rb', line 149 def get_db_name i = @db_listbox.currentItem db = '' db = @db_listbox.getItemData(i) if i >= 0 db end |
#select_db(db_name) ⇒ Object
141 142 143 144 145 146 147 |
# File 'plugins/filefinder/filefinder.rb', line 141 def select_db(db_name) @db_listbox.numItems.times do |i| if db_name == @db_listbox.getItemData(i) @db_listbox.currentItem = i end end end |