cyberarm_engine 0.5.1 → 0.6.0
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.
- checksums.yaml +4 -4
- data/lib/cyberarm_engine/ui/dsl.rb +12 -0
- data/lib/cyberarm_engine/ui/element.rb +5 -1
- data/lib/cyberarm_engine/ui/theme.rb +7 -4
- data/lib/cyberarm_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f11a60c76c06ce3939734baec31821815b26b779919cbcee7d0c289511a11c87
|
4
|
+
data.tar.gz: 403a8b5e1ed211ee4240887f1851df14507c398b5052defa79c28b0a0c06cae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4959236427d16fbf69636813f2cd013556b6633e80dce054f69273384af0ca73af944c109ebd51ace29e5329d56f8e2cda717b114cf63ba83dbedd28cae87e3d
|
7
|
+
data.tar.gz: cabf8137a4add3a2eda6cda2cd737ffafde764bf208777deaa1d86dcb21ee8ec54204546ed841416217ed92c908aed4b02fd229927cfcb26d5fa0ee2a0896cb9
|
@@ -2,6 +2,7 @@ module CyberarmEngine
|
|
2
2
|
module DSL
|
3
3
|
def flow(options = {}, &block)
|
4
4
|
options[:parent] = @containers.last
|
5
|
+
options[:theme] = @current_theme
|
5
6
|
_container = Flow.new(options, block)
|
6
7
|
@containers << _container
|
7
8
|
_container.build
|
@@ -13,6 +14,7 @@ module CyberarmEngine
|
|
13
14
|
|
14
15
|
def stack(options = {}, &block)
|
15
16
|
options[:parent] = @containers.last
|
17
|
+
options[:theme] = @current_theme
|
16
18
|
_container = Stack.new(options, block)
|
17
19
|
@containers << _container
|
18
20
|
_container.build
|
@@ -24,6 +26,7 @@ module CyberarmEngine
|
|
24
26
|
|
25
27
|
def label(text, options = {}, &block)
|
26
28
|
options[:parent] = @containers.last
|
29
|
+
options[:theme] = @current_theme
|
27
30
|
_element = Label.new(text, options, block)
|
28
31
|
@containers.last.add(_element)
|
29
32
|
|
@@ -32,6 +35,7 @@ module CyberarmEngine
|
|
32
35
|
|
33
36
|
def button(text, options = {}, &block)
|
34
37
|
options[:parent] = @containers.last
|
38
|
+
options[:theme] = @current_theme
|
35
39
|
_element = Button.new(text, options, block) { if block.is_a?(Proc); block.call; end }
|
36
40
|
@containers.last.add(_element)
|
37
41
|
|
@@ -40,6 +44,7 @@ module CyberarmEngine
|
|
40
44
|
|
41
45
|
def edit_line(text, options = {}, &block)
|
42
46
|
options[:parent] = @containers.last
|
47
|
+
options[:theme] = @current_theme
|
43
48
|
_element = EditLine.new(text, options, block)
|
44
49
|
@containers.last.add(_element)
|
45
50
|
|
@@ -48,6 +53,7 @@ module CyberarmEngine
|
|
48
53
|
|
49
54
|
def toggle_button(options = {}, &block)
|
50
55
|
options[:parent] = @containers.last
|
56
|
+
options[:theme] = @current_theme
|
51
57
|
_element = ToggleButton.new(options, block)
|
52
58
|
@containers.last.add(_element)
|
53
59
|
|
@@ -56,6 +62,7 @@ module CyberarmEngine
|
|
56
62
|
|
57
63
|
def check_box(text, options = {}, &block)
|
58
64
|
options[:parent] = @containers.last
|
65
|
+
options[:theme] = @current_theme
|
59
66
|
_element = CheckBox.new(text, options, block)
|
60
67
|
@containers.last.add(_element)
|
61
68
|
|
@@ -64,6 +71,7 @@ module CyberarmEngine
|
|
64
71
|
|
65
72
|
def image(path, options = {}, &block)
|
66
73
|
options[:parent] = @containers.last
|
74
|
+
options[:theme] = @current_theme
|
67
75
|
_element = Image.new(path, options, block)
|
68
76
|
@containers.last.add(_element)
|
69
77
|
|
@@ -78,5 +86,9 @@ module CyberarmEngine
|
|
78
86
|
def color(color)
|
79
87
|
@containers.last.color(color)
|
80
88
|
end
|
89
|
+
|
90
|
+
def set_theme(theme)
|
91
|
+
@current_theme = theme
|
92
|
+
end
|
81
93
|
end
|
82
94
|
end
|
@@ -15,7 +15,7 @@ module CyberarmEngine
|
|
15
15
|
|
16
16
|
def initialize(options = {}, block = nil)
|
17
17
|
@parent = options[:parent] # parent Container (i.e. flow/stack)
|
18
|
-
options = theme_defaults
|
18
|
+
options = theme_defaults(options)
|
19
19
|
@options = options
|
20
20
|
@block = block
|
21
21
|
|
@@ -206,6 +206,10 @@ module CyberarmEngine
|
|
206
206
|
raise "#{self.class}#recalculate was not overridden!"
|
207
207
|
end
|
208
208
|
|
209
|
+
def reposition
|
210
|
+
raise "#{self.class}#reposition was not overridden!"
|
211
|
+
end
|
212
|
+
|
209
213
|
def value
|
210
214
|
raise "#{self.class}#value was not overridden!"
|
211
215
|
end
|
@@ -9,21 +9,24 @@ module CyberarmEngine
|
|
9
9
|
value
|
10
10
|
end
|
11
11
|
|
12
|
-
def theme_defaults
|
12
|
+
def theme_defaults(options)
|
13
13
|
raise "Error" unless self.class.ancestors.include?(CyberarmEngine::Element)
|
14
|
+
_theme = THEME
|
15
|
+
_theme = _theme.merge(options[:theme]) if options[:theme]
|
16
|
+
options.delete(:theme)
|
14
17
|
|
15
18
|
hash = {}
|
16
19
|
class_names = self.class.ancestors
|
17
20
|
class_names = class_names[0..class_names.index(CyberarmEngine::Element)].map! {|c| c.to_s.split("::").last.to_sym}.reverse!
|
18
21
|
|
19
22
|
class_names.each do |klass|
|
20
|
-
next unless data =
|
23
|
+
next unless data = _theme.dig(klass)
|
21
24
|
data.each do |key, value|
|
22
25
|
hash.merge!(data)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
|
-
hash
|
29
|
+
hash.merge(options)
|
27
30
|
end
|
28
31
|
|
29
32
|
THEME = {
|
@@ -86,6 +89,6 @@ module CyberarmEngine
|
|
86
89
|
ToggleButton: { # < Button
|
87
90
|
checkmark: "√"
|
88
91
|
}
|
89
|
-
}
|
92
|
+
}.freeze
|
90
93
|
end
|
91
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyberarm_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyberarm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|