Class: Bioroebe::GUI::UniversalWidgets::ShowCodonTable
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::ShowCodonTable
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb
Overview
Bioroebe::GUI::UniversalWidgets::ShowCodonTable
Constant Summary collapse
- TITLE =
#
TITLE
Specify which title to use for this widget.
#
'Show Codon Table'
- WIDTH =
#
WIDTH
#
'75% or 2000px minimum'
- HEIGHT =
#
HEIGHT
#
'55% or 500px minimum'
- FONT_LARGE =
#
FONT_LARGE
#
'Calibri 32'
- 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
- USE_THIS_MONOFONT =
MONOSPACED_FONT
- SMALLER_FONT =
#
SMALLER_FONT
#
:hack_16
- USE_THIS_SLIGHTLY_SMALLER_FONT =
#
USE_THIS_SLIGHTLY_SMALLER_FONT
#
:hack_16
- HEADER_TO_USE_FOR_THE_TREE_VIEW =
#
HEADER_TO_USE_FOR_THE_TREE_VIEW
#
[ 'Local Path', 'File size', 'n nucleotides', '%GC' ]
Constants included from Bioroebe::GUI
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, Bioroebe::GUI::USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
Constants included from ColoursForBase
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Class Method Summary collapse
-
.[](i = ARGV) ⇒ Object
# === Bioroebe::GUI::UniversalWidgets::ShowCodonTable[] ========================================================================= #.
-
.run(i = ARGV) ⇒ Object
# === Bioroebe::GUI::Gtk::ShowCodonTable.run ========================================================================= #.
Instance Method Summary collapse
-
#A ⇒ Object
# === A ========================================================================= #.
-
#active_text? ⇒ Boolean
(also: #selected?)
# === active_text? ========================================================================= #.
-
#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_the_skeleton ⇒ Object
# === connect_the_skeleton (connect tag, skeleton 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_skeleton ⇒ Object
# === create_the_skeleton (create tag, skeleton tag) ========================================================================= #.
-
#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_rules ⇒ Object
(also: #handle_CSS)
# === handle_CSS_rules (CSS tag, css tag) ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ ShowCodonTable
constructor
# === initialize ========================================================================= #.
-
#main_font? ⇒ Boolean
# === main_font? ========================================================================= #.
-
#padding? ⇒ Boolean
# === padding? ========================================================================= #.
-
#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) ========================================================================= #.
-
#slightly_smaller_font? ⇒ Boolean
# === slightly_smaller_font? ========================================================================= #.
-
#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 Bioroebe::GUI
#disable_warnings, #enable_warnings, #log_dir?
Methods included from CommandlineArguments
#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
Methods included from ColoursForBase
#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) ⇒ ShowCodonTable
#
initialize
#
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 88 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
#
Bioroebe::GUI::UniversalWidgets::ShowCodonTable[]
#
789 790 791 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 789 def self.[](i = ARGV) new(i) end |
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::ShowCodonTable.run
#
796 797 798 799 800 801 802 803 804 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 796 def self.run( i = ARGV ) r = ::Gtk.runner_factory( ::Bioroebe::GUI::Gtk::ShowCodonTable.new(i) ) r.background_colour(:white) return r end |
Instance Method Details
#A ⇒ Object
#
A
#
318 319 320 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 318 def A label('A') end |
#active_text? ⇒ Boolean Also known as: selected?
#
active_text?
#
311 312 313 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 311 def active_text? @combo_box_containing_the_registered_codon_tables.selected?.to_s end |
#attach_all_proper_values_to_the_main_table ⇒ Object
#
attach_all_proper_values_to_the_main_table
#
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 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 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 138 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
#
346 347 348 349 350 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 346 def bold_A _ = A().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_C ⇒ Object
#
bold_C
#
364 365 366 367 368 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 364 def bold_C _ = C().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_G ⇒ Object
#
bold_G
#
373 374 375 376 377 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 373 def bold_G _ = G().set_name('bold_royalblue') _.make_selectable return _ end |
#bold_T ⇒ Object
#
bold_T
#
355 356 357 358 359 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 355 def bold_T _ = T().set_name('bold_royalblue') _.make_selectable return _ end |
#border_size? ⇒ Boolean
#
border_size?
#
405 406 407 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 405 def border_size? 2 end |
#C ⇒ Object
#
C
#
325 326 327 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 325 def C label('C') end |
#change_label(i) ⇒ Object
#
change_label
#
492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 492 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
#
622 623 624 625 626 627 628 629 630 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 622 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_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 751 def connect_the_skeleton abort_on_exception # ======================================================================= # # The left vbox will contain the scrolled-window. # ======================================================================= # left_vbox = create_vbox left_vbox.minimal(@scrolled_window) right_vbox = create_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?, _ ) window = (nil, width?, height?, title?) window << main_box ::UniversalWidgets.set_main_window(window) upon_delete_event_quit_the_application clear_the_main_hash_before_syncing_the_dataset_onto_the_main_table window.use_this_font = font? window.show_all window.set_padding(padding?) window.set_border_size(border_size?) window.set_size_request(width?, height?) window.set_default_size(width?, height?) window.top_left run_main end |
#create_the_box_containing_the_label_and_the_combobox ⇒ Object
#
create_the_box_containing_the_label_and_the_combobox
#
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 635 def create_the_box_containing_the_label_and_the_combobox # ======================================================================= # # === @label_and_combo_box # ======================================================================= # @label_and_combo_box = create_vbox @label_and_combo_box.minimal( left_aligned_label( ' Select the codon table (default: <b>eukaryotes</b>)' ), 8 ) @label_and_combo_box.make_selectable hbox = create_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.
#
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 414 def create_the_combo_box_containing_the_available_codon_tables @combo_box_containing_the_registered_codon_tables = combo_box_text @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)
#
474 475 476 477 478 479 480 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 474 def create_the_main_table @table = create_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
#
524 525 526 527 528 529 530 531 532 533 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 524 def create_the_scrolled_window_then_add_the_table_into_it # ======================================================================= # # === @scrolled_window # ======================================================================= # @scrolled_window = create_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_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
724 725 726 727 728 729 730 731 732 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 724 def create_the_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_title_bar ⇒ Object
#
create_the_title_bar
This is the “title” bar, the main header, on top of the widget.
#
456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 456 def hbox = create_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
#
570 571 572 573 574 575 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 570 def create_the_top_vbox @top_vbox = create_vbox @top_vbox.add(horizontal_spacer) @top_vbox.add(@title_bar) @top_vbox.add(horizontal_spacer) end |
#determine_the_codon_for_the_last_button ⇒ Object
#
determine_the_codon_for_the_last_button
#
510 511 512 513 514 515 516 517 518 519 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 510 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
#
382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 382 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
#
339 340 341 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 339 def G label('G') end |
#handle_CSS_rules ⇒ Object Also known as: handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
707 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 707 def handle_CSS_rules use_gtk_paradise_project_css_file append_project_css_file add_these_custom_CSS_rules ' tooltip { padding: 25px; border-width: 3px; border-style: dotted; border-color: orange; } ' apply_the_CSS_rules end |
#main_font? ⇒ Boolean
#
main_font?
#
556 557 558 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 556 def main_font? USE_THIS_FONT end |
#padding? ⇒ Boolean
#
padding?
#
398 399 400 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 398 def padding? 2 end |
#reset ⇒ Object
#
reset (reset tag)
#
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 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 103 def reset super() if respond_to?(:super) reset_the_internal_variables reset_the_base_module # This must come after reset_the_internal_variables(). infer_the_namespace # ======================================================================= # # === @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) handle_CSS if use_gtk3? # ======================================================================= # # === @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
#
549 550 551 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 549 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.
#
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 658 def hbox = create_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) } # ======================================================================= # # Next comes the button that will also show '*'. # ======================================================================= # @button4 = ('T') @button4.foreground_colour = :crimson @button4.bblack1 @button4.set_name('custom_tooltip') @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 '<b>*</b>' 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)
#
737 738 739 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 737 def run run_super end |
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
563 564 565 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 563 def slightly_smaller_font? USE_THIS_SLIGHTLY_SMALLER_FONT end |
#smaller_font? ⇒ Boolean
#
smaller_font?
#
744 745 746 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 744 def smaller_font? SMALLER_FONT 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().
#
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 585 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
#
332 333 334 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 332 def T label('T') end |
#top_box? ⇒ Boolean
#
top_box?
#
485 486 487 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 485 def top_box? @top_vbox end |
#uniform_length(i) ⇒ Object
#
uniform_length
#
538 539 540 541 542 543 544 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 538 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).
#
436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/bioroebe/gui/universal_widgets/show_codon_table/show_codon_table.rb', line 436 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 |