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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0fd65bf048edb4ec2556097bcbbe82b2dd2c1411e6a2c81d592901a40fdcf0f
4
- data.tar.gz: 4e48a01e498afdf21fc72a82891106e8198360eeea971f98663e585b6c2ba6d1
3
+ metadata.gz: 916c5f10df3886ef6a5eed0ba6cbade95141812b5f5ab302ba3fb6dc0449a989
4
+ data.tar.gz: 6558bc6824e050a4f36c8d89d8ee2eded34017e2f931905f7469e045e56ab5e7
5
5
  SHA512:
6
- metadata.gz: 45492206e1c62e3daf5199a6551029300a8f73a8fdf1cf40b38a3efdaddc49f8b123c18ae61c2b233ed2c19272aa9661c35043b2adccc2cc4f487f004486e8a1
7
- data.tar.gz: 0c2b32d5c933da94e99f07926491d1423b29e36b91ad8e2a207472d5235d199a7761f9d768ce7a4eea02287515837aa4c35c0aeb6ed9b1d5c21d387fd796e9c6
6
+ metadata.gz: 5395eb43d9bc4a6aee0a18d498334a15475bd17cd976853bfb79c831eb55cdda6d68a9f8f04d62586d6d442004f0c74cef96f4f11e2ac53a08fba100813f989d
7
+ data.tar.gz: 8d8ed838367b768e7c18d47027f0b8a11d5728bf578339867b60411566dec0ada11294f9691008489f8fedaf971548d0c8bdc927f1b2f53f8f3de0a8e9a90b01
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.9.4
4
+
5
+ - Scaffold Custom Window via `glimmer scaffold:customwindow[name,namespace]`
6
+
3
7
  ## 0.9.3
4
8
 
5
9
  - Application Scaffolding via `glimmer scaffold[app_name]` includes a Model layer
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.3
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.3'
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.3
1
+ 0.9.4
Binary file
@@ -639,7 +639,7 @@ require '#{current_dir_name}/model/greeting'
639
639
  margined true
640
640
 
641
641
  label {
642
- text <= [@greeting, :text]
642
+ #{%i[gem app].include?(window_type) ? "text <= [@greeting, :text]" : "text '#{human_name(custom_window_name)}'"}
643
643
  }
644
644
  }
645
645
  }
@@ -93,16 +93,16 @@ namespace :glimmer do
93
93
  Glimmer::RakeTask::Scaffold.app(args[:app_name])
94
94
  end
95
95
 
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
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
- # end
162
+ end
163
163
 
164
164
  namespace :list do
165
165
  task :list_require do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh