Class: Bioroebe::GUI::Gtk::WwwFinder
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Bioroebe::GUI::Gtk::WwwFinder
show all
- Includes:
- Bioroebe::GUI, Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/www_finder/www_finder.rb
Overview
Bioroebe::GUI::Gtk::WwwFinder
Constant Summary
collapse
- NAMESPACE =
inspect
- TITLE =
'WWW-Finder'
- BASE_URL_FOR_DBGET =
'"https://www.genome.ad.jp/dbget-bin/www_bfind_sub?mode=bfind&max_hit=1200&dbkey=kegg&keywords='.dup
- BASE_URL_FOR_NCBI =
'"https://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term='
- WIDTH =
580
- HEIGHT =
720
- USE_THIS_FONT =
:dejavu_condensed_22
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
Class Method Summary
collapse
-
.run(i = ARGV) ⇒ Object
# === Bioroebe::GUI::Gtk::WwwFinder.run ========================================================================= #.
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ WwwFinder
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 77
def initialize(
commandline_arguments = ARGV,
run_already = true
)
super(:vertical)
register_sigint
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::WwwFinder.run
#
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 348
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Bioroebe::GUI::Gtk::WwwFinder.new(i)
r = ::Gtk.run
r << _
r.add_shortcut(1, 'focus_entry(1)', :alt)
r.add_shortcut(2, 'focus_entry(2)', :alt)
r.add_shortcut(3, 'focus_entry(3)', :alt)
r.add_shortcut(4, 'focus_entry(4)', :alt)
r.background_colour :white
r.automatic_size_then_automatic_title
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
124
125
126
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 124
def border_size?
0
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
333
334
335
336
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 333
def connect_skeleton
abort_on_exception
pack_start(@frame)
end
|
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 241
def create_buttons
@button_quit = coloured_quit_button(colour: 'honeydew')
@button_search_dbget = coloured_button('_DBGET_ivory')
@button_search_dbget.signal_connect(:clicked) { |w|
e rev+'Searching DBGET for: '+sfancy(@entry_dbget.text)
open_in_browser target_for(:dbget)
}
@button_search_dbget.fancy_tooltip = BASE_URL_FOR_DBGET.delete('"')
@button_ensembl = coloured_button('_Ensembl_lightblue')
@button_ensembl.signal_connect(:clicked) { |w|
e rev+'Searching ENSEMBL for: '+sfancy(@entry_ensembl.text)
open_in_browser target_for(:ensembl)
}
@button_search_ncbi = coloured_button('_NCBISearch_lightblue')
@button_search_ncbi.signal_connect(:clicked) { |w|
e rev+'Searching ncbi for: '+sfancy(@entry_ncbi.text)
open_in_browser target_for(:ncbi)
}
@button_search_ncbi.fancy_tooltip = BASE_URL_FOR_NCBI.delete('"')
@button_search_nih = coloured_button('_NIHSearch_lightblue')
@button_search_nih.signal_connect(:clicked) { |w|
e rev+'Searching NIH for: '+sfancy(@entry_nih.text)
target = '"https://search2.google.cit.nih.gov/search?'
target << 'client=NIH_frontend&site=NIH_Master&output=xml_no_dtd&'
target << 'proxystylesheet=NIH_frontend&ie=UTF-8&oe=UTF-8&filter=0&'
target << 'as_q='
tmp = @entry_nih.text.tr(' ','+')
target << tmp
target << '&'
target << 'num=40&btnG.x=29&btnG.y=10&btnG=Search&as_epq=&'
target << 'as_oq=&as_eq=&lr=&as_occt=any&as_dt=i&as_sitesearch=&sort='
target << '"'
}
end
|
#create_check_boxes ⇒ Object
#
create_check_boxes
Creates the check boxes. On startup, we synchronize this.
#
168
169
170
171
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 168
def create_check_boxes
@checkbox_synchronize = check_button('Synchronize On', false)
@checkbox_synchronize.set_active(true)
end
|
#create_entries ⇒ Object
#
create_entries
entries tag.
#
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 178
def create_entries
@entry_dbget = create_entry_with_text_and_max_length('alzheimer')
@entry_ensembl = create_entry_with_text_and_max_length('helicobacter')
@entry_ncbi = create_entry_with_text_and_max_length('escherichia coli')
@entry_nih = create_entry_with_text_and_max_length('escherichia coli')
@array_entries = [
@entry_dbget, @entry_ensembl, @entry_ncbi, @entry_nih
]
@array_entries.each { |entry|
entry.signal_connect(:changed) { |w, event|
if @checkbox_synchronize.active?
@array_entries.each { |entry|
entry.set_text(entry.text) unless e == entry
}
end
}
entry.signal_connect(:activate) { |w| puts w }
}
end
|
#
This creates the menu.
#
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 144
def
begin
require 'gtk_paradise/widgets/version_agnostic/my_image_menu_item.rb'
rescue LoadError => error
pp error
end
@menu_bar =
@menu_item = ('Menu')
@first_submenu =
@item1 = ('foo',nil,0)
@item1.signal_connect(:activate) { do_something }
@first_submenu << @item1
@item2 = ('bar',nil,3)
@item2.signal_connect(:activate) { e 'test 2' }
@first_submenu << @item2
@menu_item.(@first_submenu)
@menu_bar.append(@menu_item)
end
|
#create_skeleton ⇒ Object
#
create_skeleton (create tag)
#
131
132
133
134
135
136
137
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 131
def create_skeleton
create_check_boxes
create_entries
create_buttons
create_vbox
end
|
#create_vbox ⇒ Object
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 305
def create_vbox
@frame = gtk_frame
@frame.label_widget = modify_bold_label('Search for BioStuff: ','slateblue')
@v_box.minimal(@menu_bar,2)
@v_box.minimal(@entry_dbget,6)
@v_box.minimal(@button_search_dbget,6)
@v_box.minimal(@entry_ncbi,6)
@v_box.minimal(@button_search_ncbi,6)
@v_box.minimal(@entry_nih,6)
@v_box.minimal(@button_search_nih,6)
@v_box.minimal(@entry_ensembl,6)
@v_box.minimal(@button_ensembl,6)
@v_box.minimal(@checkbox_synchronize,6)
@v_box.maximal(@button_quit, 6)
@frame = gtk_frame(@v_box) end
|
#favicon? ⇒ Boolean
326
327
328
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 326
def favicon?
:tabble
end
|
#focus_entry(which_entry) ⇒ Object
#
focus_entry
This helps you to focus an entry.
#
293
294
295
296
297
298
299
300
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 293
def focus_entry(which_entry)
case which_entry.to_s
when '1' then @entry_dbget.do_focus
when '2' then @entry_ncbi.do_focus
when '3' then @entry_nih.do_focus
when '4' then @entry_ensembl.do_focus
end
end
|
#padding? ⇒ Boolean
117
118
119
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 117
def padding?
4
end
|
#reset ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 93
def reset
reset_the_internal_variables
@configuration = [true, __dir__, NAMESPACE]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
use_gtk_paradise_project_css_file
append_project_css_file
infer_the_size_automatically
@button_quit = ''
@v_box = gtk_vbox
background_colour :slateblue
end
|
#run ⇒ Object
341
342
343
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 341
def run
create_skeleton_then_connect_skeleton
end
|
#target_for(i) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
# File 'lib/bioroebe/gui/gtk3/www_finder/www_finder.rb', line 213
def target_for(i)
_ = ''.dup
case i when :ensembl
_ << '"https://www.ensembl.org/Human/Search/Results?q='
_ << @entry_ensembl.text+';name=Search;facet_species=Human"'
when :dbget
_ << BASE_URL_FOR_DBGET
_ << @entry_dbget.text+'"'
when :ncbi
_ << BASE_URL_FOR_NCBI
_ << @entry_ncbi.text+'"'
end
return _
end
|