class RBT::GUI::Gtk::Notebook

Constants

HASH_DESIGNATED_KEY_COMBINATIONS
#

HASH_DESIGNATED_KEY_COMBINATIONS

#
HEIGHT
#

HEIGHT

#
TITLE
#

TITLE

#
USE_THIS_FONT
#

USE_THIS_FONT

#
WIDTH
#

WIDTH

#

Public Class Methods

new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 61
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end
run( i = ARGV ) click to toggle source
#

RBT::GUI::Gtk::Notebook.run

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 331
def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::RBT::GUI::Gtk::Notebook.new(i)
  r = ::Gtk.run { :add_a_new_accel_group }
  r << _
  _.set_parent_widget(r)
  _.enable_these_key_combinations(HASH_DESIGNATED_KEY_COMBINATIONS)
  r.automatic_size
  r.automatic_title
  r.top_left_then_run
end

Public Instance Methods

border_size?() click to toggle source
#

border_size?

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 105
def border_size?
  0
end
connect_skeleton() click to toggle source
#

connect_skeleton (connect tag)

#
# File lib/rbt/gui/gtk/notebook/connect_skeleton.rb, line 18
def connect_skeleton
  abort_on_exception
  @notebook = gtk_notebook(:useful_defaults)
  @notebook.append_this_widget(
    return_widget_containing_compile_related_components,
    'Compile a program'
  )
  @notebook.append_this_widget(
    RBT::GUI::Gtk::CompileProgram.new,
    'Compile a program (advanced widget)'
  )
  @notebook.append_this_widget(
    return_widget_containing_package_related_components,
    'Create or install packages'
  )
  @notebook.append_this_widget(
    return_widget_containing_recipe_related_components,
    'Create a new recipe'
  )
  # ======================================================================= #
  # The VTE does not work very well. We may have to
  # find a solution to this; perhaps just a custom
  # non-vte shell or something.
  #
  #   @notebook.append_this_widget(
  #     return_widget_containing_vte,
  #     'VTE'
  #   )
  # ======================================================================= #
  @notebook.append_this_widget(
    return_widget_containing_statistical_information,
    'Statistics'
  )
  add(@notebook)
end
consider_updating_when_this_program_was_compiled(i) click to toggle source
#

consider_updating_when_this_program_was_compiled

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 218
def consider_updating_when_this_program_was_compiled(i)
  if RBT.is_this_program_registered?(i)
    @text_status.set_text(
      'Finished compiling <b>'+i.to_s+
      '</b> at '+Time.now.to_s+'.'
    )
    @text_status.do_markify
  end
end
create_skeleton() click to toggle source
#

create_skeleton (create tag)

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 119
def create_skeleton
  # ======================================================================= #
  # === @notebook
  # ======================================================================= #
  @notebook = notebook
  @notebook.allow_scrolling
end
do_compile_the_program( i = @entry_compile_this_program.text? )
do_compile_this_program( i = @entry_compile_this_program.text? ) click to toggle source
#

do_compile_this_program

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 191
def do_compile_this_program(
    i = @entry_compile_this_program.text?
  )
  if i and !i.empty?
    _ = ::RBT::Installer.new(i) { :do_not_run_yet }
    _.set_prefix(
      @entry_prefix_to_use.text?
    )
    @entry_program_path.set_text(
      _.returned_the_assumed_program_path.to_s
    )
    _.determine_which_programs_to_compile
    _.do_extract_the_archive
    _.initialize_a_new_cookbook_instance
    _.determine_the_program_path
    Dir.chdir(_.base_dir?) if File.directory?(_.base_dir?)
    text = RBT.infer_build_system.to_s
    @entry_inferred_build_type.set_text(text)
    # Thread.new { # We let the compilation run in a thread.
    _.do_initiate_batch_compilation
    consider_updating_when_this_program_was_compiled(i)
  end
end
Also aliased as: do_compile_the_program, do_compile_the_program
do_update_stuff() click to toggle source
#

do_update_stuff

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 283
def do_update_stuff
  total_size = RBT.return_total_size_of_all_archives
  _n_kilobytes = total_size  / 1024.0
  _n_megabytes = _n_kilobytes / 1024.0
  n_gigabytes = _n_megabytes / 1024.0
  
  @label_total_size_of_all_archives.set_text(
    'All local archives amount to a total size of <b>'+
    n_gigabytes.round(3).to_s+
    ' GB</b>.'
  )
  @label_total_size_of_all_archives.do_markify
  @label_total_size_of_all_archives.left_align
end
focus_on_this_tab(i = 2) click to toggle source
#

focus_on_this_tab

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 112
def focus_on_this_tab(i = 2)
  @notebook.focus_on_this_tab(i.to_i)
end
padding?() click to toggle source
#

padding?

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 98
def padding?
  0
end
reset() click to toggle source
#

reset (reset tag)

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 76
def reset
  reset_the_internal_variables
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  use_gtk_paradise_project_css_file  
  infer_the_size_automatically
  # ======================================================================= #
  # === @array_available_programs
  # ======================================================================= #
  _ = RBT.file_available_programs
  if File.exist? _
    @array_available_programs = YAML.load_file(_)
  end
end
return_the_combo_box_containing_all_available_programs() click to toggle source
#

return_the_combo_box_containing_all_available_programs

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 268
def return_the_combo_box_containing_all_available_programs
  array = @array_available_programs
  _ = gtk_combo_box_text(array[0 ... 751]) { :first_element_is_active }
  _.use_this_font = :hack_15
  _.on_changed {
    set_compile_this_program(_.active_text?.to_s)
  }
  _.bblack1
  return _
end
return_widget_containing_statistical_information() click to toggle source
#

return_widget_containing_statistical_information

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 232
def return_widget_containing_statistical_information
  vbox = gtk_vbox
  vbox.set_border_width(2)
  @label_total_size_of_all_archives = label
  @label_total_size_of_all_archives.make_selectable

  label_n_programs_are_registered = gtk_markified_text(
    "There are a total of <b>#{RBT.available_programs?.size}</b> "\
    "programs available in the RBT project."
  )
  label_n_programs_are_registered.left_align
  label_n_programs_are_registered.make_selectable
  vbox.minimal(label_n_programs_are_registered,   2)
  vbox.minimal(@label_total_size_of_all_archives, 2)
  return vbox
end
return_widget_containing_vte() click to toggle source
#

return_widget_containing_vte

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 323
def return_widget_containing_vte
  require 'gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb'
  return ::Gtk::FlexibleVte.new {{ n_tabs: 3 }}
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 301
def run
  create_skeleton_then_connect_skeleton
  Thread.new {
    sleep 0.5
    do_update_stuff
  }
end
set_compile_this_program(i) click to toggle source
#

set_compile_this_program

#
# File lib/rbt/gui/gtk/notebook/notebook.rb, line 184
def set_compile_this_program(i)
  @entry_compile_this_program.set_text(i.to_s)
end