Class: Bioroebe::GUI::Gtk::RestrictionEnzymes
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Bioroebe::GUI::Gtk::RestrictionEnzymes
show all
- Includes:
- Bioroebe::GUI, Bioroebe::GUI::Gtk, Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb
Overview
Bioroebe::GUI::Gtk::RestrictionEnzymes
Constant Summary
collapse
- NAMESPACE =
inspect
- TITLE =
'Restriction Enzymes'
- FILE_RESTRICTION_ENZYMES =
#
FILE_RESTRICTION_ENZYMES
#
::Bioroebe.restriction_enzymes_file?
- WIDTH =
940
- HEIGHT =
'20% or minimum 200px'
- USE_THIS_FONT =
:dejavu_condensed_21
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::RestrictionEnzymes.run ========================================================================= #.
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ RestrictionEnzymes
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 65
def initialize(
commandline_arguments = ARGV,
run_already = true
)
super(:vertical)
reset
set_commandline_arguments(
commandline_arguments
)
modify_background(:normal, :white)
run if run_already
end
|
Class Method Details
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::RestrictionEnzymes.run
#
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 287
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Bioroebe::GUI::Gtk::RestrictionEnzymes.new(i)
r = ::Gtk.run
r << _
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
r.infer_the_size
r.top_left_then_run
end
|
Instance Method Details
#add_status_message(i) ⇒ Object
164
165
166
167
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 164
def add_status_message(i)
@statusbar.set_text(i)
@statusbar.do_markify
end
|
#border_size? ⇒ Boolean
116
117
118
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 116
def border_size?
0
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (skeleton tag)
#
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 308
def connect_skeleton
abort_on_exception
text1 = selectable_text('<b>'+@yaml.keys.size.to_s+'</b> restriction enzymes '\
'are registered.')
minimal(text1, 1)
hbox1 = hbox
hbox1.minimal(@combo_box, 5)
hbox1.minimal(@entry_selection, 5)
minimal(hbox1, 1)
minimal(return_widget_in_the_second_row_starting_with_a_gtk_entry_widget, 1)
minimal(@statusbar, 1)
add_status_message('')
end
|
#create_combo_box ⇒ Object
#
create_combo_box
rf gtk combobox
#
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 134
def create_combo_box
@combo_box = gtk_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_entries ⇒ Object
#
create_entries (entries tag, entry tag)
#
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
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 246
def create_entries
@entry_showing_only_the_sequence_that_is_to_be_cut = gtk_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 = gtk_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_skeleton ⇒ Object
#
create_skeleton (create tag)
#
226
227
228
229
230
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 226
def create_skeleton
create_entries
create_combo_box
create_status_bar
end
|
#create_status_bar ⇒ Object
235
236
237
238
239
240
241
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 235
def create_status_bar
@statusbar = gtk_label
@statusbar.align_left
end
|
217
218
219
220
221
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 217
def (
i = 'No restriction enzyme is known with this name.'
)
return_popover(i, @entry_search, 5).
end
|
#load_yaml_file(i = FILE_RESTRICTION_ENZYMES) ⇒ Object
123
124
125
126
127
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 123
def load_yaml_file(
i = FILE_RESTRICTION_ENZYMES
)
@yaml = YAML.load_file(i)
end
|
#padding? ⇒ Boolean
109
110
111
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 109
def padding?
6
end
|
#reset ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 81
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
@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
#
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 172
def return_widget_in_the_second_row_starting_with_a_gtk_entry_widget
hbox = gtk_hbox
@entry_search = gtk_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
276
277
278
279
280
281
282
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 276
def run
super()
Thread.new {
sleep 0.0001
@entry_search.do_focus
}
end
|
#try_to_pick_this_restriction_enzyme(i = @entry_search.text?) ⇒ Object
#
try_to_pick_this_restriction_enzyme
#
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
# File 'lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb', line 191
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
|