Class: RBT::GUI::UniversalWidgets::RecipeMaker

Inherits:
Base show all
Includes:
UniversalWidgets::BaseModule
Defined in:
lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb

Overview

RBT::GUI::UniversalWidgets::RecipeMaker

Constant Summary collapse

USE_THESE_CSS_RULES =
#

USE_THESE_CSS_RULES

#
'
'
TITLE =
#

TITLE

#
'Recipe Maker'
WIDTH =
#

WIDTH

#
'82% or minimum 1280px'
HEIGHT =
#

HEIGHT

#
'40% or minimum 300px'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_20
LARGER_FONT =
#

LARGER_FONT

#
:dejavu_condensed_22
SMALLER_FONT =
#

SMALLER_FONT

#
:dejavu_condensed_18
GUESS_NAME =
#

GUESS_NAME

#
true
DEBUG =
#

DEBUG

#
false
VERSION_RECIPE_MAKER =
#

VERSION_RECIPE_MAKER

#
'1.0.7'
USE_OVERRIDE =
#

USE_OVERRIDE

#
false
AUTHOR_NAME =
#

AUTHOR_NAME

#
RBT.author_name?
DEFAULT_FONT_SIZE =
#

DEFAULT_FONT_SIZE

#
'16'
USE_THIS_MONOSPACED_FONT =
#

USE_THIS_MONOSPACED_FONT

#
:hack_16
ARRAY_WITH_PROGRAM_DIRS =
#

ARRAY_WITH_PROGRAM_DIRS

#
[
  '','RB', 'PHP', 'PYTHON','AUD',
  'VID',
  'EDITORS',
  'GCC',
  'GNOME',
  'IMG',
  'GAMES',
  'KDE'
]
ARRAY_AVAILABLE_PROGRAMS =
#

ARRAY_AVAILABLE_PROGRAMS

#
::RBT.available_programs?

Constants inherited from LeanPrototype

LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cat, #cd_back_to_the_current_working_directory, #consider_reporting_how_many_programs_are_registered, #cookbook_files?, #copy_recursively, #delete_code_of_conduct?, #determine_appdir_prefix_from_this_input, #directory_validation?, #do_not_show_names, #fast_return_file_size_of_this_program, #file_last_symlinked_program?, #file_programs_version_url, #gem_version, #is_a_64bit_system?, #is_ccache_available?, #is_porg_available?, #is_this_binary_registered?, #is_this_program_included?, #make_command?, #make_install_command?, #new_cookbook_instance_for, #program_exists?, #publish_list_of_all_programs_version, #rcp, registered_binaries?, #remove_symlink, #rename_kde_konsole_tab, #repackage, #report_n_programs, #report_working_directory, #return_compile_time_statistics, #return_n_random_characters, #return_version_of_this_program, #run_make_then_make_install, #sanitize_url1_entry, #set_source_directory, #show_overview_over_available_utility_scripts, #symlink_all_files_from_this_directory_to_that_directory, #system_tags?, #upload_list_of_all_programs_version, #use_yaml_database_for_tags?, #warn_and_exit, #wget

Methods inherited from LeanPrototype

#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_options, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #debug?, #directory_expanded_cookbooks?, #disable_colours, #display_md5sum?, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #enable_debug, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #extract_to?, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #is_this_program_included?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #n_programs_available?, #namespace?, #no_directory_exists_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #opnn, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_symlink, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #reset_the_internal_hash, #return_all_archives_from_this_directory, #return_appdir_prefix, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_information, #return_program_name_for_gobolinux_systems, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no

Constructor Details

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

#

initialize

The second argument is the text which can be shown on the compile-button. The default text is ‘Compile’. The reason why this option exists is because we may want to have this widget ‘Install’ rather than ‘Compile’ sometimes.

#


157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 157

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

Class Method Details

.[](i = ARGV) ⇒ Object

#

RBT::GUI::UniversalWidgets::RecipeMaker[]

#


763
764
765
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 763

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

.height?Boolean

#

RBT::GUI::Gtk::RecipeMaker.height?

#

Returns:

  • (Boolean)


69
70
71
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 69

def self.height?
  HEIGHT
end

.run(i = ARGV) ⇒ Object

#

RBT::GUI::Gtk::RecipeMaker.run

#


