glimmer-dsl-libui 0.2.10 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/README.md +209 -100
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/bin/girb_runner.rb +1 -1
- data/examples/area_gallery.rb +1 -3
- data/examples/area_gallery3.rb +1 -3
- data/examples/basic_draw_text2.rb +0 -1
- data/examples/basic_table_button.rb +2 -1
- data/examples/basic_table_checkbox.rb +1 -1
- data/examples/basic_table_image.rb +1 -0
- data/examples/basic_table_image_text.rb +1 -0
- data/examples/color_the_circles.rb +13 -13
- data/examples/control_gallery.rb +6 -0
- data/examples/editable_table.rb +2 -0
- data/examples/meta_example.rb +20 -10
- data/examples/method_based_custom_keyword.rb +16 -6
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/control_expression.rb +2 -0
- data/lib/glimmer/dsl/libui/string_expression.rb +9 -2
- data/lib/glimmer/libui/attributed_string.rb +32 -12
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +37 -4
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +30 -10
- data/lib/glimmer/libui/control_proxy.rb +17 -2
- data/lib/glimmer/libui/shape/arc.rb +5 -1
- data/lib/glimmer/libui/shape/circle.rb +5 -1
- metadata +13 -10
@@ -37,7 +37,6 @@ module Glimmer
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def widget_proxy_class(keyword)
|
40
|
-
class_name = constant_symbol(keyword)
|
41
40
|
descendant_keyword_constant_map[keyword] || ControlProxy
|
42
41
|
end
|
43
42
|
|
@@ -72,7 +71,7 @@ module Glimmer
|
|
72
71
|
end
|
73
72
|
|
74
73
|
def descendant_keyword_constant_map
|
75
|
-
@descendant_keyword_constant_map ||= map_descendant_keyword_constants_for(self)
|
74
|
+
@descendant_keyword_constant_map ||= add_aliases_to_keyword_constant_map(map_descendant_keyword_constants_for(self))
|
76
75
|
end
|
77
76
|
|
78
77
|
def reset_descendant_keyword_constant_map
|
@@ -91,8 +90,22 @@ module Glimmer
|
|
91
90
|
end
|
92
91
|
accumulator
|
93
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def add_aliases_to_keyword_constant_map(keyword_constant_map)
|
97
|
+
KEYWORD_ALIASES.each do |keyword, alias_keyword|
|
98
|
+
keyword_constant_map[alias_keyword] = keyword_constant_map[keyword]
|
99
|
+
end
|
100
|
+
keyword_constant_map
|
101
|
+
end
|
94
102
|
end
|
95
103
|
|
104
|
+
KEYWORD_ALIASES = {
|
105
|
+
'msg_box' => 'message_box',
|
106
|
+
'msg_box_error' => 'message_box_error',
|
107
|
+
}
|
108
|
+
|
96
109
|
BOOLEAN_PROPERTIES = %w[
|
97
110
|
padded
|
98
111
|
checked
|
@@ -223,6 +236,7 @@ module Glimmer
|
|
223
236
|
elsif ::LibUI.respond_to?("#{libui_api_keyword}_set_#{method_name.to_s.sub(/=$/, '')}") && !args.empty?
|
224
237
|
property = method_name.to_s.sub(/=$/, '')
|
225
238
|
args[0] = Glimmer::LibUI.boolean_to_integer(args.first) if BOOLEAN_PROPERTIES.include?(property) && (args.first.is_a?(TrueClass) || args.first.is_a?(FalseClass))
|
239
|
+
args[0] = '' if STRING_PROPERTIES.include?(property) && args.first == nil
|
226
240
|
if property.to_s == 'checked'
|
227
241
|
current_value = Glimmer::LibUI.integer_to_boolean(::LibUI.send("#{libui_api_keyword}_checked", @libui))
|
228
242
|
new_value = Glimmer::LibUI.integer_to_boolean(args[0])
|
@@ -239,6 +253,7 @@ module Glimmer
|
|
239
253
|
elsif ::LibUI.respond_to?("control_set_#{method_name.to_s.sub(/=$/, '')}")
|
240
254
|
property = method_name.to_s.sub(/=$/, '')
|
241
255
|
args[0] = Glimmer::LibUI.boolean_to_integer(args.first) if BOOLEAN_PROPERTIES.include?(property) && (args.first.is_a?(TrueClass) || args.first.is_a?(FalseClass))
|
256
|
+
args[0] = '' if STRING_PROPERTIES.include?(property) && args.first == nil
|
242
257
|
::LibUI.send("control_set_#{method_name.to_s.sub(/=$/, '')}", @libui, *args)
|
243
258
|
elsif ::LibUI.respond_to?("control_#{method_name}") && !args.empty?
|
244
259
|
::LibUI.send("control_#{method_name}", @libui, *args)
|
@@ -36,7 +36,11 @@ module Glimmer
|
|
36
36
|
if parent.is_a?(Figure) && parent.x.nil? && parent.y.nil?
|
37
37
|
::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
|
38
38
|
else
|
39
|
-
|
39
|
+
if OS.windows? && parent.children.find {|child| child.is_a?(Arc)} == self
|
40
|
+
::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
|
41
|
+
else
|
42
|
+
::LibUI.draw_path_arc_to(path_proxy.libui, *arc_args)
|
43
|
+
end
|
40
44
|
end
|
41
45
|
super
|
42
46
|
end
|
@@ -36,7 +36,11 @@ module Glimmer
|
|
36
36
|
if parent.is_a?(Figure) && parent.x.nil? && parent.y.nil?
|
37
37
|
::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
|
38
38
|
else
|
39
|
-
|
39
|
+
if OS.windows? && parent.children.find {|child| child.is_a?(Circle)} == self
|
40
|
+
::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
|
41
|
+
else
|
42
|
+
::LibUI.draw_path_arc_to(path_proxy.libui, *arc_args)
|
43
|
+
end
|
40
44
|
end
|
41
45
|
super
|
42
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: os
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.0.
|
67
|
+
version: 0.0.12
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0.
|
74
|
+
version: 0.0.12
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: juwelier
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,9 +190,12 @@ dependencies:
|
|
190
190
|
- - "~>"
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: 1.4.0
|
193
|
-
description: Glimmer DSL for LibUI
|
194
|
-
Library
|
195
|
-
platform-independent native GUI that just works!
|
193
|
+
description: Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI
|
194
|
+
Library) - No need to pre-install any prerequisites. Just install the gem and have
|
195
|
+
platform-independent native GUI that just works! Glimmer DSL for LibUI aims to provide
|
196
|
+
declarative DSL syntax that visually maps to GUI control hierarchy, convention over
|
197
|
+
configuration via smart defaults, automation of low-level details, requiring the
|
198
|
+
least amount of syntax possible to build GUI, and custom keyword support.
|
196
199
|
email: andy.am@gmail.com
|
197
200
|
executables:
|
198
201
|
- girb
|
@@ -364,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
364
367
|
- !ruby/object:Gem::Version
|
365
368
|
version: '0'
|
366
369
|
requirements: []
|
367
|
-
rubygems_version: 3.2.
|
370
|
+
rubygems_version: 3.2.22
|
368
371
|
signing_key:
|
369
372
|
specification_version: 4
|
370
373
|
summary: Glimmer DSL for LibUI
|