Class: Bioroebe::GUI::Gtk::LevenstheinDistance

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

Overview

Bioroebe::GUI::Gtk::LevenstheinDistance

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Constants included from LevenstheinDistanceModule

LevenstheinDistanceModule::HEIGHT, LevenstheinDistanceModule::INPUT_HINT, LevenstheinDistanceModule::TEXT_COMPARE_THE_TWO_SEQUENCES, LevenstheinDistanceModule::TITLE, LevenstheinDistanceModule::USE_THIS_AS_BACKGROUND_COLOUR_FOR_THE_WIDGET, LevenstheinDistanceModule::USE_THIS_FONT, LevenstheinDistanceModule::USE_THIS_MONOFONT, LevenstheinDistanceModule::WIDTH

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LevenstheinDistanceModule

#border_size?, #check_for_commandline_arguments, #create_the_buttons, #create_the_entries, #create_the_first_row, #create_the_labels, #create_the_second_row, #create_the_third_row, #do_compare_the_two_strings, #entry1?, #entry2?, #input_field_for_gap_cost?, #instantiate_a_new_levensthein_object, #let_the_fist_entry_respond_to_on_changed_events, #levensthein_object?, #padding?, #return_hbox4, #return_hbox_containing_the_edit_distance, #return_the_edit_distance_label, #return_the_label_for_the_edit_distance, #set_edit_distance, #set_entry1, #set_entry2

Constructor Details

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

#

initialize

#

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 37

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  register_sigint
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  modify_background(
    :normal, USE_THIS_AS_BACKGROUND_COLOUR_FOR_THE_WIDGET
  )
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

Bioroebe::GUI::Gtk::LevenstheinDistance.run

#

159
160
161
162
163
164
165
166
167
168
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 159

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

Instance Method Details

#connect_skeletonObject

#

connect_skeleton (connect tag)

#

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
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 98

def connect_skeleton
  abort_on_exception
  populate_the_grid
  minimal(@grid, 4)
  if levensthein_object?.sequence1?
    unless levensthein_object?.sequence1?.empty?
      @input_for_string1.set_text(levensthein_object?.sequence1?)
    end
  end
  if levensthein_object?.sequence2?
    unless levensthein_object?.sequence2?.empty?
      @input_for_string2.set_text(levensthein_object?.sequence2?)
    end
  end
  minimal(@input_for_string1, 4)
  minimal(@input_for_string2, 4)
  # ======================================================================= #
  # Next below these two input-fields we will add more info:
  # ======================================================================= #
  small_label = return_the_edit_distance_label
  @hbox_with_the_label_for_the_edit_distance = return_hbox_containing_the_edit_distance(
    small_label, @label_for_the_edit_distance
  )
  @hbox4 = return_hbox4(
    @label_for_the_total_score
  )
  minimal(@hbox_with_the_label_for_the_edit_distance, 4)
  minimal(@hbox4, 4)
  button_box = gtk_button_box(
    @button_compare_the_two_strings
  ) { :spread }
  minimal(button_box, 4)
end

#create_skeletonObject

#

create_skeleton (create tag)

#

135
136
137
138
139
140
141
142
143
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 135

def create_skeleton
  create_the_entries
  create_the_labels
  create_the_grid
  create_the_first_row
  create_the_second_row
  create_the_third_row
  create_the_buttons
end

#create_the_gridObject

#

create_the_grid (grid tag)

#

72
73
74
75
76
77
78
79
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 72

def create_the_grid
  # ======================================================================= #
  # === @grid
  # ======================================================================= #
  @grid = gtk_grid
  @grid.set_column_spacing(4)
  @grid.set_row_spacing(4)
end

#populate_the_gridObject

#

populate_the_grid

#

84
85
86
87
88
89
90
91
92
93
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 84

def populate_the_grid
  @grid.left(@text1)
  @grid.right(@input_field_for_matches)
  @grid.new_row
  @grid.left(@text2)
  @grid.right(@input_field_for_mismatches)
  @grid.new_row
  @grid.left(@text3)
  @grid.right(@input_field_for_gap_cost)
end

#resetObject

#

reset (reset tag)

#

56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 56

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

#runObject

#

run (run tag)

#

148
149
150
151
152
153
154
# File 'lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb', line 148

def run
  create_skeleton_then_connect_skeleton
  show_all
  check_for_commandline_arguments
  do_compare_the_two_sequences
  let_the_fist_entry_respond_to_on_changed_events
end