Class: LibuiParadise::Base

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/libui_paradise/base/base.rb

Overview

LibuiParadise::Base

Constant Summary collapse

TITLE =
#

TITLE

#
'Generic Title'

Constants included from BaseModule

LibuiParadise::BaseModule::HEIGHT, LibuiParadise::BaseModule::WIDTH

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

#abort_on_exception, #append_this_array_to_that_combobox, #area, #assumed_height?, #assumed_width?, #bold_button, #bold_label, #bold_text_left_aligned, #button, #chdir, #checkbox, #checked_checkbox, #close_properly, #colour_button, #colour_to_rgb, #combobox, #commandline_arguments?, #connect_skeleton, #copy, #copy_file, #create_directory, #create_grid, #create_skeleton_then_connect_skeleton, #create_table, #current_widget_pointer_type?, #delete_file, #do_quit, #editable_combobox, #entry, #error_msg, #esystem, #exit_from, #fancy_text, #font, #font_button, #free_table_model, #gtk3?, #hbox, #height?, #horizontal_separator, #image, #is_on_roebe?, #is_on_windows?, #label, #last_pointer?, #left_arrow?, #main_hash?, #main_then_quit, #menu, #message_box_error, #multiline_entry, #new_brush, #non_wrapping_multiline_entry, #parse_this_file_into_a_table, #password_entry, #quit_button, #radio_buttons, #register_this_fiddle_pointer_widget, #reset_the_internal_hash, #return_button_for_opening_a_local_file, #return_default_window, #return_pwd, #return_the_resolution_using_xrandr, #run_main, #scrolling_area, #search_entry, #selected?, #set_commandline_arguments, #set_height, #set_main_window, #set_title, #set_width, #set_window, #sfancy, #sfile, #slider, #spinbox, #tab, #table, #text?, #text_layout, #title?, #title_width_height, #title_width_height_font, #try_to_parse_this_config_file, #try_to_use_this_font, #two_elements_hbox, #ui_draw_text_layout_params, #ui_font_descriptor, #ui_margined_main_window, #ui_msg_box, #ui_open_file, #ui_padded_grid, #ui_padded_hbox, #ui_padded_vbox, #ui_sync_connect, #ui_table_params_malloc, #ui_text_then_entry, #use_gtk3?, #use_gtk?, #use_libui?, #vbox, #vertical_separator, #width?, #window, #window?, #without_trailing_comment, #wrapper_new_progress_bar

Class Method Details

.[](i = ARGV) ⇒ Object

#

LibuiParadise::Base[]

#


135
136
137
# File 'lib/libui_paradise/base/base.rb', line 135

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

Instance Method Details

#add_these_widgets_to_the_main_window(*i) ⇒ Object Also known as: add_these_widgets

#

add_these_widgets_to_the_main_window

This method can be used to batch-add several widgets into the main window at hand. It has been created in September 2022 to simplify adding widgets from simple scripts. If we can easily add widgets then this will help write smaller GUIs quickly.

For now the main container to be used is a vertical-box here. In theory this could be changed, but for now this is how it is.

#


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/libui_paradise/base/base.rb', line 69

def add_these_widgets_to_the_main_window(*i)
  outer_vbox = padded_vbox
  # ======================================================================= #
  # First add the two buttons on top:
  # ======================================================================= #
  outer_vbox.add_hsep
  i.flatten.each {|this_widget|
    # ===================================================================== #
    # Some symbols exist as special keywords:
    # ===================================================================== #
    case this_widget
    # ===================================================================== #
    # === :create_a_quit_button
    # ===================================================================== #
    when :create_a_quit_button
      this_widget = quit_button
    end
    outer_vbox.minimal(this_widget)
  }
  # ======================================================================= #
  # Next add them to the main-window:
  # ======================================================================= #
  window?.add(outer_vbox)
  if i.size > 0
    Thread.new {
      sleep 5
      require 'save_file'
      SaveFile.write_what_into('YO','/Depot/j/ACK.md')
      exit
    }
  end
  window?.intelligent_exit
end

#create_the_skeletonObject Also known as: create_skeleton

#

create_the_skeleton (create tag, skeleton tag)

#


129
130
# File 'lib/libui_paradise/base/base.rb', line 129

def create_the_skeleton
end

#default_title_width_height(title = TITLE, width = WIDTH, height = HEIGHT) ⇒ Object

#

default_title_width_height

#


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/libui_paradise/base/base.rb', line 45

def default_title_width_height(
    title  = TITLE,
    width  = WIDTH,
    height = HEIGHT
  )
  title_width_height(
    title,
    width,
    height
  )
end

#resetObject

#

reset (reset tag)

#


32
33
34
35
36
37
38
39
40
# File 'lib/libui_paradise/base/base.rb', line 32

def reset
  title_width_height(TITLE, WIDTH, HEIGHT)
  # ======================================================================= #
  # === @window
  # ======================================================================= #
  set_window(
    return_default_window
  )
end

#runObject

#

run (run tag)

#


122
123
124
# File 'lib/libui_paradise/base/base.rb', line 122

def run
  create_skeleton_then_connect_skeleton
end

#run_in_the_backgroundObject

#

run_in_the_background

#


115
116
117
# File 'lib/libui_paradise/base/base.rb', line 115

def run_in_the_background
  Process.daemon
end

#update_the_main_windowObject

#

update_the_main_window

#


106
107
108
109
110
# File 'lib/libui_paradise/base/base.rb', line 106

def update_the_main_window
  set_window(
    return_default_window
  )
end