glimmer-dsl-libui 0.9.3 → 0.9.4
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/README.md +166 -9
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/rake_task/scaffold.rb +1 -1
- data/lib/glimmer/rake_task.rb +11 -11
- 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: 916c5f10df3886ef6a5eed0ba6cbade95141812b5f5ab302ba3fb6dc0449a989
|
4
|
+
data.tar.gz: 6558bc6824e050a4f36c8d89d8ee2eded34017e2f931905f7469e045e56ab5e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5395eb43d9bc4a6aee0a18d498334a15475bd17cd976853bfb79c831eb55cdda6d68a9f8f04d62586d6d442004f0c74cef96f4f11e2ac53a08fba100813f989d
|
7
|
+
data.tar.gz: 8d8ed838367b768e7c18d47027f0b8a11d5728bf578339867b60411566dec0ada11294f9691008489f8fedaf971548d0c8bdc927f1b2f53f8f3de0a8e9a90b01
|
data/CHANGELOG.md
CHANGED
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.9.
|
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.9.4
|
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)
|
@@ -351,6 +351,7 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
351
351
|
- [Run Application](#run-application)
|
352
352
|
- [Run Examples](#run-examples)
|
353
353
|
- [Scaffold Application](#scaffold-application)
|
354
|
+
- [Scaffold Custom Window](#scaffold-custom-window)
|
354
355
|
- [Girb (Glimmer IRB)](#girb-glimmer-irb)
|
355
356
|
- [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
|
356
357
|
- [API](#api)
|
@@ -421,7 +422,7 @@ gem install glimmer-dsl-libui
|
|
421
422
|
Or install via Bundler `Gemfile`:
|
422
423
|
|
423
424
|
```ruby
|
424
|
-
gem 'glimmer-dsl-libui', '~> 0.9.
|
425
|
+
gem 'glimmer-dsl-libui', '~> 0.9.4'
|
425
426
|
```
|
426
427
|
|
427
428
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -625,7 +626,7 @@ Scaffold Glimmer DSL for LibUI application with this command:
|
|
625
626
|
glimmer "scaffold[app_name]"
|
626
627
|
```
|
627
628
|
|
628
|
-
That will generate the general MVC structure of a new Glimmer DSL for LibUI application.
|
629
|
+
That will automatically generate the general MVC structure of a new Glimmer DSL for LibUI application and launch the application when done.
|
629
630
|
|
630
631
|
For example, if we run:
|
631
632
|
|
@@ -659,6 +660,16 @@ Views live under `app/app_name/view` (e.g. `app/hello_world/view`)
|
|
659
660
|
|
660
661
|
Models live under `app/app_name/model` (e.g. `app/hello_world/model`)
|
661
662
|
|
663
|
+
The application runs automatically once scaffolding is done.
|
664
|
+
|
665
|
+
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
666
|
+
|
667
|
+
![glimmer-dsl-libui-mac-scaffold-app-preferences.png](images/glimmer-dsl-libui-mac-scaffold-app-preferences.png)
|
668
|
+
|
669
|
+
![glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png](images/glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png)
|
670
|
+
|
671
|
+
![glimmer-dsl-libui-mac-scaffold-app-about.png](images/glimmer-dsl-libui-mac-scaffold-app-about.png)
|
672
|
+
|
662
673
|
Once you step into the application directory, you can run it in one of multiple ways:
|
663
674
|
|
664
675
|
```
|
@@ -679,12 +690,6 @@ glimmer run
|
|
679
690
|
|
680
691
|
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
681
692
|
|
682
|
-
![glimmer-dsl-libui-mac-scaffold-app-preferences.png](images/glimmer-dsl-libui-mac-scaffold-app-preferences.png)
|
683
|
-
|
684
|
-
![glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png](images/glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png)
|
685
|
-
|
686
|
-
![glimmer-dsl-libui-mac-scaffold-app-about.png](images/glimmer-dsl-libui-mac-scaffold-app-about.png)
|
687
|
-
|
688
693
|
The application comes with the [juwelier](https://rubygems.org/gems/juwelier) gem for auto-generating an application gem from the app `Rakefile` and `Gemfile` configuration (no need to manually declare gems in a gemspec... just use `Gemfile` normally and [juwelier](https://rubygems.org/gems/juwelier) takes care of the rest by generating an app gemspec automatically from `Gemfile`).
|
689
694
|
|
690
695
|
You can package the newly scaffolded app as a Ruby gem by running this command:
|
@@ -725,6 +730,158 @@ hello_world
|
|
725
730
|
|
726
731
|
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
727
732
|
|
733
|
+
### Scaffold Custom Window
|
734
|
+
|
735
|
+
When you are in a scaffolded application, you can scaffold a new custom window (a window that you can put anything in to represent a view concept in your application) by running this command:
|
736
|
+
|
737
|
+
```
|
738
|
+
glimmer scaffold:customwindow[name,namespace]
|
739
|
+
```
|
740
|
+
|
741
|
+
The name represents the custom window view class name (it can be underscored, and Glimmer will automatically classify it).
|
742
|
+
|
743
|
+
The namespace is optional and represents the module that the custom window view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
|
744
|
+
|
745
|
+
You can also use the shorter `cw` alias for `customwindow`:
|
746
|
+
|
747
|
+
```
|
748
|
+
glimmer scaffold:cw[name,namespace]
|
749
|
+
```
|
750
|
+
|
751
|
+
For example by running this command under a `hello_world` application:
|
752
|
+
|
753
|
+
```
|
754
|
+
glimmer scaffold:cw[greeting_window]
|
755
|
+
```
|
756
|
+
|
757
|
+
That will generate this class under `app/hello_world/view/greeting_window`:
|
758
|
+
|
759
|
+
```ruby
|
760
|
+
class HelloWorld
|
761
|
+
module View
|
762
|
+
class GreetingWindow
|
763
|
+
include Glimmer::LibUI::CustomWindow
|
764
|
+
|
765
|
+
|
766
|
+
## Add options like the following to configure CustomWindow by outside consumers
|
767
|
+
#
|
768
|
+
# options :title, :background_color
|
769
|
+
# option :width, default: 320
|
770
|
+
# option :height, default: 240
|
771
|
+
|
772
|
+
## Use before_body block to pre-initialize variables to use in body and
|
773
|
+
# to setup application menu
|
774
|
+
#
|
775
|
+
# before_body do
|
776
|
+
#
|
777
|
+
# end
|
778
|
+
|
779
|
+
## Use after_body block to setup observers for controls in body
|
780
|
+
#
|
781
|
+
# after_body do
|
782
|
+
#
|
783
|
+
# end
|
784
|
+
|
785
|
+
## Add control content inside custom window body
|
786
|
+
## Top-most control must be a window or another custom window
|
787
|
+
#
|
788
|
+
body {
|
789
|
+
window {
|
790
|
+
# Replace example content below with custom window content
|
791
|
+
content_size 240, 240
|
792
|
+
title 'Hello World'
|
793
|
+
|
794
|
+
margined true
|
795
|
+
|
796
|
+
label {
|
797
|
+
text 'Hello World'
|
798
|
+
}
|
799
|
+
}
|
800
|
+
}
|
801
|
+
end
|
802
|
+
end
|
803
|
+
end
|
804
|
+
```
|
805
|
+
|
806
|
+
When the generated file is required in another view, the custom window keyword `greeting_window` become available and reusable, like by calling:
|
807
|
+
|
808
|
+
```ruby
|
809
|
+
greeting_window.show
|
810
|
+
```
|
811
|
+
|
812
|
+
Here is an example that generates a custom window with a namespace:
|
813
|
+
|
814
|
+
```
|
815
|
+
glimmer scaffold:cw[train,station]
|
816
|
+
```
|
817
|
+
|
818
|
+
That will generate this class under `app/station/view/train`:
|
819
|
+
|
820
|
+
```ruby
|
821
|
+
module Station
|
822
|
+
module View
|
823
|
+
class Train
|
824
|
+
include Glimmer::LibUI::CustomWindow
|
825
|
+
|
826
|
+
|
827
|
+
## Add options like the following to configure CustomWindow by outside consumers
|
828
|
+
#
|
829
|
+
# options :title, :background_color
|
830
|
+
# option :width, default: 320
|
831
|
+
# option :height, default: 240
|
832
|
+
|
833
|
+
## Use before_body block to pre-initialize variables to use in body and
|
834
|
+
# to setup application menu
|
835
|
+
#
|
836
|
+
# before_body do
|
837
|
+
#
|
838
|
+
# end
|
839
|
+
|
840
|
+
## Use after_body block to setup observers for controls in body
|
841
|
+
#
|
842
|
+
# after_body do
|
843
|
+
#
|
844
|
+
# end
|
845
|
+
|
846
|
+
## Add control content inside custom window body
|
847
|
+
## Top-most control must be a window or another custom window
|
848
|
+
#
|
849
|
+
body {
|
850
|
+
window {
|
851
|
+
# Replace example content below with custom window content
|
852
|
+
content_size 240, 240
|
853
|
+
title 'Station'
|
854
|
+
|
855
|
+
margined true
|
856
|
+
|
857
|
+
label {
|
858
|
+
text 'Station'
|
859
|
+
}
|
860
|
+
}
|
861
|
+
}
|
862
|
+
end
|
863
|
+
end
|
864
|
+
end
|
865
|
+
```
|
866
|
+
|
867
|
+
When that file is required, the `train` keyword becomes available:
|
868
|
+
|
869
|
+
```ruby
|
870
|
+
train.show
|
871
|
+
```
|
872
|
+
|
873
|
+
If for whatever reason, you end up with 2 custom window views having the same name with different namespaces, then you can invoke the specific custom window you want by including the Ruby namespace in underscored format separated by double-underscores:
|
874
|
+
|
875
|
+
```ruby
|
876
|
+
station__view__train.show
|
877
|
+
```
|
878
|
+
|
879
|
+
Or another `train` custom window view:
|
880
|
+
|
881
|
+
```ruby
|
882
|
+
hello_world__view__train.show
|
883
|
+
```
|
884
|
+
|
728
885
|
## Girb (Glimmer IRB)
|
729
886
|
|
730
887
|
You can run the `girb` command (`bin/girb` if you cloned the project locally) to do some quick and dirty experimentation and learning:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -93,16 +93,16 @@ namespace :glimmer do
|
|
93
93
|
Glimmer::RakeTask::Scaffold.app(args[:app_name])
|
94
94
|
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
96
|
+
namespace :scaffold do
|
97
|
+
desc 'Scaffold Glimmer::UI::CustomWindow subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cw]'
|
98
|
+
task :customwindow, [:name, :namespace] do |t, args|
|
99
|
+
require_relative 'rake_task/scaffold'
|
100
|
+
Glimmer::RakeTask::Scaffold.custom_window(args[:name], args[:namespace])
|
101
|
+
end
|
102
|
+
|
103
|
+
task :cw, [:name, :namespace] => :customwindow
|
104
|
+
task :custom_window, [:name, :namespace] => :customwindow
|
105
|
+
task :"custom-window", [:name, :namespace] => :customwindow
|
106
106
|
#
|
107
107
|
# desc 'Scaffold Glimmer::UI::CustomControl subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cc]'
|
108
108
|
# task :customcontrol, [:name, :namespace] do |t, args|
|
@@ -159,7 +159,7 @@ namespace :glimmer do
|
|
159
159
|
# task :custom_window_gem, [:name, :namespace] => 'gem:customwindow'
|
160
160
|
# task :custom_control_gem, [:name, :namespace] => 'gem:customcontrol'
|
161
161
|
# task :custom_shape_gem, [:name, :namespace] => 'gem:customshape'
|
162
|
-
|
162
|
+
end
|
163
163
|
|
164
164
|
namespace :list do
|
165
165
|
task :list_require do
|