glimmer-dsl-libui 0.5.4 → 0.5.5
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 +154 -9
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 186c49fc28b9767289f398563e727a564aec12ccadee63ef1ef8b8337b186c34
|
4
|
+
data.tar.gz: 45b1ea94ca10b26f52146270c40cd4cf43567ff8142aecda6b1f46c528418882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 253f2335dc985e7e25481f27fb78d78b9ce2a77b1c86cbd513c1e3d289d6204155e72512cbb72994329d905e4906bdf7905e3e070487d19c22605092ce249a70
|
7
|
+
data.tar.gz: 33633220d46d61a1428c9e0cfad06ea6a0706a44bc537006802f4f24210bbb415a04c7332c4f7fd020e1fb68adce28edf81946ea88eb4652a44fce847725c5fe
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.5
|
4
|
+
|
5
|
+
- Upgrade to libui 0.0.15 (with official Mac ARM64 support)
|
6
|
+
- Update [README](/README.md) with [Area Animation](/README.md#area-animation) `spinner` custom control
|
7
|
+
|
3
8
|
## 0.5.4
|
4
9
|
|
5
10
|
- Support `figure` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
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.5.
|
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.5.5
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -24,8 +24,6 @@ The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/gl
|
|
24
24
|
- [Far Future Plan] Scaffolding for new custom controls, apps, and gems
|
25
25
|
- [Far Future Plan] Native-Executable packaging on Mac, Windows, and Linux.
|
26
26
|
|
27
|
-
Note that currently, [LibUI](https://github.com/kojix2/LibUI) only includes x86_64 binaries out of the box, but there are plans to include ARM64/AARCH64 binaries too in the future.
|
28
|
-
|
29
27
|
Hello, World!
|
30
28
|
|
31
29
|
```ruby
|
@@ -338,7 +336,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
338
336
|
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
339
337
|
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
|
340
338
|
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
341
|
-
[Glimmer DSL for Tk (
|
339
|
+
[Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Complicated Setup / Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
342
340
|
[Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
|
343
341
|
[Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
|
344
342
|
[Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
|
@@ -370,6 +368,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
370
368
|
- [Area Listeners](#area-listeners)
|
371
369
|
- [Area Methods/Attributes](#area-methods-attributes)
|
372
370
|
- [Area Transform Matrix](#area-transform-matrix)
|
371
|
+
- [Area Animation](#area-animation)
|
373
372
|
- [Smart Defaults and Conventions](#smart-defaults-and-conventions)
|
374
373
|
- [Custom Keywords](#custom-keywords)
|
375
374
|
- [Observer Pattern](#observer-pattern)
|
@@ -452,10 +451,68 @@ The Glimmer GUI DSL provides object-oriented declarative hierarchical syntax for
|
|
452
451
|
- Requires the minimum amount of syntax needed to describe an app's GUI
|
453
452
|
|
454
453
|
The Glimmer GUI DSL follows these simple concepts in mapping from [LibUI](https://github.com/kojix2/LibUI) syntax:
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
454
|
+
|
455
|
+
**Keyword(args)**: [LibUI](https://github.com/kojix2/LibUI) controls may be declared by lower-case underscored name (aka keyword from list of [supported keywords](#supported-keywords)) (e.g. `window` or `button`). Behind the scenes, they are represented by keyword methods that map to corresponding `LibUI.new_keyword` methods receiving args (e.g. `window('hello world', 300, 200, true)`).
|
456
|
+
|
457
|
+
**Content Block** (Properties/Listeners/Controls): Any keyword may be optionally followed by a Ruby curly-brace multi-line content block containing properties (attributes), listeners, and/or nested controls.
|
458
|
+
|
459
|
+
Example:
|
460
|
+
|
461
|
+
```ruby
|
462
|
+
window {
|
463
|
+
title 'hello world' # property
|
464
|
+
|
465
|
+
on_closing do # listener (always has a do; end block to signify logic)
|
466
|
+
puts 'Bye'
|
467
|
+
end
|
468
|
+
|
469
|
+
button('greet') { # nested control
|
470
|
+
on_clicked do
|
471
|
+
puts 'hello world'
|
472
|
+
end
|
473
|
+
}
|
474
|
+
}
|
475
|
+
```
|
476
|
+
|
477
|
+
Content block optionally receives one arg representing the controll
|
478
|
+
|
479
|
+
Example:
|
480
|
+
|
481
|
+
```ruby
|
482
|
+
button('greet') { |b|
|
483
|
+
on_clicked do
|
484
|
+
puts b.text
|
485
|
+
end
|
486
|
+
}
|
487
|
+
```
|
488
|
+
|
489
|
+
**Property**: Control properties may be declared inside keyword blocks with lower-case underscored name followed by property value args (e.g. `title "hello world"` inside `group`). Behind the scenes, properties correspond to `LibUI.control_set_property` methods.
|
490
|
+
|
491
|
+
**Listener**: Control listeners may be declared inside keyword blocks with listener lower-case underscored name beginning with `on_` and receiving required block handler (always followed by a `do; end` style block to signify logic).
|
492
|
+
|
493
|
+
Example:
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
button('click') {
|
497
|
+
on_clicked do
|
498
|
+
puts 'clicked'
|
499
|
+
end
|
500
|
+
}
|
501
|
+
```
|
502
|
+
|
503
|
+
Optionally, the listener block can receive an arg representing the control.
|
504
|
+
|
505
|
+
```ruby
|
506
|
+
button('click') {
|
507
|
+
on_clicked do |btn|
|
508
|
+
puts btn.text
|
509
|
+
end
|
510
|
+
}
|
511
|
+
```
|
512
|
+
|
513
|
+
Behind the scenes, listeners correspond to `LibUI.control_on_event` methods.
|
514
|
+
|
515
|
+
**Method**: Controls have methods that invoke certain operations on them. For example, `window` has a `#show` method that shows the window GUI. More methods are mentioned under [API](#api)
|
459
516
|
|
460
517
|
Example of an app written in [LibUI](https://github.com/kojix2/LibUI)'s procedural imperative syntax:
|
461
518
|
|
@@ -519,7 +576,7 @@ gem install glimmer-dsl-libui
|
|
519
576
|
Or install via Bundler `Gemfile`:
|
520
577
|
|
521
578
|
```ruby
|
522
|
-
gem 'glimmer-dsl-libui', '~> 0.5.
|
579
|
+
gem 'glimmer-dsl-libui', '~> 0.5.5'
|
523
580
|
```
|
524
581
|
|
525
582
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -1404,6 +1461,92 @@ You can set a `matrix`/`transform` on `area` directly to conveniently apply to a
|
|
1404
1461
|
|
1405
1462
|
Note that `area`, `path`, and nested shapes are all truly declarative, meaning they do not care about the ordering of calls to `fill`, `stroke`, and `transform`. Furthermore, any transform that is applied is reversed at the end of the block, so you never have to worry about the ordering of `transform` calls among different paths. You simply set a transform on the `path`s that need it and it is guaranteed to be called before all its content is drawn, and then undone afterwards to avoid affecting later paths. Matrix `transform` can be set on an entire `area` too, applying to all nested `path`s.
|
1406
1463
|
|
1464
|
+
#### Area Animation
|
1465
|
+
|
1466
|
+
If you need to animate `area` vector graphics, you just have to use the [`Glimmer::LibUI::timer`](#libui-operations) method along with making changes to shape attributes.
|
1467
|
+
|
1468
|
+
Spinner example that has a fully customizable method-based custom control called `spinner`, which is destroyed if you click on it (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
1469
|
+
|
1470
|
+
```ruby
|
1471
|
+
require 'glimmer-dsl-libui'
|
1472
|
+
|
1473
|
+
class SpinnerExample
|
1474
|
+
include Glimmer
|
1475
|
+
|
1476
|
+
SIZE = 120
|
1477
|
+
|
1478
|
+
def initialize
|
1479
|
+
create_gui
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
def launch
|
1483
|
+
@main_window.show
|
1484
|
+
end
|
1485
|
+
|
1486
|
+
def create_gui
|
1487
|
+
@main_window = window {
|
1488
|
+
title 'Spinner'
|
1489
|
+
content_size SIZE*2, SIZE*2
|
1490
|
+
|
1491
|
+
horizontal_box {
|
1492
|
+
padded false
|
1493
|
+
|
1494
|
+
vertical_box {
|
1495
|
+
padded false
|
1496
|
+
|
1497
|
+
spinner(size: SIZE)
|
1498
|
+
spinner(size: SIZE, fill_color: [42, 153, 214])
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
vertical_box {
|
1502
|
+
padded false
|
1503
|
+
|
1504
|
+
spinner(size: SIZE/2.0, fill_color: :orange)
|
1505
|
+
spinner(size: SIZE/2.0, fill_color: {x0: 0, y0: 0, x1: SIZE/2.0, y1: SIZE/2.0, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 1, r: 2, g: 2, b: 254}]})
|
1506
|
+
spinner(size: SIZE/2.0, fill_color: :green, unfilled_color: :yellow)
|
1507
|
+
spinner(size: SIZE/2.0, fill_color: :white, unfilled_color: :gray, background_color: :black)
|
1508
|
+
}
|
1509
|
+
}
|
1510
|
+
}
|
1511
|
+
end
|
1512
|
+
|
1513
|
+
def spinner(size: 40.0, fill_color: :gray, background_color: :white, unfilled_color: {r: 243, g: 243, b: 243}, donut_percentage: 0.25)
|
1514
|
+
arc1 = arc2 = nil
|
1515
|
+
area { |the_area|
|
1516
|
+
rectangle(0, 0, size, size) {
|
1517
|
+
fill background_color
|
1518
|
+
}
|
1519
|
+
circle(size/2.0, size/2.0, size/2.0) {
|
1520
|
+
fill fill_color
|
1521
|
+
}
|
1522
|
+
arc1 = arc(size/2.0, size/2.0, size/2.0, 0, 180) {
|
1523
|
+
fill unfilled_color
|
1524
|
+
}
|
1525
|
+
arc2 = arc(size/2.0, size/2.0, size/2.0, 90, 180) {
|
1526
|
+
fill unfilled_color
|
1527
|
+
}
|
1528
|
+
circle(size/2.0, size/2.0, (size/2.0)*(1.0 - donut_percentage)) {
|
1529
|
+
fill background_color
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
on_mouse_up do
|
1533
|
+
the_area.destroy
|
1534
|
+
end
|
1535
|
+
}.tap do
|
1536
|
+
Glimmer::LibUI.timer(0.05) do
|
1537
|
+
delta = 10
|
1538
|
+
arc1.start_angle += delta
|
1539
|
+
arc2.start_angle += delta
|
1540
|
+
end
|
1541
|
+
end
|
1542
|
+
end
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
SpinnerExample.new.launch
|
1546
|
+
```
|
1547
|
+
|
1548
|
+

|
1549
|
+
|
1407
1550
|
### Smart Defaults and Conventions
|
1408
1551
|
|
1409
1552
|
- `horizontal_box`, `vertical_box`, `grid`, and `form` controls have `padded` as `true` upon instantiation to ensure more user-friendly GUI by default
|
@@ -1868,6 +2011,7 @@ Learn more from data-binding usage in [Login](#login) (4 data-binding versions),
|
|
1868
2011
|
- There is no proper way to destroy `grid` children due to [libui](https://github.com/andlabs/libui) not offering any API for deleting them from `grid` (no `grid_delete` similar to `box_delete` for `horizontal_box` and `vertical_box`).
|
1869
2012
|
- `table` `checkbox_column` checkbox editing only works on Linux and Windows (not Mac) due to a current limitation in [libui](https://github.com/andlabs/ui/issues/357).
|
1870
2013
|
- `table` `checkbox_text_column` checkbox editing only works on Linux (not Mac or Windows) due to a current limitation in [libui](https://github.com/andlabs/ui/issues/357).
|
2014
|
+
- `checkbox` only supports obtaining the `checked` property, but not updating it due to a current limitation in [libui](https://github.com/andlabs/libui).
|
1871
2015
|
- `text` `align` property seems not to work on the Mac ([libui](https://github.com/andlabs/libui) has an [issue](https://github.com/andlabs/libui/pull/407) about it)
|
1872
2016
|
- `text` `string` `background` does not work on Windows due to an [issue in libui](https://github.com/andlabs/libui/issues/347).
|
1873
2017
|
- `table` `progress_bar` column on Windows cannot be updated with a positive value if it started initially with `-1` (it ignores update to avoid crashing due to an issue in [libui](https://github.com/andlabs/libui) on Windows.
|
@@ -1875,6 +2019,7 @@ Learn more from data-binding usage in [Login](#login) (4 data-binding versions),
|
|
1875
2019
|
- It seems that [libui](https://github.com/andlabs/libui) does not support nesting multiple `area` controls under a `grid` as only the first one shows up in that scenario. To workaround that limitation, use a `vertical_box` with nested `horizontal_box`s instead to include multiple `area`s in a GUI.
|
1876
2020
|
- As per the code of [examples/basic_transform.rb](#basic-transform), Windows requires different ordering of transforms than Mac and Linux.
|
1877
2021
|
- `scrolling_area#scroll_to` does not seem to work on Windows and Linux, but works fine on Mac
|
2022
|
+
- When creating/showing a window other than the main window and then closing the secondary window, the entire app closes. This is a current limitation to the windowing system that should be fixed with [child window support](https://github.com/andlabs/libui/issues/137) in [libui](https://github.com/andlabs/libui)
|
1878
2023
|
|
1879
2024
|
### Original API
|
1880
2025
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.5
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
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.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.0.
|
81
|
+
version: 0.0.15
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.0.
|
88
|
+
version: 0.0.15
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: chunky_png
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|