Class: Bioroebe::GUI::UniversalWidgets::Sizeseq

Inherits:
UniversalWidgets::Base
  • Object
show all
Includes:
CommandlineArguments, Bioroebe::GUI
Defined in:
lib/bioroebe/gui/universal_widgets/shell/shell.rb,
lib/bioroebe/gui/universal_widgets/sizeseq/sizeseq.rb

Overview

Bioroebe::GUI::UniversalWidgets::Sizeseq

Constant Summary collapse

TITLE =
#

TITLE

Specify which title to use for this small widget.

#
'Sizeseq'
WIDTH =
#

WIDTH

#
'75% or 800px 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
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_16
USE_THIS_SLIGHTLY_SMALLER_FONT =
#

USE_THIS_SLIGHTLY_SMALLER_FONT

#
:hack_16
TEXT_COMPARE_THE_TWO_SEQUENCES =
#

TEXT_COMPARE_THE_TWO_SEQUENCES

#
'_Compare the two sequences'
PADDING_TO_USE =
#

PADDING_TO_USE

#
4

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

Instance Method Summary collapse

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) ⇒ Sizeseq

#

initialize

#


80
81
82
83
84
85
86
87
88
89
90
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 80

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::Sizeseq[]

#


266
267
268
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 266

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

.run(i = ARGV) ⇒ Object

#

Bioroebe::GUI::Gtk::Sizeseq.run

#


273
274
275
276
277
278
279
280
281
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 273

def self.run(
    i = ARGV
  )
  r = ::Gtk.runner_factory(
    ::Bioroebe::GUI::Gtk::Sizeseq.new(i)
  )
  r.modify_background(:normal, :mintcream)
  return r
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


122
123
124
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 122

def border_size?
  2
end

#clear_the_primary_textviewObject

#

clear_the_primary_textview

#


190
191
192
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 190

def clear_the_primary_textview
  @textarea1.clear
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag, skeleton tag)

#


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
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 225

def connect_the_skeleton
  abort_on_exception
  grid1 = create_grid('2x2')
  text1 = text('User input')
  text1.complex_font(FONT_LARGE)
  grid1.left(text1)
  # ======================================================================= #
  # This is the input for the user of the application:
  # ======================================================================= #
  @textview1.on_enter_key_pressed {|event|
    do_evaluate_the_user_input
  }
  small_hbox = create_hbox
  small_hbox.maximal(@textview1)
  button1 = create_button('_Evaluate', self, :use_mnemonic) {
    :do_evaluate_the_user_input
  }
  small_hbox.minimal(button1)
  grid1.right(small_hbox)
  scrolled_window = create_scrolled_window(@textarea1)
  scrolled_window.width_height(1600, 800)
  grid1.full_row(scrolled_window)
  grid1.width_height(1600, 800)

  window = runner_widget(nil, width?, height?, title?)
  window << grid1
  ::UniversalWidgets.set_main_window(window)
  upon_delete_event_quit_the_application
  window.use_this_font = font?
  window.show_all
  window.set_size_request(width?, height?)
  window.set_default_size(width?, height?)
  window.set_padding(padding?)
  window.set_border_size(border_size?)
  window.top_left
  run_main
end

#create_a_new_bioroebe_shell_instanceObject

#

create_a_new_bioroebe_shell_instance

#


173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 173

def create_a_new_bioroebe_shell_instance
  # ======================================================================= #
  # === @shell
  # ======================================================================= #
  @shell = Bioroebe::Shell.new(ARGV) { :do_not_run_yet }
  @shell.set_runmode(:GUI)
  @shell.extended_disable_colours # We don't need colours in the GUI.
  @shell.run
  # ======================================================================= #
  # === @result_from_the_shell
  # ======================================================================= #
  @result_from_the_shell = nil
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


154
155
156
157
158
159
160
161
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 154

def create_the_skeleton
  @textarea1 = create_textview
  @textarea1.use_this_font = 'Monospace 30'
  @textarea1.width_height(850, 450)
  @textview1 = create_textview
  @textview1.width_height(400, 80)
  @textview1.complex_font(FONT_LARGE)