743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 743

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::RBT::GUI::Gtk::RecipeMaker.new(i)
  r = ::Gtk.run
  _.set_parent_widget(r) # Must come before we enable the key-combinations.
  r << _
  r.add_shortcut(1,  'focus_on_entry', :alt)
  r.add_shortcut(:a, 'focus_on_entry', :alt)
  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

.width?Boolean

#

RBT::GUI::Gtk::RecipeMaker.width?

#

Returns:

  • (Boolean)


76
77
78
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 76

def self.width?
  WIDTH
end

Instance Method Details

#append(i, append_this_string = "\n") ⇒ Object

#

append

This will, by default, append via a newline. See the second argument to this method.

#


406
407
408
409
410
411
412
413
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 406

def append(
    i,
    append_this_string = "\n"
  )
  @text_buffer.append(
    "#{i}#{append_this_string}"
  )
end

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


236
237
238
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 236

def border_size?
  2
end

#colourize_the_bufferObject

#

colourize_the_buffer

This method will colourize the buffer at hand.

#


439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 439

def colourize_the_buffer
  _ = @text_buffer.text?
  @text_buffer.clear
  iter = @text_buffer.start_iter
  _.split(N).each { |line|
    case line
    when /^ last_update:/i
      @text_buffer.insert(iter, line+N,tags: ['bold','tomato'])
    # ===================================================================== #
    # === name:
    # ===================================================================== #
    when /name:$/,
         /^#{program_name?}:$/
      @text_buffer.insert(iter, line+N,tags: ['bold','seagreen'])
    # ===================================================================== #
    # === program_name
    # ===================================================================== #
    when /program_name/
      @text_buffer.insert(iter, line+N,tags: ['bold','darkblue'])
    # ===================================================================== #
    # === description
    # ===================================================================== #
    when /description/
      @text_buffer.insert(iter, line+N,tags: ['bold','darkgreen'])
    # ===================================================================== #
    # === required_deps
    # ===================================================================== #
    when /required_deps/
      @text_buffer.insert(iter, line+N,tags: ['bold','slateblue'])
    # ===================================================================== #
    # === true
    # ===================================================================== #
    when /true/, / t$/
      line.gsub!(/ true/,'')
      line.gsub!(/ t$/,'') if line =~ / t$/
      @text_buffer.insert(iter, line)
      @text_buffer.insert(iter, ' yes'+N, tags: ['bold','red'])
    # ===================================================================== #
    # === false
    # ===================================================================== #
    when /false/, / f$/
      line.gsub!(/ false/,'')
      line.gsub!(/ f$/,'') if line =~ / f$/
      @text_buffer.insert(iter, line)
      @text_buffer.insert(iter, ' no'+N, tags: ['bold','red'])
    else
      @text_buffer.insert(iter, line+N)
    end
  }
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 559

def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox # A new vbox.

  _ = default_top_bar
  _.title = 'Recipe maker - create a new .yml file, a recipe'
  _.css_class('pad0px')
  # ======================================================================= #
  # === Create the open-file-button
  # ======================================================================= #
  @button_open_file = create_button('Open File')
  @button_open_file.bblack1
  @button_open_file.hint = 'Click on this button in order to '\
                           'select a local .cfdg file to open.'
  @button_open_file.on_clicked {
    do_open_a_local_recipe
  }
  _.pack_start(@button_open_file)
  # ======================================================================= #
  # Add the about-dialog next.
  # ======================================================================= #
  button_about_dialog = button('About')
  button_about_dialog.bblack1
  button_about_dialog.on_clicked {
    create_a_new_about_dialog
  }
  _.pack_end(button_about_dialog)
  outer_vbox.minimal(_)
  hbox_for_the_name_of_the_program = create_hbox
  hbox_for_the_name_of_the_program.minimal(
    text('Input the name of the program:', 2)
  )
  @entry_name_of_the_program = entry('htop')
  @entry_name_of_the_program.default_entry
  @entry_name_of_the_program.pad8px
  @entry_name_of_the_program.on_click_select_everything
  @entry_name_of_the_program.width_height(250, 50)
  @entry_name_of_the_program.center
  # @entry_name_of_the_program.set_completion(
  #   ARRAY_AVAILABLE_PROGRAMS
  # ) if @entry_name_of_the_program.respond_to? :set_completion
  @entry_name_of_the_program.do_focus
  @entry_name_of_the_program.on_enter {
    do_assign_data_from_this_program
  }
  hbox_for_the_name_of_the_program.minimal(@entry_name_of_the_program, 2)
  # === button_assign_data_to_the_buffer
  button_assign_data_to_the_buffer = button('_Assign')
  button_assign_data_to_the_buffer.hint = 'Click this button in '\
    'order to assign to the text view below this widget. Note that '\
    'this will only work if that program is registered in the '\
    'RBT project.'
  button_assign_data_to_the_buffer.bblack1
  button_assign_data_to_the_buffer.on_clicked {
    do_assign_data_from_this_program(@entry_name_of_the_program.text?)
  }
  hbox_for_the_name_of_the_program.minimal(button_assign_data_to_the_buffer, 2)
  hbox_for_the_name_of_the_program.minimal(@button_clear, 2)
  hbox_for_the_name_of_the_program.minimal(@button_traditional, 2)
  hbox_for_the_name_of_the_program.minimal(@button_download, 2)
  hbox_for_the_name_of_the_program.minimal(@button_save, 2)

  outer_vbox.minimal(hbox_for_the_name_of_the_program, 4)
  outer_vbox.minimal(@outermost_vbox, 1)

  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

