glimmer-dsl-libui 0.0.22 → 0.0.23
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/CHANGELOG.md +5 -0
- data/README.md +9 -11
- data/VERSION +1 -1
- data/examples/basic_table_image.rb +1 -1
- data/examples/basic_table_image_text.rb +3 -7
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/image_part_proxy.rb +10 -0
- data/lib/glimmer/libui/image_proxy.rb +63 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e29a14b4e8c65eaaa7ffa9d1ef5a7e1d13a592cf5d1090e850525b8d9188450
|
4
|
+
data.tar.gz: 37f077425a3627fddd8047a052fa55c43b8b907160ddb406a821757b544c5d97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2447933bbdce2b03660b8d9c4eb13736b4989eb2632288951ad836b3bd25f0e8fa7075d976b42da1df8a2495540302dd18c02c162abb08ab5a9cd5fad4c1378d
|
7
|
+
data.tar.gz: f5018929934e70c3364f29ac124626ac1d9502e748e4b98ec1f44cdc5dae63e3baf7d856aa56dc50bb044e2909d040fff1c812ca66706bba4fa53fd92efdc97c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.23
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-libui/maintainability)
|
@@ -43,7 +43,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
43
43
|
|
44
44
|
## Table of Contents
|
45
45
|
|
46
|
-
- [Glimmer DSL for LibUI 0.0.
|
46
|
+
- [Glimmer DSL for LibUI 0.0.23](#-glimmer-dsl-for-libui-0023)
|
47
47
|
- [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
|
48
48
|
- [Usage](#usage)
|
49
49
|
- [API](#api)
|
@@ -162,7 +162,7 @@ gem install glimmer-dsl-libui
|
|
162
162
|
Or install via Bundler `Gemfile`:
|
163
163
|
|
164
164
|
```ruby
|
165
|
-
gem 'glimmer-dsl-libui', '~> 0.0.
|
165
|
+
gem 'glimmer-dsl-libui', '~> 0.0.23'
|
166
166
|
```
|
167
167
|
|
168
168
|
Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
|
@@ -319,7 +319,9 @@ Control(Args) | Properties | Listeners
|
|
319
319
|
- Smart defaults for `grid` child attributes are `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`0`), `vexpand` (`false`), and `valign` (`0`)
|
320
320
|
- The `table` control automatically constructs required `TableModelHandler`, `TableModel`, and `TableParams`, calculating all their arguments from `cell_rows` and `editable` properties (e.g. `NumRows`) as well as nested columns (e.g. `text_column`)
|
321
321
|
- Table model instances are automatically freed from memory after `window` is destroyed.
|
322
|
+
- Table `cell_rows` data has implicit data-binding to table cell values. When deleting data from `cell_rows` array, then actual rows from the `table` are automatically deleted.
|
322
323
|
- `image` instances are automatically freed from memory after `window` is destroyed.
|
324
|
+
- `image` `width` and `height` can be left off if it has one `image_part` only as they default to the same `width` and `height` of the `image_part`
|
323
325
|
|
324
326
|
### API Gotchas
|
325
327
|
|
@@ -2141,7 +2143,7 @@ IMAGE_ROWS = []
|
|
2141
2143
|
data = canvas.to_rgba_stream
|
2142
2144
|
width = canvas.width
|
2143
2145
|
height = canvas.height
|
2144
|
-
img = image
|
2146
|
+
img = image {
|
2145
2147
|
image_part(data, width, height, width * 4)
|
2146
2148
|
}
|
2147
2149
|
IMAGE_ROWS << [img] # array of one column cell
|
@@ -2219,23 +2221,19 @@ IMAGE_ROWS = []
|
|
2219
2221
|
data = canvas.to_rgba_stream
|
2220
2222
|
width = canvas.width
|
2221
2223
|
height = canvas.height
|
2222
|
-
img = image
|
2224
|
+
img = image {
|
2223
2225
|
image_part(data, width, height, width * 4)
|
2224
2226
|
}
|
2225
2227
|
text = url.sub('https://www.ghibli.jp/gallery/thumb-redturtle', '').sub('.png', '')
|
2226
|
-
IMAGE_ROWS << [[img, text],
|
2228
|
+
IMAGE_ROWS << [[img, text], [img, text]] # cell values are dual-element arrays
|
2227
2229
|
rescue StandardError => e
|
2228
2230
|
warn url, e.message
|
2229
2231
|
end
|
2230
2232
|
|
2231
|
-
window('The Red Turtle',
|
2233
|
+
window('The Red Turtle', 670, 350) {
|
2232
2234
|
horizontal_box {
|
2233
2235
|
table {
|
2234
2236
|
image_text_column('image/number')
|
2235
|
-
text_column('number')
|
2236
|
-
text_column('number (editable)') {
|
2237
|
-
editable true
|
2238
|
-
}
|
2239
2237
|
image_text_column('image/number (editable)') {
|
2240
2238
|
editable true
|
2241
2239
|
}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.23
|
@@ -20,23 +20,19 @@ IMAGE_ROWS = []
|
|
20
20
|
data = canvas.to_rgba_stream
|
21
21
|
width = canvas.width
|
22
22
|
height = canvas.height
|
23
|
-
img = image
|
23
|
+
img = image {
|
24
24
|
image_part(data, width, height, width * 4)
|
25
25
|
}
|
26
26
|
text = url.sub('https://www.ghibli.jp/gallery/thumb-redturtle', '').sub('.png', '')
|
27
|
-
IMAGE_ROWS << [[img, text],
|
27
|
+
IMAGE_ROWS << [[img, text], [img, text]] # cell values are dual-element arrays
|
28
28
|
rescue StandardError => e
|
29
29
|
warn url, e.message
|
30
30
|
end
|
31
31
|
|
32
|
-
window('The Red Turtle',
|
32
|
+
window('The Red Turtle', 670, 350) {
|
33
33
|
horizontal_box {
|
34
34
|
table {
|
35
35
|
image_text_column('image/number')
|
36
|
-
text_column('number')
|
37
|
-
text_column('number (editable)') {
|
38
|
-
editable true
|
39
|
-
}
|
40
36
|
image_text_column('image/number (editable)') {
|
41
37
|
editable true
|
42
38
|
}
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -27,6 +27,16 @@ module Glimmer
|
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class ImagePartProxy < ControlProxy
|
30
|
+
def initialize(keyword, parent, args, &block)
|
31
|
+
@keyword = keyword
|
32
|
+
@parent_proxy = parent
|
33
|
+
@args = args
|
34
|
+
@block = block
|
35
|
+
@enabled = true
|
36
|
+
@children = []
|
37
|
+
post_add_content if @block.nil?
|
38
|
+
end
|
39
|
+
|
30
40
|
private
|
31
41
|
|
32
42
|
def build_control
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/libui/control_proxy'
|
23
|
+
require 'glimmer/data_binding/observer'
|
24
|
+
|
25
|
+
using ArrayIncludeMethods
|
26
|
+
|
27
|
+
module Glimmer
|
28
|
+
module LibUI
|
29
|
+
# Proxy for LibUI image objects
|
30
|
+
#
|
31
|
+
# Follows the Proxy Design Pattern
|
32
|
+
class ImageProxy < ControlProxy
|
33
|
+
def initialize(keyword, parent, args, &block)
|
34
|
+
@keyword = keyword
|
35
|
+
@parent_proxy = parent
|
36
|
+
@args = args
|
37
|
+
@block = block
|
38
|
+
@enabled = true
|
39
|
+
@children = []
|
40
|
+
post_add_content if @block.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
def post_add_content
|
44
|
+
build_control
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_initialize_child(child)
|
49
|
+
@children << child
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def build_control
|
55
|
+
@args = [@children.first.args[1], @children.first.args[2]] if @children.size == 1 && (@args[0].nil? || @args[1].nil?)
|
56
|
+
super
|
57
|
+
@libui.tap do
|
58
|
+
@children.each {|child| child&.send(:build_control) }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
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.0.
|
4
|
+
version: 0.0.23
|
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-09-
|
11
|
+
date: 2021-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0.
|
53
|
+
version: 0.0.10
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.0.
|
60
|
+
version: 0.0.10
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: juwelier
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- lib/glimmer/libui/horizontal_box_proxy.rb
|
247
247
|
- lib/glimmer/libui/image_column_proxy.rb
|
248
248
|
- lib/glimmer/libui/image_part_proxy.rb
|
249
|
+
- lib/glimmer/libui/image_proxy.rb
|
249
250
|
- lib/glimmer/libui/image_text_column_proxy.rb
|
250
251
|
- lib/glimmer/libui/label_proxy.rb
|
251
252
|
- lib/glimmer/libui/menu_item_proxy.rb
|