Class: Bioroebe::GUI::UniversalWidgets::Controller
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::Controller
show all
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/controller/controller.rb
Overview
Constant Summary
collapse
- TITLE =
#
TITLE
Specify which title to use for this small widget.
The old title before the rewrite in February 2022 was this String:
'Graphical Interface to the Bioroebe project'
#
'Controller'
- 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
- HASH_DESIGNATED_KEY_COMBINATIONS =
#
HASH_DESIGNATED_KEY_COMBINATIONS
#
{
'alt+1': 'key_pressed(1)',
'alt+2': 'key_pressed(2)',
'alt+3': 'key_pressed(3)',
'alt+4': 'key_pressed(4)',
'alt+5': 'key_pressed(5)',
'alt+6': 'key_pressed(6)',
'alt+7': 'key_pressed(7)',
'alt+8': 'key_pressed(8)',
'alt+9': 'key_pressed(9)',
'alt+0': 'key_pressed(0)'
}
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) ⇒ Controller
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 94
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
439
440
441
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 439
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::Controller.run
#
446
447
448
449
450
451
452
453
454
455
456
457
458
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 446
def self.run(
i = ARGV
)
_ = ::Bioroebe::GUI::Gtk::Controller.new(i)
r = ::Gtk.runner_factory(_)
r.background_colour :white
r.add_accel_group(@accel_group = ::Gtk::AccelGroup.new)
_.set_parent_widget(r)
_.enable_these_key_combinations(
_::HASH_DESIGNATED_KEY_COMBINATIONS
)
return r
end
|
Instance Method Details
#batch_require_all_relevant_gtk3_files ⇒ Object
#
batch_require_all_relevant_gtk3_files
#
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 249
def batch_require_all_relevant_gtk3_files
require 'bioroebe/gui/gtk3/alignment/alignment.rb'
require 'bioroebe/gui/gtk3/nucleotide_analyser/nucleotide_analyser.rb'
require 'bioroebe/gui/gtk3/aminoacid_composition/aminoacid_composition.rb'
require 'bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb'
require 'bioroebe/gui/gtk3/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb'
require 'bioroebe/gui/gtk3/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget.rb'
require 'bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb'
require 'bioroebe/gui/gtk3/format_converter/format_converter.rb'
require 'bioroebe/gui/gtk3/gene/gene.rb'
require 'bioroebe/gui/gtk3/hamming_distance/hamming_distance.rb'
require 'bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb'
require 'bioroebe/gui/gtk3/parse_pdb_file/parse_pdb_file.rb'
require 'bioroebe/gui/gtk3/primer_design_widget/primer_design_widget.rb'
require 'bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb'
require 'bioroebe/gui/gtk3/random_sequence/random_sequence.rb'
require 'bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb'
require 'bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb'
require 'bioroebe/gui/gtk3/show_codon_usage/show_codon_usage.rb'
require 'bioroebe/gui/gtk3/sizeseq/sizeseq.rb'
require 'bioroebe/gui/gtk3/three_to_one/three_to_one.rb'
end
|
#border_size? ⇒ Boolean
139
140
141
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 139
def border_size?
1
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 313
def connect_the_skeleton
abort_on_exception
@dna_to_aminoacid_widget = DnaToAminoacidWidget.new
@dna_to_aminoacid_widget.set_parent_widget(self)
@notebook.add_page('dna-to-aminoacid-widget', vbox(@dna_to_aminoacid_widget))
@notebook.add_page('nucleotide-analyser', vbox(@nucleotide_analyser))
@aminoacid_composition = AminoacidComposition.new
@aminoacid_composition.set_parent_widget(self)
@notebook.add_page('aminoacid-composition', vbox(@aminoacid_composition))
@protein_to_DNA = ProteinToDNA.new
@notebook.add_page('protein-to-DNA', vbox(@protein_to_DNA))
@notebook.add_page('dna-to-reverse-complement', vbox(DnaToReverseComplementWidget.new))
@notebook.add_page('alignment', vbox(Alignment.new))
@notebook.add_page('blosum-matrix-viewer', vbox(BlosumMatrixViewer.new))
@notebook.add_page('fasta-table-widget', vbox(FastaTableWidget.new))
@notebook.add_page('format-converter', vbox(FormatConverter.new))
@notebook.add_page('gene', vbox(Gene.new))
@notebook.add_page('hamming-distance', vbox(HammingDistance.new))
@notebook.add_page('levensthein-distance', vbox(LevenstheinDistance.new))
@notebook.add_page('parse-pdb-file', vbox(ParsePdbFile.new))
@notebook.add_page('primer-design-widget', vbox(PrimerDesignWidget.new))
@notebook.add_page('random-sequence', vbox(RandomSequence.new))
@notebook.add_page('restriction-enzymes', vbox(RestrictionEnzymes.new))
@notebook.add_page('show-codon-table', vbox(ShowCodonTable.new))
@notebook.add_page('show-codon-usage', vbox(ShowCodonUsage.new))
@notebook.add_page('sizeseq', vbox(Sizeseq.new))
@notebook.add_page('three-to-one', vbox(ThreeToOne.new))
draggable_one = draggable_via_up_and_down_movement(, @notebook)
window = runner_widget(nil, width?, height?, title?)
window << draggable_one
::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
|
275
276
277
278
279
280
281
282
283
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 275
def
@header_bar =
@header_bar.pad8px
_ = selectable_text(' π Controller π ')
@header_bar.central_element(_)
end
|
#create_the_notebook ⇒ Object
#
create_the_notebook (notebook tag)
#
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 288
def create_the_notebook
@notebook = create_notebook
@notebook. = true
@notebook.use_this_font(smaller_font?)
@notebook.set_border_width(5)
@notebook.do_show_border
@notebook.pad8px
@notebook.bblack1
@notebook.is_scrollable
@notebook.position_on_top
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
175
176
177
178
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 175
def create_the_skeleton
create_the_notebook
end
|
#
This method is currently not in use. It was used up until February 2022 to batch-load all ruby-gtk3 related files.
#
235
236
237
238
239
240
241
242
243
244
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 235
def do_batch_load_all_gtk3_related_ruby_files
base_dir_to_use = Bioroebe.project_directory?+'gui/gtk3/'
all_entries = Dir[base_dir_to_use+'*']
all_entries.select {|entry| File.directory? entry }.each {|entry|
next if entry.end_with? 'notebook' entry = File.basename(entry).delete_suffix('.rb')
load_this_file = "#{base_dir_to_use}#{entry}/#{entry}.rb"
require load_this_file
}
end
|
#focus_on_tab(number = 1) ⇒ Object
Also known as:
key_pressed
209
210
211
212
213
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 209
def focus_on_tab(
number = 1
)
@notebook.focus_on_tab(number.to_i - 1)
end
|
#handle_CSS_rules ⇒ Object
Also known as:
handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
160
161
162
163
164
165
166
167
168
169
170
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 160
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
add_these_custom_CSS_rules '
notebook header {
color: green;
border: 2px dotted royalblue;
}
'
apply_the_CSS_rules
end
|
225
226
227
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 225
def
@header_bar
end
|
#main_dna_sequence? ⇒ Boolean
Also known as:
main_DNA_sequence?
202
203
204
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 202
def main_dna_sequence?
@dna_to_aminoacid_widget.dna_sequence?
end
|
#main_font? ⇒ Boolean
146
147
148
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 146
def main_font?
USE_THIS_FONT
end
|
#padding? ⇒ Boolean
132
133
134
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 132
def padding?
2
end
|
#reset ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 109
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?
@nucleotide_analyser = NucleotideAnalyser.new
end
|
#run ⇒ Object
306
307
308
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 306
def run
run_super
end
|
#set_aminoacid_sequence(i) ⇒ Object
#
set_aminoacid_sequence
#
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 183
def set_aminoacid_sequence(i)
i = i.to_s
@aminoacid_sequence = i
@aminoacid_composition.set_main_input_sequence_and_evaluate_it(i)
@protein_to_DNA.set_aminoacid_sequence(i)
if @protein_to_DNA.respond_to? :do_determine_the_DNA_sequence
@protein_to_DNA.do_determine_the_DNA_sequence
end
@nucleotide_analyser.set_dna_sequence(
main_dna_sequence?.delete(' ')
)
end
|
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
153
154
155
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 153
def slightly_smaller_font?
USE_THIS_SLIGHTLY_SMALLER_FONT
end
|
#smaller_font? ⇒ Boolean
218
219
220
|
# File 'lib/bioroebe/gui/universal_widgets/controller/controller.rb', line 218
def smaller_font?
SMALLER_FONT
end
|