glimmer-dsl-libui 0.11.8 → 0.11.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +75 -13
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/content_expression.rb +1 -0
- data/lib/glimmer/libui/control_proxy/transformable.rb +1 -0
- data/lib/glimmer/libui/control_proxy.rb +5 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dc986b55cf3a2e7709de2312a9c1c347d46ab164f4fcb9b7d9ffb4f03f938b7
|
4
|
+
data.tar.gz: 16788eb79d6c697856296ffccd60e430a2068208ee2b4f43850183eee56dc9e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad2265f1cefe53aa1d23157c33c0e8126738943ddcd735e0d3da24fcf9afa3ae1e467b66bdae204c0e0474d926938bcf693ab9c8510495521595a994a493d05
|
7
|
+
data.tar.gz: 8de4c0931c5a47d052eb4818512f6a0149a7c634c6375c79307695a3eef075eac8043d2a2eb38758f8d0fcc7c72fdac11fb19bb635ccf5cef6e592fbcd7b313a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.11.10
|
4
|
+
|
5
|
+
- Fix issue with not being able to add content to the body root of a custom control by opening a block when invoking the custom control keyword
|
6
|
+
|
7
|
+
## 0.11.9
|
8
|
+
|
9
|
+
- Support Content Data-Binding to multiple model attributes via `computed_by` option (e.g. `content(@game, :scale, computed_by: [:width, :height])` or `content(@game, computed_by: [:scale, :width, :height])` will rebuild content on changes to `:scale`, `:width`, or `:height`)
|
10
|
+
|
3
11
|
## 0.11.8
|
4
12
|
|
5
13
|
- Fix issue with applying a `transform` inside a `Glimmer::LibUI::Application`, `Glimmer::LibUI::CustomControl`, `Glimmer::LibUI::CustomWindow`, or `Glimmer::LibUI::CustomShape` (it otherwise worked when using Glimmer GUI DSL in top-level object)
|
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.11.
|
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.11.10
|
2
2
|
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](http://www.digitalfukuoka.jp/topics/187?locale=ja))
|
3
3
|
### The Quickest Way From Zero To GUI
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
@@ -31,7 +31,7 @@ The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/gl
|
|
31
31
|
- [Custom Component](#custom-components) support (Custom Controls, Custom Windows, and Custom Shapes), including external Ruby gems (e.g. [Graphs and Charts](https://github.com/AndyObtiva/glimmer-libui-cc-graphs_and_charts))
|
32
32
|
- [Bidirectional/Unidirectional Data-Binding](#data-binding) to declaratively wire and automatically synchronize GUI Views with Models
|
33
33
|
- [Scaffolding](#scaffold-application) for new custom windows/controls, apps, and gems
|
34
|
-
- [Far Future Plan] Native-Executable packaging on Mac, Windows, and Linux.
|
34
|
+
- [Far Future Plan] Native-Executable [packaging](#packaging) on Mac, Windows, and Linux.
|
35
35
|
|
36
36
|
Hello, World!
|
37
37
|
|
@@ -431,7 +431,8 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
431
431
|
- [RubyCrumbler](#rubycrumbler)
|
432
432
|
- [Rubio-Radio](#rubio-radio)
|
433
433
|
- [PMV Calc](#pmv-calc)
|
434
|
-
- [
|
434
|
+
- [Design Principles](#design-principles)
|
435
|
+
- [Glimmer Process](#glimmer-process)
|
435
436
|
- [Resources](#resources)
|
436
437
|
- [Help](#help)
|
437
438
|
- [Issues](#issues)
|
@@ -444,6 +445,8 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
444
445
|
|
445
446
|
## Setup
|
446
447
|
|
448
|
+
Note: the newest Ruby 3.3 is not fully supported yet.
|
449
|
+
|
447
450
|
Install [glimmer-dsl-libui](https://rubygems.org/gems/glimmer-dsl-libui) gem directly into a [maintained Ruby version](https://www.ruby-lang.org/en/downloads/):
|
448
451
|
|
449
452
|
```
|
@@ -453,7 +456,7 @@ gem install glimmer-dsl-libui
|
|
453
456
|
Or install via Bundler `Gemfile`:
|
454
457
|
|
455
458
|
```ruby
|
456
|
-
gem 'glimmer-dsl-libui', '~> 0.11.
|
459
|
+
gem 'glimmer-dsl-libui', '~> 0.11.10'
|
457
460
|
```
|
458
461
|
|
459
462
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -485,7 +488,7 @@ Afterwards, to access the Glimmer GUI DSL:
|
|
485
488
|
|
486
489
|
You may learn more about the different options above with basic examples in the following subsections: [Experimentation Usage](#experimentation-usage), [Prototyping Usage](#prototyping-usage), [Serious Usage](#serious-usage).
|
487
490
|
|
488
|
-
If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Style Guide](#glimmer-style-guide), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. Alternatively, beginners can learn from the RubyConf 2023 workshop ["How To Build Desktop Applications in Ruby"](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby), which includes 27 step-by-step exercises. You may refer to the [API](#api) once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need a more detailed reference.
|
491
|
+
If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Style Guide](#glimmer-style-guide), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. Alternatively, beginners can learn from the RubyConf 2023 workshop ["How To Build Desktop Applications in Ruby"](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby), which includes 27 step-by-step exercises. You may refer to the [API](#api) once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need a more detailed reference.
|
489
492
|
|
490
493
|
If you encounter any issues with the documentation, get stuck with code you do not understand, or notice some out-of-date information, you may contact the project maintainers on the [Glimmer Gitter Chat](https://app.gitter.im/#/room/#AndyObtiva_glimmer:gitter.im). Also, this could be your opportunity to be a good steward of Open-Source Software by contributing a documentation fix in a GitHub Pull Request or reporting a GitHub Issue at least.
|
491
494
|
|
@@ -660,7 +663,7 @@ Mac | Windows | Linux
|
|
660
663
|
|
661
664
|
Application scaffolding enables automatically generating the directories/files of a new desktop GUI application that follows the MVC architecture and can be packaged as a Ruby gem that includes an executable script for running the app conveniently. It also ensures that software engineers follow the recommended Glimmer DSL for LibUI conventions and best practices. Application Scaffolding greatly improves software engineering productivity when building desktop applications with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui).
|
662
665
|
|
663
|
-
Application Scaffolding relies on the juwelier Ruby gem, which expects a local Git config of [`user.name`](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git#setting-your-git-username-for-every-repository-on-your-computer) (git config --global user.name "FirstName LastName") and `github.user` (`git config --global github.user githubusername`).
|
666
|
+
Application Scaffolding relies on the juwelier Ruby gem, which expects a local Git config of [`user.name`](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git#setting-your-git-username-for-every-repository-on-your-computer) (git config --global user.name "FirstName LastName") and `github.user` (`git config --global github.user githubusername`).
|
664
667
|
|
665
668
|
Scaffold Glimmer DSL for LibUI application with this command:
|
666
669
|
|
@@ -1663,7 +1666,51 @@ form {
|
|
1663
1666
|
}
|
1664
1667
|
```
|
1665
1668
|
|
1666
|
-
The form above will only display fields for a model's customizable attributes, so if they change, the form content will change too.
|
1669
|
+
The form above will only display fields for a model's customizable attributes, so if they change, the form content will change too.
|
1670
|
+
|
1671
|
+
If you need to rebuild (re-render) content upon changes to multiple model attributes, you can use the `computed_by` option.
|
1672
|
+
|
1673
|
+
Example:
|
1674
|
+
|
1675
|
+
```ruby
|
1676
|
+
form {
|
1677
|
+
stretchy false
|
1678
|
+
|
1679
|
+
content(@user, :address, computed_by: [:street, :city, :zipcode]) {
|
1680
|
+
@user.address_attributes.each do |attribute|
|
1681
|
+
entry {
|
1682
|
+
label attribute.to_s.split('_').map(&:capitalize).join(' ')
|
1683
|
+
text <=> [@user, attribute]
|
1684
|
+
}
|
1685
|
+
end
|
1686
|
+
}
|
1687
|
+
}
|
1688
|
+
```
|
1689
|
+
|
1690
|
+
Now, the content block will get called when changes occur to any of `User` `address` ,`street`, `city`, or `zipcode`.
|
1691
|
+
|
1692
|
+
If you do not have a main attribute that is computed by other attributes, you can leave the main attribute out while using `computed_by`.
|
1693
|
+
|
1694
|
+
Example:
|
1695
|
+
|
1696
|
+
```ruby
|
1697
|
+
form {
|
1698
|
+
stretchy false
|
1699
|
+
|
1700
|
+
content(@user, computed_by: [:street, :city, :zipcode]) {
|
1701
|
+
@user.address_attributes.each do |attribute|
|
1702
|
+
entry {
|
1703
|
+
label attribute.to_s.split('_').map(&:capitalize).join(' ')
|
1704
|
+
text <=> [@user, attribute]
|
1705
|
+
}
|
1706
|
+
end
|
1707
|
+
}
|
1708
|
+
}
|
1709
|
+
```
|
1710
|
+
|
1711
|
+
Now, the content block will get called (rerendered) when changes occur to any of `User` `street`, `city`, or `zipcode`.
|
1712
|
+
|
1713
|
+
Learn more about Content Data-Binding at the [Dynamic Form](/docs/examples/GLIMMER-DSL-LIBUI-ADVANCED-EXAMPLES.md#dynamic-form) example.
|
1667
1714
|
|
1668
1715
|
**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.
|
1669
1716
|
|
@@ -3791,17 +3838,20 @@ To learn more about the [LibUI](https://github.com/kojix2/LibUI) API exposed thr
|
|
3791
3838
|
|
3792
3839
|
## Packaging
|
3793
3840
|
|
3794
|
-
I am documenting options for packaging, which I have not tried myself, but figured they would still be useful to add to the README.md until I can expand further effort into supporting packaging.
|
3841
|
+
If you are building a productivity tool to help with your work, then packaging the app as a Ruby gem would be a good enough solution (already supported via [Application Scaffolding](#scaffold-application)). Otherwise, I am documenting options for native executable packaging, which I have not tried myself, but figured they would still be useful to add to the README.md until I can expand further effort into supporting packaging.
|
3795
3842
|
|
3796
|
-
For Windows,
|
3843
|
+
For Windows, [OCRAN](https://github.com/Largo/ocran) can build Windows executables from Ruby source code. It is a new maintained alternative version of [OCRA](https://github.com/larsch/ocra) (One-Click Ruby Application).
|
3797
3844
|
|
3798
|
-
For Mac, consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a native Mac app from a Ruby script)
|
3845
|
+
For Mac, you can consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a native Mac app from a Ruby script) by following the tutorial ["Create a MacOS desktop application with pure Ruby"](https://dev.to/josephschito/create-macos-application-desktop-with-pure-ruby-tutorial-36io) by Joseph Schito.
|
3799
3846
|
|
3800
3847
|
For Linux, simply package your app as a [Ruby Gem](https://guides.rubygems.org/what-is-a-gem/) and [build rpm package from Ruby Gem](https://www.redpill-linpro.com/sysadvent/2015/12/07/building-rpms-from-gems.html) or [build deb package from Ruby Gem](https://openpreservation.org/blogs/building-debian-package-ruby-program/).
|
3801
3848
|
|
3802
3849
|
Also, there is a promising project called [ruby-packer](https://github.com/pmq20/ruby-packer) that supports all platforms.
|
3803
3850
|
|
3804
|
-
|
3851
|
+
One more thing to note is that Ruby recently supported WASM, including the ability to [package a Ruby application as a WASI application](https://github.com/ruby/ruby.wasm#quick-example-how-to-package-your-ruby-application-as-a-wasi-application). You can explore combining that with [wasm2native](https://github.com/vshymanskyy/wasm2native) to produce cross-platform native executables.
|
3852
|
+
|
3853
|
+
Otherwise, if you really need comprehensive cross-platform native executable packaging support, consider using [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt), which does offer [cross-platform packaging support](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) for apps as MSI/EXE on Windows, APP/DMG/PKG on Mac, and DEB/RPM on Linux out of the box.
|
3854
|
+
|
3805
3855
|
|
3806
3856
|
## Glimmer Style Guide
|
3807
3857
|
|
@@ -4231,13 +4281,25 @@ This is built as an exploratory software prototype by [Ari Brown](https://github
|
|
4231
4281
|
|
4232
4282
|
### Adamantite
|
4233
4283
|
|
4234
|
-
A local password manager written in Ruby
|
4284
|
+
A local password manager written in Ruby:
|
4235
4285
|
|
4236
4286
|
https://rubygems.org/gems/adamantite
|
4237
4287
|
|
4238
4288
|
![Adamantite password manager](/images/glimmer-dsl-libui-mac-application-adamantite.png)
|
4239
4289
|
|
4240
|
-
##
|
4290
|
+
## Design Principles
|
4291
|
+
|
4292
|
+
- The Ruby Way (including TIMTOWTDI: There Is More Than One Way To Do It)
|
4293
|
+
- Requiring the least amount of syntax possible to build GUI (Graphical User Interface)
|
4294
|
+
- Declarative syntax that visually maps to the GUI control hierarchy
|
4295
|
+
- Ability to mix declarative and imperative code conveniently without needing awkward & verbose technologies (e.g. no XML, HTML, ERB scriptlets, JSX)
|
4296
|
+
- Computers serve Software Engineers (not Software Engineers serve Computers)
|
4297
|
+
- Think only about real world concepts directly relevant to the GUI and interacting with it (no weird non-real-world irrelevant concepts like hooks/effects/immutability)
|
4298
|
+
- The Rails Way Convention over Configuration via smart defaults and automation of low-level details
|
4299
|
+
- Modular Software Design (e.g. support for Components)
|
4300
|
+
- No premature optimizations
|
4301
|
+
|
4302
|
+
## Glimmer Process
|
4241
4303
|
|
4242
4304
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
4243
4305
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.10
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -25,6 +25,7 @@ module Glimmer
|
|
25
25
|
module DSL
|
26
26
|
module Libui
|
27
27
|
class ContentExpression < Expression
|
28
|
+
# TODO rename to ContentDataBindingExpression given it is no longer a static_expression (and update in dsl.rb)
|
28
29
|
def can_interpret?(parent, keyword, *args, &block)
|
29
30
|
keyword == 'content' &&
|
30
31
|
block_given? &&
|
@@ -42,6 +42,7 @@ module Glimmer
|
|
42
42
|
def transform(matrix = nil, &transform_body_block)
|
43
43
|
if matrix.nil?
|
44
44
|
if transform_body_block
|
45
|
+
# TODO Consider using alternate version of Engine call instead: Glimmer::DSL::Engine.interpret('transform', &transform_body_block) (or delete this comment if not needed)
|
45
46
|
Glimmer::DSL::Engine.interpret_expression(Glimmer::DSL::Libui::ControlExpression.new, 'transform', &transform_body_block)
|
46
47
|
else
|
47
48
|
@transform
|
@@ -126,12 +126,13 @@ module Glimmer
|
|
126
126
|
]
|
127
127
|
|
128
128
|
# libui returns the contained LibUI object
|
129
|
-
attr_reader :parent_proxy, :libui, :args, :keyword, :block, :content_added
|
129
|
+
attr_reader :parent_proxy, :parent_custom_control, :libui, :args, :keyword, :block, :content_added
|
130
130
|
alias content_added? content_added
|
131
131
|
|
132
132
|
def initialize(keyword, parent, args, &block)
|
133
133
|
@keyword = keyword
|
134
|
-
@
|
134
|
+
@parent_custom_control = parent if parent.is_a?(CustomControl)
|
135
|
+
@parent_proxy = parent.is_a?(CustomControl) ? parent.body_root : parent
|
135
136
|
@args = args
|
136
137
|
@block = block
|
137
138
|
@enabled = true
|
@@ -395,8 +396,9 @@ module Glimmer
|
|
395
396
|
children.dup.each { |child| child.destroy }
|
396
397
|
content(&content_block)
|
397
398
|
end
|
399
|
+
model_binding_observer = Glimmer::DataBinding::ModelBinding.new(*binding_args)
|
398
400
|
content_binding_observer = Glimmer::DataBinding::Observer.proc(&content_binding_work)
|
399
|
-
content_binding_observer.observe(
|
401
|
+
content_binding_observer.observe(model_binding_observer)
|
400
402
|
content_binding_work.call # TODO inspect if we need to pass args here (from observed attributes) [but it's simpler not to pass anything at first]
|
401
403
|
end
|
402
404
|
|
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.11.
|
4
|
+
version: 0.11.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -640,7 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
640
640
|
- !ruby/object:Gem::Version
|
641
641
|
version: '0'
|
642
642
|
requirements: []
|
643
|
-
rubygems_version: 3.
|
643
|
+
rubygems_version: 3.4.10
|
644
644
|
signing_key:
|
645
645
|
specification_version: 4
|
646
646
|
summary: Glimmer DSL for LibUI (Fukuoka Award Winning Prerequisite-Free Ruby Desktop
|