libui_paradise 0.2.49 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +241 -116
  3. data/bin/libui_message +7 -0
  4. data/doc/README.gen +191 -56
  5. data/doc/SNIPPETS.md +1 -30
  6. data/doc/todo/todo.md +13 -8
  7. data/lib/libui_paradise/base/base.rb +64 -25
  8. data/lib/libui_paradise/colours/colours.rb +12 -0
  9. data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +2 -4
  10. data/lib/libui_paradise/examples/complex/010_table_example.rb +143 -49
  11. data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +18 -9
  12. data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +8 -8
  13. data/lib/libui_paradise/examples/simple/007_control_gallery.rb +19 -13
  14. data/lib/libui_paradise/examples/simple/010_font_button.rb +31 -0
  15. data/lib/libui_paradise/examples/simple/011_simple_notepad.rb +24 -0
  16. data/lib/libui_paradise/examples/simple/012_table_example.rb +71 -0
  17. data/lib/libui_paradise/extensions/extensions.rb +961 -11
  18. data/lib/libui_paradise/extensions/toplevel_counters.rb +58 -0
  19. data/lib/libui_paradise/fiddle/{pointer.rb → fiddle.rb} +162 -144
  20. data/lib/libui_paradise/generic_window/generic_window.rb +1 -1
  21. data/lib/libui_paradise/images/README.md +5 -2
  22. data/lib/libui_paradise/libui_classes/box.rb +3 -2
  23. data/lib/libui_paradise/libui_classes/grid.rb +4 -1
  24. data/lib/libui_paradise/libui_classes/libui_classes.rb +113 -78
  25. data/lib/libui_paradise/project/project.rb +5 -1
  26. data/lib/libui_paradise/prototype/prototype.rb +1 -3
  27. data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +1 -1
  28. data/lib/libui_paradise/version/version.rb +2 -2
  29. data/lib/libui_paradise.rb +0 -0
  30. data/libui_paradise.gemspec +5 -4
  31. metadata +18 -27
  32. data/lib/libui_paradise/extensions/counters.rb +0 -58
  33. data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +0 -150
  34. data/lib/libui_paradise/extensions/misc.rb +0 -754
  35. data/lib/libui_paradise/toplevel_methods/misc.rb +0 -13
