glimmer-dsl-libui 0.5.12 → 0.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +71 -6
- data/VERSION +1 -1
- data/examples/basic_child_window.rb +19 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +29 -11
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +5 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84de8d621093ee6e1a4a5f88743e05fe3bfc3f14d844b4dbe0c8633a25b3c4b5
|
4
|
+
data.tar.gz: 6b92c7d5fe723d64aaf6f01c934d8404c055ab3154c40a1b3a1771d5a0007549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a87a6606123afd53a3ad2419734c845a57072a76c4b1b81e4725372d94ebead2ab47536b8d2f0d84d04cd2319f38f41143244b0a08189f6046de6edc3a7e1da
|
7
|
+
data.tar.gz: 8d7d4d95c4841355211c1f8058977098103ce9ac2b2c44b5d31478117f8815ee4f41afbd90cca03646f8d82e0546c79004894aed989f725b93756d8ffc2dc1f2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.15
|
4
|
+
|
5
|
+
- Fix an issue with rendering table content changes when the number of rows changes with new content that is not a subset of the old content or a container of it
|
6
|
+
|
7
|
+
## 0.5.14
|
8
|
+
|
9
|
+
- Basic Child Window example
|
10
|
+
- Modify default window closing behavior to autodetect if the window is a child window (not the main window), and if closed, ensure that does not quit the app.
|
11
|
+
- Accept `true` and `false` as return values for `on_closing` window listener as aliases to `1` and `0`
|
12
|
+
|
13
|
+
## 0.5.13
|
14
|
+
|
15
|
+
- Fix issue with rendering table content changes when having many rows
|
16
|
+
|
3
17
|
## 0.5.12
|
4
18
|
|
5
19
|
- Upgrade `perfect-shape` gem to 1.0.5 to address Ruby 3.1 issue with `matrix` gem getting extracted from Ruby into a bundled gem
|
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.15
|
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)
|
@@ -385,6 +385,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
385
385
|
- [Examples](#examples)
|
386
386
|
- [Basic Examples](#basic-examples)
|
387
387
|
- [Basic Window](#basic-window)
|
388
|
+
- [Basic Child Window](#basic-child-window)
|
388
389
|
- [Basic Button](#basic-button)
|
389
390
|
- [Basic Entry](#basic-entry)
|
390
391
|
- [Simple Notepad](#simple-notepad)
|
@@ -433,6 +434,9 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
433
434
|
- [Manga2PDF](#manga2pdf)
|
434
435
|
- [Befunge98 GUI](#befunge98-gui)
|
435
436
|
- [i3off Gtk Ruby](#i3off-gtk-ruby)
|
437
|
+
- [Chess](#chess)
|
438
|
+
- [RubyCrumbler](#rubycrumbler)
|
439
|
+
- [Rubio-Radio](#rubio-radio)
|
436
440
|
- [Process](#process)
|
437
441
|
- [Resources](#resources)
|
438
442
|
- [Help](#help)
|
@@ -579,7 +583,7 @@ gem install glimmer-dsl-libui
|
|
579
583
|
Or install via Bundler `Gemfile`:
|
580
584
|
|
581
585
|
```ruby
|
582
|
-
gem 'glimmer-dsl-libui', '~> 0.5.
|
586
|
+
gem 'glimmer-dsl-libui', '~> 0.5.15'
|
583
587
|
```
|
584
588
|
|
585
589
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -1613,8 +1617,7 @@ SpinnerExample.new.launch
|
|
1613
1617
|
- All controls nested under a `horizontal_box`, `vertical_box`, and `form` have `stretchy` property (fill maximum space) as `true` by default (passed to `box_append`/`form_append` method)
|
1614
1618
|
- If an event listener is repeated under a control (e.g. two `on_clicked {}` listeners under `button`), it does not overwrite the previous listener, yet it is added to an `Array` of listeners for the event. [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) provides multiple-event-listener support unlike [LibUI](https://github.com/kojix2/LibUI)
|
1615
1619
|
- `window` instatiation args can be left off, having the following defaults when unspecified: `title` as `''`, `width` as `190`, `height` as `150`, and `has_menubar` as `true`)
|
1616
|
-
- `window` has an `on_closing` listener by default that quits application upon hitting
|
1617
|
-
|
1620
|
+
- `window` has an `on_closing` listener by default that quits application upon hitting close button if window is the main window, not a child window (the behavior can be overridden with a manual `on_closing` implementation that returns integer `1`/`true` for closing and `0`/`false` for remaining open).
|
1618
1621
|
- `group` has `title` property default to `''` if not specified in instantiation args, so it can be instantiated without args with `title` property specified in nested block (e.g. `group {title 'Address'; ...}`)
|
1619
1622
|
- `button`, `checkbox`, and `label` have `text` default to `''` if not specified in instantiation args, so they can be instantiated without args with `text` property specified in nested block (e.g. `button {text 'Greet'; on_clicked {puts 'Hello'}}`)
|
1620
1623
|
- `quit_menu_item` has an `on_clicked` listener by default that quits application upon selecting the quit menu item (can be overridden with a manual `on_clicked` implementation that returns integer `0` for success)
|
@@ -1903,7 +1906,7 @@ Learn more from custom keyword usage in [Method-Based Custom Keyword](#method-ba
|
|
1903
1906
|
|
1904
1907
|
The [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) (a.k.a. Observer Pattern) is fundamental to building GUIs (Graphical User Interfaces) following the [MVC (Model View Controller) Architectural Pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) or any of its variations like [MVP (Model View Presenter)](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter). In the original Smalltalk-MVC, the View observes the Model for changes and updates itself accordingly.
|
1905
1908
|
|
1906
|
-
![MVC - Model View Controller](https://
|
1909
|
+
![MVC - Model View Controller](https://developer.mozilla.org/en-US/docs/Glossary/MVC/model-view-controller-light-blue.png)
|
1907
1910
|
|
1908
1911
|
[Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) supports the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) via the `observe(model, attribute_or_key=nil)` keyword, which can observe `Object` models with attributes, `Hash`es with keys, and `Array`s. It automatically enhances objects as needed to support automatically notifying observers of changes via `observable#notify_observers(attribute_or_key = nil)` method:
|
1909
1912
|
- `Object` becomes `Glimmer::DataBinding::ObservableModel`, which supports observing specified `Object` model attributes.
|
@@ -1934,7 +1937,7 @@ Data-binding automatically takes advantage of the [Observer Pattern](#observer-p
|
|
1934
1937
|
|
1935
1938
|
Data-binding supports utilizing the [MVP (Model View Presenter)](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter) flavor of [MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) by observing both the View and a Presenter for changes and updating the opposite side upon encountering them. This enables writing more decoupled cleaner code that keeps View code and Model code disentangled and highly maintainable. For example, check out the Snake game presenters for [Grid](/examples/snake/presenter/grid.rb) and [Cell](/examples/snake/presenter/cell.rb), which act as proxies for the actual Snake game models [Snake](/examples/snake/model/snake.rb) and [Apple](/examples/snake/model/apple.rb), mediating synchronization of data between them and the [Snake View GUI](/examples/snake.rb).
|
1936
1939
|
|
1937
|
-
![MVP](https://
|
1940
|
+
![MVP](https://upload.wikimedia.org/wikipedia/commons/d/dc/Model_View_Presenter_GUI_Design_Pattern.png)
|
1938
1941
|
|
1939
1942
|
#### Bidirectional (Two-Way) Data-Binding
|
1940
1943
|
|
@@ -2641,6 +2644,50 @@ window { # first 3 args can be set via properties with 4th arg has_menubar=true
|
|
2641
2644
|
}.show
|
2642
2645
|
```
|
2643
2646
|
|
2647
|
+
#### Basic Child Window
|
2648
|
+
|
2649
|
+
[examples/basic_child_window.rb](examples/basic_child_window.rb)
|
2650
|
+
|
2651
|
+
Run with this command from the root of the project if you cloned the project:
|
2652
|
+
|
2653
|
+
```
|
2654
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_child_window.rb
|
2655
|
+
```
|
2656
|
+
|
2657
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
2658
|
+
|
2659
|
+
```
|
2660
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_child_window.rb'"
|
2661
|
+
```
|
2662
|
+
|
2663
|
+
Mac | Windows | Linux
|
2664
|
+
----|---------|------
|
2665
|
+
![glimmer-dsl-libui-mac-basic-child-window.png](images/glimmer-dsl-libui-mac-basic-child-window.png) ![glimmer-dsl-libui-mac-basic-child-window-open.png](images/glimmer-dsl-libui-mac-basic-child-window-open.png) | ![glimmer-dsl-libui-windows-basic-child-window.png](images/glimmer-dsl-libui-windows-basic-child-window.png) ![glimmer-dsl-libui-windows-basic-child-window-open.png](images/glimmer-dsl-libui-windows-basic-child-window-open.png) | ![glimmer-dsl-libui-linux-basic-child-window.png](images/glimmer-dsl-libui-linux-basic-child-window.png) ![glimmer-dsl-libui-linux-basic-child-window-open.png](images/glimmer-dsl-libui-linux-basic-child-window-open.png)
|
2666
|
+
|
2667
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2668
|
+
|
2669
|
+
```ruby
|
2670
|
+
require 'glimmer-dsl-libui'
|
2671
|
+
|
2672
|
+
include Glimmer
|
2673
|
+
|
2674
|
+
window('Main Window') {
|
2675
|
+
button('Spawn Child Window') {
|
2676
|
+
on_clicked do
|
2677
|
+
window('Child Window') {
|
2678
|
+
on_closing do
|
2679
|
+
puts 'Child window is closing'
|
2680
|
+
end
|
2681
|
+
}.show
|
2682
|
+
end
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
on_closing do
|
2686
|
+
puts 'Main window is closing'
|
2687
|
+
end
|
2688
|
+
}.show
|
2689
|
+
```
|
2690
|
+
|
2644
2691
|
#### Basic Button
|
2645
2692
|
|
2646
2693
|
[examples/basic_button.rb](examples/basic_button.rb)
|
@@ -11227,6 +11274,22 @@ https://github.com/iraamaro/i3off-gtk-ruby
|
|
11227
11274
|
|
11228
11275
|
https://github.com/mikeweber/chess
|
11229
11276
|
|
11277
|
+
### RubyCrumbler
|
11278
|
+
|
11279
|
+
NLP (Natural Language Processing) App
|
11280
|
+
|
11281
|
+
https://github.com/joh-ga/RubyCrumbler
|
11282
|
+
|
11283
|
+
MacOS | Windows | Linux
|
11284
|
+
| :---: | :---: | :---:
|
11285
|
+
![mac_31](https://user-images.githubusercontent.com/72874215/159339948-b7ae1bf2-60c1-4dae-ac1a-4e13a6048ef0.gif)|![windows_4](https://user-images.githubusercontent.com/72874215/160242473-c38439be-0955-4e89-9f3f-b3d0567531fd.gif)|![rubycrumbler_linux](https://user-images.githubusercontent.com/72874215/160242460-99af1c8c-b43f-458d-bd69-1274a0bd9814.gif)
|
11286
|
+
|
11287
|
+
### Rubio-Radio
|
11288
|
+
|
11289
|
+
https://github.com/kojix2/rubio-radio
|
11290
|
+
|
11291
|
+
![rubio radio screenshot](https://user-images.githubusercontent.com/5798442/171986696-24bedc38-3811-4c62-a5ad-89c09d015c8a.png)
|
11292
|
+
|
11230
11293
|
## Process
|
11231
11294
|
|
11232
11295
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
@@ -11260,6 +11323,8 @@ These features have been planned or suggested. You might see them in a future ve
|
|
11260
11323
|
|
11261
11324
|
## Contributing
|
11262
11325
|
|
11326
|
+
If you would like to contribute to the project, please adhere to the [Open-Source Etiquette](https://github.com/AndyObtiva/open-source-etiquette) to ensure the best results.
|
11327
|
+
|
11263
11328
|
- Check out the latest master to make sure the feature hasn't been
|
11264
11329
|
implemented or the bug hasn't been fixed yet.
|
11265
11330
|
- Check out the issue tracker to make sure someone already hasn't
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.15
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window('Main Window') {
|
6
|
+
button('Spawn Child Window') {
|
7
|
+
on_clicked do
|
8
|
+
window('Child Window') {
|
9
|
+
on_closing do
|
10
|
+
puts 'Child window is closing'
|
11
|
+
end
|
12
|
+
}.show
|
13
|
+
end
|
14
|
+
}
|
15
|
+
|
16
|
+
on_closing do
|
17
|
+
puts 'Main window is closing'
|
18
|
+
end
|
19
|
+
}.show
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -302,20 +302,38 @@ module Glimmer
|
|
302
302
|
|
303
303
|
def register_cell_rows_observer
|
304
304
|
@cell_rows_observer = Glimmer::DataBinding::Observer.proc do |new_cell_rows|
|
305
|
-
if @cell_rows.size < @last_cell_rows.size
|
306
|
-
@last_cell_rows.
|
307
|
-
|
308
|
-
|
305
|
+
if @cell_rows.size < @last_cell_rows.size
|
306
|
+
@last_cell_rows.each_with_index do |old_row_data, row|
|
307
|
+
if old_row_data != @cell_rows[row] && model
|
308
|
+
::LibUI.table_model_row_changed(model, row)
|
309
|
+
notify_custom_listeners('on_changed', row, :changed, @cell_rows[row])
|
310
|
+
end
|
309
311
|
end
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
312
|
+
(@last_cell_rows.size - @cell_rows.size).times do |n|
|
313
|
+
row = @last_cell_rows.size - n - 1
|
314
|
+
if model
|
315
|
+
::LibUI.table_model_row_deleted(model, row)
|
316
|
+
notify_custom_listeners('on_changed', row, :deleted, @last_cell_rows[row])
|
317
|
+
end
|
318
|
+
end
|
319
|
+
elsif @cell_rows.size > @last_cell_rows.size
|
320
|
+
(@cell_rows.size - @last_cell_rows.size).times do |n|
|
321
|
+
row = @last_cell_rows.size + n
|
322
|
+
if model
|
323
|
+
::LibUI.table_model_row_inserted(model, row)
|
324
|
+
notify_custom_listeners('on_changed', row, :inserted, @cell_rows[row])
|
325
|
+
end
|
326
|
+
end
|
327
|
+
@cell_rows.each_with_index do |new_row_data, row|
|
328
|
+
if new_row_data != @last_cell_rows[row] && model
|
329
|
+
::LibUI.table_model_row_changed(model, row)
|
330
|
+
notify_custom_listeners('on_changed', row, :changed, @cell_rows[row])
|
331
|
+
end
|
314
332
|
end
|
315
|
-
|
333
|
+
elsif @cell_rows != @last_cell_rows
|
316
334
|
@cell_rows.each_with_index do |new_row_data, row|
|
317
|
-
if new_row_data != @last_cell_rows[row]
|
318
|
-
::LibUI.table_model_row_changed(model, row)
|
335
|
+
if new_row_data != @last_cell_rows[row] && model
|
336
|
+
::LibUI.table_model_row_changed(model, row)
|
319
337
|
notify_custom_listeners('on_changed', row, :changed, @cell_rows[row])
|
320
338
|
end
|
321
339
|
end
|
@@ -80,10 +80,14 @@ module Glimmer
|
|
80
80
|
return_value = nil
|
81
81
|
@on_closing_listeners.each do |l|
|
82
82
|
return_value = l.call(self)
|
83
|
-
break if return_value.is_a?(Numeric)
|
83
|
+
break if return_value.is_a?(Numeric) || return_value.is_a?(TrueClass) || return_value.is_a?(FalseClass)
|
84
84
|
end
|
85
85
|
if return_value.is_a?(Numeric)
|
86
86
|
return_value
|
87
|
+
elsif return_value.is_a?(TrueClass) || return_value.is_a?(FalseClass)
|
88
|
+
return_value ? 1 : 0
|
89
|
+
elsif self != ControlProxy.main_window_proxy
|
90
|
+
1
|
87
91
|
else
|
88
92
|
destroy
|
89
93
|
::LibUI.quit
|
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.15
|
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-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -285,6 +285,7 @@ files:
|
|
285
285
|
- examples/basic_area3.rb
|
286
286
|
- examples/basic_area4.rb
|
287
287
|
- examples/basic_button.rb
|
288
|
+
- examples/basic_child_window.rb
|
288
289
|
- examples/basic_code_area.rb
|
289
290
|
- examples/basic_draw_text.rb
|
290
291
|
- examples/basic_draw_text2.rb
|
@@ -511,7 +512,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
512
|
- !ruby/object:Gem::Version
|
512
513
|
version: '0'
|
513
514
|
requirements: []
|
514
|
-
rubygems_version: 3.3.
|
515
|
+
rubygems_version: 3.3.16
|
515
516
|
signing_key:
|
516
517
|
specification_version: 4
|
517
518
|
summary: Glimmer DSL for LibUI
|