Class: Roebe::GUI::UniversalWidgets::ShowAliases

Inherits:
Base
  • Object
show all
Includes:
UniversalWidgets::BaseModule
Defined in:
lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb

Overview

Roebe::GUI::UniversalWidgets::ShowAliases

Constant Summary collapse

TITLE =
#

TITLE

#
'Show Aliases'
WIDTH =
#

WIDTH

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

HEIGHT

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

USE_THIS_FONT

#
:hack_20
LARGER_FONT =
#

LARGER_FONT

#
:hack_24
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_28
TODO_DIRECTORY =
#

TODO_DIRECTORY

#
'/home/x/data/personal/todo/'

Constants inherited from Base

Base::COLOURS, Base::HOME_DIRECTORY_OF_USER_X, Base::N, Base::NAMESPACE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#actions, #append_this_onto_that_file, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #burlywood, #call_next, #chdir, #cheerful_guy, #cliner, #complex_esystem, #convert_global_env, #copy_directory, #copy_file, #cornflowerblue, #create_directory, #crimson, #current_month?, #current_time?, #current_year?, #cyan, #darkcyan, #darkgreen, #darkkhaki, #darkslateblue, #deeppink, #delete_symlink, #do_not_use_the_base_colours, #do_use_the_base_colours, #e, #ecomment, #editor_to_use?, #efancy, #eimp, #emphasis, #ensure_main_encoding, #ensure_utf_encoding, #eparse, #erev, #esteelblue, #etomato, #ewarn, #exit_program, #firebrick, #get_current_day, #get_current_month, #get_files_and_directories, #get_files_from, #get_german_name_for_this_weekday, #gold, #green, #grey, #hh_mm_ss, #hh_mm_ss_day_month_year, #home_dir?, #home_directory_of_user_x?, #infer_the_namespace, #internal_hash?, #is_a_directory?, #is_a_file?, #is_a_jpg_file?, #is_an_image_file?, #is_archive?, #is_audio_file?, #is_in_studium_dir?, #is_multimedia_file?, #is_on_roebe?, #is_on_windows?, #is_studium_available?, #is_symlink?, #is_this_a_ruby_file?, #is_video_file?, #iso_encoding?, #le, #left_colour, #lightblue, #lightgreen, #lightseagreen, #lightsteelblue, #lime, #limegreen, #localhost_to_data, #log_directory?, #main_encoding?, #mediumorchid, #mediumpurple, #mediumseagreen, #mediumslateblue, #mediumspringgreen, #mediumturquoise, #mkdir_p, #mv, #n_days_in_this_month, #n_pages_in_this_pdf_file?, #namespace?, #no_file_exists_at, #ogrey, #olive, #olivedrab, #open_in_browser, #opne, #opnesystem, #opnn, #orange, #orchid, #orev, #palegoldenrod, #palevioletred, #pink, #powderblue, #programs_dir?, #project_base_dir?, #random_html_colour, #rds, #read_file_in_iso_encoding, #read_file_via_the_default_encoding, #read_lines_via_iso_encoding, #readlines_with_main_encoding, #red, #register_sigint, #remove, #remove_directory, #remove_file, #rename_kde_konsole_tab, #replace_localhost_with_data, #report_pwd, #require_rescue, #reset_the_internal_hash, #return_all_directories_from_this_directory, #return_all_files_from_this_directory, #return_current_directory, #return_dd_mm_yyyy, #return_file_or_directory_of, #return_files_from_pwd, #return_last_part_of_the_current_directory, #return_utc, #rev, #right_arrow?, #right_colour, #roebe_log_directory?, #rosybrown, #royalblue, #ruby_base_directory?, #run_in_background, #run_rcfiles_then_run_ata_via_qdbus, #sandybrown, #sdir, #seagreen, #set_be_verbose, #set_xorg_buffer, #sfancy, #sfile, #show_help, #silent_redirection?, #simp, #simple_esystem, #skyblue, #slateblue, #slategray, #springgreen, #steelblue, #string_italic, #swarn, #symlink, #teal, #temp_dir?, #to_camelcase, #to_counted_hash, #tomato, #touch, #try_to_require_the_beautiful_url_gem, #try_to_require_the_html_template, #try_to_require_the_open_gem, #try_to_require_the_program_information_gem, #try_to_require_the_xorg_buffer, #use_colours?, #verbose_truth, #weekday?, #word_wrap, #write_what_into, #yellow

Methods included from Base::CommandlineArguments

#append_onto_the_commandline_arguments, #clear_commandline_arguments, #commandline_arguments?, #commandline_arguments_as_string?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_argument_without_leading_hyphens?, #has_an_argument_been_passed?, #remove_hyphened_arguments_from_the_commandline_arguments, #return_commandline_arguments_with_leading_hyphens, #second_argument?, #set_commandline_arguments

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ ShowAliases

#

initialize

#


72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 72

