glimmer 2.5.5 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/PROCESS.md +1 -1
- data/README.md +146 -142
- data/VERSION +1 -1
- data/glimmer.gemspec +3 -3
- data/lib/glimmer/config.rb +1 -1
- data/lib/glimmer/data_binding/model_binding.rb +1 -1
- data/lib/glimmer/data_binding/observable.rb +1 -1
- data/lib/glimmer/data_binding/observable_array.rb +1 -1
- data/lib/glimmer/data_binding/observable_hash.rb +1 -1
- data/lib/glimmer/data_binding/observable_hashable.rb +1 -1
- data/lib/glimmer/data_binding/observable_model.rb +1 -1
- data/lib/glimmer/data_binding/observer.rb +1 -1
- data/lib/glimmer/data_binding/shine.rb +1 -1
- data/lib/glimmer/dsl/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/engine.rb +6 -2
- data/lib/glimmer/dsl/expression.rb +1 -1
- data/lib/glimmer/dsl/expression_handler.rb +1 -1
- data/lib/glimmer/dsl/observe_expression.rb +1 -1
- data/lib/glimmer/dsl/parent_expression.rb +1 -1
- data/lib/glimmer/dsl/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/static_expression.rb +1 -1
- data/lib/glimmer/dsl/top_level_expression.rb +1 -1
- data/lib/glimmer/error.rb +1 -1
- data/lib/glimmer/invalid_keyword_error.rb +1 -1
- data/lib/glimmer.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0270d930a2379147403b0ed98ad22d38fc737a4bd45cac8a079b873db3b26b0
|
4
|
+
data.tar.gz: 002ea9f8c526d059ec0401397c0a2feb624f2333222b40e628a814275568ae7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8034dbe6953955e23c2a355f211337fb9593e8722251ed35152af4b587422c675e675dd93e0d6b8ef9a04145f5a2ebbf364ed83f8a17296f7f4c4a83c711eb3c
|
7
|
+
data.tar.gz: 6f43bac5604f4759bbdcea11a0b1a84b68c24e7e087862f00f4bb7145ecfe0085ae1cbabe379c96a6f19c22465faa62c13bcfaeedc1f8390129e177d5318c0f5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
Related Change Logs:
|
4
4
|
- [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)
|
5
5
|
|
6
|
+
### 2.6.0
|
7
|
+
|
8
|
+
- If a static expression cannot handle keyword, it is tried with available dynamic expressions instead of erroring out.
|
9
|
+
|
6
10
|
### 2.5.5
|
7
11
|
|
8
12
|
- Support observing an array object index directly (e.g. `ModelBinding.new(array, '[0]')` as opposed to `ModelBinding.new(self, 'array[0]')`)
|
data/LICENSE.txt
CHANGED
data/PROCESS.md
CHANGED
data/README.md
CHANGED
@@ -27,13 +27,13 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
27
27
|
- Multiple DSLs may be [mixed](#multi-dsl-support) together safely to achieve maximum expressability, composability, and productivity.
|
28
28
|
- DSLs are fully configurable, so you may activate and deactivate DSLs as per your current needs only.
|
29
29
|
|
30
|
-
Start by checking out Glimmer's original GUI DSL (for [JRuby](https://www.jruby.org/)), which got extracted into its own gem
|
30
|
+
Start by checking out [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt), Glimmer's original GUI DSL (for [JRuby](https://www.jruby.org/)), which got extracted into its own gem; and [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui), Glimmer's CRuby GUI DSL, which has no prerequisites beyond installing the Ruby gem.
|
31
31
|
|
32
32
|
[**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
|
33
33
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
34
34
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
35
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
36
35
|
- [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
36
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
37
37
|
- [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
|
38
38
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
39
39
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
@@ -48,8 +48,8 @@ Start by checking out Glimmer's original GUI DSL (for [JRuby](https://www.jruby.
|
|
48
48
|
- [Official DSLs](#official-dsls)
|
49
49
|
- [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-framework)
|
50
50
|
- [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](#glimmer-dsl-for-opal-pure-ruby-web-gui-and-auto-webifier-of-desktop-apps)
|
51
|
-
- [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-mri-ruby-desktop-development-gui-library)
|
52
51
|
- [Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](#glimmer-dsl-for-libui-prerequisite-free-ruby-desktop-development-gui-library)
|
52
|
+
- [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-mri-ruby-desktop-development-gui-library)
|
53
53
|
- [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
|
54
54
|
- [Glimmer DSL for CSS](#glimmer-dsl-for-css)
|
55
55
|
- [Data-Binding Library](#data-binding-library)
|
@@ -232,7 +232,7 @@ end
|
|
232
232
|
### Setup
|
233
233
|
|
234
234
|
Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
|
235
|
-
- Add `gem 'glimmer', '~> 2.
|
235
|
+
- Add `gem 'glimmer', '~> 2.6.0'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.6.0` and add `require 'glimmer'`
|
236
236
|
- Create `glimmer/dsl/[dsl_name]/dsl.rb`, which requires and adds all dynamic expressions for the [dsl_name] Glimmer DSL module as per the code shown in the previous section (or [Official DSLs](#official-dsls) as examples)
|
237
237
|
- Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static
|
238
238
|
|
@@ -756,144 +756,6 @@ You should see "Apple Calculator Theme"
|
|
756
756
|
|
757
757
|
[![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)](http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple)
|
758
758
|
|
759
|
-
#### Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
760
|
-
|
761
|
-
[Tcl/Tk](https://www.tcl.tk/) has recently improved by gaining native looking themed widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.). Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
|
762
|
-
|
763
|
-
The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time and a small memory footprint via [MRI Ruby](https://www.ruby-lang.org/en/).
|
764
|
-
|
765
|
-
[Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
|
766
|
-
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
767
|
-
- Convention over configuration via smart defaults and automation of low-level details
|
768
|
-
- Requiring the least amount of syntax possible to build GUI
|
769
|
-
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
|
770
|
-
- Custom Widget support
|
771
|
-
- Scaffolding for new custom widgets, apps, and gems
|
772
|
-
- Native-Executable packaging on Mac, Windows, and Linux
|
773
|
-
|
774
|
-
To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
775
|
-
|
776
|
-
##### Glimmer DSL for Tk Samples
|
777
|
-
|
778
|
-
###### Hello, World!
|
779
|
-
|
780
|
-
Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
|
781
|
-
|
782
|
-
```ruby
|
783
|
-
include Glimmer
|
784
|
-
|
785
|
-
root {
|
786
|
-
label {
|
787
|
-
text 'Hello, World!'
|
788
|
-
}
|
789
|
-
}.open
|
790
|
-
```
|
791
|
-
|
792
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
793
|
-
|
794
|
-
```
|
795
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
|
796
|
-
```
|
797
|
-
|
798
|
-
Glimmer app:
|
799
|
-
|
800
|
-
![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
801
|
-
|
802
|
-
###### Hello, Notebook!
|
803
|
-
|
804
|
-
Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
|
805
|
-
|
806
|
-
```ruby
|
807
|
-
include Glimmer
|
808
|
-
|
809
|
-
root {
|
810
|
-
title 'Hello, Notebook!'
|
811
|
-
|
812
|
-
notebook {
|
813
|
-
frame(text: 'English') {
|
814
|
-
label {
|
815
|
-
text 'Hello, World!'
|
816
|
-
}
|
817
|
-
}
|
818
|
-
|
819
|
-
frame(text: 'French') {
|
820
|
-
label {
|
821
|
-
text 'Bonjour, Univers!'
|
822
|
-
}
|
823
|
-
}
|
824
|
-
}
|
825
|
-
}.open
|
826
|
-
```
|
827
|
-
|
828
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
829
|
-
|
830
|
-
```
|
831
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_notebook.rb'"
|
832
|
-
```
|
833
|
-
|
834
|
-
Glimmer app:
|
835
|
-
|
836
|
-
![glimmer dsl tk screenshot sample hello notebook English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-notebook-english.png)
|
837
|
-
![glimmer dsl tk screenshot sample hello notebook French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-notebook-french.png)
|
838
|
-
|
839
|
-
###### Hello, Combobox!
|
840
|
-
|
841
|
-
Glimmer code (from [samples/hello/hello_combobox.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combobox.rb)):
|
842
|
-
|
843
|
-
```ruby
|
844
|
-
require 'glimmer-dsl-tk'
|
845
|
-
|
846
|
-
class Person
|
847
|
-
attr_accessor :country, :country_options
|
848
|
-
|
849
|
-
def initialize
|
850
|
-
self.country_options=["", "Canada", "US", "Mexico"]
|
851
|
-
self.country = "Canada"
|
852
|
-
end
|
853
|
-
|
854
|
-
def reset_country
|
855
|
-
self.country = "Canada"
|
856
|
-
end
|
857
|
-
end
|
858
|
-
|
859
|
-
class HelloCombobox
|
860
|
-
include Glimmer
|
861
|
-
|
862
|
-
def launch
|
863
|
-
person = Person.new
|
864
|
-
|
865
|
-
root {
|
866
|
-
title 'Hello, Combobox!'
|
867
|
-
|
868
|
-
combobox {
|
869
|
-
readonly true # this applies to text editing only (item selection still triggers a write to model)
|
870
|
-
text <=> [person, :country]
|
871
|
-
}
|
872
|
-
|
873
|
-
button {
|
874
|
-
text "Reset Selection"
|
875
|
-
command {
|
876
|
-
person.reset_country
|
877
|
-
}
|
878
|
-
}
|
879
|
-
}.open
|
880
|
-
end
|
881
|
-
end
|
882
|
-
|
883
|
-
HelloCombobox.new.launch
|
884
|
-
```
|
885
|
-
|
886
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
887
|
-
|
888
|
-
```
|
889
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combobox.rb'"
|
890
|
-
```
|
891
|
-
|
892
|
-
Glimmer app:
|
893
|
-
|
894
|
-
![glimmer dsl tk screenshot sample hello combobox](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combobox.png)
|
895
|
-
![glimmer dsl tk screenshot sample hello combobox dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combobox-dropdown.png)
|
896
|
-
|
897
759
|
#### Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
898
760
|
|
899
761
|
[Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui) is a prerequisite-free Ruby desktop development GUI library. No need to pre-install any prerequisites. Just install the gem and have platform-independent native GUI that just works!
|
@@ -1099,6 +961,144 @@ Linux
|
|
1099
961
|
|
1100
962
|
![glimmer-dsl-libui-linux-area-gallery.png](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-libui/master/images/glimmer-dsl-libui-linux-area-gallery.png)
|
1101
963
|
|
964
|
+
#### Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
965
|
+
|
966
|
+
[Tcl/Tk](https://www.tcl.tk/) has recently improved by gaining native looking themed widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.). Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
|
967
|
+
|
968
|
+
The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time and a small memory footprint via [MRI Ruby](https://www.ruby-lang.org/en/).
|
969
|
+
|
970
|
+
[Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
|
971
|
+
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
972
|
+
- Convention over configuration via smart defaults and automation of low-level details
|
973
|
+
- Requiring the least amount of syntax possible to build GUI
|
974
|
+
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
|
975
|
+
- Custom Widget support
|
976
|
+
- Scaffolding for new custom widgets, apps, and gems
|
977
|
+
- Native-Executable packaging on Mac, Windows, and Linux
|
978
|
+
|
979
|
+
To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
980
|
+
|
981
|
+
##### Glimmer DSL for Tk Samples
|
982
|
+
|
983
|
+
###### Hello, World!
|
984
|
+
|
985
|
+
Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
|
986
|
+
|
987
|
+
```ruby
|
988
|
+
include Glimmer
|
989
|
+
|
990
|
+
root {
|
991
|
+
label {
|
992
|
+
text 'Hello, World!'
|
993
|
+
}
|
994
|
+
}.open
|
995
|
+
```
|
996
|
+
|
997
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
998
|
+
|
999
|
+
```
|
1000
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
|
1001
|
+
```
|
1002
|
+
|
1003
|
+
Glimmer app:
|
1004
|
+
|
1005
|
+
![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
1006
|
+
|
1007
|
+
###### Hello, Notebook!
|
1008
|
+
|
1009
|
+
Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
|
1010
|
+
|
1011
|
+
```ruby
|
1012
|
+
include Glimmer
|
1013
|
+
|
1014
|
+
root {
|
1015
|
+
title 'Hello, Notebook!'
|
1016
|
+
|
1017
|
+
notebook {
|
1018
|
+
frame(text: 'English') {
|
1019
|
+
label {
|
1020
|
+
text 'Hello, World!'
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
frame(text: 'French') {
|
1025
|
+
label {
|
1026
|
+
text 'Bonjour, Univers!'
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
}.open
|
1031
|
+
```
|
1032
|
+
|
1033
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
1034
|
+
|
1035
|
+
```
|
1036
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_notebook.rb'"
|
1037
|
+
```
|
1038
|
+
|
1039
|
+
Glimmer app:
|
1040
|
+
|
1041
|
+
![glimmer dsl tk screenshot sample hello notebook English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-notebook-english.png)
|
1042
|
+
![glimmer dsl tk screenshot sample hello notebook French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-notebook-french.png)
|
1043
|
+
|
1044
|
+
###### Hello, Combobox!
|
1045
|
+
|
1046
|
+
Glimmer code (from [samples/hello/hello_combobox.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combobox.rb)):
|
1047
|
+
|
1048
|
+
```ruby
|
1049
|
+
require 'glimmer-dsl-tk'
|
1050
|
+
|
1051
|
+
class Person
|
1052
|
+
attr_accessor :country, :country_options
|
1053
|
+
|
1054
|
+
def initialize
|
1055
|
+
self.country_options=["", "Canada", "US", "Mexico"]
|
1056
|
+
self.country = "Canada"
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
def reset_country
|
1060
|
+
self.country = "Canada"
|
1061
|
+
end
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
class HelloCombobox
|
1065
|
+
include Glimmer
|
1066
|
+
|
1067
|
+
def launch
|
1068
|
+
person = Person.new
|
1069
|
+
|
1070
|
+
root {
|
1071
|
+
title 'Hello, Combobox!'
|
1072
|
+
|
1073
|
+
combobox {
|
1074
|
+
readonly true # this applies to text editing only (item selection still triggers a write to model)
|
1075
|
+
text <=> [person, :country]
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
button {
|
1079
|
+
text "Reset Selection"
|
1080
|
+
command {
|
1081
|
+
person.reset_country
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
}.open
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
HelloCombobox.new.launch
|
1089
|
+
```
|
1090
|
+
|
1091
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
1092
|
+
|
1093
|
+
```
|
1094
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combobox.rb'"
|
1095
|
+
```
|
1096
|
+
|
1097
|
+
Glimmer app:
|
1098
|
+
|
1099
|
+
![glimmer dsl tk screenshot sample hello combobox](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combobox.png)
|
1100
|
+
![glimmer dsl tk screenshot sample hello combobox dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combobox-dropdown.png)
|
1101
|
+
|
1102
1102
|
#### Glimmer DSL for XML (& HTML)
|
1103
1103
|
|
1104
1104
|
[Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) provides Ruby syntax for building XML (eXtensible Markup Language) documents.
|
@@ -1180,6 +1180,10 @@ body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2
|
|
1180
1180
|
|
1181
1181
|
Data-Binding enables mapping GUI properties (like text and color) to Model attributes (like name and age) for bidirectional or unidirectional synchronization and conversion as needed.
|
1182
1182
|
|
1183
|
+
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.
|
1184
|
+
|
1185
|
+
![MVP](https://www.researchgate.net/profile/Gilles-Perrouin/publication/320249584/figure/fig8/AS:668260987068418@1536337243385/Model-view-presenter-architecture.png)
|
1186
|
+
|
1183
1187
|
Glimmer enhances observed models automatically (including array operations like `<<`, `delete`, and `reject!`) on first observation. As such, you get automatic observable support, including nested and computed observations. No need to change your model code to data-bind it to the view or add repetitive boilerplate modules. View data-binding is truly decoupled from model logic by being able to observe any model attribute (Ruby attribute reader/writer combo or Ruby attribute reader alone for read-only data-binding when needed)
|
1184
1188
|
|
1185
1189
|
This relies mainly on the Observer Design Pattern and the MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.0
|
data/glimmer.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer 2.
|
5
|
+
# stub: glimmer 2.6.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer".freeze
|
9
|
-
s.version = "2.
|
9
|
+
s.version = "2.6.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2022-01-
|
14
|
+
s.date = "2022-01-22"
|
15
15
|
s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), Glimmer DSL for Tk (Ruby Desktop Development GUI Library), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/glimmer/config.rb
CHANGED
data/lib/glimmer/dsl/engine.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
1
|
+
# Copyright (c) 2007-2022 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -59,7 +59,11 @@ module Glimmer
|
|
59
59
|
static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
|
60
60
|
static_expression_can_interpret = nil
|
61
61
|
if static_expression.nil? || !(static_expression_can_interpret = static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block))
|
62
|
-
|
62
|
+
begin
|
63
|
+
Glimmer::DSL::Engine.interpret(keyword, *args, &block)
|
64
|
+
rescue => e
|
65
|
+
raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent.inspect} with DSL #{Glimmer::DSL::Engine.dsl.inspect} and static expression #{static_expression.inspect} having can_interpret? as #{static_expression_can_interpret.inspect} and no dynamic expressions to be able to handle either!"
|
66
|
+
end
|
63
67
|
else
|
64
68
|
Glimmer::Config.logger.info {"#{static_expression.class.name} will handle expression keyword #{keyword}"}
|
65
69
|
Glimmer::DSL::Engine.interpret_expression(static_expression, keyword, *args, &block)
|
data/lib/glimmer/error.rb
CHANGED
data/lib/glimmer.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: array_include_methods
|