Class: Bioroebe::GUI::Gtk::Controller
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Bioroebe::GUI::Gtk::Controller
- Includes:
- Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/controller/controller.rb
Overview
Bioroebe::GUI::Gtk::Controller
Constant Summary collapse
- NAMESPACE =
#
NAMESPACE
#
inspect
- TITLE =
#
TITLE
The old title before the rewrite in February 2022 was this String:
'Graphical Interface to the Bioroebe project'
#
'Controller'
- WIDTH =
#
WIDTH
#
'25% or minimum 200px'
- HEIGHT =
#
HEIGHT
#
'15% or minimum 100px'
- USE_THIS_FONT =
#
USE_THIS_FONT
#
:dejavu_condensed_20
- SMALLER_FONT =
#
SMALLER_FONT
#
:dejavu_condensed_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)' }
Class Method Summary collapse
-
.run(i = ARGV) ⇒ Object
# === Bioroebe::GUI::Gtk::Controller.run ========================================================================= #.
Instance Method Summary collapse
-
#batch_require_all_relevant_gtk3_files ⇒ Object
# === batch_require_all_relevant_gtk3_files ========================================================================= #.
-
#border_size? ⇒ Boolean
# === border_size? ========================================================================= #.
-
#connect_skeleton ⇒ Object
# === connect_skeleton (connect tag) ========================================================================= #.
-
#create_skeleton ⇒ Object
# === create_skeleton (create tag, skeleton tag) ========================================================================= #.
-
#create_the_header_bar ⇒ Object
# === create_the_header_bar (header tag, top tag) ========================================================================= #.
-
#create_the_notebook ⇒ Object
# === create_the_notebook (notebook tag) ========================================================================= #.
-
#do_batch_load_all_gtk3_related_ruby_files ⇒ Object
# === do_batch_load_all_gtk3_related_ruby_files.
-
#do_handle_all_CSS_related_aspects ⇒ Object
# === do_handle_all_CSS_related_aspects ========================================================================= #.
-
#focus_on_tab(number = 1) ⇒ Object
(also: #key_pressed)
# === focus_on_tab ========================================================================= #.
-
#header_bar? ⇒ Boolean
# === header_bar? ========================================================================= #.
-
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ Controller
constructor
# === initialize ========================================================================= #.
-
#main_dna_sequence? ⇒ Boolean
(also: #main_DNA_sequence?)
# === main_dna_sequence? ========================================================================= #.
-
#padding? ⇒ Boolean
# === padding? ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#set_aminoacid_sequence(i) ⇒ Object
# === set_aminoacid_sequence ========================================================================= #.
-
#smaller_font? ⇒ Boolean
# === smaller_font? ========================================================================= #.
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ Controller
#
initialize
#
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 81 def initialize( commandline_arguments = ARGV, run_already = true ) super(:vertical) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::Controller.run
#
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 367 def self.run( i = ARGV ) require 'gtk_paradise/app/app.rb' _ = ::Bioroebe::GUI::Gtk::Controller.new(i) r = ::Gtk.run r << _ r.add_accel_group(@accel_group = ::Gtk::AccelGroup.new) _.(r) _.enable_these_key_combinations( HASH_DESIGNATED_KEY_COMBINATIONS ) r.automatic_size_then_automatic_title r.enable_quick_exit r.maximize r.top_left_then_run end |
Instance Method Details
#batch_require_all_relevant_gtk3_files ⇒ Object
#
batch_require_all_relevant_gtk3_files
#
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 207 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
#
border_size?
#
137 138 139 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 137 def border_size? 1 end |
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 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 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 233 def connect_skeleton abort_on_exception # ========================================================================= # # === DnaToAminoacidWidget # ========================================================================= # @dna_to_aminoacid_widget = DnaToAminoacidWidget.new @dna_to_aminoacid_widget.(self) @notebook.add_page('dna-to-aminoacid-widget', vbox(@dna_to_aminoacid_widget)) # ======================================================================= # # === nucleotide-analyser # ======================================================================= # @notebook.add_page('nucleotide-analyser', vbox(@nucleotide_analyser)) # ======================================================================= # # === aminoacid-composition # ======================================================================= # @aminoacid_composition = AminoacidComposition.new @aminoacid_composition.(self) @notebook.add_page('aminoacid-composition', vbox(@aminoacid_composition)) # ======================================================================= # # === protein-to-DNA # ======================================================================= # @protein_to_DNA = ProteinToDNA.new @notebook.add_page('protein-to-DNA', vbox(@protein_to_DNA)) # ======================================================================= # # === dna-to-reverse-complement # ======================================================================= # @notebook.add_page('dna-to-reverse-complement', vbox(DnaToReverseComplementWidget.new)) # ======================================================================= # # === alignment # ======================================================================= # @notebook.add_page('alignment', vbox(Alignment.new)) # ======================================================================= # # === anti-sense-strand # # Not added - it is not sufficiently useful. # ======================================================================= # # ======================================================================= # # === blosum-matrix-viewer # ======================================================================= # @notebook.add_page('blosum-matrix-viewer', vbox(BlosumMatrixViewer.new)) # ======================================================================= # # === calculate_cell_numbers_of_bacteria # # This one is skipped too - end users do not really need it. # ======================================================================= # # ======================================================================= # # === fasta-table-widget # ======================================================================= # @notebook.add_page('fasta-table-widget', vbox(FastaTableWidget.new)) # ======================================================================= # # === format-converter # ======================================================================= # @notebook.add_page('format-converter', vbox(FormatConverter.new)) # ======================================================================= # # === gene # ======================================================================= # @notebook.add_page('gene', vbox(Gene.new)) # ======================================================================= # # === hamming-distance # ======================================================================= # @notebook.add_page('hamming-distance', vbox(HammingDistance.new)) # ======================================================================= # # === levensthein-distance # ======================================================================= # @notebook.add_page('levensthein-distance', vbox(LevenstheinDistance.new)) # ======================================================================= # # === parse-pdb-file # ======================================================================= # @notebook.add_page('parse-pdb-file', vbox(ParsePdbFile.new)) # ======================================================================= # # === primer-design-widget # ======================================================================= # @notebook.add_page('primer-design-widget', vbox(PrimerDesignWidget.new)) # ======================================================================= # # === random-sequence # ======================================================================= # @notebook.add_page('random-sequence', vbox(RandomSequence.new)) # ======================================================================= # # === restriction-enzymes # ======================================================================= # @notebook.add_page('restriction-enzymes', vbox(RestrictionEnzymes.new)) # ======================================================================= # # === show-codon-table # ======================================================================= # @notebook.add_page('show-codon-table', vbox(ShowCodonTable.new)) # ======================================================================= # # === show-codon-usage # ======================================================================= # @notebook.add_page('show-codon-usage', vbox(ShowCodonUsage.new)) # ======================================================================= # # === sizeseq # ======================================================================= # @notebook.add_page('sizeseq', vbox(Sizeseq.new)) # ======================================================================= # # === three-to-one # ======================================================================= # @notebook.add_page('three-to-one', vbox(ThreeToOne.new)) # ======================================================================= # # === www-finder # # This one is currently not in use. Perhaps at some later moment # in time we will add hyperlinks that may be useful, but right # now we will not. # ======================================================================= # draggable_one = draggable_via_up_and_down_movement(, @notebook) maximal(draggable_one) end |
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
144 145 146 147 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 144 def create_skeleton create_the_notebook end |
#create_the_header_bar ⇒ Object
#
create_the_header_bar (header tag, top tag)
#
170 171 172 173 174 175 176 177 178 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 170 def # ======================================================================= # # === @header_bar # ======================================================================= # @header_bar = @header_bar.pad8px _ = selectable_text(' 🐟 Controller 🐟 ') @header_bar.central_element(_) end |
#create_the_notebook ⇒ Object
#
create_the_notebook (notebook tag)
#
152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 152 def create_the_notebook # ======================================================================= # # === @notebook # ======================================================================= # @notebook = gtk_notebook @notebook.enable_popup = 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 |
#do_batch_load_all_gtk3_related_ruby_files ⇒ Object
#
do_batch_load_all_gtk3_related_ruby_files
This method is currently not in use. It was used up until February 2022 to batch-load all ruby-gtk3 related files.
#
193 194 195 196 197 198 199 200 201 202 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 193 def 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' # Exclude self. entry = File.basename(entry).delete_suffix('.rb') load_this_file = "#{base_dir_to_use}#{entry}/#{entry}.rb" require load_this_file } end |
#do_handle_all_CSS_related_aspects ⇒ Object
#
do_handle_all_CSS_related_aspects
#
118 119 120 121 122 123 124 125 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 118 def use_gtk_paradise_project_css_file append_project_CSS_file more_CSS 'notebook header { color: green; border: 2px dotted royalblue; }' end |
#focus_on_tab(number = 1) ⇒ Object Also known as: key_pressed
#
focus_on_tab
#
344 345 346 347 348 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 344 def focus_on_tab( number = 1 ) @notebook.focus_on_tab(number.to_i - 1) end |
#header_bar? ⇒ Boolean
#
header_bar?
#
183 184 185 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 183 def @header_bar end |
#main_dna_sequence? ⇒ Boolean Also known as: main_DNA_sequence?
#
main_dna_sequence?
#
407 408 409 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 407 def main_dna_sequence? @dna_to_aminoacid_widget.dna_sequence? end |
#padding? ⇒ Boolean
#
padding?
#
130 131 132 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 130 def padding? 2 end |
#reset ⇒ Object
#
reset (reset tag)
#
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 96 def reset batch_require_all_relevant_gtk3_files reset_the_internal_variables # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] # ======================================================================= # # === Set the title, width, height and the font in use. # ======================================================================= # title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT) infer_the_size_automatically # ======================================================================= # # === @nucleotide_analyser # ======================================================================= # @nucleotide_analyser = NucleotideAnalyser.new end |
#run ⇒ Object
#
run (run tag)
#
360 361 362 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 360 def run super() end |
#set_aminoacid_sequence(i) ⇒ Object
#
set_aminoacid_sequence
#
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 388 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 # ======================================================================= # # Also update the nucleotide-analyser next: # ======================================================================= # @nucleotide_analyser.set_dna_sequence( main_dna_sequence?.delete(' ') ) end |
#smaller_font? ⇒ Boolean
#
smaller_font?
#
353 354 355 |
# File 'lib/bioroebe/gui/gtk3/controller/controller.rb', line 353 def smaller_font? SMALLER_FONT end |