#create_a_new_about_dialogObject

#

create_a_new_about_dialog

This creates our about dialog.

#


510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 510

def create_a_new_about_dialog
  @about_dialog = gtk_about_dialog
  @about_dialog.artists = [ AUTHOR_NAME ]
  @about_dialog.authors = [ AUTHOR_NAME ]
  @about_dialog.comments = 'This Script creates recipe information '\
    'which will be stored in sources.yaml'
  @about_dialog.copyright = 'None'
  @about_dialog.documenters = ['']
  @about_dialog.license = 'This program is licenced under the same license '\
    'as Ruby. There is one additional license part - which simply '\
    'encourages you to send bug reports to '\
    'me so that I can improve the program. ;-)'
  @about_dialog.name = 'Ruby::Gtk::ReciperMaker'
  # @about_dialog.translator_credits = "Here you can insert the credits of the translator.\n"
  @about_dialog.version = VERSION_RECIPE_MAKER
  @about_dialog.website = 'https://rubygems.org/gems/rbt'
  @about_dialog.website_label = 'RBT on rubygems.org'
  _ = ENV['IMG'].to_s+'/STD/UHR.png'
  if File.exist? _
    @about_dialog. = GdkPixbuf::Pixbuf.new(file: _)
  end
  @about_dialog.popup
end

#create_the_buttonsObject

#

create_the_buttons

#


320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 320

def create_the_buttons
  # ======================================================================= #
  # === The traditional button aka prefix: t
  # ======================================================================= #
  @button_traditional = check_button('_Traditional')
  @button_traditional.hint = 'This button can be used to toggle between '\
    'the /usr/ prefix and the corresponding app-dir prefix.'
  @button_traditional.on_toggled { |widget|
    this_program = compile_this_program?
    hash = return_hash_from_sanitize_cookbook(this_program)
    if widget.active?
      hash[:prefix] = '/usr/'
    else
      hash[:prefix] =
        RBT.determine_appdir_prefix_from_this_input_by_guessing_the_program_version(this_program)
    end
    mass_append(hash)
  }
  # ======================================================================= #
  # === The save-button is created next
  # ======================================================================= #
  @button_save = button('_Save')
  @button_save.hint = 'Click this button in order to save the content '\
    'of the text view component, below this widget. This will save '\
    'within the directory <b>'+RBT.log_directory?+'</b>.'
  @button_save.bblack1
  @button_save.on_clicked {
    location = do_save_the_buffer
    pop_up_this_message_over_that_widget(location, @button_save)
  }
  # ======================================================================= #
  # === The clear-button is created next
  # ======================================================================= #
  @button_clear = button('_Clear')
  @button_clear.hint = 'Click this button in '\
    'order to clear the content of the text view component, '\
    'below this widget.'
  @button_clear.bblack1
  @button_clear.on_clicked {
    @entry_name_of_the_program.clear
    main_text_view?.clear
  }
  # ======================================================================= #
  # === The download button comes next
  #
  # This button can be used to quickly download the program at hand.
  # ======================================================================= #
  @button_download = button('_Download' )
  @button_download.hint = 'Click this button in '\
    'order to download the remote URL associated with the '\
    'given program at hand. This only works for programs '\
    'that are registered within the RBT project, though.'
  @button_download.bblack1
  @button_download.on_clicked {
    download_program(RBT.return_url1_of(handle_which_program?))
  }
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