end

#do_evaluate_the_user_input(i = @textview1.text?) ⇒ Object

#

do_evaluate_the_user_input

#


214
215
216
217
218
219
220
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 214

def do_evaluate_the_user_input(
    i = @textview1.text?
  )
  e 'Evaluating this input now: '+i.to_s
  clear_the_primary_textview
  the_user_has_input_this_command(i)
end

#do_open_a_file(i = main_file?.to_s) ⇒ Object

#

do_open_a_file

#


227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/bioroebe/gui/universal_widgets/sizeseq/sizeseq.rb', line 227

def do_open_a_file(
    i = main_file?.to_s
  )
  create_a_new_file_chooser_dialog(self) {{
    additional_folders: ::Bioroebe.log_dir?,
    start_directory:    ::Bioroebe.log_dir?+'fasta/'
  }}
  _ = ::Gtk.main_file?
  if _ and File.exist?(_)
    set_use_this_file(_)
  end
end

#handle_CSS_rulesObject Also known as: handle_CSS

#

handle_CSS_rules (CSS tag, css tag)

#


143
144
145
146
147
148
149
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 143

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  add_these_custom_CSS_rules '
'
  apply_the_CSS_rules
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


129
130
131
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 129

def main_font?
  USE_THIS_FONT
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


115
116
117
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 115

def padding?
  4
end

#resetObject

#

reset (reset tag)

#


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 95

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?
  create_a_new_bioroebe_shell_instance
end

#return_widget_containing_the_filepathObject

#

return_widget_containing_the_filepath

#


252
253
254
255
256
257
258
259
260
261
# File 'lib/bioroebe/gui/universal_widgets/sizeseq/sizeseq.rb', line 252

def return_widget_containing_the_filepath
  vbox = create_vbox
  vbox << text('Use this file:')
  @entry_use_this_file = create_entry
  @entry_use_this_file.yellow_background
  @entry_use_this_file.center_align
  vbox.minimal(@entry_use_this_file, 1)
  @entry_use_this_file.set_text(@use_this_file)
  return vbox
end

#return_widget_containing_the_top_barObject

#

return_widget_containing_the_top_bar

#


214
215
216
217
218
219
220
221
222
# File 'lib/bioroebe/gui/universal_widgets/sizeseq/sizeseq.rb', line 214

def return_widget_containing_the_top_bar
  _ = default_top_bar
  button_open_file = button('_Open file', self, :use_mnemonics) {
    :do_open_a_file if use_gtk3?
  } 
  button_open_file.bblack1
  _.add(button_open_file)
  return _
end

#runObject

#

run (run tag)

#


166
167
168
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 166

def run
  run_super
end

#set_use_this_file(i) ⇒ Object

#

set_use_this_file

#


243
244
245
246
247
# File 'lib/bioroebe/gui/universal_widgets/sizeseq/sizeseq.rb', line 243

def set_use_this_file(i)
  if File.exist?(i)
    @textview.set_text(File.read(i))
  end
end

#slightly_smaller_font?Boolean

#

slightly_smaller_font?

#

Returns:

  • (Boolean)


136
137
138
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 136

def slightly_smaller_font?
  USE_THIS_SLIGHTLY_SMALLER_FONT
end

#the_user_has_input_this_command(i) ⇒ Object

#

the_user_has_input_this_command

This will be passed into menu.

#


199
200
201
202
203
204
205
206
207
208
209
# File 'lib/bioroebe/gui/universal_widgets/shell/shell.rb', line 199

def the_user_has_input_this_command(i)
  i = i.dup if i.frozen?
  i.rstrip!
  @shell.parse_this_user_input(i)
  @shell.menu
  @shell.append_this_onto_the_history(i)
  @result_from_the_shell = @shell.result?
  if @result_from_the_shell
    @textarea1.set_text(@result_from_the_shell.to_s)
  end
end