class RBT::GUI::LibUI::CompileViaSQLDatabase
Constants
- HEIGHT
#¶ ↑
HEIGHT
¶ ↑#¶ ↑
- TITLE
#¶ ↑
TITLE
¶ ↑#¶ ↑
- WIDTH
#¶ ↑
WIDTH
¶ ↑#¶ ↑
Public Class Methods
Public Instance Methods
compile_object?()
click to toggle source
compile_which_program?()
click to toggle source
create_a_new_compile_object()
click to toggle source
#¶ ↑
create_a_new_compile_object
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 135 def create_a_new_compile_object # ======================================================================= # # === @compile_object # # Create a new compile-object. We will re-use it lateron. # ======================================================================= # @compile_object = RBT::CompileViaSQLDatabase.new(nil, :do_not_run_yet) end
create_skeleton()
click to toggle source
#¶ ↑
create_skeleton
(create tag, skeleton tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 56 def create_skeleton # ======================================================================= # # === @window # ======================================================================= # @window = padded_main_window(title?, width?, height?, 0) create_the_labels create_the_entries create_the_buttons create_the_grid end
create_the_entries()
click to toggle source
#¶ ↑
create_the_entries
(entries tag, entry tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 108 def create_the_entries # ======================================================================= # # === @entry_target_prefix # ======================================================================= # @entry_target_prefix = entry('/usr/') # ======================================================================= # # === @entry_compile_this_program # ======================================================================= # @entry_compile_this_program = entry @entry_compile_this_program.on_changed {|something| proc { |pointer| evaluate_the_current_input(@entry_compile_this_program, pointer) } } @entry_location_of_the_database = entry end
create_the_grid()
click to toggle source
#¶ ↑
create_the_grid
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 70 def create_the_grid # ======================================================================= # # === @grid # ======================================================================= # @grid = padded_grid end
create_the_labels()
click to toggle source
#¶ ↑
create_the_labels
(labels tag, label tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 262 def create_the_labels # ======================================================================= # # === @label_file_size_of_the_source_archive # ======================================================================= # @label_file_size_of_the_source_archive = text('File size of the source archive: ') end
determine_the_location_of_the_compile_database()
click to toggle source
#¶ ↑
determine_the_location_of_the_compile_database
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 147 def determine_the_location_of_the_compile_database target = @compile_object.database_location?.to_s unless File.directory? File.dirname(target) mkdir(File.dirname(target)) end @entry_location_of_the_database.set_text(target) end
do_compile_this_program( text = compile_which_program? )
click to toggle source
#¶ ↑
do_compile_this_program
(compile tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 172 def do_compile_this_program( text = compile_which_program? ) text = text.dup if text and text.include?('-') text.delete!('-') end require 'rbt/compile_via_sql_database/compile_via_sql_database.rb' @compile_object.set_compile_this_program(text) @compile_object.set_prefix(prefix?) if @compile_object.is_this_program_included? text Thread.new { _ = @compile_object.assumed_local_file_path_for?(text) if File.exist? _ @label_file_size_of_the_source_archive.set_text( 'File size of the source archive: '+ (File.size(_) / 1000).round(2).to_s+' kb' ) end @compile_object.do_the_actual_compilation message_box( text: "Finished compiling `#{text}` into the "\ "prefix #{prefix?}"\ "!\n\n Hopefully everything worked ok-ish." ) } else message_box( text: 'The program `'+text+'` is NOT included. '\ 'Make sure the program is registered in '\ 'the RBT project.' ) end end
do_compile_via_this_program(i)
click to toggle source
#¶ ↑
do_compile_via_this_program
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 217 def do_compile_via_this_program(i) ensure_that_the_prefix_is_not_a_symbol ensure_that_the_prefix_entry_has_a_trailing_forward_slash set_compile_this_program(i) do_compile_this_program end
ensure_that_the_prefix_entry_has_a_trailing_forward_slash()
click to toggle source
#¶ ↑
ensure_that_the_prefix_entry_has_a_trailing_forward_slash
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 227 def ensure_that_the_prefix_entry_has_a_trailing_forward_slash _ = prefix? unless _.end_with? '/' @entry_target_prefix.set_text("#{_}/") end end
ensure_that_the_prefix_is_not_a_symbol()
click to toggle source
#¶ ↑
ensure_that_the_prefix_is_not_a_symbol
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 237 def ensure_that_the_prefix_is_not_a_symbol _ = @entry_target_prefix.text? if _.start_with? ':' _ = _.delete(':') case _ when 'appdir' try_to_compile_this_program = compile_which_program? # =================================================================== # # We must use SQL here to determine the assumed version. # But first we will specify a default. # =================================================================== # assumed_version = '1.0.0' assumed_version = @compile_object.assumed_version_of_this_program?(try_to_compile_this_program) use_this_prefix = RBT.return_appdir_prefix( try_to_compile_this_program+'-'+ assumed_version ) @entry_target_prefix.set_text(use_this_prefix) end end end
evaluate_the_current_input(entry, pointer)
click to toggle source
#¶ ↑
evaluate_the_current_input
¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 97 def evaluate_the_current_input(entry, pointer) text = entry.text? if text and text.end_with?('#') entry.set_text( without_trailing_comment(text) ) do_compile_via_this_program(entry.text?) end end
prefix?()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/libui/compile_via_sql_database/compile_via_sql_database.rb, line 272 def run create_skeleton_then_connect_skeleton create_a_new_compile_object determine_the_location_of_the_compile_database outer_vbox = padded_vbox outer_vbox.add_hsep # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign @grid.left( text('Compile this program → ') ) @grid.right( @entry_compile_this_program ) @grid.right( @button_do_compile_the_program ) @grid.new_row @grid.left(text('The SQL database is kept at the following location:'), :default, :default, 3) @grid.new_row @grid.left(@entry_location_of_the_database, :default, :default, 3) @grid.new_row @grid.left( text('Use this target prefix → ') ) @grid.right(@entry_target_prefix, :default, :default, 2) @grid.new_row @grid.left( @label_file_size_of_the_source_archive ) @grid.new_row @grid.left( text('n registered programs are available in the SQL database → ') ) n_programs_available = compile_object?.n_programs_available? @grid.right( text(n_programs_available.to_s)) outer_vbox.minimal(@grid) outer_vbox.add_hsep outer_vbox.minimal(quit_button) outer_vbox.add_hsep @window.add(outer_vbox) @window.intelligent_exit end