Class: Bioroebe::GUI::UniversalWidgets::WwwFinder
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::WwwFinder
show all
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb
Overview
Constant Summary
collapse
- TITLE =
#
TITLE
Specify which title to use for this small widget.
#
'WWW-Finder'
- WIDTH =
'65% or 600px minimum'
- HEIGHT =
'55% or 400px minimum'
- MONOSPACED_FONT =
#
MONOSPACED_FONT
When this font is changed, don’t forget to also change the font at SMALLER_FONT.
#
:hack_20
- USE_THIS_FONT =
MONOSPACED_FONT
- SMALLER_FONT =
:hack_16
- USE_THIS_SLIGHTLY_SMALLER_FONT =
#
USE_THIS_SLIGHTLY_SMALLER_FONT
#
:hack_16
- 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='
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, Bioroebe::GUI::USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Class Method Summary
collapse
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
#commandline_arguments?, #commandline_arguments_that_are_files?, #e, #first?, #first_non_hyphen_argument?, #remove_hyphens_from_the_commandline_arguments, #return_commandline_arguments_as_string, #return_commandline_arguments_that_are_not_files, #return_entries_without_two_leading_hyphens, #select_commandline_arguments, #select_entries_starting_with_two_hyphens, #set_commandline_arguments
#colourize_this_aminoacid_sequence_for_the_commandline, #colourize_this_nucleotide_sequence, #disable_colours, #ecomment, #efancy, #egold, #enable_colours, #eorange, #eparse, #erev, #red, #remove_trailing_escape_part, #return_colour_for_nucleotides, #rev, #sdir, #set_will_we_use_colours, #sfancy, #sfile, #simp, #swarn, #use_colours?, #use_colours_within_the_bioroebe_namespace?
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ WwwFinder
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 87
def initialize(
commandline_arguments = nil,
run_already = true
)
determine_the_GUI_to_be_used(commandline_arguments)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
400
401
402
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 400
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::WwwFinder.run
#
407
408
409
410
411
412
413
414
415
416
417
418
419
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 407
def self.run(
i = ARGV
)
r = ::Gtk.runner_factory(
::Bioroebe::GUI::Gtk::WwwFinder.new(i)
)
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
return r
end
|
Instance Method Details
#border_size? ⇒ Boolean
183
184
185
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 183
def border_size?
2
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 378
def connect_the_skeleton
abort_on_exception
window = runner_widget(nil, width?, height?, title?)
window << @frame
::UniversalWidgets.set_main_window(window)
upon_delete_event_quit_the_application
window.use_this_font = font?
window.show_all
window.set_size_request(width?, height?)
window.set_default_size(width?, height?)
window.set_padding(padding?)
window.set_border_size(border_size?)
window.top_left
run_main
end
|
230
231
232
233
234
235
236
237
238
239
240
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
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 230
def create_the_buttons
@button_quit = coloured_quit_button(colour: 'honeydew')
@button_search_dbget = coloured_button('_DBGET_ivory')
@button_search_dbget.on_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.on_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.on_clicked { |w|
e rev+'Searching ncbi for: '+sfancy(@entry_ncbi.text)
open_in_browser target_for(:ncbi)
}
@button_search_ncbi.hint_URL_FOR_NCBI.delete('"')
@button_search_nih = coloured_button('_NIHSearch_lightblue')
@button_search_nih.on_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_the_check_boxes ⇒ Object
#
create_the_check_boxes
Creates the check boxes. On startup, we synchronize this.
#
131
132
133
134
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 131
def create_the_check_boxes
@checkbox_synchronize = check_button('Synchronize On', false)
@checkbox_synchronize.set_active(true)
end
|
#create_the_entries ⇒ Object
#
create_the_entries
entries tag.
#
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 141
def create_the_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.
#
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 331
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_the_primary_vbox ⇒ Object
#
create_the_primary_vbox
#
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 308
def create_the_primary_vbox
@frame = create_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 = create_frame(@v_box) end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
353
354
355
356
357
358
359
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 353
def create_the_skeleton
create_the_entries
create_the_check_boxes
create_the_buttons
create_the_primary_vbox
end
|
#favicon? ⇒ Boolean
371
372
373
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 371
def favicon?
:tabble
end
|
#focus_entry(which_entry) ⇒ Object
#
focus_entry
This helps you to focus an entry.
#
218
219
220
221
222
223
224
225
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 218
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
|
#handle_CSS_rules ⇒ Object
Also known as:
handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
204
205
206
207
208
209
210
211
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 204
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
add_these_custom_CSS_rules '
'
apply_the_CSS_rules
end
|
#main_font? ⇒ Boolean
190
191
192
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 190
def main_font?
USE_THIS_FONT
end
|
#padding? ⇒ Boolean
176
177
178
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 176
def padding?
8
end
|
#reset ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 102
def reset
super() if respond_to?(:super)
reset_the_internal_variables
reset_the_base_module infer_the_namespace
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
handle_CSS if use_gtk3?
@button_quit = ''
@v_box = create_vbox
end
|
#run ⇒ Object
364
365
366
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 364
def run
run_super
end
|
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
197
198
199
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 197
def slightly_smaller_font?
USE_THIS_SLIGHTLY_SMALLER_FONT
end
|
#target_for(i) ⇒ Object
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
# File 'lib/bioroebe/gui/universal_widgets/www_finder/www_finder.rb', line 280
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
|