roebe 0.5.120 → 0.5.121

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of roebe might be problematic. Click here for more details.

Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -34
  3. data/doc/README.gen +56 -33
  4. data/doc/add_ons_for_ruby/fxruby.md +14 -0
  5. data/doc/add_ons_for_ruby/prawn.md +12 -0
  6. data/doc/sinatra_tutorial/sinatra_tutorial.rb +52 -22
  7. data/lib/roebe/base/colours.rb +59 -50
  8. data/lib/roebe/classes/create_file_skeleton/generate_ruby_string.rb +1 -0
  9. data/lib/roebe/classes/current_monitor_resolution.rb +27 -9
  10. data/lib/roebe/classes/do_install.rb +1 -9
  11. data/lib/roebe/classes/done.rb +1 -9
  12. data/lib/roebe/classes/done_and_open.rb +2 -13
  13. data/lib/roebe/classes/email.rb +36 -26
  14. data/lib/roebe/classes/find_out_version_of.rb +1 -5
  15. data/lib/roebe/classes/find_static_libraries.rb +1 -18
  16. data/lib/roebe/classes/fluxbox/generate_fluxbox_apps_file.rb +1 -9
  17. data/lib/roebe/classes/generate_fstab_file/generate_fstab_file.rb +1 -9
  18. data/lib/roebe/classes/generate_master_shell_script.rb +1 -13
  19. data/lib/roebe/classes/generate_system_values.rb +1 -9
  20. data/lib/roebe/classes/get_dependencies.rb +1 -9
  21. data/lib/roebe/classes/good_night.rb +1 -5
  22. data/lib/roebe/classes/google_url_cleaner.rb +1 -9
  23. data/lib/roebe/classes/grant_superuser_rights.rb +0 -5
  24. data/lib/roebe/classes/run/run.rb +130 -105
  25. data/lib/roebe/classes/symlink_files_from_that_directory_to_the_current_directory/symlink_files_from_that_directory_to_the_current_directory.rb +10 -1
  26. data/lib/roebe/classes/time/current_time_in_singapore.rb +1 -5
  27. data/lib/roebe/classes/umlaut_converter.rb +1 -1
  28. data/lib/roebe/classes/use_jruby.rb +68 -0
  29. data/lib/roebe/documentation/prawn.md +0 -11
  30. data/lib/roebe/gui/gtk3/shell/misc.rb +94 -0
  31. data/lib/roebe/gui/gtk3/shell/shell.rb +690 -10
  32. data/lib/roebe/gui/libui/shell/shell.rb +107 -0
  33. data/lib/roebe/gui/shared_code/shell/shell_module.rb +0 -601
  34. data/lib/roebe/pdf/README.md +1 -0
  35. data/lib/roebe/pdf/prawn/all_in_one_showcasing_prawn.rb +160 -0
  36. data/lib/roebe/requires/require_the_run_class.rb +7 -0
  37. data/lib/roebe/shell/shell/class_methods.rb +25 -0
  38. data/lib/roebe/shell/shell/core/browser.rb +4 -1
  39. data/lib/roebe/shell/shell/core/cat.rb +34 -28
  40. data/lib/roebe/shell/shell/core/disable.rb +12 -1
  41. data/lib/roebe/shell/shell/core/esystem.rb +10 -1
  42. data/lib/roebe/shell/shell/core/help.rb +24 -21
  43. data/lib/roebe/shell/shell/core/queries.rb +7 -7
  44. data/lib/roebe/shell/shell/core/set.rb +15 -0
  45. data/lib/roebe/shell/shell/core/show_display_feedback_and_report.rb +11 -7
  46. data/lib/roebe/shell/shell/core/stat.rb +4 -1
  47. data/lib/roebe/shell/shell/menu.rb +231 -173
  48. data/lib/roebe/shell/shell/shell.rb +77 -77
  49. data/lib/roebe/toplevel_methods/unicode/popular_unicode_symbols.rb +9 -0
  50. data/lib/roebe/version/version.rb +2 -2
  51. data/lib/roebe/www/cancer/cancer.rb +10 -5
  52. data/lib/roebe/www/cellbiology/cellbiology.rb +4 -0
  53. data/lib/roebe/www/covid19/covid19.rb +32 -6
  54. data/lib/roebe/www/developmental_biology/developmental_biology.rb +16 -4
  55. data/lib/roebe/www/genomics/genomics.rb +27 -3
  56. data/lib/roebe/www/hardware/computersysteme/computersysteme.rb +25 -13
  57. data/lib/roebe/www/libreoffice/libreoffice.rb +22 -5
  58. data/lib/roebe/www/lighttpd/autogenerated_lighttpd.conf +1 -1
  59. data/lib/roebe/www/lighttpd/configuration/redirects.conf +1 -1
  60. data/lib/roebe/www/links/links.rb +1 -1
  61. data/lib/roebe/www/mathematics/mathematics.rb +48 -24
  62. data/lib/roebe/www/neurobiology/neurobiology.rb +13 -3
  63. data/lib/roebe/www/virology/virology.rb +81 -58
  64. data/lib/roebe/www/weechat/weechat.cgi +1 -1
  65. data/lib/roebe/www/weechat/weechat.rb +4 -5
  66. data/lib/roebe/www/wlan/wlan.rb +9 -3
  67. metadata +12 -7
  68. data/lib/roebe/classes/monitor_resolution.rb +0 -95
  69. data/lib/roebe/gui/gtk2/shell/shell.rb +0 -37
  70. data/lib/roebe/gui/shared_code/shell/connect_skeleton.rb +0 -53
  71. data/lib/roebe/gui/shared_code/shell/constants.rb +0 -82
