Class: Bioroebe::GUI::Tk::BlosumMatrixViewer

Inherits:
Object
  • Object
show all
Includes:
Colours, Tk
Defined in:
lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb

Overview

< Base # === Bioroebe::GUI::Tk::BlosumMatrixViewer

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Blosum Matrix Viewer'
MAIN_FONT =
#

MAIN_FONT

#
TkFont.new(family: 'Helvetica', size: 20, weight: 'bold')
PADDING_TO_USE =
#

PADDING_TO_USE

#
{
  padx: 10,
  pady: 10
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

#

initialize

#

58
59
60
61
62
63
64
65
66
67
# File 'lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 58

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

Bioroebe::GUI::Tk::BlosumMatrixViewer[]

#

132
133
134
# File 'lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 132

def self.[](i = '')
  new(i)
end

Instance Method Details

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)

86
87
88
# File 'lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 86

def commandline_arguments?
  @commandline_arguments
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)

93
94
95
# File 'lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 93

def first_argument?
  @commandline_arguments.first
end

#resetObject

#

reset (reset tag)

#

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

def reset
end

#runObject

#

run (run tag)

#

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
# File 'lib/bioroebe/gui/tk/blosum_matrix_viewer/blosum_matrix_viewer.rb', line 100

def run
  root = TkRoot.new { title TITLE }
  root.geometry('800x500+0+0')

  label = ::TkLabel.new(root) {
    font(MAIN_FONT)
    justify :left
    text 'Blosum Matrix Viewer:'
    pack(side: 'top', padx: 10, pady: 10)
  }

  @variable1 = TkVariable.new
  combo_box = TkCombobox.new(
    root,
    width: 30,
    font:  MAIN_FONT,
    justify: :left,
    textvariable: @variable1,
    background: 'moccasin'
  )
  combo_box.values(
    ::Bioroebe.available_blosum_matrices?
  )
  combo_box.pack
  combo_box.current = 0 # Set the first entry as our default entry for now.

  ::Tk.run
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#

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

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end