Class: Bioroebe::GUI::Gtk::ShowCodonTable
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Bioroebe::GUI::Gtk::ShowCodonTable
- Includes:
- ShowCodonTableModule, Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/show_codon_table/misc.rb,
lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb
Overview
Bioroebe::GUI::Gtk::ShowCodonTable
Constant Summary collapse
- NAMESPACE =
#
NAMESPACE
#
inspect
- USE_THIS_FONT =
#
USE_THIS_FONT
We need a mono-spaced font here; Source Code Pro seems fine.
#
:hack_18
Constants included from ShowCodonTableModule
ShowCodonTableModule::HEIGHT, ShowCodonTableModule::TITLE, ShowCodonTableModule::WIDTH
Class Method Summary collapse
-
.run(i = ARGV) ⇒ Object
# === Bioroebe::GUI::Gtk::ShowCodonTable.run ========================================================================= #.
Instance Method Summary collapse
-
#A ⇒ Object
# === A ========================================================================= #.
-
#attach_all_proper_values_to_the_main_table ⇒ Object
# === attach_all_proper_values_to_the_main_table ========================================================================= #.
-
#bold_A ⇒ Object
# === bold_A ========================================================================= #.
-
#bold_C ⇒ Object
# === bold_C ========================================================================= #.
-
#bold_G ⇒ Object
# === bold_G ========================================================================= #.
-
#bold_T ⇒ Object
# === bold_T ========================================================================= #.
-
#border_size? ⇒ Boolean
# === border_size? ========================================================================= #.
-
#C ⇒ Object
# === C ========================================================================= #.
-
#change_label(i) ⇒ Object
# === change_label ========================================================================= #.
-
#clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table ⇒ Object
# === clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table ========================================================================= #.
-
#connect_skeleton ⇒ Object
# === connect_skeleton (connect tag) ========================================================================= #.
-
#create_skeleton ⇒ Object
# === create_skeleton (create tag) ========================================================================= #.
-
#create_the_box_containing_the_label_and_the_combobox ⇒ Object
# === create_the_box_containing_the_label_and_the_combobox ========================================================================= #.
-
#create_the_combo_box_containing_the_available_codon_tables ⇒ Object
(also: #create_the_combo_box)
# === create_the_combo_box_containing_the_available_codon_tables.
-
#create_the_main_table ⇒ Object
# === create_the_main_table (table tag) ========================================================================= #.
-
#create_the_scrolled_window_then_add_the_table_into_it ⇒ Object
# === create_the_scrolled_window_then_add_the_table_into_it ========================================================================= #.
-
#create_the_title_bar ⇒ Object
# === create_the_title_bar.
-
#create_the_top_vbox ⇒ Object
# === create_the_top_vbox ========================================================================= #.
-
#determine_the_codon_for_the_last_button ⇒ Object
# === determine_the_codon_for_the_last_button ========================================================================= #.
-
#do_populate_the_combo_box ⇒ Object
# === do_populate_the_combo_box ========================================================================= #.
-
#G ⇒ Object
# === G ========================================================================= #.
-
#handle_CSS ⇒ Object
# === handle_CSS ========================================================================= #.
-
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ ShowCodonTable
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_all_codon_tables ⇒ Object
# === return_all_codon_tables ========================================================================= #.
-
#return_widget_containing_the_toggle_buttons ⇒ Object
# === return_widget_containing_the_toggle_buttons.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#smaller_font? ⇒ Boolean
# === smaller_font? ========================================================================= #.
-
#sync_this_dataset_onto_the_main_table(i = @main_hash) ⇒ Object
(also: #sync_the_dataset_onto_the_main_table)
# === sync_this_dataset_onto_the_main_table.
-
#T ⇒ Object
# === T ========================================================================= #.
-
#top_box? ⇒ Boolean
# === top_box? ========================================================================= #.
-
#uniform_length(i) ⇒ Object
# === uniform_length ========================================================================= #.
-
#update_the_main_header ⇒ Object
# === update_the_main_header.
Methods included from ShowCodonTableModule
#active_text?, #padding?, #reset_the_shared_module
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ ShowCodonTable
#
initialize
#
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 31 def initialize( commandline_arguments = ARGV, run_already = true ) super(:vertical) reset set_commandline_arguments( commandline_arguments ) signal_destroy_then_quit set_title(TITLE) if respond_to?(:set_title) run if run_already end |
Class Method Details
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::ShowCodonTable.run
#
390 391 392 393 394 395 396 397 398 399 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 390 def self.run( i = ARGV ) require 'gtk_paradise/run' _ = ::Bioroebe::GUI::Gtk::ShowCodonTable.new(i) r = ::Gtk.run r << _ r.automatic_size_then_automatic_title r.top_left_then_run end |
Instance Method Details
#A ⇒ Object
#
A
#
239 240 241 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 239 def A label('A') end |
#attach_all_proper_values_to_the_main_table ⇒ Object
#
attach_all_proper_values_to_the_main_table
#
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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 123 124 125 126 127 128 129 130 131 132 133 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 160 161 162 163 164 165 166 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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 66 def attach_all_proper_values_to_the_main_table # left_attach, right_attach, top_attach, bottom_attach. @table.attach_defaults(label(''), 0,1, 0, 1) @table.attach_defaults(bold_T(), 1,2, 0, 1) @table.attach_defaults(C().set_name('bold_royalblue'), 2,3, 0, 1) @table.attach_defaults(A().set_name('bold_royalblue'), 3,4, 0, 1) @table.attach_defaults(G().set_name('bold_royalblue'), 4,5, 0, 1) @table.attach_defaults(label(''), 5,6, 0, 1) # ======================================================================= # # === T # ======================================================================= # @table.attach_defaults(bold_T(), 0,1, 1, 2) @table.attach_defaults(@table_hash['TTT'] = label(' '), 1,2, 1, 2) @table.attach_defaults(@table_hash['TCT'] = label(' '), 2,3, 1, 2) @table.attach_defaults(@table_hash['TAT'] = label(' '), 3,4, 1, 2) @table.attach_defaults(@table_hash['TGT'] = label(' '), 4,5, 1, 2) @table.attach_defaults(bold_T(),5,6, 1, 2) # ======================================================================= # # === T # ======================================================================= # @table.attach_defaults(bold_T(), 0,1, 2, 3) @table.attach_defaults(@table_hash['TTC'] = label, 1,2, 2, 3) @table.attach_defaults(@table_hash['TCC'] = label, 2,3, 2, 3) @table.attach_defaults(@table_hash['TAC'] = label, 3,4, 2, 3) @table.attach_defaults(@table_hash['TGC'] = label, 4,5, 2, 3) @table.attach_defaults(bold_C(),5,6, 2, 3) # ======================================================================= # # === T # ======================================================================= # @table.attach_defaults(bold_T(), 0,1, 3, 4) @table.attach_defaults(@table_hash['TTA'] = label, 1,2, 3, 4) @table.attach_defaults(@table_hash['TCA'] = label, 2,3, 3, 4) @table.attach_defaults(@table_hash['TAA'] = label, 3,4, 3, 4) @table.attach_defaults(@table_hash['TGA'] = label, 4,5, 3, 4) @table.attach_defaults(bold_A(), 5,6, 3, 4) # ======================================================================= # # === T # ======================================================================= # @table.attach_defaults(bold_T(), 0,1, 4, 5) @table.attach_defaults(@table_hash['TTG'] = label, 1,2, 4, 5) @table.attach_defaults(@table_hash['TCG'] = label, 2,3, 4, 5) @table.attach_defaults(@table_hash['TAG'] = label, 3,4, 4, 5) @table.attach_defaults(@table_hash['TGG'] = label,4,5, 4, 5) @table.attach_defaults(bold_G(), 5,6, 4, 5) # ======================================================================= # # === C # ======================================================================= # @table.attach_defaults(bold_C(), 0,1, 5, 6) @table.attach_defaults(@table_hash['CTT'] = label, 1,2, 5, 6) @table.attach_defaults(@table_hash['CCT'] = label, 2,3, 5, 6) @table.attach_defaults(@table_hash['CAT'] = label, 3,4, 5, 6) @table.attach_defaults(@table_hash['CGT'] = label,4,5, 5, 6) @table.attach_defaults(bold_T(), 5,6, 5, 6) # ======================================================================= # # === C # ======================================================================= # @table.attach_defaults(bold_C(), 0,1, 6, 7) @table.attach_defaults(@table_hash['CTC'] = label, 1,2, 6, 7) @table.attach_defaults(@table_hash['CCC'] = label, 2,3, 6, 7) @table.attach_defaults(@table_hash['CAC'] = label, 3,4, 6, 7) @table.attach_defaults(@table_hash['CGC'] = label, 4,5, 6, 7) @table.attach_defaults(bold_C(), 5,6, 6, 7) # ======================================================================= # # === C # ======================================================================= # @table.attach_defaults(bold_C(), 0,1, 7, 8) @table.attach_defaults(@table_hash['CTA'] = label, 1,2, 7, 8) @table.attach_defaults(@table_hash['CCA'] = label, 2,3, 7, 8) @table.attach_defaults(@table_hash['CAA'] = label, 3,4, 7, 8) @table.attach_defaults(@table_hash['CGA'] = label, 4,5, 7, 8) @table.attach_defaults(bold_A(), 5,6, 7, 8) # ======================================================================= # # === C # ======================================================================= # @table.attach_defaults(bold_C(), 0,1, 8, 9) @table.attach_defaults(@table_hash['CTG'] = label, 1,2, 8, 9) @table.attach_defaults(@table_hash['CCG'] = label, 2,3, 8, 9) @table.attach_defaults(@table_hash['CAG'] = label, 3,4, 8, 9) @table.attach_defaults(@table_hash['CGG'] = label,4,5, 8, 9) @table.attach_defaults(bold_G(), 5,6, 8, 9) # ======================================================================= # # === A # ======================================================================= # @table.attach_defaults(bold_A(), 0,1, 9, 10) @table.attach_defaults(@table_hash['ATT'] = label, 1,2, 9, 10) @table.attach_defaults(@table_hash['ACT'] = label, 2,3, 9, 10) @table.attach_defaults(@table_hash['AAT'] = label, 3,4, 9, 10) @table.attach_defaults(@table_hash['AGT'] = label, 4,5, 9, 10) @table.attach_defaults(bold_T(), 5,6, 9, 10) # ======================================================================= # # === A # ======================================================================= # @table.attach_defaults(bold_A(), 0,1, 10, 11) @table.attach_defaults(@table_hash['ATC'] = label, 1,2, 10, 11) @table.attach_defaults(@table_hash['ACC'] = label, 2,3, 10, 11) @table.attach_defaults(@table_hash['AAC'] = label, 3,4, 10, 11) @table.attach_defaults(@table_hash['AGC'] = label, 4,5, 10, 11) @table.attach_defaults(bold_C(), 5,6, 10, 11) # ======================================================================= # # === A # ======================================================================= # @table.attach_defaults(bold_A(), 0,1, 11, 12) @table.attach_defaults(@table_hash['ATA'] = label, 1,2, 11, 12) @table.attach_defaults(@table_hash['ACA'] = label, 2,3, 11, 12) @table.attach_defaults(@table_hash['AAA'] = label, 3,4, 11, 12) @table.attach_defaults(@table_hash['AGA'] = label, 4,5, 11, 12) @table.attach_defaults(bold_A(), 5,6, 11, 12) # ======================================================================= # # === A # ======================================================================= # @table.attach_defaults(bold_A(), 0,1, 12, 13) @table.attach_defaults(@table_hash['ATG'] = label, 1,2, 12, 13) @table.attach_defaults(@table_hash['ACG'] = label, 2,3, 12, 13) @table.attach_defaults(@table_hash['AAG'] = label, 3,4, 12, 13) @table.attach_defaults(@table_hash['AGG'] = label,4,5, 12, 13) @table.attach_defaults(bold_G(), 5,6, 12, 13) # ======================================================================= # # === G # ======================================================================= # @table.attach_defaults(bold_G(), 0,1, 13, 14) @table.attach_defaults(@table_hash['GTT'] = label, 1,2, 13, 14) @table.attach_defaults(@table_hash['GCT'] = label, 2,3, 13, 14) @table.attach_defaults(@table_hash['GAT'] = label, 3,4, 13, 14) @table.attach_defaults(@table_hash['GGT'] = label, 4,5, 13, 14) @table.attach_defaults(bold_T(), 5,6, 13, 14) # ======================================================================= # # === G # ======================================================================= # @table.attach_defaults(bold_G(), 0,1, 14, 15) @table.attach_defaults(@table_hash['GTC'] = label, 1,2, 14, 15) @table.attach_defaults(@table_hash['GCC'] = label, 2,3, 14, 15) @table.attach_defaults(@table_hash['GAC'] = label, 3,4, 14, 15) @table.attach_defaults(@table_hash['GGC'] = label,4,5, 14, 15) @table.attach_defaults(bold_C(), 5,6, 14, 15) # ======================================================================= # # === G # ======================================================================= # @table.attach_defaults(bold_G(), 0,1, 15, 16) @table.attach_defaults(@table_hash['GTA'] = label, 1,2, 15, 16) @table.attach_defaults(@table_hash['GCA'] = label, 2,3, 15, 16) @table.attach_defaults(@table_hash['GAA'] = label, 3,4, 15, 16) @table.attach_defaults(@table_hash['GGA'] = label,4,5, 15, 16) @table.attach_defaults(bold_A(), 5,6, 15, 16) # ======================================================================= # # === G # ======================================================================= # @table.attach_defaults(bold_G(), 0,1, 16, 17) @table.attach_defaults(@table_hash['GTG'] = label, 1,2, 16, 17) @table.attach_defaults(@table_hash['GCG'] = label, 2,3, 16, 17) @table.attach_defaults(@table_hash['GAG'] = label, 3,4, 16, 17) @table.attach_defaults(@table_hash['GGG'] = label, 4,5, 16, 17) @table.attach_defaults(bold_G(), 5,6, 16, 17) end |
#bold_A ⇒ Object
#
bold_A
#
267 268 269 270 271 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 267 def bold_A _ = A().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_C ⇒ Object
#
bold_C
#
285 286 287 288 289 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 285 def bold_C _ = C().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_G ⇒ Object
#
bold_G
#
294 295 296 297 298 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 294 def bold_G _ = G().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_T ⇒ Object
#
bold_T
#
276 277 278 279 280 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 276 def bold_T _ = T().set_name('bold_royalblue') _.make_selectable return _ end |
#border_size? ⇒ Boolean
#
border_size?
#
337 338 339 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 337 def border_size? 2 end |
#C ⇒ Object
#
C
#
246 247 248 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 246 def C label('C') end |
#change_label(i) ⇒ Object
#
change_label
#
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 344 def change_label(i) case i.label.to_s when 'A' i.set_text('C') when 'C' i.set_text('T') when 'T' i.set_text('G') when 'G' i.set_text('A') end i.make_bold end |
#clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table ⇒ Object
#
clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table
#
546 547 548 549 550 551 552 553 554 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 546 def clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table _ = active_text?.split(' ').first.to_s if _ and !_.empty? new_dataset = @all_codon_tables[_] @main_hash.clear @main_hash.merge!(new_dataset) sync_the_dataset_onto_the_main_table end end |
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 125 def connect_skeleton abort_on_exception # ======================================================================= # # The left vbox will contain the scrolled-window. # ======================================================================= # left_vbox = gtk_vbox left_vbox.minimal(@scrolled_window) right_vbox = gtk_vbox right_vbox.minimal(@label_and_combo_box, 2) right_vbox.minimal(gtk_horizontal_spacer, 2) right_vbox.minimal(, 12) _ = drag_it_left_to_right(left_vbox, right_vbox) _.position = @width / 4.5 main_box = can_be_dragged_up_and_down( top_box?, _ ) minimal(main_box) show_all end |
#create_skeleton ⇒ Object
#
create_skeleton (create tag)
#
149 150 151 152 153 154 155 156 157 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 149 def create_skeleton create_the_combo_box_containing_the_available_codon_tables create_the_box_containing_the_label_and_the_combobox create_the_top_vbox # Must come after create_the_title_bar(). create_the_main_table attach_all_proper_values_to_the_main_table create_the_scrolled_window_then_add_the_table_into_it end |
#create_the_box_containing_the_label_and_the_combobox ⇒ Object
#
create_the_box_containing_the_label_and_the_combobox
#
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 95 def create_the_box_containing_the_label_and_the_combobox # ======================================================================= # # === @label_and_combo_box # ======================================================================= # @label_and_combo_box = gtk_vbox @label_and_combo_box.minimal( left_aligned_label( ' Select the codon table (default: <b>eukaryotes</b>)' ), 8 ) hbox = gtk_hbox hbox.minimal(@combo_box_containing_the_registered_codon_tables, 2) @label_and_combo_box.minimal( hbox, 2 ) end |
#create_the_combo_box_containing_the_available_codon_tables ⇒ Object Also known as: create_the_combo_box
#
create_the_combo_box_containing_the_available_codon_tables
This method will create the main combo-box.
#
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 406 def create_the_combo_box_containing_the_available_codon_tables if use_gtk2? @combo_box_containing_the_registered_codon_tables = gtk_combo_box else @combo_box_containing_the_registered_codon_tables = gtk_combo_box_text end @combo_box_containing_the_registered_codon_tables.bblack1 @combo_box_containing_the_registered_codon_tables.pad4px do_populate_the_combo_box @combo_box_containing_the_registered_codon_tables.first_entry_is_active # ======================================================================= # # React to the combo-box's value changing - must come after the # combo box was populated with data: # ======================================================================= # @combo_box_containing_the_registered_codon_tables.on_changed { clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table update_the_main_header } end |
#create_the_main_table ⇒ Object
#
create_the_main_table (table tag)
#
470 471 472 473 474 475 476 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 470 def create_the_main_table @table = gtk_table(8, 20, true) @table.set_name('table_bblack1') @table.set_column_spacings(5) # And a decent column spacing as well. @table.set_row_spacings(1) # Also use a decent row-spacing. @table.set_border_width(12) # Make the "border" noticable. end |
#create_the_scrolled_window_then_add_the_table_into_it ⇒ Object
#
create_the_scrolled_window_then_add_the_table_into_it
#
376 377 378 379 380 381 382 383 384 385 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 376 def create_the_scrolled_window_then_add_the_table_into_it # ======================================================================= # # === @scrolled_window # ======================================================================= # @scrolled_window = gtk_scrolled_window(@table) { :automatic } @scrolled_window.bblack1 @scrolled_window.pad6px @scrolled_window.set_size_request(240, 780) @scrolled_window.use_this_font = smaller_font? end |
#create_the_title_bar ⇒ Object
#
create_the_title_bar
This is the “title” bar, the main header, on top of the widget.
#
452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 452 def hbox = gtk_hbox # ======================================================================= # # For the following gtk-label, always keep a leading ' '. # ======================================================================= # @label_for_the_title_bar = label( ' Standard (Eukaryote) Codon Table (codon table number: 1)' ) @label_for_the_title_bar.left_align @label_for_the_title_bar.set_name('h1') hbox.minimal(image_starred, 4) hbox.minimal(@label_for_the_title_bar, 4) @title_bar = hbox end |
#create_the_top_vbox ⇒ Object
#
create_the_top_vbox
#
115 116 117 118 119 120 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 115 def create_the_top_vbox @top_vbox = gtk_vbox @top_vbox.add(gtk_horizontal_spacer) @top_vbox.add(@title_bar) @top_vbox.add(gtk_horizontal_spacer) end |
#determine_the_codon_for_the_last_button ⇒ Object
#
determine_the_codon_for_the_last_button
#
362 363 364 365 366 367 368 369 370 371 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 362 def first = @button1.text?.to_s second = @button2.text?.to_s third = @button3.text?.to_s codon = first+second+third if @main_hash.has_key? codon @button4.set_text(@main_hash[codon]) @button4.make_bold end end |
#do_populate_the_combo_box ⇒ Object
#
do_populate_the_combo_box
#
303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 303 def do_populate_the_combo_box # ======================================================================= # # Populate the combo-box with our dataset. # ======================================================================= # array = [] hash = ::Bioroebe.hash_codon_tables? hash.each_pair {|key, value| value = uniform_length(value) array << "#{key} (#{value})" } @combo_box_containing_the_registered_codon_tables.populate_with(array) end |
#G ⇒ Object
#
G
#
260 261 262 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 260 def G label('G') end |
#handle_CSS ⇒ Object
#
handle_CSS
#
537 538 539 540 541 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 537 def handle_CSS use_gtk_paradise_project_css_file use_project_css_file apply_the_CSS end |
#reset ⇒ Object
#
reset (reset tag)
#
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 35 def reset reset_the_internal_variables reset_the_shared_module # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] set_use_this_font(USE_THIS_FONT) handle_CSS infer_the_size_automatically # ======================================================================= # # === @main_hash # # This is the hash that will store the new dataset. # ======================================================================= # @main_hash = {} # ======================================================================= # # === @table_hash # ======================================================================= # @table_hash = {} # ======================================================================= # # === @all_codon_tables # # Use a "pointer" towards all codon tables. # ======================================================================= # @all_codon_tables = return_all_codon_tables end |
#return_all_codon_tables ⇒ Object
#
return_all_codon_tables
#
330 331 332 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 330 def return_all_codon_tables ::Bioroebe.codon_tables end |
#return_widget_containing_the_toggle_buttons ⇒ Object
#
return_widget_containing_the_toggle_buttons
These are the four “toggle” buttons on the right side of the widget.
#
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 50 def hbox = gtk_hbox hbox.pad8px @button1 = ('T') @button1.foreground_colour = :royalblue @button1.bblack1 @button1.on_clicked { change_label(@button1) } @button2 = ('T') @button2.foreground_colour = :royalblue @button2.bblack1 @button2.on_clicked { change_label(@button2) } @button3 = ('T') @button3.foreground_colour = :royalblue @button3.bblack1 @button3.on_clicked { change_label(@button3) } @button4 = ('T') @button4.foreground_colour = :crimson @button4.bblack1 @button4.hint = "\nThis button is special in that it will denote "\ "the current aminoacid. The other three buttons "\ "represent the codon at different positions.\n\n"\ "A '*' indicates a stop-codon.\n" # button4.on_clicked { # change_label(button4) # } bbox = ( @button1, @button2, @button3 ) hbox.minimal(bbox, 2) hbox.minimal((@button4), 10) return hbox end |
#run ⇒ Object
#
run (run tag)
#
162 163 164 165 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb', line 162 def run create_skeleton_then_connect_skeleton clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table end |
#smaller_font? ⇒ Boolean
#
smaller_font?
#
488 489 490 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 488 def smaller_font? :hack_16 end |
#sync_this_dataset_onto_the_main_table(i = @main_hash) ⇒ Object Also known as: sync_the_dataset_onto_the_main_table
#
sync_this_dataset_onto_the_main_table
Note that this method not only syncs the dataset, as such, but it will also change some CSS rules as-is, in particular to enable different colours (red or forestgreen or black). This is made possible thanks to the support via .set_name().
#
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 500 def sync_this_dataset_onto_the_main_table( i = @main_hash ) i.each_pair {|key, value| = @table_hash[key] if value = value.to_s # =================================================================== # # Handle key and value separately next: # =================================================================== # case value when '*' # Rewrite '*' to 'STOP'. value = 'STOP' .set_name('red') else .set_name('black') end case key when i['START'] .set_text("#{value}*") .set_name('forestgreen') else # ================================================================= # # .center(4) is necessary because, oddly enough, two codon tables # have no stop codons - or the dataset is wrong. Either way it # makes sense to use 4 here; see the string "STOP" too which # has four characters. # ================================================================= # .set_text(value.center(4)) end end } end |
#T ⇒ Object
#
T
#
253 254 255 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 253 def T label('T') end |
#top_box? ⇒ Boolean
#
top_box?
#
481 482 483 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 481 def top_box? @top_vbox end |
#uniform_length(i) ⇒ Object
#
uniform_length
#
319 320 321 322 323 324 325 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 319 def uniform_length(i) i = i.dup if i.size > 45 i[45 ..-1] = '[...]' end return i end |
#update_the_main_header ⇒ Object
#
update_the_main_header
This method will update the main header (which is on top of the widget).
#
432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/bioroebe/gui/gtk3/show_codon_table/misc.rb', line 432 def update_the_main_header _ = active_text? codon_table_number = 0 if _.include? '(' codon_table_number = _.split('(').first.to_s.strip _ = _.scan(/\((.+)\)/).flatten.first end _ = _.dup if _.size > 45 # Shrink it a bit in this case. _ = _[0 .. 45]+' [...]' end _ << ' Codon Table (codon table number: '+codon_table_number.to_s+')' @label_for_the_title_bar.set_text(_) end |