def initialize(
    commandline_arguments = nil,
    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
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

Roebe::GUI::UniversalWidgets::ShowAliases[]

#


322
323
324
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 322

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

.run(i = ARGV) ⇒ Object

#

Roebe::GUI::Gtk::ShowAliases.run

#


307
308
309
310
311
312
313
314
315
316
317
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 307

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::Roebe::GUI::Gtk::ShowAliases.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size
  r.automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


223
224
225
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 223

def border_size?
  2
end

#button1Object

#

button1

#


190
191
192
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 190

def button1
  @button_update_the_content_for_the_scrolled_window
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 258

def connect_the_skeleton
  abort_on_exception

  hbox1 = create_hbox
  hbox1.minimal(@label_n_aliases,   2)
  hbox1.minimal(button1,            2)

  vbox1 = padded_vbox
  vbox1.minimal(hbox1,              2)
  vbox1.maximal(scrolled_window?,   2)

  window = create_window_or_runner(vbox1, width?, height?, title?)

  properly_prepare_this_window(window,
    {
      title:       title?,
      font:        font?,
      width:       width?,
      height:      height?,
      padding:     padding?,
      border_size: border_size?
    }
  )
  window.show_all
  run_main
end

#create_label_n_aliasesObject

#

create_label_n_aliases

#


288
289
290
291
292
293
294
295
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 288

def create_label_n_aliases
  # ======================================================================= #
  # === @label_n_aliases
  # ======================================================================= #
  _ = '<b>'+@aliases.keys.size.to_s+'</b> aliases'
  @label_n_aliases = create_label(_)
  @label_n_aliases.to_the_left
end

#create_the_button_update_the_content_for_the_scrolled_windowObject

#

create_the_button_update_the_content_for_the_scrolled_window

#


197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 197

def create_the_button_update_the_content_for_the_scrolled_window
  # ======================================================================= #
  # === @button_update_the_content_for_the_scrolled_window
  # ======================================================================= #
  @button_update_the_content_for_the_scrolled_window = button(
    'Update the content for the scrolled window below'
  )
  @button_update_the_content_for_the_scrolled_window.bblack1
  @button_update_the_content_for_the_scrolled_window.hint = 
    'Click on this button to update the scrolled-window content below.'
  @button_update_the_content_for_the_scrolled_window.on_clicked {
    determine_the_content_for_the_main_string_in_use
    do_update_the_content_for_the_scrolled_window
  }
end

#create_the_buttonsObject

#

create_the_buttons (buttons tag, button tag)

#


156
157
158
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 156

def create_the_buttons
  create_the_button_update_the_content_for_the_scrolled_window
end

#create_the_scrolled_windowObject

#

create_the_scrolled_window

#


237
238
239
240
241
242
243
244
245
246
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 237

def create_the_scrolled_window
  # ======================================================================= #
  # === @scrolled_window
  # ======================================================================= #
  @scrolled_window = create_a_scrolled_window(@sourcecode_widget)
  @scrolled_window.bblack1
  @scrolled_window.pad5px
  @scrolled_window.set_size_request(800, 600)
  @scrolled_window.set_font(:hack_22)
end

#create_the_skeletonObject Also known as: create_skeleton

#

create_skeleton (create tag, skeleton tag)

#


127
128
129
130
131
132
133
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 127

def create_the_skeleton
  create_label_n_aliases
  create_the_buttons
  create_the_text_buffer
  create_the_text_view
  create_the_scrolled_window
end

#create_the_text_bufferObject

#

create_the_text_buffer

#


230
231
232
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 230

def create_the_text_buffer
  @text_buffer = Gtk::BaseModuleBox.new.create_text_buffer if use_gtk3?
end

#create_the_text_viewObject

#

create_the_text_view

#


138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 138

def create_the_text_view
  # ======================================================================= #
  # === @sourcecode_widget
  #
  # On gtk this will be Gtk::TextView.
  # ======================================================================= #
  if use_gtk3?
    @sourcecode_widget = Gtk::BaseModuleBox.new.create_text_view(@text_buffer)
    @sourcecode_widget.set_editable(true)
    @sourcecode_widget.use_this_font = main_font?
  else # this variant here is for libui, for instance.
    @sourcecode_widget = create_text_view
  end
end

#determine_the_aliases_in_useObject

#

determine_the_aliases_in_use

#


117
118
119
120
121
122
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 117

def determine_the_aliases_in_use
  # ======================================================================= #
  # === @aliases
  # ======================================================================= #
  @aliases = ::Rcfiles.aliases?
end

#determine_the_content_for_the_main_string_in_useObject

#

determine_the_content_for_the_main_string_in_use

The @text variable will contain the content of the scrolled-window.

#


172
173
174
175
176
177
178
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 172

def determine_the_content_for_the_main_string_in_use
  @text = ''.dup
  @aliases.each_pair {|key, value|
    @text << "#{key}: #{value}\n"
  }
  @text.strip!
end

#do_update_the_content_for_the_scrolled_windowObject

#

do_update_the_content_for_the_scrolled_window (clicked tag)

#


163
164
165
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 163

def do_update_the_content_for_the_scrolled_window
  @sourcecode_widget.set_text(@text)
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


251
252
253
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 251

def main_font?
  :hack_15
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


216
217
218
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 216

def padding?
  0
end

#resetObject

#

reset (reset tag)

#


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 88

def reset
  super() if respond_to?(:super)
  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)
  determine_the_aliases_in_use
  if use_gtk3?
    use_gtk_paradise_project_css_file
  end  
  infer_the_size_automatically
end

#reset_the_shared_moduleObject

#

reset_the_shared_module

#


111
112
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 111

def reset_the_shared_module
end

#runObject

#

run (run tag)

#


300
301
302
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 300

def run
  run_super
end

#scrolled_window?Boolean

#

scrolled_window?

#

Returns:

  • (Boolean)


183
184
185
# File 'lib/roebe/gui/universal_widgets/show_aliases/show_aliases.rb', line 183

def scrolled_window?
  @scrolled_window
end