500
501
502
503
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 500

def create_the_skeleton
  create_the_buttons
  create_the_text_buffer
end

#create_the_text_bufferObject

#

create_the_text_buffer

This method will create the textedit stuff.

#


649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 649

def create_the_text_buffer
  @outermost_vbox = create_vbox
  @text_buffer = create_text_buffer
  if use_gtk3?
    require 'gtk_paradise/toplevel_methods/tokenizer_and_text_buffer_tags.rb'
    @text_buffer = ::Gtk::TextBufferTags.create_default_tags(@text_buffer)
  end
  @text_view = create_text_view(@text_buffer)
  # @text_view.it_can_not_be_edited
  @text_view.use_this_font = USE_THIS_MONOSPACED_FONT
  hbox = create_hbox
  _ = return_widget_with_line_numbers {{ n_lines: 40 }}
  _.use_this_font = USE_THIS_MONOSPACED_FONT
  hbox.minimal(_)
  hbox.maximal(@text_view)

  another_scrolled_window = create_scrolled_window(hbox) { :always }
  another_scrolled_window.set_policy(:never, :always)
  another_scrolled_window.bblack3
  another_scrolled_window.width_height(720, 520)
  another_scrolled_window.pad5px
  @outermost_vbox.minimal(another_scrolled_window, 1)
end
#
#


731
732
733
734
735
736
737
738
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 731

def do_all_startup_related_actions
  do_process_the_commandline_arguments
  cd(RBT.log_directory) # Must navigate to a "safe directory".
  Thread.new {
    sleep 0.1
    do_assign_data_from_this_program
  }
end

#do_assign_data_from_this_program(this_program = @entry_name_of_the_program.text?) ⇒ Object Also known as: update_the_main_buffer

#

do_assign_data_from_this_program

#


256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 256

def do_assign_data_from_this_program(
    this_program = @entry_name_of_the_program.text?
  )
  # ======================================================================= #
  # We have to check whether the program is included in RBT or
  # whether it is not.
  # ======================================================================= #
  if ::RBT.is_this_program_included?(this_program)
    mass_append(return_hash_from_sanitize_cookbook(this_program))
  else
    e "The program `#{this_program}` is not included."
  end
end

#do_open_a_local_recipeObject

#

do_open_a_local_recipe (open tag)

#


537
538
539
540
541
542
543
544
545
546
547
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 537

def do_open_a_local_recipe
  create_a_new_file_chooser_dialog(self) {{
    start_dir:              ::RBT.project_base_directory?+'yaml/cookbooks/',
    additional_directories: ::RBT.project_base_directory?+'yaml/cookbooks/'
  }}
  _ = ::Gtk.main_file?
  if _ and File.exist?(_)
    @entry_name_of_the_program.set_text(File.basename(_).delete_suffix('.yml'))
    do_assign_data_from_this_program
  end
end

#do_process_the_commandline_argumentsObject

#

do_process_the_commandline_arguments

For now the first argument given is assumed to be a program.

#


420
421
422
423
424
425
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 420

def do_process_the_commandline_arguments
  _ = commandline_arguments?
  if _ and !_.empty?
    set_handle_this_program(_.first)
  end
end

#do_save_the_buffer(what = main_buffer?.text.to_s) ⇒ Object

#

do_save_the_buffer (save tag)

#


243
244
245
246
247
248
249
250
251
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 243

def do_save_the_buffer(
    what = main_buffer?.text.to_s
  )
  into = RBT.log_directory?+
         main_entry?.text.to_s+'.yml'
  e "Saving into `#{into}`."
  RBT.write_what_into(what, into)
  return into
end

#download_program(url = RBT.return_url1_of(handle_which_program?)) ⇒ Object

#

download_program

This will download a program by using our Download module.

#


391
392
393
394
395
396
397
398
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 391

def download_program(
    url = RBT.return_url1_of(handle_which_program?)
  )
  e "Downloading #{url} next, into the directory at #{sfancy(Dir.pwd)}:"
  Cliner.cliner {
    Wget.download(url)
  }
end

#favicon?Boolean

#

favicon?

#

Returns:

  • (Boolean)


197
198
199
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 197

def favicon?
  :tabble
end

#handle_CSS_rulesObject

#

handle_CSS_rules (CSS tag)

#


211
212
213
214
215
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 211

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it(USE_THESE_CSS_RULES)
end

#main_buffer?Boolean

