glimmer-dsl-libui 0.4.12 → 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -5
- data/VERSION +1 -1
- data/examples/cpu_percentage.rb +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/image_proxy.rb +16 -0
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1f51ecb1e42d70d4081b671b3ba4ee277a35cc5f75372536a826802f2766124
|
4
|
+
data.tar.gz: 949069cd28522b6480ae3095cd4056aaeb26c90758429a393a5ee325a5e29c4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f0f791fe044894e4aa300f9642b2703e1774e0bb02bb98044056306e6e06ae32d58296301c0e6b6c0ede7bd2236ce2c2793ee56beb5e9f7db2ea772e427811d
|
7
|
+
data.tar.gz: 8d11e1478a7c6a317a1a176cf464faaff5947231f01635c69d9771baf643ef80afba40ae92fdff551959f81f17eab2effa6edfe7dc40085ee020c789e1baf586
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.4.13
|
4
|
+
|
5
|
+
- Shorten height of examples/cpu_percentage.rb
|
6
|
+
- Optimize `table` `image` object by caching for multiple images sharing the same arguments
|
7
|
+
|
3
8
|
## 0.4.12
|
4
9
|
|
5
10
|
- Support `table` data-binding to model rows when utilizing dual-columns or triple-columns (e.g. columns having color and/or a checkbox in addition to text)
|
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.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.4.13
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -500,7 +500,7 @@ gem install glimmer-dsl-libui
|
|
500
500
|
Or install via Bundler `Gemfile`:
|
501
501
|
|
502
502
|
```ruby
|
503
|
-
gem 'glimmer-dsl-libui', '~> 0.4.
|
503
|
+
gem 'glimmer-dsl-libui', '~> 0.4.13'
|
504
504
|
```
|
505
505
|
|
506
506
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -933,9 +933,15 @@ Check [examples/basic_scrolling_area.rb](#basic-scrolling-area) for a more detai
|
|
933
933
|
|
934
934
|
#### Area Path Shapes
|
935
935
|
|
936
|
+
`area` can have geometric shapes drawn by adding `path` elements.
|
937
|
+
|
938
|
+
To add `path` shapes under an `area`, you can do so:
|
939
|
+
- Explicitly: by adding `path` under `area` and nesting shapes (e.g. `rectangle`) underneath that share the same `fill`/`stroke`/`transform` properties
|
940
|
+
- Implicitly: by adding shapes directly under `area` when the shapes have unique `fill`/`stroke`/`transform` properties ([Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) automatically constructs `path`s as intermediary parents for shapes directly added under `area`)
|
941
|
+
|
936
942
|
`path` can receive a `draw_fill_mode` argument that can accept values `:winding` or `:alternate` and defaults to `:winding`.
|
937
943
|
|
938
|
-
Available nested `path`
|
944
|
+
Available `path` shapes (that can be nested explicitly under `path` or implicitly under `area` directly):
|
939
945
|
- `rectangle(x as Numeric, y as Numeric, width as Numeric, height as Numeric)`
|
940
946
|
- `square(x as Numeric, y as Numeric, length as Numeric)`
|
941
947
|
- `arc(x_center as Numeric, y_center as Numeric, radius as Numeric, start_angle as Numeric, sweep as Numeric, is_negative as Boolean)`
|
@@ -1354,7 +1360,8 @@ Note that `area`, `path`, and nested shapes are all truly declarative, meaning t
|
|
1354
1360
|
- Automatically provide shifted `:key` characters in `area_key_event` provided in `area` key listeners `on_key_event`, `on_key_down`, and `on_key_up`
|
1355
1361
|
- `scrolling_area` `width` and `height` default to main window width and height if not specified.
|
1356
1362
|
- `scrolling_area` `#scroll_to` 3rd and 4th arguments (`width` and `height`) default to main window width and height if not specified.
|
1357
|
-
- `area` paths are specified declaratively with figures underneath (e.g. `rectangle`) and `area` draw listener is automatically generated
|
1363
|
+
- `area` paths are specified declaratively with shapes/figures underneath (e.g. `rectangle`), and `area` draw listener is automatically generated
|
1364
|
+
- `area` path shapes can be added directly under `area` without declaring `path` explicitly as a convenient shorthand
|
1358
1365
|
- Observe figure properties (e.g. `rectangle` `width`) for changes and automatically redraw containing area accordingly
|
1359
1366
|
- Observe `path` `fill` and `stroke` hashes for changes and automatically redraw containing area accordingly
|
1360
1367
|
- Observe `text` and `string` properties for changes and automatically redraw containing area accordingly
|
@@ -1767,6 +1774,7 @@ Learn more from data-binding usage in [Login](#login) (4 data-binding versions),
|
|
1767
1774
|
|
1768
1775
|
- Never data-bind a control property to an attribute on the same view object with the same exact name (e.g. binding `entry` `text` property to `self` `text` attribute) as it would conflict with it. Instead, data-bind view property to an attribute with a different name on the view object or with the same name, but on a presenter or model object (e.g. data-bind `entry` `text` to `self` `legal_text` attribute or to `contract` model `text` attribute)
|
1769
1776
|
- Data-binding a property utilizes the control's listener associated with the property (e.g. `on_changed` for `entry` `text`), so you cannot hook into the listener directly anymore as that would negate data-binding. Instead, you can add an `after_write: ->(val) {}` option to perform something on trigger of the control listener instead.
|
1777
|
+
- Data-binding a View control to another View control directly is not a good idea. Instead, data-bind both View controls to the same Presenter/Model attribute, and that keeps them in sync while keeping the code decoupled.
|
1770
1778
|
|
1771
1779
|
### API Gotchas
|
1772
1780
|
|
@@ -6023,7 +6031,7 @@ Glimmer::LibUI.timer(1) do
|
|
6023
6031
|
data[0][2] = cpu_percentage_value
|
6024
6032
|
end
|
6025
6033
|
|
6026
|
-
window('CPU Percentage', 400,
|
6034
|
+
window('CPU Percentage', 400, 50) {
|
6027
6035
|
vertical_box {
|
6028
6036
|
table {
|
6029
6037
|
text_column('Name')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.13
|
data/examples/cpu_percentage.rb
CHANGED
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -34,6 +34,22 @@ module Glimmer
|
|
34
34
|
#
|
35
35
|
# Follows the Proxy Design Pattern
|
36
36
|
class ImageProxy < ControlProxy
|
37
|
+
class << self
|
38
|
+
# creates or returns existing instance for passed in arguments if parent is nil and block is nil
|
39
|
+
def create(keyword, parent, args, &block)
|
40
|
+
if parent.nil? && block.nil?
|
41
|
+
instances[args] ||= new(keyword, parent, args.dup, &block)
|
42
|
+
else
|
43
|
+
new(keyword, parent, args, &block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def instances
|
48
|
+
@@instances = {} unless defined? @@instances
|
49
|
+
@@instances
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
37
53
|
include Parent
|
38
54
|
prepend Transformable
|
39
55
|
|
@@ -211,8 +211,8 @@ module Glimmer
|
|
211
211
|
# TODO refactor to eliminate redundancy and share similar code
|
212
212
|
row = row - 1 if OS.windows? && row == cell_rows.count
|
213
213
|
img = expanded_cell_rows[row][column]
|
214
|
-
img = ControlProxy::ImageProxy.
|
215
|
-
img = ControlProxy::ImageProxy.
|
214
|
+
img = ControlProxy::ImageProxy.create('image', nil, img) if img.is_a?(Array)
|
215
|
+
img = ControlProxy::ImageProxy.create('image', nil, [img]) if img.is_a?(String)
|
216
216
|
img = img.respond_to?(:libui) ? img.libui : img
|
217
217
|
::LibUI.new_table_value_image(img)
|
218
218
|
when Column::CheckboxColumnProxy, Column::CheckboxTextColumnProxy, Column::CheckboxTextColorColumnProxy
|