@@ -1,754 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # This file should only contain changes that are specific to libui-widgets.
6
- #
7
- # Other, more generic helper-code should be in the toplevel_methods/
8
- # directory instead.
9
- # =========================================================================== #
10
- # require 'libui_paradise/extensions/misc.rb
11
- # =========================================================================== #
12
- module LibuiParadise
13
-
14
- module Extensions # === LibuiParadise::Extensions
15
-
16
- require 'fileutils'
17
-
18
- # ========================================================================= #
19
- # === COLOUR_BLUE
20
- # ========================================================================= #
21
- COLOUR_BLUE = 0x1E90FF
22
-
23
- # ========================================================================= #
24
- # === LibuiParadise::Extensions.notification
25
- #
26
- # This method can be used to show a quick message box to the end
27
- # user.
28
- # ========================================================================= #
29
- def self.notification(
30
- text = 'Backup complete!',
31
- title_to_use = ''
32
- )
33
- ::LibuiParadise::Extensions.message_box(
34
- text: text,
35
- title_to_use: title_to_use
36
- )
37
- end
38
-
39
- # ========================================================================= #
40
- # === use_gtk3?
41
- # ========================================================================= #
42
- def use_gtk3?
43
- Object.const_defined?(:Gtk)
44
- end; alias use_gtk? use_gtk3? # === use_gtk?
45
-
46
- # ========================================================================= #
47
- # === gtk3?
48
- # ========================================================================= #
49
- def gtk3?
50
- false
51
- end; alias is_on_gtk? gtk3? # === is_on_gtk?
52
-
53
- # ========================================================================= #
54
- # === return_pwd
55
- # ========================================================================= #
56
- def return_pwd
57
- "#{Dir.pwd}/".squeeze('/')
58
- end
59
-
60
- # ========================================================================= #
61
- # === ui_sync_connect
62
- #
63
- # This method can connect two widgets: the first one should be a
64
- # combo-box, and the second one a ui-entry.
65
- # ========================================================================= #
66
- def ui_sync_connect(
67
- widget1,
68
- widget2,
69
- optional_array = nil
70
- )
71
- combobox_selected_callback = proc { |pointer|
72
- selected_value = selected?(pointer)
73
- if optional_array and optional_array.is_a?(Array)
74
- selected_value = optional_array[selected_value.to_i]
75
- end
76
- widget2.set_text(
77
- selected_value
78
- )
79
- }
80
- ::LibUI.combobox_on_selected(
81
- widget1, combobox_selected_callback, nil
82
- )
83
- end; alias sync_connect ui_sync_connect # === sync_connect
84
-
85
- # ========================================================================= #
86
- # === esystem
87
- #
88
- # This method can be used to run system(), with output. Thread.new is
89
- # used because that seems to work better in a GUI.
90
- # ========================================================================= #
91
- def esystem(i)
92
- puts i
93
- Thread.new {
94
- system i
95
- }
96
- end
97
-
98
- # ========================================================================= #
99
- # === delete_file
100
- #
101
- # This method can be used if you want to quickly delete a (local) file.
102
- # ========================================================================= #
103
- def delete_file(i)
104
- if File.file?(i)
105
- File.delete(i)
106
- else
107
- puts "Not a file: #{i}"
108
- end
109
- end
110
-
111
- # ========================================================================= #
112
- # === copy
113
- # ========================================================================= #
114
- def copy(from, to)
115
- require 'fileutils'
116
- FileUtils.cp(from, to)
117
- end
118
-
119
- # ========================================================================= #
120
- # === colour_to_rgb
121
- # ========================================================================= #
122
- def colour_to_rgb(colour = :steelblue)
123
- array = Colours.colour_to_rgb(colour)
124
- return array
125
- end
126
-
127
- # ========================================================================= #
128
- # === assumed_height?
129
- # ========================================================================= #
130
- def assumed_height?
131
- return_the_resolution_using_xrandr.split('x').last.to_i
132
- end; alias assumed_max_height? assumed_height? # === assumed_max_height?
133
-
134
- # ========================================================================= #
135
- # === without_trailing_comment
136
- # ========================================================================= #
137
- def without_trailing_comment(i)
138
- i = i.dup
139
- if i and i.end_with?('#')
140
- i = i[0 .. -2]
141
- end
142
- return i
143
- end
144
-
145
- # ========================================================================= #
146
- # === assumed_width?
147
- # ========================================================================= #
148
- def assumed_width?
149
- return_the_resolution_using_xrandr.split('x').first.to_i
150
- end; alias assumed_max_width? assumed_width? # === assumed_max_width?
151
-
152
- # ========================================================================= #
153
- # === set_width
154
- # ========================================================================= #
155
- def set_width(
156
- i = 1024
157
- )
158
- case i
159
- # ======================================================================= #
160
- # === :max_width
161
- # ======================================================================= #
162
- when :max_width
163
- i = assumed_max_width?
164
- end
165
- if i.is_a?(String) and i.include?('%')
166
- # ===================================================================== #
167
- # In this case we have to modify this a bit.
168
- # ===================================================================== #
169
- max_width = assumed_max_width?
170
- i = (max_width.to_f * i.to_i) / 100.0
171
- end
172
- i = i.to_i
173
- @width = i
174
- end
175
-
176
- # ========================================================================= #
177
- # === is_on_roebe?
178
- # ========================================================================= #
179
- def is_on_roebe?
180
- ENV['IS_ROEBE'].to_s == '1'
181
- end
182
-
183
- # ========================================================================= #
184
- # === try_to_parse_this_config_file
185
- #
186
- # This method can be used to parse a .config file for data it stores.
187
- #
188
- # The .config file must have "width:", "height:" and "title:" settings.
189
- # ========================================================================= #
190
- def try_to_parse_this_config_file(i)
191
- if File.exist? i
192
- dataset = File.readlines(i)
193
- # ===================================================================== #
194
- # Next check for width, height and title:
195
- # ===================================================================== #
196
- width = dataset.select {|line| line.include? 'width:' }.first.
197
- split(':').last.strip.to_i
198
- height = dataset.select {|line| line.include? 'height:' }.first.
199
- split(':').last.strip.to_i
200
- title = dataset.select {|line| line.include? 'title:' }.first.
201
- split(':').last.strip
202
- window = LibuiParadise.window(title, width, height)
203
- return window
204
- else
205
- e 'No file exists at `'+i+'`.'
206
- end
207
- end; alias parse_this_config_file try_to_parse_this_config_file # === parse_this_config_file
208
-
209
- # ========================================================================= #
210
- # === ui_draw_text_layout_params
211
- # ========================================================================= #
212
- def ui_draw_text_layout_params
213
- return ::LibUI::FFI::DrawTextLayoutParams.malloc
214
- end
215
-
216
- # ========================================================================= #
217
- # === left_arrow?
218
- # ========================================================================= #
219
- def left_arrow?
220
- ui_text('→')
221
- end
222
-
223
- # ========================================================================= #
224
- # === append_this_array_to_that_combobox
225
- # ========================================================================= #
226
- def append_this_array_to_that_combobox(
227
- this_array,
228
- that_combobox
229
- )
230
- this_array.each {|this_entry|
231
- UI.combobox_append(that_combobox, this_entry)
232
- }
233
- end
234
-
235
- # ========================================================================= #
236
- # === new_brush
237
- # ========================================================================= #
238
- def new_brush
239
- UI::FFI::DrawBrush.malloc
240
- end
241
-
242
- # ========================================================================= #
243
- # === exit_from
244
- #
245
- # This method essentially combines UI.control_destroy() and UI.quit(
246
- # into one method.
247
- # ========================================================================= #
248
- def exit_from(
249
- main_window = ::LibuiParadise::Extensions.main_window?
250
- )
251
- LibUI.control_destroy(main_window)
252
- LibUI.quit
253
- 0
254
- end
255
-
256
- # ========================================================================= #
257
- # === main_then_quit
258
- # ========================================================================= #
259
- def main_then_quit
260
- ::LibUI.main
261
- do_quit
262
- end
263
-
264
- # ========================================================================= #
265
- # === do_quit
266
- # ========================================================================= #
267
- def do_quit
268
- ::LibUI.quit
269
- end
270
-
271
- # ========================================================================= #
272
- # === LibuiParadise::Extensions.hello_world
273
- #
274
- # This is merely an ad-hoc test.
275
- # ========================================================================= #
276
- def self.hello_world
277
- e 'Hello world!'
278
- end
279
-
280
- # ========================================================================= #
281
- # === close_properly
282
- # ========================================================================= #
283
- def close_properly(
284
- main_window = LibuiParadise::Extensions.main_window?
285
- )
286
- LibUI.window_on_closing(main_window) {
287
- LibUI.exit_from(main_window)
288
- }
289
- end; alias simple_exit close_properly # === simple_exit
290
-
291
- # ========================================================================= #
292
- # === LibuiParadise::Extensions.register_sigint
293
- # ========================================================================= #
294
- def self.register_sigint
295
- Signal.trap('SIGINT') { exit }
296
- end
297
-
298
- # ========================================================================= #
299
- # === LibuiParadise::Extensions.initializer
300
- # ========================================================================= #
301
- def self.initializer
302
- LibuiParadise::Extensions.register_sigint
303
- Object.const_set('UI', LibUI) # This is equal to: UI = LibUI
304
- ::LibUI.extend(LibuiParadise::Extensions) # This call will also trigger the extended-hook.
305
- end
306
-
307
- # ========================================================================= #
308
- # === LibuiParadise::Extensions.extended
309
- #
310
- # This method taps into the extended-hook - see the code in the
311
- # method shown above this method.
312
- #
313
- # The purpose of this hook is to automatically call .init. This saves
314
- # us one line of code.
315
- #
316
- # In regular LibUI code this is equal to:
317
- #
318
- # UI.init
319
- #
320
- # ========================================================================= #
321
- def self.extended(i)
322
- i.init
323
- end
324
-
325
- # ========================================================================= #
326
- # === LibuiParadise::Extensions.set_title
327
- #
328
- # Simpler window-set-title functionality.
329
- # ========================================================================= #
330
- def self.set_title(
331
- this_title,
332
- main_window = MAIN_WINDOW
333
- )
334
- window_set_title(main_window, this_title)
335
- end
336
-
337
- # ========================================================================= #
338
- # === title?
339
- # ========================================================================= #
340
- def title?
341
- @title
342
- end
343
-
344
- # ========================================================================= #
345
- # === width?
346
- # ========================================================================= #
347
- def width?
348
- @width
349
- end
350
-
351
- # ========================================================================= #
352
- # === height?
353
- # ========================================================================= #
354
- def height?
355
- @height
356
- end
357
-
358
- # ========================================================================= #
359
- # === return_the_resolution_using_xrandr
360
- #
361
- # This method will only work on e. g. Linux.
362
- #
363
- # It will then return a String such as "1920x1080".
364
- # ========================================================================= #
365
- def return_the_resolution_using_xrandr
366
- _ = '800x600' # This is a generic failsafe value.
367
- begin
368
- xrandr_result = `xrandr`
369
- _ = xrandr_result.split("\n").select {|line|
370
- line.include? '*'
371
- }.first.strip.squeeze(' ').split(' ').first.to_s
372
- rescue Errno::ENOENT # Rescue for Windows systems.
373
- end
374
- return _ # This will yield e. g. "1920x1080"
375
- end
376
-
377
- # ========================================================================= #
378
- # === ui_table_params_malloc
379
- # ========================================================================= #
380
- def ui_table_params_malloc(optional_model = nil)
381
- _ = LibUI::FFI::TableParams.malloc
382
- if optional_model
383
- _.Model = optional_model
384
- _.RowBackgroundColorModelColumn = -1
385
- end
386
- return _
387
- end
388
-
389
- # ========================================================================= #
390
- # === ui_font_descriptor
391
- #
392
- # This method will return a new font-descriptor pointer.
393
- #
394
- # Usage example:
395
- #
396
- # ui_font_descriptor('Hack')
397
- #
398
- # ========================================================================= #
399
- def ui_font_descriptor(
400
- use_this_font_family = 'Hack',
401
- use_this_size = 25,
402
- use_this_weight = 500,
403
- is_in_italic_font_variant = :no,
404
- stretch_factor = 4
405
- )
406
- case is_in_italic_font_variant
407
- when :yes
408
- is_in_italic_font_variant = 1 # true
409
- when :no
410
- is_in_italic_font_variant = 0 # false
411
- end
412
- font_descriptor = UI::FFI::FontDescriptor.malloc
413
- font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
414
- font_descriptor.Family = use_this_font_family
415
- font_descriptor.Size = use_this_size
416
- font_descriptor.Weight = use_this_weight
417
- font_descriptor.Italic = is_in_italic_font_variant
418
- font_descriptor.Stretch = stretch_factor
419
- return font_descriptor
420
- end; alias font_descriptor ui_font_descriptor # === font_descriptor
421
-
422
- # ========================================================================= #
423
- # === ui_text_then_entry
424
- #
425
- # This method must return an Array containing three elements.
426
- #
427
- # Note that :padding specifies whether we will use padding or not in
428
- # libui. In ruby-gtk3 we can pass the pixels here; I am not sure
429
- # whether this is possible via libui as such.
430
- # ========================================================================= #
431
- def ui_text_then_entry(
432
- text = '',
433
- hash = {
434
- padding: 0
435
- }
436
- )
437
- text = ui_text(text)
438
- entry = ui_entry
439
- hbox = padded_hbox
440
- hbox.minimal(text, hash[:padding])
441
- hbox.minimal(entry, hash[:padding])
442
- return [ hbox, text, entry ]
443
- end; alias text_then_entry ui_text_then_entry # === text_then_entry
444
-
445
- # ========================================================================= #
446
- # === use_libui?
447
- # ========================================================================= #
448
- def use_libui?
449
- true
450
- end
451
-
452
- # ========================================================================= #
453
- # === use_gtk?
454
- # ========================================================================= #
455
- def use_gtk?
456
- false
457
- end
458
-
459
- # ========================================================================= #
460
- # === try_to_use_this_font
461
- #
462
- # This is currently not in use - once libui supports setting
463
- # a font then this can be enabled.
464
- # ========================================================================= #
465
- def try_to_use_this_font(i = nil); end
466
- alias use_this_font= try_to_use_this_font # === use_this_font=
467
- alias set_use_this_font try_to_use_this_font # === set_use_this_font
468
-
469
- # ========================================================================= #
470
- # === abort_on_exception
471
- # ========================================================================= #
472
- def abort_on_exception
473
- Thread.abort_on_exception
474
- end
475
-
476
- # ========================================================================= #
477
- # === LibuiParadise::Extensions.draw_rectangle
478
- #
479
- # This method can be used to draw a rectangle.
480
- #
481
- # The third argument should be a HTML colour.
482
- # ========================================================================= #
483
- def self.draw_rectangle(
484
- width = :default,
485
- height = :default,
486
- colour = :orange
487
- )
488
- unless ::LibuiParadise.respond_to?(:padded_vbox)
489
- require 'libui_paradise/libui_classes/vbox.rb'
490
- end
491
- unless Object.const_defined? :Colours
492
- begin
493
- require 'colours'
494
- rescue LoadError; end
495
- end
496
- case width
497
- # ======================================================================= #
498
- # === :default
499
- # ======================================================================= #
500
- when :default
501
- width = 25
502
- end
503
- case height
504
- # ======================================================================= #
505
- # === :default
506
- # ======================================================================= #
507
- when :default
508
- height = 25
509
- end
510
- handler = LibUI::FFI::AreaHandler.malloc
511
- handler.to_ptr.free = Fiddle::RUBY_FREE
512
- area = LibUI.new_area(handler)
513
- brush = LibUI::FFI::DrawBrush.malloc
514
- brush.to_ptr.free = Fiddle::RUBY_FREE
515
-
516
- handler_draw_event = Fiddle::Closure::BlockCaller.new(0, [1, 1, 1]) { |_, _, area_draw_params|
517
- path = LibUI.draw_new_path(0)
518
- LibUI.draw_path_add_rectangle(path, 0, 0, width, height)
519
- LibUI.draw_path_end(path)
520
- brush.Type = 0
521
- # ===================================================================== #
522
- # Need to find out the true RGB values. For now we divide by 255.
523
- #
524
- # See here:
525
- #
526
- # https://stackoverflow.com/questions/10848990/rgb-values-to-0-to-1-scale
527
- #
528
- # ===================================================================== #
529
- array = Colours.colour_to_rgb(colour)
530
- brush.R = array[0] / 255.0 # 0.4
531
- brush.G = array[1] / 255.0 # 0.4
532
- brush.B = array[2] / 255.0 # 0.8
533
- brush.A = 1.0
534
- area_draw_params = LibUI::FFI::AreaDrawParams.new(area_draw_params)
535
- LibUI.draw_fill(area_draw_params.Context, path, brush.to_ptr)
536
- LibUI.draw_free_path(path)
537
- }
538
-
539
- do_nothing = Fiddle::Closure::BlockCaller.new(0, [0]) {}
540
- key_event = Fiddle::Closure::BlockCaller.new(1, [0]) { 0 }
541
-
542
- handler.Draw = handler_draw_event
543
- handler.MouseEvent = do_nothing
544
- handler.MouseCrossed = do_nothing
545
- handler.DragBroken = do_nothing
546
- handler.KeyEvent = key_event
547
-
548
- box = ::LibuiParadise.padded_vbox
549
- box.maximal(area)
550
- return box
551
- end
552
-
553
- # ========================================================================= #
554
- # === set_commandline_arguments
555
- # ========================================================================= #
556
- def set_commandline_arguments(i = ARGV)
557
- @commandline_arguments = [i].flatten.compact
558
- end
559
-
560
- # ========================================================================= #
561
- # === commandline_arguments?
562
- # ========================================================================= #
563
- def commandline_arguments?
564
- @commandline_arguments
565
- end
566
-
567
- # ========================================================================= #
568
- # === set_title
569
- # ========================================================================= #
570
- def set_title(i)
571
- @title = i
572
- end
573
-
574
- # ========================================================================= #
575
- # === title_width_height
576
- # ========================================================================= #
577
- def title_width_height(
578
- title,
579
- width = 1024,
580
- height = 800
581
- )
582
- set_title(title)
583
- set_width(width)
584
- set_height(height)
585
- end; alias set_title_width_height title_width_height # === title_width_height
586
-
587
- # ========================================================================= #
588
- # === set_height
589
- # ========================================================================= #
590
- def set_height(
591
- i = 800
592
- )
593
- case i
594
- # ======================================================================= #
595
- # === :max_width
596
- # ======================================================================= #
597
- when :max_height
598
- i = assumed_max_height?
599
- end
600
- if i.is_a?(String) and i.include?('%')
601
- # ===================================================================== #
602
- # In this case we have to modify this a bit.
603
- # ===================================================================== #
604
- max_height = assumed_max_height?
605
- i = (max_height.to_f * i.to_i) / 100.0
606
- end
607
- i = i.to_i
608
- @height = i
609
- end
610
-
611
- # ========================================================================= #
612
- # === chdir (cd tag, chdir tag)
613
- # ========================================================================= #
614
- def chdir(i)
615
- if i and File.directory?(i)
616
- Dir.chdir(i)
617
- end
618
- end; alias cd chdir # === cd
619
-
620
- # ========================================================================= #
621
- # === create_skeleton_then_connect_skeleton
622
- # ========================================================================= #
623
- def create_skeleton_then_connect_skeleton
624
- create_skeleton
625
- connect_skeleton
626
- end
627
-
628
- # ========================================================================= #
629
- # === connect_skeleton
630
- #
631
- # This is a stub method, because we want to allow the user to modify it.
632
- # ========================================================================= #
633
- def connect_skeleton
634
- end
635
-
636
- # ========================================================================= #
637
- # === copy_file
638
- # ========================================================================= #
639
- def copy_file(from, to)
640
- FileUtils.cp(from, to)
641
- end; alias cp_file copy_file # === cp_file
642
-
643
- # ========================================================================= #
644
- # === create_directory
645
- # ========================================================================= #
646
- def create_directory(i)
647
- FileUtils.mkdir_p(i)
648
- end; alias mkdir create_directory # === mkdir
649
-
650
- # ========================================================================= #
651
- # === run_main
652
- # ========================================================================= #
653
- def run_main
654
- end
655
-
656
- end
657
-
658
- # =========================================================================== #
659
- # === LibuiParadise.draw_rectangle
660
- # =========================================================================== #
661
- def self.draw_rectangle(
662
- width = :default,
663
- height = :default,
664
- colour = :orange
665
- )
666
- ::LibuiParadise::Extensions.draw_rectangle(width, height, colour)
667
- end
668
-
669
- # =========================================================================== #
670
- # === LibuiParadise.notification
671
- # =========================================================================== #
672
- def self.notification(
673
- text = 'Backup complete!',
674
- title_to_use = ''
675
- )
676
- ::LibuiParadise::Extensions.message_box(
677
- :default_window,
678
- text,
679
- title_to_use
680
- )
681
- end
682
-
683
- # =========================================================================== #
684
- # === LibuiParadise.generic_window
685
- #
686
- # Usage example:
687
- #
688
- # x = LibuiParadise.generic_window(LibuiParadise.button('1'), LibuiParadise.button('2'))
689
- # x = LibuiParadise.generic_window(LibuiParadise.button('1'), LibuiParadise.button('2')) {{ height: 50 }}
690
- # x = LibuiParadise.generic_window(LibuiParadise.button('1'), LibuiParadise.button('2')) {{ height: 50, width: 120 }}
691
- #
692
- # =========================================================================== #
693
- def self.generic_window(
694
- *use_these_widgets,
695
- &block
696
- )
697
- unless LibuiParadise.respond_to?(:GenericWindow)
698
- require 'libui_paradise/generic_window/generic_window.rb'
699
- end
700
- generic_window = LibuiParadise::GenericWindow.new { :do_not_run_yet }
701
- # ========================================================================= #
702
- # === Handle blocks next
703
- # ========================================================================= #
704
- if block_given?
705
- yielded = yield
706
- if yielded.is_a? Hash
707
- # ===================================================================== #
708
- # === :height
709
- # ===================================================================== #
710
- if yielded.has_key?(:height)
711
- generic_window.set_height(
712
- yielded[:height]
713
- )
714
- generic_window.update_the_main_window
715
- end
716
- # ===================================================================== #
717
- # === :width
718
- # ===================================================================== #
719
- if yielded.has_key?(:width)
720
- generic_window.set_width(
721
- yielded[:width]
722
- )
723
- generic_window.update_the_main_window
724
- end
725
- # ===================================================================== #
726
- # === :title
727
- # ===================================================================== #
728
- if yielded.has_key?(:title)
729
- generic_window.set_title(
730
- yielded[:title]
731
- )
732
- generic_window.update_the_main_window
733
- end
734
- end
735
- end
736
- # ========================================================================= #
737
- # Next prepare adding more widgets to this generic window:
738
- # ========================================================================= #
739
- use_these_widgets.flatten!
740
- use_these_widgets.compact!
741
- if use_these_widgets.is_a?(Array) and !use_these_widgets.empty?
742
- generic_window.add_these_widgets(use_these_widgets)
743
- end
744
- return generic_window
745
- end
746
-
747
- # =========================================================================== #
748
- # === LibuiParadise.run_in_the_background
749
- # =========================================================================== #
750
- def self.run_in_the_background
751
- Process.daemon
752
- end
753
-
754
- end