class RBT::GUI::UniversalWidgets::Notebook

Constants

HASH_DESIGNATED_KEY_COMBINATIONS
#

HASH_DESIGNATED_KEY_COMBINATIONS

#
HEIGHT
#

HEIGHT

#
LARGER_FONT
#

LARGER_FONT

#
SMALLER_FONT
#

SMALLER_FONT

#
TITLE
#

TITLE

#
USE_THESE_CSS_RULES
#

USE_THESE_CSS_RULES

#
USE_THIS_FONT
#

USE_THIS_FONT

#
USE_THIS_MONOSPACED_FONT
#

USE_THIS_MONOSPACED_FONT

#
WIDTH
#

WIDTH

#

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::GUI::UniversalWidgets::Notebook[]

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 483
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method RBT::LeanPrototype::new
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 86
def initialize(
    commandline_arguments       = ARGV,
    run_already                 = true
  )
  super(:vertical) if use_gtk3?
  determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset().
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  on_delete_event_quit_the_application
  run if run_already
end
run( i = ARGV ) click to toggle source
#

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

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 464
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_then_automatic_title
  r.enable_quick_exit
  r.set_background :white
  r.is_resizable # <- This line was added due to a possible prior .maximize action.
  r.top_left_then_run
end

Public Instance Methods

border_size?() click to toggle source
#

border_size?

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 172
def border_size?
  0
end
connect_the_skeleton() click to toggle source
#

connect_the_skeleton (connect tag)

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 375
def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox # A new vbox.

  @notebook = create_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'
  )
  outer_vbox.add(@notebook)

  window = create_window_or_runner
  window << outer_vbox

  properly_prepare_this_window(window,
    {
      title:       title?,
      font:        font?,
      width:       width?,
      height:      height?,
      padding:     padding?,
      border_size: border_size?
    }
  )
  window.show_all
  window.top_left
  do_all_startup_related_actions
  run_main
end
consider_updating_when_this_program_was_compiled(i) click to toggle source
#

consider_updating_when_this_program_was_compiled

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 269
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_the_skeleton() click to toggle source
#

create_the_skeleton (create tag, skeleton tag)

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 357
def create_the_skeleton
  # ======================================================================= #
  # === @notebook
  # ======================================================================= #
  @notebook = create_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/universal_widgets/notebook/notebook.rb, line 242
def do_compile_this_program(
    i = @entry_compile_this_program.text?
  )
  if i and !i.empty?
    _ = ::RBT::Action::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_update_stuff() click to toggle source
#

do_update_stuff

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 180
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
favicon?() click to toggle source
#

favicon?

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 126
def favicon?
  :tabble
end
focus_on_this_tab(i = 2) click to toggle source
#

focus_on_this_tab

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 198
def focus_on_this_tab(i = 2)
  @notebook.focus_on_this_tab(i.to_i)
end
handle_CSS_rules() click to toggle source
#

handle_CSS_rules (CSS tag)

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 140
def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it(USE_THESE_CSS_RULES)
end
padding?() click to toggle source
#

padding?

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

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 103
def reset
  super() if respond_to?(:super)
  reset_the_shared_module # This can come early.
  reset_the_base_module
  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)
  if use_gtk3?
    handle_CSS_rules
  end
  infer_the_size_automatically
end
reset_the_shared_module() click to toggle source
#

reset_the_shared_module

This method can be used for ruby-gtk3 and ruby-libui, among other toolkits.

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 152
def reset_the_shared_module
  # ======================================================================= #
  # === @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/universal_widgets/notebook/notebook.rb, line 221
def return_the_combo_box_containing_all_available_programs
  array = @array_available_programs
  _ = create_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/universal_widgets/notebook/notebook.rb, line 283
def return_widget_containing_statistical_information
  vbox = create_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 = 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/universal_widgets/notebook/notebook.rb, line 446
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/universal_widgets/notebook/notebook.rb, line 368
def run
  run_super
end
Also aliased as: start_gui_application
set_compile_this_program(i) click to toggle source
#

set_compile_this_program

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 235
def set_compile_this_program(i)
  @entry_compile_this_program.set_text(i.to_s)
end
smaller_font?() click to toggle source
#

smaller_font?

#
# File lib/rbt/gui/universal_widgets/notebook/notebook.rb, line 133
def smaller_font?
  SMALLER_FONT
end
start_gui_application()
Alias for: run