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.
- checksums.yaml +4 -4
- data/README.md +57 -34
- data/doc/README.gen +56 -33
- data/doc/add_ons_for_ruby/fxruby.md +14 -0
- data/doc/add_ons_for_ruby/prawn.md +12 -0
- data/doc/sinatra_tutorial/sinatra_tutorial.rb +52 -22
- data/lib/roebe/base/colours.rb +59 -50
- data/lib/roebe/classes/create_file_skeleton/generate_ruby_string.rb +1 -0
- data/lib/roebe/classes/current_monitor_resolution.rb +27 -9
- data/lib/roebe/classes/do_install.rb +1 -9
- data/lib/roebe/classes/done.rb +1 -9
- data/lib/roebe/classes/done_and_open.rb +2 -13
- data/lib/roebe/classes/email.rb +36 -26
- data/lib/roebe/classes/find_out_version_of.rb +1 -5
- data/lib/roebe/classes/find_static_libraries.rb +1 -18
- data/lib/roebe/classes/fluxbox/generate_fluxbox_apps_file.rb +1 -9
- data/lib/roebe/classes/generate_fstab_file/generate_fstab_file.rb +1 -9
- data/lib/roebe/classes/generate_master_shell_script.rb +1 -13
- data/lib/roebe/classes/generate_system_values.rb +1 -9
- data/lib/roebe/classes/get_dependencies.rb +1 -9
- data/lib/roebe/classes/good_night.rb +1 -5
- data/lib/roebe/classes/google_url_cleaner.rb +1 -9
- data/lib/roebe/classes/grant_superuser_rights.rb +0 -5
- data/lib/roebe/classes/run/run.rb +130 -105
- 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
- data/lib/roebe/classes/time/current_time_in_singapore.rb +1 -5
- data/lib/roebe/classes/umlaut_converter.rb +1 -1
- data/lib/roebe/classes/use_jruby.rb +68 -0
- data/lib/roebe/documentation/prawn.md +0 -11
- data/lib/roebe/gui/gtk3/shell/misc.rb +94 -0
- data/lib/roebe/gui/gtk3/shell/shell.rb +690 -10
- data/lib/roebe/gui/libui/shell/shell.rb +107 -0
- data/lib/roebe/gui/shared_code/shell/shell_module.rb +0 -601
- data/lib/roebe/pdf/README.md +1 -0
- data/lib/roebe/pdf/prawn/all_in_one_showcasing_prawn.rb +160 -0
- data/lib/roebe/requires/require_the_run_class.rb +7 -0
- data/lib/roebe/shell/shell/class_methods.rb +25 -0
- data/lib/roebe/shell/shell/core/browser.rb +4 -1
- data/lib/roebe/shell/shell/core/cat.rb +34 -28
- data/lib/roebe/shell/shell/core/disable.rb +12 -1
- data/lib/roebe/shell/shell/core/esystem.rb +10 -1
- data/lib/roebe/shell/shell/core/help.rb +24 -21
- data/lib/roebe/shell/shell/core/queries.rb +7 -7
- data/lib/roebe/shell/shell/core/set.rb +15 -0
- data/lib/roebe/shell/shell/core/show_display_feedback_and_report.rb +11 -7
- data/lib/roebe/shell/shell/core/stat.rb +4 -1
- data/lib/roebe/shell/shell/menu.rb +231 -173
- data/lib/roebe/shell/shell/shell.rb +77 -77
- data/lib/roebe/toplevel_methods/unicode/popular_unicode_symbols.rb +9 -0
- data/lib/roebe/version/version.rb +2 -2
- data/lib/roebe/www/cancer/cancer.rb +10 -5
- data/lib/roebe/www/cellbiology/cellbiology.rb +4 -0
- data/lib/roebe/www/covid19/covid19.rb +32 -6
- data/lib/roebe/www/developmental_biology/developmental_biology.rb +16 -4
- data/lib/roebe/www/genomics/genomics.rb +27 -3
- data/lib/roebe/www/hardware/computersysteme/computersysteme.rb +25 -13
- data/lib/roebe/www/libreoffice/libreoffice.rb +22 -5
- data/lib/roebe/www/lighttpd/autogenerated_lighttpd.conf +1 -1
- data/lib/roebe/www/lighttpd/configuration/redirects.conf +1 -1
- data/lib/roebe/www/links/links.rb +1 -1
- data/lib/roebe/www/mathematics/mathematics.rb +48 -24
- data/lib/roebe/www/neurobiology/neurobiology.rb +13 -3
- data/lib/roebe/www/virology/virology.rb +81 -58
- data/lib/roebe/www/weechat/weechat.cgi +1 -1
- data/lib/roebe/www/weechat/weechat.rb +4 -5
- data/lib/roebe/www/wlan/wlan.rb +9 -3
- metadata +12 -7
- data/lib/roebe/classes/monitor_resolution.rb +0 -95
- data/lib/roebe/gui/gtk2/shell/shell.rb +0 -37
- data/lib/roebe/gui/shared_code/shell/connect_skeleton.rb +0 -53
- data/lib/roebe/gui/shared_code/shell/constants.rb +0 -82
@@ -0,0 +1,107 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Roebe::GUI::LibUI::Shell
|
6
|
+
# =========================================================================== #
|
7
|
+
module Roebe
|
8
|
+
|
9
|
+
module GUI
|
10
|
+
|
11
|
+
module LibUI
|
12
|
+
|
13
|
+
class Shell # === LibuiParadise::GUI::LibUI::Shell
|
14
|
+
|
15
|
+
alias e puts
|
16
|
+
|
17
|
+
require 'libui_paradise'
|
18
|
+
include LibuiParadise::Extensions
|
19
|
+
|
20
|
+
# require 'bioroebe/gui/shared_code/levensthein_distance/levensthein_distance_module.rb'
|
21
|
+
# include Bioroebe::GUI::LevenstheinDistanceModule
|
22
|
+
|
23
|
+
# ========================================================================= #
|
24
|
+
# === TITLE
|
25
|
+
# ========================================================================= #
|
26
|
+
TITLE = 'A prototype for LibUI'
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# === WIDTH
|
30
|
+
# ========================================================================= #
|
31
|
+
WIDTH = 600
|
32
|
+
|
33
|
+
# ========================================================================= #
|
34
|
+
# === HEIGHT
|
35
|
+
# ========================================================================= #
|
36
|
+
HEIGHT = 480
|
37
|
+
|
38
|
+
# ========================================================================= #
|
39
|
+
# === initialize
|
40
|
+
# ========================================================================= #
|
41
|
+
def initialize(
|
42
|
+
run_already = true
|
43
|
+
)
|
44
|
+
reset
|
45
|
+
run if run_already
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === reset (reset tag)
|
50
|
+
# ========================================================================= #
|
51
|
+
def reset
|
52
|
+
title_width_height(TITLE, WIDTH, HEIGHT)
|
53
|
+
end
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === create_skeleton (create tag, skeleton tag)
|
57
|
+
# ========================================================================= #
|
58
|
+
def create_skeleton
|
59
|
+
# ======================================================================= #
|
60
|
+
# === @window
|
61
|
+
# ======================================================================= #
|
62
|
+
@window = ui_padded_main_window(title?, width?, height?, 0)
|
63
|
+
end
|
64
|
+
|
65
|
+
# ========================================================================= #
|
66
|
+
# === run
|
67
|
+
# ========================================================================= #
|
68
|
+
def run
|
69
|
+
create_skeleton_then_connect_skeleton
|
70
|
+
outer_vbox = padded_vbox
|
71
|
+
# ======================================================================= #
|
72
|
+
# First add the two buttons on top:
|
73
|
+
# ======================================================================= #
|
74
|
+
hbox_on_top = padded_hbox
|
75
|
+
button_refresh = ui_button('Refresh')
|
76
|
+
button_refresh.on_clicked {
|
77
|
+
e 'TODO: Refresh this...'
|
78
|
+
}
|
79
|
+
button_quit = quit_button
|
80
|
+
hbox_on_top.maximal(button_refresh)
|
81
|
+
hbox_on_top.maximal(button_quit)
|
82
|
+
outer_vbox.minimal(hbox_on_top)
|
83
|
+
outer_vbox.add_hsep
|
84
|
+
|
85
|
+
grid = ui_padded_grid
|
86
|
+
grid.ui_grid_append(text('Left'), 0, 0, 1, 1, 0, 0.5, 1, 0)
|
87
|
+
grid.ui_grid_append(text('Right'), 1, 0, 1, 1, 0, 0.5, 1, 0)
|
88
|
+
|
89
|
+
3.times.each {|index| index += 1
|
90
|
+
# ===================================================================== #
|
91
|
+
# left, top, xspan, yspan, hexpand, halign, vexpand, valign
|
92
|
+
# 0, 0, 2, 1, 0, 0, 1, 0
|
93
|
+
# ===================================================================== #
|
94
|
+
grid.ui_grid_append(text(index.to_s), 0, 1+index, 1, 1, 1, 1, 1, 1)
|
95
|
+
label_exam_topic = text(entry.to_s)
|
96
|
+
grid.ui_grid_append(label_exam_topic, 1, 1+index, 1, 1, 1, 1, 1, 1)
|
97
|
+
}
|
98
|
+
outer_vbox.maximal(grid)
|
99
|
+
@window.add(outer_vbox)
|
100
|
+
@window.intelligent_exit
|
101
|
+
end
|
102
|
+
|
103
|
+
end; end; end; end
|
104
|
+
|
105
|
+
if __FILE__ == $PROGRAM_NAME
|
106
|
+
Roebe::GUI::LibUI::Shell.new
|
107
|
+
end
|
@@ -1,601 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# === Roebe::GUI::Gtk::ShellModule
|
6
|
-
#
|
7
|
-
# This specialized widgets tries to leverage the power of the
|
8
|
-
# Roebe::Shell in a graphical manner.
|
9
|
-
# =========================================================================== #
|
10
|
-
# require 'roebe/gui/shared_code/shell/shell_module.rb'
|
11
|
-
# include Roebe::GUI::Gtk::ShellModule
|
12
|
-
# =========================================================================== #
|
13
|
-
require 'roebe/gui/shared_code/shell/constants.rb'
|
14
|
-
require 'roebe/gui/shared_code/shell/connect_skeleton.rb'
|
15
|
-
|
16
|
-
module Roebe
|
17
|
-
|
18
|
-
module GUI
|
19
|
-
|
20
|
-
module Gtk
|
21
|
-
|
22
|
-
module ShellModule
|
23
|
-
|
24
|
-
require 'gtk_paradise/requires/require_the_base_module.rb'
|
25
|
-
include ::Gtk::BaseModule
|
26
|
-
|
27
|
-
require 'gtk_paradise/widgets/gtk3/button_xorg_buffer/button_xorg_buffer.rb'
|
28
|
-
|
29
|
-
# ========================================================================= #
|
30
|
-
# === Gtk::Shell.width?
|
31
|
-
# ========================================================================= #
|
32
|
-
def self.width?
|
33
|
-
WIDTH
|
34
|
-
end
|
35
|
-
|
36
|
-
# ========================================================================= #
|
37
|
-
# === Gtk::Shell.height?
|
38
|
-
# ========================================================================= #
|
39
|
-
def self.height?
|
40
|
-
HEIGHT
|
41
|
-
end
|
42
|
-
|
43
|
-
# ========================================================================= #
|
44
|
-
# === initialize
|
45
|
-
# ========================================================================= #
|
46
|
-
def initialize(
|
47
|
-
commandline_arguments = ARGV,
|
48
|
-
run_already = true
|
49
|
-
)
|
50
|
-
super()
|
51
|
-
set_commandline_arguments(
|
52
|
-
commandline_arguments.reject {|entry| entry.start_with?('--') }
|
53
|
-
)
|
54
|
-
reset
|
55
|
-
set_title(TITLE) if respond_to? :set_title
|
56
|
-
label.set_markup(
|
57
|
-
%Q(<span weight="ultrabold" size="large" foreground="darkblue"> #{TITLE} </span>),
|
58
|
-
true
|
59
|
-
)
|
60
|
-
on_delete_event_quit_the_application
|
61
|
-
run if run_already
|
62
|
-
end
|
63
|
-
|
64
|
-
# ========================================================================= #
|
65
|
-
# === reset (reset tag)
|
66
|
-
# ========================================================================= #
|
67
|
-
def reset
|
68
|
-
reset_the_internal_variables
|
69
|
-
# ======================================================================= #
|
70
|
-
# === @configuration
|
71
|
-
# ======================================================================= #
|
72
|
-
@configuration = [true, __dir__, NAMESPACE]
|
73
|
-
# ======================================================================= #
|
74
|
-
# === @title
|
75
|
-
# ======================================================================= #
|
76
|
-
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
|
77
|
-
# ======================================================================= #
|
78
|
-
# === @can_we_left_mouse_button_click
|
79
|
-
# ======================================================================= #
|
80
|
-
@can_we_left_mouse_button_click = true
|
81
|
-
append_project_css_file
|
82
|
-
infer_the_size_automatically
|
83
|
-
end
|
84
|
-
|
85
|
-
# ======================================================================== #
|
86
|
-
# ==== add_status_message
|
87
|
-
#
|
88
|
-
# This method will simply add the status message to the statusbar.
|
89
|
-
# ======================================================================== #
|
90
|
-
def add_status_message(i)
|
91
|
-
case i
|
92
|
-
# ======================================================================= #
|
93
|
-
# === :clear
|
94
|
-
#
|
95
|
-
# This will simply empty the status-bar.
|
96
|
-
# ======================================================================= #
|
97
|
-
when :clear
|
98
|
-
i = EMPTY_STRING
|
99
|
-
# ======================================================================= #
|
100
|
-
# === :found_nothing
|
101
|
-
# ======================================================================= #
|
102
|
-
when :found_nothing
|
103
|
-
i = INPUT_WAS_NOT_FOUND
|
104
|
-
end
|
105
|
-
@statusbar.push(@statusbar_context_id, i)
|
106
|
-
# @statusbar.modify_foreground :crimson
|
107
|
-
# ^^^ this does not work, unfortunately. May have to revisit
|
108
|
-
# this at a later time.
|
109
|
-
end
|
110
|
-
|
111
|
-
# ======================================================================== #
|
112
|
-
# === evaluate_this_input_via_the_shell
|
113
|
-
#
|
114
|
-
# This method can be used to "send" input to the Roebe::Shell,
|
115
|
-
# without depending on the main loop {}.
|
116
|
-
#
|
117
|
-
# It will also modify the textview-widget on the bottom.
|
118
|
-
# ======================================================================== #
|
119
|
-
def evaluate_this_input_via_the_shell(
|
120
|
-
i = @entry_for_user_input.text
|
121
|
-
)
|
122
|
-
begin
|
123
|
-
@roebe_shell.evaluate_this_input(i)
|
124
|
-
set_content_for_the_textview_widget(last_result?)
|
125
|
-
rescue Exception => error
|
126
|
-
pp error
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# ======================================================================== #
|
131
|
-
# === do_require_the_roebe_shell
|
132
|
-
# ======================================================================== #
|
133
|
-
def do_require_the_roebe_shell
|
134
|
-
require 'roebe/requires/require_the_roebe_shell.rb'
|
135
|
-
end
|
136
|
-
|
137
|
-
# ======================================================================== #
|
138
|
-
# === instantiate_the_roebe_shell
|
139
|
-
#
|
140
|
-
# This method will instantiate a new Roebe::Shell. Currently,
|
141
|
-
# Roebe::Shell embedded in ruby-gtk will not use readline nor
|
142
|
-
# colours.
|
143
|
-
# ======================================================================== #
|
144
|
-
def instantiate_the_roebe_shell
|
145
|
-
@roebe_shell = ::Roebe::Shell.new { :do_not_enter_the_main_loop }
|
146
|
-
@roebe_shell.do_not_use_readline
|
147
|
-
@roebe_shell.disable_colours # For now we will disable them.
|
148
|
-
end
|
149
|
-
|
150
|
-
# ======================================================================== #
|
151
|
-
# === set_content_for_the_textview_widget
|
152
|
-
# ======================================================================== #
|
153
|
-
def set_content_for_the_textview_widget(
|
154
|
-
i = last_result?
|
155
|
-
)
|
156
|
-
i = ::Colours.remove_escape_sequences(i.dup).to_s
|
157
|
-
@text_buffer.set_text(i)
|
158
|
-
end; alias update_the_textview_widget_with_this_content set_content_for_the_textview_widget # === update_the_textview_widget_with_this_content
|
159
|
-
|
160
|
-
# ========================================================================= #
|
161
|
-
# === create_the_text_buffer_and_the_text_view
|
162
|
-
# ========================================================================= #
|
163
|
-
def create_the_text_buffer_and_the_text_view
|
164
|
-
@text_buffer = gtk_text_buffer
|
165
|
-
@text_view = gtk_text_view(@text_buffer)
|
166
|
-
@text_view.set_editable(true)
|
167
|
-
@text_view.visible_cursor
|
168
|
-
end
|
169
|
-
|
170
|
-
# ======================================================================== #
|
171
|
-
# === last_result?
|
172
|
-
# ======================================================================== #
|
173
|
-
def last_result?
|
174
|
-
@roebe_shell.last_result?
|
175
|
-
end
|
176
|
-
|
177
|
-
# ======================================================================== #
|
178
|
-
# === roebe_shell?
|
179
|
-
# ======================================================================== #
|
180
|
-
def roebe_shell?
|
181
|
-
@roebe_shell
|
182
|
-
end
|
183
|
-
|
184
|
-
# ========================================================================= #
|
185
|
-
# === focus_on_the_user_input_gtk_entry
|
186
|
-
# ========================================================================= #
|
187
|
-
def focus_on_the_user_input_gtk_entry
|
188
|
-
@entry_for_user_input.do_focus
|
189
|
-
end
|
190
|
-
|
191
|
-
# ======================================================================== #
|
192
|
-
# === padding?
|
193
|
-
# ======================================================================== #
|
194
|
-
def padding?
|
195
|
-
10
|
196
|
-
end
|
197
|
-
|
198
|
-
# ========================================================================= #
|
199
|
-
# === border_size?
|
200
|
-
# ========================================================================= #
|
201
|
-
def border_size?
|
202
|
-
2
|
203
|
-
end
|
204
|
-
|
205
|
-
# ======================================================================== #
|
206
|
-
# === create_the_bottom_widget
|
207
|
-
# ======================================================================== #
|
208
|
-
def create_the_bottom_widget
|
209
|
-
@bottom_widget = gtk_vbox
|
210
|
-
end
|
211
|
-
|
212
|
-
# ========================================================================= #
|
213
|
-
# === focus_on_the_bottom_widget
|
214
|
-
# ========================================================================= #
|
215
|
-
def focus_on_the_bottom_widget
|
216
|
-
@text_view.do_focus
|
217
|
-
end
|
218
|
-
|
219
|
-
# ======================================================================== #
|
220
|
-
# === create_then_return_statusbar (status tag)
|
221
|
-
# ======================================================================== #
|
222
|
-
def create_then_return_statusbar
|
223
|
-
@statusbar = gtk_statusbar
|
224
|
-
if @statusbar.respond_to? :has_resize_grip=
|
225
|
-
@statusbar.has_resize_grip = true
|
226
|
-
end
|
227
|
-
@statusbar_context_id = @statusbar.get_context_id('statusbar_gtk_shell')
|
228
|
-
return @statusbar
|
229
|
-
end
|
230
|
-
|
231
|
-
# ======================================================================== #
|
232
|
-
# === deselect_and_select_relevant_widgets
|
233
|
-
# ======================================================================== #
|
234
|
-
def deselect_and_select_relevant_widgets
|
235
|
-
Thread.new {
|
236
|
-
sleep 0.05
|
237
|
-
@label_title.deselect
|
238
|
-
@entry_for_user_input.do_focus
|
239
|
-
}
|
240
|
-
end
|
241
|
-
|
242
|
-
# ========================================================================= #
|
243
|
-
# === create_skeleton
|
244
|
-
# ========================================================================= #
|
245
|
-
def create_skeleton
|
246
|
-
create_the_directory_content_widget
|
247
|
-
create_the_top_widget
|
248
|
-
create_the_bottom_widget
|
249
|
-
create_gtk_entries
|
250
|
-
create_the_text_buffer_and_the_text_view # Must come before create_scrolled_window().
|
251
|
-
create_scrolled_window
|
252
|
-
create_the_eventbox
|
253
|
-
create_the_button_xorg_buffer
|
254
|
-
create_the_combo_box
|
255
|
-
create_the_modified_scrolled_window
|
256
|
-
instantiate_a_flexible_vte
|
257
|
-
end
|
258
|
-
|
259
|
-
# ========================================================================= #
|
260
|
-
# === create_the_combo_box
|
261
|
-
# ========================================================================= #
|
262
|
-
def create_the_combo_box
|
263
|
-
# ======================================================================= #
|
264
|
-
# Create a combo-box next.
|
265
|
-
# ======================================================================= #
|
266
|
-
array = []
|
267
|
-
begin
|
268
|
-
require 'case_parser'
|
269
|
-
array << CaseParser.parse(
|
270
|
-
'$RUBY_SRC/roebe/lib/roebe/shell/core/menu.rb'
|
271
|
-
)
|
272
|
-
array.flatten!
|
273
|
-
array.reject! {|entry| entry.to_s.empty? }
|
274
|
-
rescue LoadError; end
|
275
|
-
@combo_box_with_useful_commands_from_the_case_when_menu = return_combo_box_entry(array)
|
276
|
-
@combo_box_with_useful_commands_from_the_case_when_menu.set_font(:hack_18)
|
277
|
-
@combo_box_with_useful_commands_from_the_case_when_menu.focus_on_the_first_element
|
278
|
-
@combo_box_with_useful_commands_from_the_case_when_menu.on_changed {
|
279
|
-
if @combo_box_with_useful_commands_from_the_case_when_menu.active_iter
|
280
|
-
@entry_for_user_input.set_text(
|
281
|
-
@combo_box_with_useful_commands_from_the_case_when_menu.active_text+' '
|
282
|
-
)
|
283
|
-
end
|
284
|
-
}
|
285
|
-
end
|
286
|
-
|
287
|
-
# ========================================================================= #
|
288
|
-
# === create_the_button_xorg_buffer
|
289
|
-
# ========================================================================= #
|
290
|
-
def create_the_button_xorg_buffer
|
291
|
-
# ======================================================================= #
|
292
|
-
# Create the assign-to-xorg button next:
|
293
|
-
# ======================================================================= #
|
294
|
-
@button_xorg_buffer = ::Gtk::ButtonXorgBuffer.new(@text_buffer) { :split }
|
295
|
-
end
|
296
|
-
|
297
|
-
# ========================================================================= #
|
298
|
-
# === create_the_eventbox
|
299
|
-
# ========================================================================= #
|
300
|
-
def create_the_eventbox
|
301
|
-
label_current_working_directory = gtk_bold_label('Current working directory → ')
|
302
|
-
@eventbox_label_current_working_directory = gtk_eventbox(
|
303
|
-
label_current_working_directory
|
304
|
-
)
|
305
|
-
# ======================================================================= #
|
306
|
-
# === Handle left-mouse-button click events
|
307
|
-
#
|
308
|
-
# Let the eventbox respond to left-mouse-click, and then update the
|
309
|
-
# widget that displays the current working directory.
|
310
|
-
#
|
311
|
-
# We will, however had, add a 3 seconds delay after such a click
|
312
|
-
# event.
|
313
|
-
# ======================================================================= #
|
314
|
-
@eventbox_label_current_working_directory.signal_connect(:event) { |widget, event|
|
315
|
-
if use_gtk2?
|
316
|
-
case event.event_type
|
317
|
-
when Gdk::Event::BUTTON_PRESS
|
318
|
-
update_the_current_working_directory
|
319
|
-
end
|
320
|
-
else
|
321
|
-
case event.event_type
|
322
|
-
when Gdk::EventType::BUTTON_PRESS
|
323
|
-
update_the_current_working_directory
|
324
|
-
end
|
325
|
-
end
|
326
|
-
}
|
327
|
-
end
|
328
|
-
|
329
|
-
# ========================================================================= #
|
330
|
-
# === create_the_top_widget
|
331
|
-
# ========================================================================= #
|
332
|
-
def create_the_top_widget
|
333
|
-
@top_widget = gtk_vbox
|
334
|
-
end
|
335
|
-
|
336
|
-
# ========================================================================= #
|
337
|
-
# === create_scrolled_window
|
338
|
-
#
|
339
|
-
# This is the buffer that contains all output from the roebe-shell.
|
340
|
-
# ========================================================================= #
|
341
|
-
def create_scrolled_window
|
342
|
-
@scrolled_window_containing_the_text_view = gtk_scrolled_window(@text_view) { :always }
|
343
|
-
@scrolled_window_containing_the_text_view.set_size_request(500, 500)
|
344
|
-
end
|
345
|
-
|
346
|
-
# ========================================================================= #
|
347
|
-
# === return_the_bottom_widget_finally
|
348
|
-
# ========================================================================= #
|
349
|
-
def return_the_bottom_widget_finally
|
350
|
-
return @bottom_widget
|
351
|
-
end
|
352
|
-
|
353
|
-
# ========================================================================= #
|
354
|
-
# === create_the_modified_scrolled_window
|
355
|
-
# ========================================================================= #
|
356
|
-
def create_the_modified_scrolled_window
|
357
|
-
# ======================================================================= #
|
358
|
-
# The tiny-vbox is on the right side.
|
359
|
-
# ======================================================================= #
|
360
|
-
tiny_vbox = gtk_vbox
|
361
|
-
tiny_vbox.minimal(@button_xorg_buffer)
|
362
|
-
tiny_vbox.minimal(@combo_box_with_useful_commands_from_the_case_when_menu)
|
363
|
-
|
364
|
-
@drag_top_to_bottom_pane = gtk_drag_top_to_bottom_pane(
|
365
|
-
@scrolled_window_containing_the_text_view,
|
366
|
-
tiny_vbox
|
367
|
-
)
|
368
|
-
@drag_top_to_bottom_pane.position = 1280
|
369
|
-
end
|
370
|
-
|
371
|
-
# ========================================================================= #
|
372
|
-
# === update_the_current_working_directory
|
373
|
-
#
|
374
|
-
# This method will merely modify the working-directory Gtk::Entry.
|
375
|
-
# ========================================================================= #
|
376
|
-
def update_the_current_working_directory(
|
377
|
-
use_this_directory = return_pwd
|
378
|
-
)
|
379
|
-
@entry_showing_the_current_working_directory.set_text(
|
380
|
-
use_this_directory
|
381
|
-
)
|
382
|
-
@directory_content_widget.set_pwd(use_this_directory)
|
383
|
-
end
|
384
|
-
|
385
|
-
# ========================================================================= #
|
386
|
-
# === set_pwd
|
387
|
-
# ========================================================================= #
|
388
|
-
def set_pwd(
|
389
|
-
i = @entry_showing_the_current_working_directory.text
|
390
|
-
)
|
391
|
-
evaluate_this_input_via_the_shell(i)
|
392
|
-
_ = roebe_shell?.return_pwd.to_s # Must come after the ^^^ above.
|
393
|
-
@entry_showing_the_current_working_directory.set_text(_)
|
394
|
-
update_the_textview_widget_with_this_content(_)
|
395
|
-
end
|
396
|
-
|
397
|
-
# ======================================================================== #
|
398
|
-
# === return_title
|
399
|
-
#
|
400
|
-
# This main header will also make use of "header1".
|
401
|
-
# ======================================================================== #
|
402
|
-
def return_title
|
403
|
-
_ = gtk_label("☘️ #{TITLE} ☘️") # The old symbol was the fruit-emoji, aka '🌹'.
|
404
|
-
return _
|
405
|
-
end
|
406
|
-
|
407
|
-
# ======================================================================== #
|
408
|
-
# === create_the_title_label
|
409
|
-
# ======================================================================== #
|
410
|
-
def create_the_title_label
|
411
|
-
@label_title = return_title
|
412
|
-
@label_title.set_name('header3')
|
413
|
-
@label_title.make_selectable
|
414
|
-
end
|
415
|
-
|
416
|
-
require 'gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb'
|
417
|
-
# ======================================================================== #
|
418
|
-
# === instantiate_a_flexible_vte
|
419
|
-
# ======================================================================== #
|
420
|
-
def instantiate_a_flexible_vte
|
421
|
-
# ====================================================================== #
|
422
|
-
# === @vte
|
423
|
-
# ====================================================================== #
|
424
|
-
# @vte = ::Gtk::FlexibleVte.new {{ n_tabs: 3 }}
|
425
|
-
end
|
426
|
-
|
427
|
-
# ======================================================================== #
|
428
|
-
# === run (run tag)
|
429
|
-
# ======================================================================== #
|
430
|
-
def run
|
431
|
-
do_require_the_roebe_shell
|
432
|
-
instantiate_the_roebe_shell
|
433
|
-
create_skeleton_then_connect_skeleton
|
434
|
-
show_all
|
435
|
-
deselect_and_select_relevant_widgets
|
436
|
-
end
|
437
|
-
|
438
|
-
# ======================================================================== #
|
439
|
-
# === report_return_date
|
440
|
-
# ======================================================================== #
|
441
|
-
def report_return_date
|
442
|
-
main_entry?.set_text(__method__.to_s)
|
443
|
-
do_click_the_main_button
|
444
|
-
end
|
445
|
-
|
446
|
-
# ======================================================================== #
|
447
|
-
# === show_path_in_use
|
448
|
-
# ======================================================================== #
|
449
|
-
def show_path_in_use
|
450
|
-
set_text_in_the_main_entry_then_click_the_main_button(__method__.to_s)
|
451
|
-
end
|
452
|
-
|
453
|
-
# ======================================================================== #
|
454
|
-
# === set_text_in_the_main_entry_then_click_the_main_button
|
455
|
-
# ======================================================================== #
|
456
|
-
def set_text_in_the_main_entry_then_click_the_main_button(i)
|
457
|
-
main_entry?.set_text(i.to_s)
|
458
|
-
do_click_the_main_button
|
459
|
-
end
|
460
|
-
|
461
|
-
# ======================================================================== #
|
462
|
-
# === main_entry?
|
463
|
-
# ======================================================================== #
|
464
|
-
def main_entry?
|
465
|
-
@entry_for_user_input
|
466
|
-
end
|
467
|
-
|
468
|
-
# ======================================================================== #
|
469
|
-
# === do_evaluate_the_main_entry
|
470
|
-
# ======================================================================== #
|
471
|
-
def do_evaluate_the_main_entry
|
472
|
-
evaluate_this_input_via_the_shell(@entry_for_user_input.text)
|
473
|
-
update_the_current_working_directory
|
474
|
-
if roebe_shell?.menu_found_no_match?
|
475
|
-
add_status_message(:found_nothing)
|
476
|
-
else
|
477
|
-
add_status_message(:clear)
|
478
|
-
end
|
479
|
-
end; alias do_click_the_main_button do_evaluate_the_main_entry # === do_click_the_main_button
|
480
|
-
|
481
|
-
# ========================================================================= #
|
482
|
-
# === create_the_directory_content_widget
|
483
|
-
# ========================================================================= #
|
484
|
-
def create_the_directory_content_widget
|
485
|
-
# ======================================================================= #
|
486
|
-
# The directory-content-widget comes next.
|
487
|
-
# ======================================================================= #
|
488
|
-
@directory_content_widget = directory_content_widget
|
489
|
-
@directory_content_widget.bblack2
|
490
|
-
end
|
491
|
-
|
492
|
-
# ========================================================================= #
|
493
|
-
# === Roebe::GUI::Gtk::ShellModule.run
|
494
|
-
#
|
495
|
-
# This is the variant that can be "run" directly.
|
496
|
-
# ========================================================================= #
|
497
|
-
def self.run
|
498
|
-
require 'gtk_paradise/run'
|
499
|
-
_ = ::Roebe::GUI::Gtk::Shell.new
|
500
|
-
r = ::Gtk.run
|
501
|
-
r << _
|
502
|
-
@accel_group = ::Gtk::AccelGroup.new
|
503
|
-
# ======================================================================= #
|
504
|
-
# === Alt+1
|
505
|
-
#
|
506
|
-
# Alt+1 will focus on the gtk-entry, the main user input.
|
507
|
-
# ======================================================================= #
|
508
|
-
if ::Gtk.use_gtk2?
|
509
|
-
use_this_key = Gdk::Keyval::GDK_1
|
510
|
-
else
|
511
|
-
use_this_key = Gdk::Keyval::KEY_1
|
512
|
-
end
|
513
|
-
@accel_group.alt_key(use_this_key) {
|
514
|
-
_.focus_on_the_user_input_gtk_entry
|
515
|
-
}
|
516
|
-
# ======================================================================= #
|
517
|
-
# === Alt+2
|
518
|
-
# ======================================================================= #
|
519
|
-
if ::Gtk.use_gtk2?
|
520
|
-
use_this_key = Gdk::Keyval::GDK_2
|
521
|
-
else
|
522
|
-
use_this_key = Gdk::Keyval::KEY_2
|
523
|
-
end
|
524
|
-
@accel_group.alt_key(use_this_key) {
|
525
|
-
_.focus_on_the_bottom_widget
|
526
|
-
}
|
527
|
-
r.add_accel_group(@accel_group)
|
528
|
-
_.set_parent_widget(r) # Must designate the parent-widget first.
|
529
|
-
# ====================================================================== #
|
530
|
-
# Enable additional key-combinations next:
|
531
|
-
# ====================================================================== #
|
532
|
-
_.enable_these_key_combinations(
|
533
|
-
::Roebe::GUI::Gtk::ShellModule::HASH_DESIGNATED_KEY_COMBINATIONS
|
534
|
-
)
|
535
|
-
r.automatic_title
|
536
|
-
r.automatic_size
|
537
|
-
r.set_background :white
|
538
|
-
r.top_left_then_run
|
539
|
-
end
|
540
|
-
|
541
|
-
# ========================================================================= #
|
542
|
-
# === create_gtk_entries (entry tag, entries tag)
|
543
|
-
# ========================================================================= #
|
544
|
-
def create_gtk_entries
|
545
|
-
# ======================================================================= #
|
546
|
-
# === User input entry
|
547
|
-
#
|
548
|
-
# First we will create the gtk-entry that contains the user input.
|
549
|
-
# ======================================================================= #
|
550
|
-
@entry_for_user_input = gtk_entry
|
551
|
-
@entry_for_user_input.set_activates_default(true)
|
552
|
-
@entry_for_user_input.fancy_tooltips = 'Input your <b>commands</b> here.'
|
553
|
-
@entry_for_user_input.do_focus
|
554
|
-
@entry_for_user_input.css_class('BG_gainsboro')
|
555
|
-
@entry_for_user_input.bblack1
|
556
|
-
@entry_for_user_input.border(
|
557
|
-
PADDING_TO_USE_FOR_THE_USER_INPUT,
|
558
|
-
PADDING_TO_USE_FOR_THE_USER_INPUT,
|
559
|
-
PADDING_TO_USE_FOR_THE_USER_INPUT,
|
560
|
-
PADDING_TO_USE_FOR_THE_USER_INPUT
|
561
|
-
) # ^^^ A smallish "border" is visually nicer, in my opinion.
|
562
|
-
unless @commandline_arguments.empty?
|
563
|
-
# ===================================================================== #
|
564
|
-
# Assign the commandline arguments to the input-box next:
|
565
|
-
# ===================================================================== #
|
566
|
-
@entry_for_user_input.set_text(
|
567
|
-
@commandline_arguments.join(' ').strip
|
568
|
-
)
|
569
|
-
if is_on_roebe?
|
570
|
-
@entry_for_user_input.signal_emit(:activate)
|
571
|
-
end
|
572
|
-
end
|
573
|
-
@entry_for_user_input.signal_connect(:activate) { |widget|
|
574
|
-
do_evaluate_the_main_entry
|
575
|
-
}
|
576
|
-
# ======================================================================= #
|
577
|
-
# === @entry_showing_the_current_working_directory
|
578
|
-
#
|
579
|
-
# Next comes the entry that will show the current working directory.
|
580
|
-
# ======================================================================= #
|
581
|
-
@entry_showing_the_current_working_directory = gtk_entry
|
582
|
-
@entry_showing_the_current_working_directory.bblack1
|
583
|
-
@entry_showing_the_current_working_directory.very_light_yellowish_background
|
584
|
-
@entry_showing_the_current_working_directory.on_key_press_event { |widget, event|
|
585
|
-
# ===================================================================== #
|
586
|
-
# Handle the "enter" key next, as well as the "return" key.
|
587
|
-
# ===================================================================== #
|
588
|
-
_ = Gdk::Keyval.to_name(event.keyval)
|
589
|
-
case _
|
590
|
-
when 'Return','KP_Enter'
|
591
|
-
set_pwd(
|
592
|
-
@entry_showing_the_current_working_directory.text
|
593
|
-
)
|
594
|
-
update_the_current_working_directory
|
595
|
-
# else
|
596
|
-
# pp _
|
597
|
-
end
|
598
|
-
}
|
599
|
-
end
|
600
|
-
|
601
|
-
end; end; end; end
|