Class: Bioroebe::GUI::UniversalWidgets::RestrictionEnzymes
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::RestrictionEnzymes
show all
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb
Overview
Constant Summary
collapse
- TITLE =
#
TITLE
Specify which title to use for this small widget.
#
'Restriction Enzymes'
- 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
- FILE_RESTRICTION_ENZYMES =
#
FILE_RESTRICTION_ENZYMES
#
::Bioroebe.restriction_enzymes_file?
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) ⇒ RestrictionEnzymes
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 80
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
370
371
372
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 370
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::RestrictionEnzymes.run
#
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 377
def self.run(
i = ARGV
)
r = ::Gtk.runner_factory(
::Bioroebe::GUI::Gtk::RestrictionEnzymes.new(i)
)
r.modify_background(:normal, :mintcream)
r.set_border_width(4)
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 :whitesmoke
return r
end
|
Instance Method Details
#add_status_message(i) ⇒ Object
303
304
305
306
307
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 303
def add_status_message(i)
@statusbar.set_text(i)
@statusbar.do_markify
return @statusbar
end
|
#border_size? ⇒ Boolean
134
135
136
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 134
def border_size?
2
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 328
def connect_the_skeleton
abort_on_exception
vbox = create_vbox
text1 = selectable_text('<b>'+@yaml.keys.size.to_s+'</b> restriction enzymes '\
'are registered.')
vbox.minimal(text1, 1)
hbox1 = create_hbox
hbox1.minimal(@combo_box, 5)
hbox1.minimal(@entry_selection, 5)
vbox.minimal(hbox1, 1)
vbox.minimal(return_widget_in_the_second_row_starting_with_a_gtk_entry_widget, 1)
vbox.minimal(@statusbar, 1)
add_status_message('')
window = runner_widget(nil, width?, height?, title?)
window << vbox
::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
Thread.new {
sleep 0.0001
@entry_search.do_focus
}
run_main
end
|
#create_status_bar ⇒ Object
197
198
199
200
201
202
203
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 197
def create_status_bar
@statusbar = create_label
@statusbar.align_left
end
|
#create_the_combo_box ⇒ Object
#
create_the_combo_box
rf gtk combobox
#
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 273
def create_the_combo_box
@combo_box = create_combo_box(:strings_only)
@combo_box.bblack1
@combo_box.use_this_font(:hack_21)
@yaml.each {|name_of_the_restriction_enzyme, cuts_at_this_location|
@hash_restriction_enzymes[name_of_the_restriction_enzyme] =
cuts_at_this_location
_ = "#{name_of_the_restriction_enzyme.ljust(10,' ')} → #{cuts_at_this_location}"
@combo_box.append_text(_)
}
@combo_box.on_changed {
if @combo_box.active_iter
_ = @combo_box.active_iter[0]
@entry_selection.set_text(_)
if _.include? '→'
_ = _.split('→').last.strip.split(' ').first.to_s
end
@entry_showing_only_the_sequence_that_is_to_be_cut.set_text(_)
end
}
@combo_box.active = 0
end
|
#create_the_entries ⇒ Object
#
create_the_entries (entries tag, entry tag)
#
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 167
def create_the_entries
@entry_showing_only_the_sequence_that_is_to_be_cut = create_entry
@entry_showing_only_the_sequence_that_is_to_be_cut.width_height(400, 42)
@entry_showing_only_the_sequence_that_is_to_be_cut.clear_background
@entry_showing_only_the_sequence_that_is_to_be_cut.make_bold
@entry_showing_only_the_sequence_that_is_to_be_cut.align_to_the_center
@entry_showing_only_the_sequence_that_is_to_be_cut.bblack2
@entry_showing_only_the_sequence_that_is_to_be_cut.very_light_yellowish_background
@entry_showing_only_the_sequence_that_is_to_be_cut.hint =
'This entry shows at which sequence the selected restriction '\
'enzyme will cut.'
@entry_selection = create_entry
@entry_selection.clear_background
@entry_selection.bblack1
@entry_selection.width_height(540, 42)
@entry_selection.on_button_press_event { |widget, event|
@entry_selection.set_focus(true)
}
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
312
313
314
315
316
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 312
def create_the_skeleton
create_the_entries
create_the_combo_box
create_status_bar
end
|
262
263
264
265
266
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 262
def (
i = 'No restriction enzyme is known with this name.'
)
return_popover(i, @entry_search, 5).
end
|
#handle_CSS_rules ⇒ Object
Also known as:
handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
155
156
157
158
159
160
161
162
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 155
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
add_these_custom_CSS_rules '
'
apply_the_CSS_rules
end
|
#load_yaml_file(i = FILE_RESTRICTION_ENZYMES) ⇒ Object
208
209
210
211
212
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 208
def load_yaml_file(
i = FILE_RESTRICTION_ENZYMES
)
@yaml = YAML.load_file(i)
end
|
#main_font? ⇒ Boolean
141
142
143
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 141
def main_font?
USE_THIS_FONT
end
|
#padding? ⇒ Boolean
127
128
129
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 127
def padding?
8
end
|
#reset ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 95
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?
@hash_restriction_enzymes = {}
_ = FILE_RESTRICTION_ENZYMES
if File.exist? _
load_yaml_file
else
e "No file at #{_} was found."
end
end
|
#return_widget_in_the_second_row_starting_with_a_gtk_entry_widget ⇒ Object
#
return_widget_in_the_second_row_starting_with_a_gtk_entry_widget
#
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 217
def return_widget_in_the_second_row_starting_with_a_gtk_entry_widget
hbox = create_hbox
@entry_search = create_search_entry
@entry_search.clear_background
@entry_search.bblack1
@entry_search.on_enter {
try_to_pick_this_restriction_enzyme(@entry_search.text?)
}
hbox.minimal(@entry_search, 5)
hbox.minimal(@entry_showing_only_the_sequence_that_is_to_be_cut, 5)
return hbox
end
|
#run ⇒ Object
321
322
323
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 321
def run
run_super
end
|
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
148
149
150
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 148
def slightly_smaller_font?
USE_THIS_SLIGHTLY_SMALLER_FONT
end
|
#try_to_pick_this_restriction_enzyme(i = @entry_search.text?) ⇒ Object
#
try_to_pick_this_restriction_enzyme
#
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
# File 'lib/bioroebe/gui/universal_widgets/restriction_enzymes/restriction_enzymes.rb', line 236
def try_to_pick_this_restriction_enzyme(
i = @entry_search.text?
)
i.strip!
if @hash_restriction_enzymes.has_key? i
use_this_index = @hash_restriction_enzymes.find_index {|key, value | key == i }
@combo_box.set_active(use_this_index)
else
(
'No restriction enzyme is known with this '\
'name: `<span weight="600" foreground="#de6b57">'+i.to_s+'</span>`'
)
end
end
|