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
@@ -72,6 +72,10 @@ class Run < Base # === Roebe::Run
|
|
72
72
|
# === :do_use_a_native_image
|
73
73
|
# ======================================================================= #
|
74
74
|
@internal_hash[:do_use_a_native_image] = false
|
75
|
+
# ======================================================================= #
|
76
|
+
# === @consider_appending_this
|
77
|
+
# ======================================================================= #
|
78
|
+
@consider_appending_this = ''.dup
|
75
79
|
end
|
76
80
|
|
77
81
|
# ========================================================================= #
|
@@ -178,6 +182,11 @@ class Run < Base # === Roebe::Run
|
|
178
182
|
def act_based_on_this_extension(extname)
|
179
183
|
case extname # case tag
|
180
184
|
# ======================================================================= #
|
185
|
+
# === rb
|
186
|
+
# ======================================================================= #
|
187
|
+
when 'rb'
|
188
|
+
run_this_ruby_file(@this_file)
|
189
|
+
# ======================================================================= #
|
181
190
|
# === nim
|
182
191
|
# ======================================================================= #
|
183
192
|
when 'nim'
|
@@ -223,6 +232,7 @@ class Run < Base # === Roebe::Run
|
|
223
232
|
when 'cs'
|
224
233
|
compile_this_csharp_file_then_run_it(@this_file)
|
225
234
|
else
|
235
|
+
opnn
|
226
236
|
e rev+'The extension for '+
|
227
237
|
sfile(@this_file)+' is not known/registered.'
|
228
238
|
end
|
@@ -258,15 +268,6 @@ class Run < Base # === Roebe::Run
|
|
258
268
|
try_to_run_the_compiled_file
|
259
269
|
end
|
260
270
|
|
261
|
-
# ========================================================================= #
|
262
|
-
# === java_compile
|
263
|
-
# ========================================================================= #
|
264
|
-
def java_compile(i)
|
265
|
-
esystem(
|
266
|
-
"javac #{i}", :do_colourize
|
267
|
-
) { :colourize_first_word_differently }
|
268
|
-
end
|
269
|
-
|
270
271
|
# ========================================================================= #
|
271
272
|
# === compile_this_crystal_file_then_run_it (crystal tag)
|
272
273
|
# ========================================================================= #
|
@@ -275,64 +276,6 @@ class Run < Base # === Roebe::Run
|
|
275
276
|
try_to_run_the_compiled_file(i)
|
276
277
|
end
|
277
278
|
|
278
|
-
# ========================================================================= #
|
279
|
-
# === try_to_run_the_compiled_file
|
280
|
-
#
|
281
|
-
# This method will attempt to run the file a.out or whatever is stored
|
282
|
-
# in @store_as_this_name.
|
283
|
-
# ========================================================================= #
|
284
|
-
def try_to_run_the_compiled_file(
|
285
|
-
i = @store_as_this_name
|
286
|
-
)
|
287
|
-
if File.exist?(i) and i.end_with?('.exe')
|
288
|
-
# ===================================================================== #
|
289
|
-
# Assume mono in this case.
|
290
|
-
# ===================================================================== #
|
291
|
-
esystem "mono #{i}"
|
292
|
-
elsif File.exist? i
|
293
|
-
# ===================================================================== #
|
294
|
-
# Ad-hoc remove .cr extensions.
|
295
|
-
# ===================================================================== #
|
296
|
-
i.delete_suffix!('.cr') if i.end_with? '.cr'
|
297
|
-
esystem "./#{i}"
|
298
|
-
# ======================================================================= #
|
299
|
-
# === Java variant
|
300
|
-
#
|
301
|
-
# Run the java-variant of the file. Assertions are supported since
|
302
|
-
# as of May 2020.
|
303
|
-
# ======================================================================= #
|
304
|
-
elsif File.exist? "#{i}.java"
|
305
|
-
# cmd = "java #{return_camelcase_of(i)}"
|
306
|
-
cmd = "java".dup
|
307
|
-
dataset = File.read("#{i}.java")
|
308
|
-
if dataset.include? 'assert ' # ← This is assumed to be an assertion then.
|
309
|
-
cmd << ' -enableassertions'
|
310
|
-
end
|
311
|
-
cmd << " #{i}"
|
312
|
-
e steelblue(cmd)
|
313
|
-
e
|
314
|
-
system cmd
|
315
|
-
# ======================================================================= #
|
316
|
-
# === Handle c-sharp files next
|
317
|
-
# ======================================================================= #
|
318
|
-
elsif File.exist? "#{i}.cs"
|
319
|
-
cmd = "mono #{i}"
|
320
|
-
e steelblue(cmd)
|
321
|
-
e
|
322
|
-
system cmd
|
323
|
-
# ======================================================================= #
|
324
|
-
# Run the python file.
|
325
|
-
# ======================================================================= #
|
326
|
-
elsif File.exist? "#{i}.py"
|
327
|
-
cmd = "python #{i}"
|
328
|
-
e steelblue(cmd)
|
329
|
-
e
|
330
|
-
system cmd
|
331
|
-
else
|
332
|
-
e "No file `#{sfile(i)}` was found."
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
279
|
# ========================================================================= #
|
337
280
|
# === verbose_exit_unless_javac_could_be_found
|
338
281
|
# ========================================================================= #
|
@@ -372,14 +315,6 @@ class Run < Base # === Roebe::Run
|
|
372
315
|
@internal_hash[:do_use_a_native_image] = true
|
373
316
|
end
|
374
317
|
|
375
|
-
# ========================================================================= #
|
376
|
-
# === compile_this_java_file_then_run_it (java tag)
|
377
|
-
# ========================================================================= #
|
378
|
-
def compile_this_java_file_then_run_it(i)
|
379
|
-
verbose_compile_this_file(i)
|
380
|
-
try_to_run_the_compiled_file unless do_use_a_native_image?
|
381
|
-
end
|
382
|
-
|
383
318
|
# ========================================================================= #
|
384
319
|
# === compile_this_nim_file_then_run_it (nim tag)
|
385
320
|
# ========================================================================= #
|
@@ -495,6 +430,53 @@ class Run < Base # === Roebe::Run
|
|
495
430
|
return result
|
496
431
|
end
|
497
432
|
|
433
|
+
# ========================================================================= #
|
434
|
+
# === compile_this_cfdg_file_and_then_show_it_in_the_browser
|
435
|
+
#
|
436
|
+
# This method adds support for .cfdg files.
|
437
|
+
# ========================================================================= #
|
438
|
+
def compile_this_cfdg_file_and_then_show_it_in_the_browser(
|
439
|
+
i = @this_file,
|
440
|
+
use_this_width = 850
|
441
|
+
)
|
442
|
+
store_here = ENV['HOME'].to_s+
|
443
|
+
'/image_paradise/output.png'
|
444
|
+
cmd_to_run = 'cfdg '+i+' --bordersize=1 -w '+use_this_width.to_s+' -h 450 '+store_here
|
445
|
+
esystem(cmd_to_run)
|
446
|
+
if File.exist? store_here
|
447
|
+
require 'open'
|
448
|
+
Open.in_browser(store_here)
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
# ========================================================================= #
|
453
|
+
# === check_for_macros_in (macro tag)
|
454
|
+
#
|
455
|
+
# This method can check for some "macros".
|
456
|
+
# ========================================================================= #
|
457
|
+
def check_for_macros_in(
|
458
|
+
i = @file_content
|
459
|
+
)
|
460
|
+
if i.include?('STORE_AS_DEFAULT') or
|
461
|
+
i.include?('USE_FILENAME') or
|
462
|
+
i.include?('SAVE_AS_IS')
|
463
|
+
@store_as_this_name = remove_file_extension_of(File.basename(which_file?))
|
464
|
+
elsif i.include? 'STORE_AS'
|
465
|
+
@store_as_this_name = i.scan(/STORE_AS (.+)/).flatten.first
|
466
|
+
elsif i.include? 'NAME_IS'
|
467
|
+
@store_as_this_name = i.scan(/NAME_IS (.+)/).flatten.first
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
# ========================================================================= #
|
472
|
+
# === java_compile
|
473
|
+
# ========================================================================= #
|
474
|
+
def java_compile(i)
|
475
|
+
esystem(
|
476
|
+
"javac #{i}", :do_colourize
|
477
|
+
) { :colourize_first_word_differently }
|
478
|
+
end
|
479
|
+
|
498
480
|
# ========================================================================= #
|
499
481
|
# === verbose_compile_this_file (compile tag)
|
500
482
|
#
|
@@ -560,9 +542,16 @@ class Run < Base # === Roebe::Run
|
|
560
542
|
end
|
561
543
|
end
|
562
544
|
# compile_flags = check_for_compile_flags_specified_in_the_given_file
|
563
|
-
consider_appending_this = check_for_compile_flags_specified_in_the_given_file
|
545
|
+
@consider_appending_this = check_for_compile_flags_specified_in_the_given_file.to_s.dup
|
564
546
|
# ^^^ For now we don't have to do anything special.
|
565
547
|
# ======================================================================= #
|
548
|
+
# Check for Java and JavaFX next.
|
549
|
+
# ======================================================================= #
|
550
|
+
if (extension_name == 'java') and
|
551
|
+
File.read(i).include?('import javafx')
|
552
|
+
@consider_appending_this << ' --module-path $JAVAFX_HOME --add-modules javafx.controls,javafx.fxml'
|
553
|
+
end
|
554
|
+
# ======================================================================= #
|
566
555
|
# Compile as a certain name:
|
567
556
|
# ======================================================================= #
|
568
557
|
case extension_name
|
@@ -579,51 +568,87 @@ class Run < Base # === Roebe::Run
|
|
579
568
|
# ===================================================================== #
|
580
569
|
_ << " -o #{@store_as_this_name}" unless is_on_windows?
|
581
570
|
end
|
582
|
-
if consider_appending_this
|
583
|
-
_ << " #{consider_appending_this}"
|
571
|
+
if @consider_appending_this and !@consider_appending_this.empty?
|
572
|
+
_ << " #{@consider_appending_this}"
|
584
573
|
end
|
585
574
|
_.squeeze!(' ') # ← Squeeze away extra ' ' characters.
|
586
575
|
esystem(_, :do_colourize) { :colourize_first_word_differently }
|
587
576
|
end
|
588
577
|
|
589
578
|
# ========================================================================= #
|
590
|
-
# ===
|
591
|
-
#
|
592
|
-
# This method adds support for .cfdg files.
|
579
|
+
# === compile_this_java_file_then_run_it (java tag)
|
593
580
|
# ========================================================================= #
|
594
|
-
def
|
595
|
-
|
596
|
-
|
597
|
-
)
|
598
|
-
store_here = ENV['HOME'].to_s+
|
599
|
-
'/image_paradise/output.png'
|
600
|
-
cmd_to_run = 'cfdg '+i+' --bordersize=1 -w '+use_this_width.to_s+' -h 450 '+store_here
|
601
|
-
esystem(cmd_to_run)
|
602
|
-
if File.exist? store_here
|
603
|
-
require 'open'
|
604
|
-
Open.in_browser(store_here)
|
605
|
-
end
|
581
|
+
def compile_this_java_file_then_run_it(i)
|
582
|
+
verbose_compile_this_file(i)
|
583
|
+
try_to_run_the_compiled_file unless do_use_a_native_image?
|
606
584
|
end
|
607
585
|
|
608
586
|
# ========================================================================= #
|
609
|
-
# ===
|
587
|
+
# === try_to_run_the_compiled_file
|
610
588
|
#
|
611
|
-
# This method
|
589
|
+
# This method will attempt to run the file a.out or whatever is stored
|
590
|
+
# in @store_as_this_name.
|
612
591
|
# ========================================================================= #
|
613
|
-
def
|
614
|
-
i = @
|
592
|
+
def try_to_run_the_compiled_file(
|
593
|
+
i = @store_as_this_name
|
615
594
|
)
|
616
|
-
if i.
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
595
|
+
if File.exist?(i) and i.end_with?('.exe')
|
596
|
+
# ===================================================================== #
|
597
|
+
# Assume mono in this case.
|
598
|
+
# ===================================================================== #
|
599
|
+
esystem "mono #{i}"
|
600
|
+
elsif File.exist? i
|
601
|
+
# ===================================================================== #
|
602
|
+
# Ad-hoc remove .cr extensions.
|
603
|
+
# ===================================================================== #
|
604
|
+
i.delete_suffix!('.cr') if i.end_with? '.cr'
|
605
|
+
esystem "./#{i}"
|
606
|
+
# ======================================================================= #
|
607
|
+
# === Java variant
|
608
|
+
#
|
609
|
+
# Run the java-variant of the file. Assertions are supported since
|
610
|
+
# as of May 2020.
|
611
|
+
# ======================================================================= #
|
612
|
+
elsif File.exist? "#{i}.java"
|
613
|
+
# cmd = "java #{return_camelcase_of(i)}"
|
614
|
+
cmd = "java".dup
|
615
|
+
dataset = File.read("#{i}.java")
|
616
|
+
if dataset.include? 'assert ' # ← This is assumed to be an assertion then.
|
617
|
+
cmd << ' -enableassertions'
|
618
|
+
end
|
619
|
+
cmd << @consider_appending_this unless @consider_appending_this.empty?
|
620
|
+
cmd << " #{i}"
|
621
|
+
e steelblue(cmd)
|
622
|
+
e
|
623
|
+
system cmd
|
624
|
+
# ======================================================================= #
|
625
|
+
# === Handle c-sharp files next
|
626
|
+
# ======================================================================= #
|
627
|
+
elsif File.exist? "#{i}.cs"
|
628
|
+
cmd = "mono #{i}"
|
629
|
+
e steelblue(cmd)
|
630
|
+
e
|
631
|
+
system cmd
|
632
|
+
# ======================================================================= #
|
633
|
+
# Run the python file.
|
634
|
+
# ======================================================================= #
|
635
|
+
elsif File.exist? "#{i}.py"
|
636
|
+
cmd = "python #{i}"
|
637
|
+
e steelblue(cmd)
|
638
|
+
e
|
639
|
+
system cmd
|
640
|
+
else
|
641
|
+
e "No file `#{sfile(i)}` was found."
|
624
642
|
end
|
625
643
|
end
|
626
644
|
|
645
|
+
# ========================================================================= #
|
646
|
+
# === run_this_ruby_file
|
647
|
+
# ========================================================================= #
|
648
|
+
def run_this_ruby_file(i)
|
649
|
+
esystem "ruby #{i} &" # Run in background seems better for interactive shells.
|
650
|
+
end
|
651
|
+
|
627
652
|
# ========================================================================= #
|
628
653
|
# === Roebe::Run[]
|
629
654
|
# ========================================================================= #
|
@@ -239,7 +239,16 @@ class SymlinkFilesFromThatDirectoryToTheCurrentDirectory < Base # === Roebe::Sym
|
|
239
239
|
new(i)
|
240
240
|
end
|
241
241
|
|
242
|
-
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# =========================================================================== #
|
245
|
+
# === Roebe.symlink_files_from
|
246
|
+
# =========================================================================== #
|
247
|
+
def self.symlink_files_from(i = ARGV)
|
248
|
+
Roebe::SymlinkFilesFromThatDirectoryToTheCurrentDirectory.new(i)
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
243
252
|
|
244
253
|
if __FILE__ == $PROGRAM_NAME
|
245
254
|
Roebe::SymlinkFilesFromThatDirectoryToTheCurrentDirectory.new(ARGV)
|
@@ -21,11 +21,6 @@ class CurrentTimeInSingapore < Base # === Roebe::CurrentTimeInSingapore
|
|
21
21
|
|
22
22
|
require 'open-uri'
|
23
23
|
|
24
|
-
# ========================================================================= #
|
25
|
-
# === NAMESPACE
|
26
|
-
# ========================================================================= #
|
27
|
-
NAMESPACE = inspect
|
28
|
-
|
29
24
|
# ========================================================================= #
|
30
25
|
# === REMOTE_URL
|
31
26
|
# ========================================================================= #
|
@@ -53,6 +48,7 @@ class CurrentTimeInSingapore < Base # === Roebe::CurrentTimeInSingapore
|
|
53
48
|
# ========================================================================= #
|
54
49
|
def reset
|
55
50
|
super()
|
51
|
+
infer_the_namespace
|
56
52
|
set_time
|
57
53
|
end
|
58
54
|
|
@@ -124,7 +124,7 @@ class UmlautConverter < ::Roebe::Base # === Roebe::UmlautConverter
|
|
124
124
|
end
|
125
125
|
|
126
126
|
# ========================================================================= #
|
127
|
-
# === []
|
127
|
+
# === Roebe::UmlautConverter[]
|
128
128
|
# ========================================================================= #
|
129
129
|
def self.[](i = '')
|
130
130
|
new(i)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Roebe::UseJruby
|
6
|
+
#
|
7
|
+
# This class will simply switch to jruby, as-is.
|
8
|
+
#
|
9
|
+
# Usage example:
|
10
|
+
#
|
11
|
+
# Roebe::UseJruby.new(ARGV)
|
12
|
+
#
|
13
|
+
# =========================================================================== #
|
14
|
+
# require 'roebe/classes/use_jruby.rb'
|
15
|
+
# =========================================================================== #
|
16
|
+
require 'roebe/base/base.rb'
|
17
|
+
|
18
|
+
module Roebe
|
19
|
+
|
20
|
+
class UseJruby < ::Roebe::Base # === Roebe::UseJruby
|
21
|
+
|
22
|
+
begin
|
23
|
+
require 'rbt/toplevel_methods/programs_directory.rb'
|
24
|
+
rescue LoadError; end
|
25
|
+
|
26
|
+
require 'roebe/classes/symlink_files_from_that_directory_to_the_current_directory/symlink_files_from_that_directory_to_the_current_directory.rb'
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# === initialize
|
30
|
+
# ========================================================================= #
|
31
|
+
def initialize(
|
32
|
+
i = nil,
|
33
|
+
run_already = true
|
34
|
+
)
|
35
|
+
reset
|
36
|
+
set_input(i)
|
37
|
+
run if run_already
|
38
|
+
end
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === reset (reset tag)
|
42
|
+
# ========================================================================= #
|
43
|
+
def reset
|
44
|
+
super()
|
45
|
+
infer_the_namespace
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === run (run tag)
|
50
|
+
# ========================================================================= #
|
51
|
+
def run
|
52
|
+
_ = RBT.programs_directory?+'Jruby/Current/bin/'
|
53
|
+
cd '/usr/bin'
|
54
|
+
Roebe.symlink_files_from(_)
|
55
|
+
end
|
56
|
+
|
57
|
+
# ========================================================================= #
|
58
|
+
# === Roebe::UseJruby[]
|
59
|
+
# ========================================================================= #
|
60
|
+
def self.[](i = '')
|
61
|
+
new(i)
|
62
|
+
end
|
63
|
+
|
64
|
+
end; end
|
65
|
+
|
66
|
+
if __FILE__ == $PROGRAM_NAME
|
67
|
+
Roebe::UseJruby.new(ARGV)
|
68
|
+
end # usejruby
|
@@ -14,12 +14,6 @@ Dies hat nun eine <ud>.pdf</ud> Datei erstellt, genannt
|
|
14
14
|
Mittels der obigen Variante erspart man sich ein vorangestelltes
|
15
15
|
<b class="darkblue">pdf.</b>.
|
16
16
|
|
17
|
-
Noch ein Beispiel:
|
18
|
-
|
19
|
-
Prawn::Document.generate "example.pdf" do
|
20
|
-
font "Times-Roman"
|
21
|
-
draw_text "Hello World", :at => [200,720], :size => 32
|
22
|
-
end
|
23
17
|
|
24
18
|
Folgende Optionen sind für <b>.generate()</b> verfügbar:
|
25
19
|
|
@@ -69,11 +63,6 @@ Dokumentation hierzu gibt es auf
|
|
69
63
|
|
70
64
|
https://prawnpdf.org/docs/0.11.1/Prawn/Document.html#method-c-generate
|
71
65
|
|
72
|
-
Wie erstelle ich ein PDF mit einer bestimmten Grösse?
|
73
|
-
|
74
|
-
pdf = Prawn::Document.new(:page_size => "A4",
|
75
|
-
page_layout: :landscape)
|
76
|
-
|
77
66
|
Weitere Werte für <b>:page_layout</b> sind:
|
78
67
|
|
79
68
|
:page_layout => :portrait
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'roebe/gui/gtk3/shell/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'gtk_paradise/require_gtk3'
|
8
|
+
|
9
|
+
module Roebe
|
10
|
+
|
11
|
+
module GUI
|
12
|
+
|
13
|
+
module Gtk
|
14
|
+
|
15
|
+
class Shell < ::Gtk::Frame # === Roebe::GUI::Gtk::Shell
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === entry_user_input_for_the_shell?
|
19
|
+
# ========================================================================= #
|
20
|
+
def entry_user_input_for_the_shell?
|
21
|
+
@entry_user_input_for_the_shell
|
22
|
+
end; alias main_entry? entry_user_input_for_the_shell? # === main_entry?
|
23
|
+
alias entry_for_user_input? entry_user_input_for_the_shell? # === entry_for_user_input?
|
24
|
+
alias entry_for_the_user_input? entry_user_input_for_the_shell? # === entry_for_the_user_input?
|
25
|
+
alias entry_user_input? entry_user_input_for_the_shell? # === entry_user_input?
|
26
|
+
|
27
|
+
# ========================================================================= #
|
28
|
+
# === padding?
|
29
|
+
# ========================================================================= #
|
30
|
+
def padding?
|
31
|
+
0
|
32
|
+
end
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === border_size?
|
36
|
+
# ========================================================================= #
|
37
|
+
def border_size?
|
38
|
+
0
|
39
|
+
end
|
40
|
+
|
41
|
+
# ========================================================================= #
|
42
|
+
# === run (run tag)
|
43
|
+
# ========================================================================= #
|
44
|
+
def run
|
45
|
+
super()
|
46
|
+
show_all
|
47
|
+
deselect_and_select_relevant_widgets
|
48
|
+
update_the_current_working_directory
|
49
|
+
end
|
50
|
+
|
51
|
+
# ========================================================================= #
|
52
|
+
# === Roebe::GUI::Gtk::Shell.run
|
53
|
+
#
|
54
|
+
# This is the variant that can be "run" directly.
|
55
|
+
# ========================================================================= #
|
56
|
+
def self.run(
|
57
|
+
i = ARGV
|
58
|
+
)
|
59
|
+
require 'gtk_paradise/app/app.rb'
|
60
|
+
_ = ::Roebe::GUI::Gtk::Shell.new(i)
|
61
|
+
r = ::Gtk.run
|
62
|
+
r << _
|
63
|
+
@accel_group = ::Gtk::AccelGroup.new
|
64
|
+
# ======================================================================= #
|
65
|
+
# === Alt+1
|
66
|
+
#
|
67
|
+
# Alt+1 will focus on the gtk-entry, the main user input.
|
68
|
+
# ======================================================================= #
|
69
|
+
use_this_key = Gdk::Keyval::KEY_1
|
70
|
+
@accel_group.alt_key(use_this_key) {
|
71
|
+
_.focus_on_the_user_input_gtk_entry
|
72
|
+
}
|
73
|
+
# ======================================================================= #
|
74
|
+
# === Alt+2
|
75
|
+
# ======================================================================= #
|
76
|
+
use_this_key = Gdk::Keyval::KEY_2
|
77
|
+
@accel_group.alt_key(use_this_key) {
|
78
|
+
_.focus_on_the_bottom_widget
|
79
|
+
}
|
80
|
+
r.add_accel_group(@accel_group)
|
81
|
+
_.set_parent_widget(r) # Must designate the parent-widget first.
|
82
|
+
# ====================================================================== #
|
83
|
+
# Enable additional key-combinations next:
|
84
|
+
# ====================================================================== #
|
85
|
+
_.enable_these_key_combinations(
|
86
|
+
_.hash_designated_key_combinations?
|
87
|
+
)
|
88
|
+
r.automatic_size_then_automatic_title
|
89
|
+
r.enable_quick_exit
|
90
|
+
r.set_background :white
|
91
|
+
r.top_left_then_run
|
92
|
+
end
|
93
|
+
|
94
|
+
end; end; end; end
|