#

main_buffer?

#

Returns:

  • (Boolean)


430
431
432
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 430

def main_buffer?
  @text_buffer
end

#main_entry?Boolean

#

main_entry?

#

Returns:

  • (Boolean)


273
274
275
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 273

def main_entry?
  @entry_name_of_the_program
end

#main_text_view?Boolean

#

main_text_view?

#

Returns:

  • (Boolean)


493
494
495
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 493

def main_text_view?
  @text_view
end

#mass_append(hash) ⇒ Object

#

mass_append

The first argument to this method must be a Hash that contains all relevant data.

Whenever this method is used, the old text-buffer is cleared.

#


681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 681

def mass_append(hash)
  @text_buffer.clear # Clear the old content first.
  append(hash[:short_name].to_s+':') # This entry is mandatory.
  append(' # blfs:')
  append(' # -')
  unless hash[:binaries].empty?
    append(' binaries:')
    append(' - ')
  end
  append(
    ' # program_name_and_program_version: '+hash[:program_name_and_program_version]
  )
  append(' configure_options: |')
  append('  enable-shared')
  if hash.has_key? :short_description
    append(' short_description: |')
    append('  '+hash[:short_description].to_s)
  end
  append(' description: |')
  append(
    '  '+RBT.word_wrap(hash[:description], 60)
  )
  append(' extra_information: |')
  append('  '+hash[:extra_information].to_s)
  append(' licence: '+hash[:licence].to_s)
  append(' url1: '+hash[:url1].to_s)
  append(' url1: '+hash[:url2].to_s)
  append(' homepage: '+hash[:homepage].to_s)
  append(' git_url: '+hash[:git_url].to_s) if hash[:git_url]
  append(' prefix: '+hash[:prefix].to_s)
  append(' use_autogen: '+hash[:use_autogen].to_s)
  append(' keep_extracted: '+hash[:keep_extracted].to_s)
  append(' use_build_directory: '+hash[:use_build_directory].to_s)
  if hash[:tags] and hash[:tags].is_a? Array
    append(' tags:')
    hash[:tags].each {|inner_entry|
      append('  - '+inner_entry.to_s)
    }
  end
  append(' required_deps_on:')
  hash[:required_deps_on].each {|this_dependency|
    append('  - '+this_dependency)
  }
  append(' last_update: '+hash[:last_update].to_s)
  colourize_the_buffer
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


229
230
231
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 229

def padding?
  0
end

#program_name?Boolean Also known as: compile_this_program?, handle_which_program?

#

program_name?

#

Returns:

  • (Boolean)


381
382
383
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 381

def program_name?
  @entry_name_of_the_program.text?
end

#resetObject

#

reset (reset tag)

#


174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 174

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_moduleObject

#

reset_the_shared_module

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

#


223
224
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 223

def reset_the_shared_module
end

#return_hash_from_sanitize_cookbook(for_this_program = @entry_name_of_the_program.text?) ⇒ Object

#

return_hash_from_sanitize_cookbook

#


288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 288

def return_hash_from_sanitize_cookbook(
    for_this_program = @entry_name_of_the_program.text?
  )
  _ = RBT::Cookbooks::SanitizeCookbook.new(for_this_program)
  binaries = _.binaries?
  hash = {
    short_name: _.short_name?,
    binaries: binaries,
    program_name_and_program_version: _.program_name_and_program_version?,
    short_description: _.short_description?,
    description: _.description?,
    extra_information: _.extra_information?,
    licence: _.licence?,
    url1: _.url1?,
    url2: _.url2?,
    homepage: _.homepage?,
    git_url: _.git_url?,
    prefix: _.prefix?,
    use_autogen: _.use_autogen?,
    keep_extracted: _.keep_extracted?,
    use_build_directory: _.use_build_directory?,
    tags: _.tags?,
    required_deps_on: _.required_deps_on?,
    last_update: _.last_update?
  }
  return hash
end

#runObject

#

run (run tag)

#


552
553
554
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 552

def run
  run_super
end

#set_handle_this_program(i) ⇒ Object

#

set_handle_this_program

#


280
281
282
283
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 280

def set_handle_this_program(i)
  @entry_name_of_the_program.set_text(i)
  update_the_main_buffer
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


204
205
206
# File 'lib/rbt/gui/universal_widgets/recipe_maker/recipe_maker.rb', line 204

def smaller_font?
  SMALLER_FONT
end