@@ -3,14 +3,14 @@
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
5
  # === Roebe::GUI::Gtk::Shell
6
+ #
7
+ # This specialized widgets tries to leverage the power of the
8
+ # Roebe::Shell in a graphical manner, via a GUI.
6
9
  # =========================================================================== #
7
10
  # require 'roebe/gui/gtk3/shell/shell.rb'
8
11
  # Roebe::GUI::Gtk::Shell.run
9
12
  # =========================================================================== #
10
13
  require 'gtk_paradise/require_gtk3'
11
- require 'gtk_paradise/widgets/gtk3/debug_widget/debug_widget.rb'
12
- require 'gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb'
13
- require 'gtk_paradise/widgets/gtk3/mini_clock/mini_clock.rb'
14
14
 
15
15
  module Roebe
16
16
 
@@ -18,20 +18,700 @@ module GUI
18
18
 
19
19
  module Gtk
20
20
 
21
- class Shell < ::Gtk::Frame
21
+ class Shell < ::Gtk::Frame # === Roebe::GUI::Gtk::Shell
22
22
 
23
- require 'roebe/gui/shared_code/shell/shell_module.rb'
24
- include Roebe::GUI::Gtk::ShellModule
23
+ require 'roebe/gui/gtk3/shell/misc.rb'
24
+ require 'gtk_paradise/widgets/gtk3/debug_widget/debug_widget.rb'
25
+ require 'gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb'
26
+ require 'gtk_paradise/widgets/gtk3/mini_clock/mini_clock.rb'
27
+ require 'gtk_paradise/widgets/gtk3/button_xorg_buffer/button_xorg_buffer.rb'
28
+
29
+ require 'gtk_paradise/requires/require_the_base_module.rb'
30
+ include ::Gtk::BaseModule
31
+
32
+ # ========================================================================= #
33
+ # === N
34
+ # ========================================================================= #
35
+ N = "\n"
36
+
37
+ # ========================================================================= #
38
+ # === TITLE
39
+ #
40
+ # This constant sets the main title for this widget. It currently
41
+ # includes a :: to indicate the namespace within module Roebe.
42
+ # ========================================================================= #
43
+ TITLE = 'Shell' # 'Roebe::Shell'
44
+
45
+ # ========================================================================= #
46
+ # === WIDTH
47
+ # ========================================================================= #
48
+ WIDTH = '75% or minimum 1820px'
49
+
50
+ # ========================================================================= #
51
+ # === HEIGHT
52
+ # ========================================================================= #
53
+ HEIGHT = '55% or minimum 960px'
54
+
55
+ # ========================================================================= #
56
+ # === USE_THIS_FONT
57
+ # ========================================================================= #
58
+ USE_THIS_FONT = :hack_23
59
+
60
+ # ========================================================================= #
61
+ # === EMPTY_STRING
62
+ # ========================================================================= #
63
+ EMPTY_STRING = ''
64
+
65
+ # ========================================================================= #
66
+ # === INPUT_WAS_NOT_FOUND
67
+ # ========================================================================= #
68
+ INPUT_WAS_NOT_FOUND = 'Input was not found.'
69
+
70
+ # ========================================================================= #
71
+ # === PADDING_TO_USE_FOR_THE_USER_INPUT
72
+ # ========================================================================= #
73
+ PADDING_TO_USE_FOR_THE_USER_INPUT = 12
74
+
75
+ # ========================================================================= #
76
+ # === HASH_DESIGNATED_KEY_COMBINATIONS
77
+ #
78
+ # If we need more key-combinations to work quickly, we can simply add
79
+ # them here. As of May 2021, only the first four are in use.
80
+ # ========================================================================= #
81
+ HASH_DESIGNATED_KEY_COMBINATIONS = {
82
+ 'Alt+w' => 'report_return_date',
83
+ 'Alt+e' => 'show_path_in_use',
84
+ 'Alt+r' => 'cd_one_down',
85
+ 'Alt+t' => 'll',
86
+ 'Alt+z' => 'NOT_YET_DEFINED',
87
+ 'Alt+u' => 'NOT_YET_DEFINED',
88
+ 'Alt+i' => 'NOT_YET_DEFINED',
89
+ 'Alt+o' => 'NOT_YET_DEFINED',
90
+ 'Alt+p' => 'NOT_YET_DEFINED',
91
+ 'Alt+ü' => 'NOT_YET_DEFINED',
92
+ }
93
+
94
+ # ========================================================================= #
95
+ # === Roebe::GUI::Gtk::Shell.width?
96
+ # ========================================================================= #
97
+ def self.width?
98
+ WIDTH
99
+ end
100
+
101
+ # ========================================================================= #
102
+ # === Roebe::GUI::Gtk::Shell.height?
103
+ # ========================================================================= #
104
+ def self.height?
105
+ HEIGHT
106
+ end
107
+
108
+ # ========================================================================= #
109
+ # === initialize
110
+ # ========================================================================= #
111
+ def initialize(
112
+ commandline_arguments = ARGV,
113
+ run_already = true
114
+ )
115
+ super()
116
+ reset
117
+ set_commandline_arguments(
118
+ commandline_arguments.reject {|entry| entry.start_with?('--') }
119
+ )
120
+ set_title(TITLE) if respond_to? :set_title
121
+ label.set_markup(
122
+ %Q(<span weight="ultrabold" size="large" foreground="darkblue"> #{TITLE} </span>),
123
+ use_underline: true
124
+ )
125
+ on_delete_event_quit_the_application
126
+ run if run_already
127
+ end
128
+
129
+ # ========================================================================= #
130
+ # === reset (reset tag)
131
+ # ========================================================================= #
132
+ def reset
133
+ reset_the_internal_variables
134
+ infer_the_namespace
135
+ # ======================================================================= #
136
+ # === @configuration
137
+ # ======================================================================= #
138
+ @configuration = [true, __dir__, namespace?]
139
+ # ======================================================================= #
140
+ # === Set the title, width, height and the font in use.
141
+ # ======================================================================= #
142
+ title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
143
+ use_gtk_paradise_project_css_file
144
+ infer_the_size_automatically
145
+ instantiate_the_roebe_shell
146
+ # ======================================================================= #
147
+ # === @can_we_left_mouse_button_click
148
+ # ======================================================================= #
149
+ @can_we_left_mouse_button_click = true
150
+ # ======================================================================= #
151
+ # === @last_result
152
+ # ======================================================================= #
153
+ @last_result = nil
154
+ end
155
+
156
+ # ========================================================================= #
157
+ # === instantiate_the_roebe_shell
158
+ #
159
+ # This method will instantiate a new Roebe::Shell. Currently,
160
+ # Roebe::Shell embedded in ruby-gtk will not use readline nor
161
+ # colours.
162
+ # ========================================================================= #
163
+ def instantiate_the_roebe_shell
164
+ do_require_the_roebe_shell
165
+ # ====================================================================== #
166
+ # === @shell
167
+ # ====================================================================== #
168
+ @shell = ::Roebe::Shell.new { :do_not_enter_the_main_loop }
169
+ @shell.do_not_use_readline
170
+ @shell.disable_colours { :be_quiet } # For now we will disable them.
171
+ end
172
+
173
+ # ========================================================================= #
174
+ # === hash_designated_key_combinations?
175
+ # ========================================================================= #
176
+ def hash_designated_key_combinations?
177
+ HASH_DESIGNATED_KEY_COMBINATIONS
178
+ end
179
+
180
+ # ========================================================================= #
181
+ # === focus_on_the_bottom_widget
182
+ # ========================================================================= #
183
+ def focus_on_the_bottom_widget
184
+ text_view?.do_focus
185
+ end
186
+
187
+ # ========================================================================= #
188
+ # === create_the_button_xorg_buffer
189
+ # ========================================================================= #
190
+ def create_the_button_xorg_buffer
191
+ # ======================================================================= #
192
+ # Create the assign-to-xorg button next:
193
+ # ======================================================================= #
194
+ @button_xorg_buffer = ::Gtk::ButtonXorgBuffer.new(@text_buffer) { :split }
195
+ @button_xorg_buffer.set_font(:hack_18)
196
+ end
197
+
198
+ # ========================================================================= #
199
+ # === textview?
200
+ # ========================================================================= #
201
+ def textview?
202
+ @textview_widget
203
+ end
204
+
205
+ # ========================================================================= #
206
+ # === create_the_textview_widget
207
+ # ========================================================================= #
208
+ def create_the_textview_widget
209
+ @text_buffer = text_buffer
210
+ # ======================================================================= #
211
+ # === @textview_widget
212
+ # ======================================================================= #
213
+ @textview_widget = text_view(@text_buffer)
214
+ @textview_widget.bblack1
215
+ @textview_widget.pad8px
216
+ @textview_widget.width_height(500, 200)
217
+ @textview_widget.set_editable(true)
218
+ @textview_widget.visible_cursor
219
+ @textview_widget.set_font(:hack_16)
220
+ end; alias create_the_text_buffer_and_the_text_view create_the_textview_widget # === create_the_text_buffer_and_the_text_view
221
+
222
+ # ========================================================================= #
223
+ # === deselect_and_select_relevant_widgets
224
+ # ========================================================================= #
225
+ def deselect_and_select_relevant_widgets
226
+ Thread.new {
227
+ sleep 0.025
228
+ @label_title.deselect
229
+ entry_for_the_user_input?.do_focus
230
+ }
231
+ end
232
+
233
+ # ========================================================================= #
234
+ # === focus_on_the_user_input_gtk_entry
235
+ # ========================================================================= #
236
+ def focus_on_the_user_input_gtk_entry
237
+ entry_for_user_input?.do_focus
238
+ end
239
+
240
+ # ========================================================================= #
241
+ # === report_return_date
242
+ #
243
+ # This is triggered via "Alt+w".
244
+ # ========================================================================= #
245
+ def report_return_date
246
+ main_entry?.set_text(__method__.to_s)
247
+ do_click_the_main_button
248
+ end
249
+
250
+ # ========================================================================= #
251
+ # === create_the_entries (entries tag, entry tag)
252
+ # ========================================================================= #
253
+ def create_the_entries
254
+ # ======================================================================= #
255
+ # === @entry_user_input_for_the_shell
256
+ #
257
+ # First we will create the entry that contains the user input.
258
+ # ======================================================================= #
259
+ @entry_user_input_for_the_shell = entry
260
+ @entry_user_input_for_the_shell.bblack1
261
+ # @entry_user_input_for_the_shell.BG_yellow
262
+ @entry_user_input_for_the_shell.set_activates_default(true)
263
+ @entry_user_input_for_the_shell.enable_events
264
+ @entry_user_input_for_the_shell.do_focus
265
+ @entry_user_input_for_the_shell.css_class('BG_gainsboro')
266
+ @entry_user_input_for_the_shell.border(
267
+ PADDING_TO_USE_FOR_THE_USER_INPUT,
268
+ PADDING_TO_USE_FOR_THE_USER_INPUT,
269
+ PADDING_TO_USE_FOR_THE_USER_INPUT,
270
+ PADDING_TO_USE_FOR_THE_USER_INPUT
271
+ ) # ^^^ A smallish "border" is visually nicer, in my opinion.
272
+ @entry_user_input_for_the_shell.fancy_hint =
273
+ "This entry can be used to input the shell "\
274
+ "commands. Input your <b>commands</b>here.\n"
275
+ @entry_user_input_for_the_shell.shadow_hint =
276
+ 'Input the shell-commands here ...'
277
+ @entry_user_input_for_the_shell.on_enter_key {
278
+ do_evaluate_the_shell_command
279
+ }
280
+ @entry_user_input_for_the_shell.signal_connect(:activate) { |widget|
281
+ do_evaluate_the_main_entry
282
+ }
283
+ unless @commandline_arguments.empty?
284
+ # ===================================================================== #
285
+ # Assign the commandline arguments to the input-box next:
286
+ # ===================================================================== #
287
+ @entry_user_input_for_the_shell.set_text(
288
+ @commandline_arguments.join(' ').strip
289
+ )
290
+ if is_on_roebe? and !@entry_user_input_for_the_shell.text?.empty?
291
+ do_evaluate_the_shell_command
292
+ end
293
+ end
294
+ # ======================================================================= #
295
+ # === @entry_showing_the_current_working_directory
296
+ #
297
+ # Next comes the entry that will show the current working directory.
298
+ # ======================================================================= #
299
+ @entry_showing_the_current_working_directory = entry
300
+ @entry_showing_the_current_working_directory.bblack1
301
+ @entry_showing_the_current_working_directory.set_font(:hack_15)
302
+ @entry_showing_the_current_working_directory.width_height(400, 30)
303
+ @entry_showing_the_current_working_directory.very_light_yellowish_background
304
+ @entry_showing_the_current_working_directory.on_key_press_event { |widget, event|
305
+ # ===================================================================== #
306
+ # Handle the "enter" key next, as well as the "return" key.
307
+ # ===================================================================== #
308
+ case Gdk::Keyval.to_name(event.keyval)
309
+ when 'Return','KP_Enter'
310
+ set_pwd(
311
+ @entry_showing_the_current_working_directory.text?
312
+ )
313
+ update_the_current_working_directory
314
+ # else
315
+ # pp _
316
+ end
317
+ }
318
+ end
319
+
320
+ # ========================================================================= #
321
+ # === return_title
322
+ #
323
+ # This main header will also make use of "header1".
324
+ # ========================================================================= #
325
+ def return_title
326
+ return label("☘️ #{TITLE} ☘️") # The old symbol was the fruit-emoji, aka '🌹'.
327
+ end
328
+
329
+ # ========================================================================= #
330
+ # === create_the_title_label
331
+ # ========================================================================= #
332
+ def create_the_title_label
333
+ # ====================================================================== #
334
+ # === @label_title
335
+ # ====================================================================== #
336
+ @label_title = return_title
337
+ @label_title.set_name('header3')
338
+ @label_title.make_selectable
339
+ end
340
+
341
+ # ========================================================================= #
342
+ # === update_the_current_working_directory
343
+ #
344
+ # This method will merely modify the working-directory Gtk::Entry.
345
+ # ========================================================================= #
346
+ def update_the_current_working_directory(
347
+ use_this_directory = return_pwd
348
+ )
349
+ @entry_showing_the_current_working_directory.set_text(
350
+ use_this_directory
351
+ )
352
+ @directory_content_widget.set_pwd(use_this_directory)
353
+ end
354
+
355
+ # ========================================================================= #
356
+ # === show_path_in_use
357
+ # ========================================================================= #
358
+ def show_path_in_use
359
+ set_text_in_the_main_entry_then_click_the_main_button(__method__.to_s)
360
+ end
361
+
362
+ # ========================================================================= #
363
+ # === last_result?
364
+ # ========================================================================= #
365
+ def last_result?
366
+ @shell.last_result?
367
+ end
368
+
369
+ # ========================================================================= #
370
+ # === do_require_the_roebe_shell
371
+ # ========================================================================= #
372
+ def do_require_the_roebe_shell
373
+ require 'roebe/requires/require_the_roebe_shell.rb'
374
+ end
375
+
376
+ # ========================================================================= #
377
+ # === top_bar?
378
+ # ========================================================================= #
379
+ def top_bar?
380
+ @top_bar
381
+ end; alias top_widget? top_bar? # === top_widget?
382
+
383
+
384
+ # ========================================================================= #
385
+ # === create_the_scrolled_window
386
+ #
387
+ # This is the buffer that contains all output from the roebe-shell.
388
+ # ========================================================================= #
389
+ def create_the_scrolled_window
390
+ @scrolled_window_containing_the_text_view = scrolled_window(text_view?) { :always }
391
+ @scrolled_window_containing_the_text_view.set_size_request(600, 500)
392
+ @scrolled_window_containing_the_text_view.bblack1
393
+ end
394
+
395
+ # ========================================================================= #
396
+ # === return_the_content_of_the_vbox_on_the_right_side
397
+ # ========================================================================= #
398
+ def return_the_content_of_the_vbox_on_the_right_side
399
+ # ======================================================================= #
400
+ # The tiny-vbox is on the right side.
401
+ # ======================================================================= #
402
+ tiny_vbox = vbox
403
+ tiny_vbox.minimal(@button_xorg_buffer, 1)
404
+ tiny_vbox.minimal(@combo_box_containing_useful_commands_from_the_case_when_menu, 1)
405
+ return tiny_vbox
406
+ end
407
+
408
+ # ========================================================================= #
409
+ # === set_content_for_the_textview_widget
410
+ # ========================================================================= #
411
+ def set_content_for_the_textview_widget(
412
+ i = last_result?
413
+ )
414
+ if i.is_a? Array
415
+ i = i.join
416
+ end
417
+ i = ::Colours.remove_escape_sequences(i.dup).to_s
418
+ @textview_widget.set_text(i)
419
+ end; alias update_the_textview_widget_with_this_content set_content_for_the_textview_widget # === update_the_textview_widget_with_this_content
420
+
421
+ # ========================================================================= #
422
+ # === textview_widget?
423
+ # ========================================================================= #
424
+ def textview_widget?
425
+ @textview_widget
426
+ end; alias text_view? textview_widget? # === text_view?
427
+
428
+ # ========================================================================= #
429
+ # === return_the_bottom_widget_finally
430
+ # ========================================================================= #
431
+ def return_the_bottom_widget_finally
432
+ return @bottom_widget
433
+ end
434
+
435
+ # ========================================================================= #
436
+ # === shell?
437
+ # ========================================================================= #
438
+ def shell?
439
+ @shell
440
+ end; alias roebe_shell? shell? # === roebe_shell?
441
+
442
+ # ========================================================================= #
443
+ # ==== add_status_message
444
+ #
445
+ # This method will simply add the status message to the statusbar.
446
+ # ========================================================================= #
447
+ def add_status_message(i)
448
+ case i
449
+ # ======================================================================= #
450
+ # === :clear
451
+ #
452
+ # This will simply empty the status-bar.
453
+ # ======================================================================= #
454
+ when :clear
455
+ i = EMPTY_STRING
456
+ # ======================================================================= #
457
+ # === :found_nothing
458
+ # ======================================================================= #
459
+ when :found_nothing
460
+ i = INPUT_WAS_NOT_FOUND
461
+ end
462
+ @statusbar.push(@statusbar_context_id, i)
463
+ # @statusbar.modify_foreground :crimson
464
+ # ^^^ this does not work, unfortunately. May have to revisit
465
+ # this at a later time.
466
+ end
467
+
468
+ # ========================================================================= #
469
+ # === create_skeleton (create tag, skeleton tag)
470
+ # ========================================================================= #
471
+ def create_skeleton
472
+ create_the_buttons
473
+ create_the_textview_widget # (1)
474
+ create_the_scrolled_window # (2)
475
+ create_the_entries # (3)
476
+ create_the_directory_content_widget # (4)
477
+ create_the_title_label
478
+ create_the_top_bar
479
+ create_the_button_xorg_buffer
480
+ create_the_combo_box
481
+ create_the_eventbox
482
+ create_the_bottom_widget
483
+ # instantiate_a_flexible_vte
484
+ end
485
+
486
+ # ========================================================================= #
487
+ # === create_the_eventbox
488
+ # ========================================================================= #
489
+ def create_the_eventbox
490
+ label_current_working_directory = bold_label('Current working directory → ')
491
+ label_current_working_directory.set_font(:hack_15)
492
+ @eventbox_label_current_working_directory = eventbox(
493
+ label_current_working_directory
494
+ )
495
+ # ======================================================================= #
496
+ # === Handle left-mouse-button click events
497
+ #
498
+ # Let the eventbox respond to left-mouse-click, and then update the
499
+ # widget that displays the current working directory.
500
+ #
501
+ # We will, however had, add a 3 seconds delay after such a click
502
+ # event.
503
+ # ======================================================================= #
504
+ @eventbox_label_current_working_directory.signal_connect(:event) { |widget, event|
505
+ case event.event_type
506
+ when Gdk::EventType::BUTTON_PRESS
507
+ update_the_current_working_directory
508
+ end
509
+ }
510
+ end
511
+
512
+ # ========================================================================= #
513
+ # === create_then_return_the_statusbar (status tag)
514
+ # ========================================================================= #
515
+ def create_then_return_the_statusbar
516
+ @statusbar = gtk_statusbar
517
+ if @statusbar.respond_to? :has_resize_grip=
518
+ @statusbar.has_resize_grip = true
519
+ end
520
+ @statusbar_context_id = @statusbar.get_context_id('statusbar_gtk_shell')
521
+ return @statusbar
522
+ end
523
+
524
+ # ========================================================================= #
525
+ # === set_text_in_the_main_entry_then_click_the_main_button
526
+ # ========================================================================= #
527
+ def set_text_in_the_main_entry_then_click_the_main_button(i)
528
+ main_entry?.set_text(i.to_s)
529
+ do_click_the_main_button
530
+ end
531
+
532
+ # ========================================================================= #
533
+ # === create_the_combo_box (combo tag)
534
+ # ========================================================================= #
535
+ def create_the_combo_box
536
+ # ======================================================================= #
537
+ # Create a combo-box next.
538
+ # ======================================================================= #
539
+ array = []
540
+ begin
541
+ require 'case_parser'
542
+ _ = Roebe::Shell.file_menu
543
+ array << CaseParser.parse(_)
544
+ array.flatten!
545
+ array.reject! {|entry| entry.to_s.empty? } # Get rid of emptry lines.
546
+ array.map! {|entry|
547
+ entry = entry.to_s
548
+ entry.delete!('*')
549
+ entry.delete!('"')
550
+ entry
551
+ }
552
+ rescue LoadError
553
+ end
554
+ # ======================================================================= #
555
+ # === @combo_box_containing_useful_commands_from_the_case_when_menu
556
+ # ======================================================================= #
557
+ @combo_box_containing_useful_commands_from_the_case_when_menu = return_combo_box_entry(array)
558
+ @combo_box_containing_useful_commands_from_the_case_when_menu.set_font(:hack_16)
559
+ @combo_box_containing_useful_commands_from_the_case_when_menu.focus_on_the_first_element
560
+ @combo_box_containing_useful_commands_from_the_case_when_menu.on_changed {
561
+ if @combo_box_containing_useful_commands_from_the_case_when_menu.active_iter
562
+ entry_user_input?.set_text(
563
+ @combo_box_containing_useful_commands_from_the_case_when_menu.active_text+' '
564
+ )
565
+ end
566
+ }
567
+ end
568
+
569
+ # ========================================================================= #
570
+ # === create_the_directory_content_widget
571
+ # ========================================================================= #
572
+ def create_the_directory_content_widget
573
+ # ======================================================================= #
574
+ # The directory-content-widget comes next.
575
+ # ======================================================================= #
576
+ @directory_content_widget = directory_content_widget { :omit_the_bottom_widget }
577
+ @directory_content_widget.bblack2
578
+ end
579
+
580
+ # ========================================================================= #
581
+ # === instantiate_a_flexible_vte
582
+ # ========================================================================= #
583
+ def instantiate_a_flexible_vte
584
+ require 'gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb'
585
+ # ====================================================================== #
586
+ # === @vte
587
+ # ====================================================================== #
588
+ # @vte = ::Gtk::FlexibleVte.new {{ n_tabs: 3 }}
589
+ end
590
+
591
+ # ========================================================================= #
592
+ # === connect_skeleton (connect tag)
593
+ # ========================================================================= #
594
+ def connect_skeleton
595
+ abort_on_exception
596
+ outer_vbox = vbox
597
+ outer_vbox.minimal(@top_bar)
598
+ outer_vbox.minimal(@entry_user_input_for_the_shell, 4)
599
+
600
+ # ======================================================================= #
601
+ # Next add the draggable container for the scrolled-window on the
602
+ # left hand side, and the mini-vbox containing the xorg-button
603
+ # and the combo box on the right hand side.
604
+ # ======================================================================= #
605
+ tiny_vbox = return_the_content_of_the_vbox_on_the_right_side
606
+ drag1 = drag_via_left_and_right_movement(
607
+ @scrolled_window_containing_the_text_view,
608
+ tiny_vbox
609
+ )
610
+ drag1.position = 1320
611
+
612
+ # ======================================================================= #
613
+ # Add the directory-content widget, below the bottom widget.
614
+ # ======================================================================= #
615
+ drag2 = drag_via_up_and_down_movement(
616
+ drag1,
617
+ @directory_content_widget
618
+ )
619
+ outer_vbox.minimal(drag2, 5)
620
+
621
+ # ======================================================================= #
622
+ # Next, add the entry that shows the current working directory.
623
+ # ======================================================================= #
624
+ super_tiny_hbox = hbox
625
+ super_tiny_hbox.minimal(@eventbox_label_current_working_directory)
626
+ super_tiny_hbox.maximal(@entry_showing_the_current_working_directory)
627
+ @bottom_widget.minimal(super_tiny_hbox, 5)
628
+ @bottom_widget.minimal(create_then_return_the_statusbar, 5)
629
+ # @bottom_widget.minimal(@vte, 1)
630
+ outer_vbox.minimal(@bottom_widget)
631
+ add(outer_vbox)
632
+ end
633
+
634
+ # ========================================================================= #
635
+ # === create_the_bottom_widget
636
+ # ========================================================================= #
637
+ def create_the_bottom_widget
638
+ @bottom_widget = vbox
639
+ end
640
+
641
+ # ========================================================================= #
642
+ # === set_pwd
643
+ # ========================================================================= #
644
+ def set_pwd(
645
+ i = @entry_showing_the_current_working_directory.text
646
+ )
647
+ evaluate_this_input_via_the_shell(i)
648
+ _ = roebe_shell?.return_pwd.to_s # Must come after the ^^^ above.
649
+ @entry_showing_the_current_working_directory.set_text(_)
650
+ update_the_textview_widget_with_this_content(_)
651
+ end
652
+
653
+ # ========================================================================= #
654
+ # === do_evaluate_the_shell_command
655
+ #
656
+ # This method can be used to "send" input to the Roebe::Shell,
657
+ # without depending on the main loop {} that is normally used
658
+ # by Roebe::Shell.
659
+ #
660
+ # It will also modify the textview-widget on the bottom.
661
+ # ========================================================================= #
662
+ def do_evaluate_the_shell_command(
663
+ i = @entry_user_input_for_the_shell.text?
664
+ )
665
+ begin
666
+ shell?.suiadoa(i)
667
+ set_content_for_the_textview_widget(last_result?)
668
+ update_the_current_working_directory # Always update the current working directory as well.
669
+ if shell?.menu_found_no_match?
670
+ add_status_message(:found_nothing)
671
+ else
672
+ add_status_message(:clear)
673
+ end
674
+ rescue Exception => error
675
+ pp error
676
+ end
677
+ end; alias evaluate_this_input_via_the_shell do_evaluate_the_shell_command # === evaluate_this_input_via_the_shell
678
+ alias do_evaluate_the_main_entry do_evaluate_the_shell_command # === do_evaluate_the_main_entry
679
+ alias do_click_the_main_button do_evaluate_the_shell_command # === do_click_the_main_button
680
+
681
+ # ========================================================================= #
682
+ # === create_the_top_bar (top tag)
683
+ # ========================================================================= #
684
+ def create_the_top_bar
685
+ # ======================================================================= #
686
+ # === @top_bar
687
+ # ======================================================================= #
688
+ @top_bar = default_top_bar { :with_close_button }
689
+ @top_bar.spacing = 12
690
+ @top_bar.set_custom_title(@label_title)
691
+ # ======================================================================= #
692
+ # Add a small clock next. This one does not work, though. The other
693
+ # clock works, however had.
694
+ # ======================================================================= #
695
+ # @top_bar.add_right(emoji(:clock))
696
+ @top_bar.add_right(::Gtk.return_simple_clock_widget { :bold })
697
+ @top_bar.add_left(@button_clear_textview_widget)
698
+ end; alias create_the_top_widget create_the_top_bar # === create_the_top_widget
25
699
 
26
700
  # ========================================================================= #
27
- # === Roebe::GUI::Gtk::Shell.run
701
+ # === create_the_buttons
28
702
  # ========================================================================= #
29
- def self.run
30
- ::Roebe::GUI::Gtk::ShellModule.run
703
+ def create_the_buttons
704
+ @button_clear_textview_widget = themed_icon(
705
+ 'edit-clear-all-symbolic.symbolic'
706
+ ) # 'edit-paste-symbolic.symbolic')
707
+ @button_clear_textview_widget.hint = 'Click on this button '
708
+ @button_clear_textview_widget.on_clicked {
709
+ textview?.clear
710
+ }
31
711
  end
32
712
 
33
713
  end; end; end; end
34
714
 
35
715
  if __FILE__ == $PROGRAM_NAME
36
- Roebe::GUI::Gtk::Shell.run
716
+ Roebe::GUI::Gtk::Shell.run(ARGV)
37
717
  end