Class: Bioroebe::GUI::Gtk::BlosumMatrixViewer

Inherits:
Gtk::Box
  • Object
show all
Includes:
BlosumMatrixViewerModule, Gtk::BaseModule
Defined in:
lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb

Overview

Bioroebe::GUI::Gtk::BlosumMatrixViewer

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Constants included from BlosumMatrixViewerModule

BlosumMatrixViewerModule::HEIGHT, BlosumMatrixViewerModule::TEXT1, BlosumMatrixViewerModule::TITLE, BlosumMatrixViewerModule::USE_THIS_FONT, BlosumMatrixViewerModule::WIDTH

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ BlosumMatrixViewer

#

initialize

#

34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 34

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::BlosumMatrixViewer.run

#

181
182
183
184
185
186
187
188
189
190
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 181

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::Bioroebe::GUI::Gtk::BlosumMatrixViewer.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size_then_automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)

78
79
80
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 78

def border_size?
  2
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 129

def connect_skeleton
  abort_on_exception
  header = gtk_left_aligned_label(TEXT1)
  header.use_this_font = main_font?
  first_row = gtk_hbox
  first_row.minimal(header, 5)
  hbox = gtk_hbox
  hbox.minimal(@combo_box)
  first_row.minimal(hbox, 10)
  minimal(first_row, 1)
  @combo_box.on_changed {
    do_sync_the_combo_box_text_onto_the_text_buffer
  }
  minimal(@scrolled_window)
  do_sync_the_combo_box_text_onto_the_text_buffer
end

#create_skeletonObject

#

create_skeleton (create tag)

#

113
114
115
116
117
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 113

def create_skeleton
  create_the_text_view
  create_the_combo_box
  create_the_scrolled_window
end

#create_the_combo_boxObject

#

create_the_combo_box

#

166
167
168
169
170
171
172
173
174
175
176
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 166

def create_the_combo_box
  # ======================================================================= #
  # === @combo_box
  # ======================================================================= #
  @combo_box = gtk_combo_box(
    Bioroebe.available_blosum_matrices? - ['blosum_matrix']
  )
  @combo_box.clear_background
  @combo_box.bblack2
  @combo_box.css_class('BG_very_light_yellowish')
end

#create_the_scrolled_windowObject

#

create_the_scrolled_window

#

96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 96

def create_the_scrolled_window
  # ======================================================================= #
  # === @scrolled_window
  # ======================================================================= #
  @scrolled_window = gtk_scrolled_window(@text_view) { :top_to_bottom }
  @scrolled_window.remove_background
  @scrolled_window.bblack1
  @scrolled_window.width_height(500, 740)
  @scrolled_window.pad5px
  @scrolled_window.css_class('mar5px')
  @scrolled_window.css_class('darkblue')
  @scrolled_window.use_this_font = :hack_18
end

#create_the_text_viewObject

#

create_the_text_view

#

85
86
87
88
89
90
91
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 85

def create_the_text_view
  @text_buffer = gtk_text_buffer
  # ======================================================================= #
  # === @text_view
  # ======================================================================= #
  @text_view = gtk_text_view(@text_buffer)
end

#do_sync_the_combo_box_text_onto_the_text_bufferObject

#

do_sync_the_combo_box_text_onto_the_text_buffer

#

156
157
158
159
160
161
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 156

def do_sync_the_combo_box_text_onto_the_text_buffer
  _ = @combo_box.text?
  @text_buffer.set_text(
    Bioroebe::BlosumParser.return_as_2D_table(_).tr('','|')
  )
end

#handle_CSS_rulesObject

#

handle_CSS_rules

#

63
64
65
66
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 63

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_CSS_file
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)

122
123
124
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 122

def main_font?
  USE_THIS_FONT
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)

71
72
73
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 71

def padding?
  12
end

#resetObject

#

reset (reset tag)

#

49
50
51
52
53
54
55
56
57
58
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 49

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  handle_CSS_rules
  infer_the_size_automatically
end

#runObject

#

run (run tag)

#

149
150
151
# File 'lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 149

def run
  create_skeleton_then_connect_skeleton
end