libui_paradise 0.2.48
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of libui_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +2064 -0
- data/doc/README.gen +1923 -0
- data/doc/SNIPPETS.md +94 -0
- data/doc/todo/todo.md +16 -0
- data/lib/libui_paradise/autoinclude.rb +9 -0
- data/lib/libui_paradise/base/base.rb +154 -0
- data/lib/libui_paradise/colours/colours.rb +14 -0
- data/lib/libui_paradise/domain_specific_language/README.md +5 -0
- data/lib/libui_paradise/domain_specific_language/button.yml +7 -0
- data/lib/libui_paradise/examples/complex/001_hbox_example.rb +17 -0
- data/lib/libui_paradise/examples/complex/002_tabs_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +38 -0
- data/lib/libui_paradise/examples/complex/004_font_button.rb +41 -0
- data/lib/libui_paradise/examples/complex/005_search_entry_example.rb +18 -0
- data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +22 -0
- data/lib/libui_paradise/examples/complex/007_slider_example.rb +31 -0
- data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +23 -0
- data/lib/libui_paradise/examples/complex/009_separator_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/010_table_example.rb +55 -0
- data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +32 -0
- data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +29 -0
- data/lib/libui_paradise/examples/complex/013_form_example.rb +38 -0
- data/lib/libui_paradise/examples/complex/014_text_example.rb +18 -0
- data/lib/libui_paradise/examples/complex/015_text_view_example.rb +16 -0
- data/lib/libui_paradise/examples/complex/016_grid_example.rb +31 -0
- data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +30 -0
- data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +33 -0
- data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +50 -0
- data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +81 -0
- data/lib/libui_paradise/examples/complex/021_font_example.rb +115 -0
- data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +27 -0
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.config +6 -0
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +15 -0
- data/lib/libui_paradise/examples/complex/025_colour_button.rb +53 -0
- data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +96 -0
- data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +19 -0
- data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +47 -0
- data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +116 -0
- data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +140 -0
- data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +96 -0
- data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +69 -0
- data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +91 -0
- data/lib/libui_paradise/examples/simple/001_open_file_example.rb +35 -0
- data/lib/libui_paradise/examples/simple/002_histogram_example.rb +207 -0
- data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +220 -0
- data/lib/libui_paradise/examples/simple/004_date_time_picker.rb +52 -0
- data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +185 -0
- data/lib/libui_paradise/examples/simple/006_midi_player.rb +96 -0
- data/lib/libui_paradise/examples/simple/007_control_gallery.rb +191 -0
- data/lib/libui_paradise/examples/simple/008_basic_area_example.rb +56 -0
- data/lib/libui_paradise/examples/simple/009_spectrum.rb +107 -0
- data/lib/libui_paradise/examples/simple/README.md +7 -0
- data/lib/libui_paradise/experimental/dsl.rb +17 -0
- data/lib/libui_paradise/extensions/counters.rb +58 -0
- data/lib/libui_paradise/extensions/extensions.rb +29 -0
- data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +150 -0
- data/lib/libui_paradise/extensions/misc.rb +754 -0
- data/lib/libui_paradise/fiddle/pointer.rb +1157 -0
- data/lib/libui_paradise/generic_window/README.md +9 -0
- data/lib/libui_paradise/generic_window/generic_window.rb +79 -0
- data/lib/libui_paradise/images/LIBUI_PARADISE_LOGO.png +0 -0
- data/lib/libui_paradise/images/README.md +2 -0
- data/lib/libui_paradise/images/form_example.png +0 -0
- data/lib/libui_paradise/libui_classes/box.rb +156 -0
- data/lib/libui_paradise/libui_classes/grid.rb +55 -0
- data/lib/libui_paradise/libui_classes/libui_classes.rb +1610 -0
- data/lib/libui_paradise/project/project.rb +28 -0
- data/lib/libui_paradise/prototype/README.md +3 -0
- data/lib/libui_paradise/prototype/prototype.rb +107 -0
- data/lib/libui_paradise/requires/require_the_libui_classes.rb +29 -0
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +12 -0
- data/lib/libui_paradise/toplevel_methods/misc.rb +13 -0
- data/lib/libui_paradise/version/version.rb +17 -0
- data/lib/libui_paradise.rb +1 -0
- data/libui_paradise.gemspec +49 -0
- data/test/testing_generic_window.rb +19 -0
- metadata +156 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
The main purpose of the class in this directory is to provide
|
2
|
+
a simplified toplevel window for the libui_paradise gem. That
|
3
|
+
way a user can directly tap into this, or use the base class
|
4
|
+
called LibuiParadise::GUI::LibUI::Base, to quickly display a
|
5
|
+
window.
|
6
|
+
|
7
|
+
I needed this functionality in September 2022 to quickly
|
8
|
+
show a "Backup has finished!" message on windows specifically,
|
9
|
+
to indicate that backup has, well - finished.
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === LibuiParadise::GenericWindow
|
6
|
+
# =========================================================================== #
|
7
|
+
# require 'libui_paradise/generic_window/generic_window.rb'
|
8
|
+
# LibuiParadise::GenericWindow.new(ARGV)
|
9
|
+
# =========================================================================== #
|
10
|
+
require 'libui_paradise/base/base.rb'
|
11
|
+
|
12
|
+
module LibuiParadise
|
13
|
+
|
14
|
+
class GenericWindow < LibuiParadise::Base # === LibuiParadise::GenericWindow
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === TITLE
|
18
|
+
# ========================================================================= #
|
19
|
+
TITLE = 'Generic Window'
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === WIDTH
|
23
|
+
# ========================================================================= #
|
24
|
+
WIDTH = 500
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === HEIGHT
|
28
|
+
# ========================================================================= #
|
29
|
+
HEIGHT = 300
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === initialize
|
33
|
+
# ========================================================================= #
|
34
|
+
def initialize(
|
35
|
+
*use_these_widgets,
|
36
|
+
&block
|
37
|
+
)
|
38
|
+
reset
|
39
|
+
# ======================================================================= #
|
40
|
+
# === Handle blocks given to this method next
|
41
|
+
# ======================================================================= #
|
42
|
+
if block_given?
|
43
|
+
yielded = yield
|
44
|
+
case yielded
|
45
|
+
# ===================================================================== #
|
46
|
+
# === :do_not_run_yet
|
47
|
+
# ===================================================================== #
|
48
|
+
when :do_not_run_yet,
|
49
|
+
:dont_run_already
|
50
|
+
run_already = false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if run_already # This is coupled to batch-adding widgets.
|
54
|
+
add_these_widgets_to_the_main_window(
|
55
|
+
use_these_widgets
|
56
|
+
)
|
57
|
+
run
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# ========================================================================= #
|
62
|
+
# === reset
|
63
|
+
# ========================================================================= #
|
64
|
+
def reset
|
65
|
+
super()
|
66
|
+
end
|
67
|
+
|
68
|
+
# ========================================================================= #
|
69
|
+
# === run
|
70
|
+
# ========================================================================= #
|
71
|
+
def run
|
72
|
+
super()
|
73
|
+
end
|
74
|
+
|
75
|
+
end; end
|
76
|
+
|
77
|
+
if __FILE__ == $PROGRAM_NAME
|
78
|
+
LibuiParadise::GUI::LibUI::GenericWindow.new
|
79
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,156 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/libui_classes/box.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.vbox (vbox tag)
|
13
|
+
#
|
14
|
+
# This method will create a vertical box.
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.vbox(*optional_widgets)
|
17
|
+
_ = ::LibUI.new_vertical_box
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
19
|
+
if optional_widgets and !optional_widgets.empty?
|
20
|
+
optional_widgets.flatten.each {|this_widget| _ << this_widget }
|
21
|
+
end
|
22
|
+
return _
|
23
|
+
end; self.instance_eval { alias ui_vbox vbox } # === ui_vbox
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === ui_padded_vbox
|
27
|
+
#
|
28
|
+
# This method will call .is_padded on the vbox after it has been
|
29
|
+
# initialized.
|
30
|
+
# ========================================================================= #
|
31
|
+
def ui_padded_vbox(*optional_widgets)
|
32
|
+
_ = ui_vbox(optional_widgets)
|
33
|
+
_.is_padded
|
34
|
+
return _
|
35
|
+
end; alias padded_vbox ui_padded_vbox # === padded_vbox
|
36
|
+
|
37
|
+
# ========================================================================= #
|
38
|
+
# === LibuiParadise::Extensions.hbox (hbox tag)
|
39
|
+
#
|
40
|
+
# This method will create a horizontal box.
|
41
|
+
# ========================================================================= #
|
42
|
+
def self.hbox(*optional_widgets)
|
43
|
+
_ = ::LibUI.new_horizontal_box
|
44
|
+
add_to_the_registered_widgets(_, __method__)
|
45
|
+
if optional_widgets and !optional_widgets.flatten.empty?
|
46
|
+
optional_widgets.flatten.each {|this_widget|
|
47
|
+
_.add(this_widget)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
return _
|
51
|
+
end; self.instance_eval { alias ui_hbox hbox } # === ui_hbox
|
52
|
+
self.instance_eval { alias create_hbox hbox } # === create_hbox
|
53
|
+
|
54
|
+
# ========================================================================= #
|
55
|
+
# === ui_hbox (hbox tag)
|
56
|
+
# ========================================================================= #
|
57
|
+
def hbox(*optional_widgets)
|
58
|
+
::LibuiParadise::Extensions.hbox(optional_widgets)
|
59
|
+
end; alias ui_hbox hbox # === ui_hbox
|
60
|
+
alias create_hbox hbox # === create_hbox
|
61
|
+
alias libui_hbox hbox # === libui_hbox
|
62
|
+
|
63
|
+
# ========================================================================= #
|
64
|
+
# === ui_padded_hbox
|
65
|
+
#
|
66
|
+
# If you want to add optional widgets then simply pass them as argument
|
67
|
+
# to this method.
|
68
|
+
# ========================================================================= #
|
69
|
+
def ui_padded_hbox(*optional_widgets)
|
70
|
+
_ = ui_hbox(optional_widgets)
|
71
|
+
_.is_padded
|
72
|
+
return _
|
73
|
+
end; alias padded_hbox ui_padded_hbox # === padded_hbox
|
74
|
+
alias libui_padded_hbox ui_padded_hbox # === libui_padded_hbox
|
75
|
+
|
76
|
+
# ========================================================================= #
|
77
|
+
# === two_elements_hbox
|
78
|
+
#
|
79
|
+
# This method will return a horizontal box (hbox) that is accepting
|
80
|
+
# two arguments (two widgets) that will be embedded onto that hbox.
|
81
|
+
# Then the result is returned.
|
82
|
+
# ========================================================================= #
|
83
|
+
def two_elements_hbox(
|
84
|
+
widget1,
|
85
|
+
widget2,
|
86
|
+
options = {
|
87
|
+
layout_to_use: :maximal # This is the default.
|
88
|
+
}
|
89
|
+
)
|
90
|
+
_ = ui_padded_hbox
|
91
|
+
# ======================================================================= #
|
92
|
+
# === Handle :layout_to_use
|
93
|
+
#
|
94
|
+
# This is mostly done to distinguish between maximal() and minimal()
|
95
|
+
# for widgets.
|
96
|
+
# ======================================================================= #
|
97
|
+
if options.is_a?(Hash) and options.has_key?(:layout_to_use)
|
98
|
+
case options[:layout_to_use]
|
99
|
+
# ===================================================================== #
|
100
|
+
# === :maximal
|
101
|
+
# ===================================================================== #
|
102
|
+
when :maximal
|
103
|
+
_.maximal(widget1)
|
104
|
+
_.maximal(widget2)
|
105
|
+
# ===================================================================== #
|
106
|
+
# === :minimal
|
107
|
+
# ===================================================================== #
|
108
|
+
when :minimal
|
109
|
+
_.minimal(widget1)
|
110
|
+
_.minimal(widget2)
|
111
|
+
end
|
112
|
+
else
|
113
|
+
_.minimal(widget1)
|
114
|
+
_.minimal(widget2)
|
115
|
+
end
|
116
|
+
return _
|
117
|
+
end
|
118
|
+
|
119
|
+
# ========================================================================= #
|
120
|
+
# === vbox
|
121
|
+
# ========================================================================= #
|
122
|
+
def vbox(*optional_widgets)
|
123
|
+
::LibuiParadise::Extensions.vbox(optional_widgets)
|
124
|
+
end; alias ui_vbox vbox # === ui_vbox
|
125
|
+
alias gtk_box vbox # === gtk_box
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
# ========================================================================= #
|
130
|
+
# === LibuiParadise.hbox
|
131
|
+
#
|
132
|
+
# This toplevel-method can be used to instantiate a new hbox.
|
133
|
+
# ========================================================================= #
|
134
|
+
def self.hbox(*optional_widgets)
|
135
|
+
::LibuiParadise::Extensions.hbox(optional_widgets)
|
136
|
+
end; self.instance_eval { alias ui_hbox hbox } # === LibuiParadise.ui_hbox
|
137
|
+
self.instance_eval { alias create_hbox hbox } # === LibuiParadise.create_hbox
|
138
|
+
|
139
|
+
# =========================================================================== #
|
140
|
+
# === LibuiParadise.padded_vbox
|
141
|
+
# =========================================================================== #
|
142
|
+
def self.padded_vbox
|
143
|
+
_ = ::LibuiParadise::Extensions.vbox
|
144
|
+
_.is_padded
|
145
|
+
return _
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
# =========================================================================== #
|
150
|
+
# === LibuiParadise.vbox
|
151
|
+
# =========================================================================== #
|
152
|
+
def self.vbox
|
153
|
+
::LibuiParadise::Extensions.vbox
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/libui_classes/grid.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.grid (grid tag)
|
13
|
+
#
|
14
|
+
# To insert into a grid, try to use this API:
|
15
|
+
#
|
16
|
+
# uiGridInsertAt(
|
17
|
+
# uiGrid *g,
|
18
|
+
# uiControl *c,
|
19
|
+
# uiControl *existing,
|
20
|
+
# uiAt at,
|
21
|
+
# int xspan,
|
22
|
+
# int yspan,
|
23
|
+
# int hexpand,
|
24
|
+
# uiAlign halign, int vexpand, uiAlign valign
|
25
|
+
# )
|
26
|
+
#
|
27
|
+
# Example to add a new entry onto the grid:
|
28
|
+
#
|
29
|
+
# UI.grid_append(grid, text('Yo2'), 1, 0, 1, 1, 0, 0, 1, 0)
|
30
|
+
#
|
31
|
+
# ========================================================================= #
|
32
|
+
def self.grid
|
33
|
+
_ = ::LibUI.new_grid
|
34
|
+
add_to_the_registered_widgets(_, __method__)
|
35
|
+
return _
|
36
|
+
end; self.instance_eval { alias ui_grid grid } # === LibuiParadise::Extensions.ui_grid
|
37
|
+
|
38
|
+
# ========================================================================= #
|
39
|
+
# === grid
|
40
|
+
# ========================================================================= #
|
41
|
+
def grid
|
42
|
+
::LibuiParadise::Extensions.grid
|
43
|
+
end; alias ui_grid grid # === ui_grid
|
44
|
+
|
45
|
+
# ========================================================================= #
|
46
|
+
# === ui_padded_grid
|
47
|
+
# ========================================================================= #
|
48
|
+
def ui_padded_grid
|
49
|
+
_ = ui_grid # This is defined in the method above ^^^ this method.
|
50
|
+
_.is_padded
|
51
|
+
return _
|
52
|
+
end; alias padded_grid ui_padded_grid # === padded_grid
|
53
|
+
alias default_grid ui_padded_grid # === default_grid
|
54
|
+
|
55
|
+
end; end
|