glimmer-dsl-libui 0.12.5 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +22 -20
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/content_bindable.rb +19 -0
- data/lib/glimmer/libui/control_proxy.rb +2 -14
- data/lib/glimmer/libui/shape.rb +2 -0
- data/lib/glimmer/rake_task/scaffold.rb +9 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d95327be14547ec2bbc41b7d963c00a432a6ae3fbcb5b41c9b900cba967194d8
|
4
|
+
data.tar.gz: 3bf11f49b498aabd0d6c2bc35a8e49be99aeb60066a3095a2ce08c866d2861c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dca03d07a89a0c700f50509a3f1a56c8321b7b44d38de794f7a4b81d415981c35d463623294b332350517001c2f7c6f841d2d27a18ec79546f884161798799b
|
7
|
+
data.tar.gz: bf843b6399671fdd87f7a6c3f60b17a45506d23477e6273dddb6263540925bc73c9ef3031ef9228e9b1d7ea4c37cf8355c5c22b6c3d3896c0ed05e0d6fbf4623
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.12.7
|
4
|
+
|
5
|
+
- Application Scaffolding now generates the main view as `SomeNameApplication` (with `_application` suffix in file name) to indicate clearly it is a `Glimmer::LibUI::Application` class.
|
6
|
+
- Application Scaffolding now generates a `presenter` directory for convenience in case presenters are needed.
|
7
|
+
|
8
|
+
## 0.12.6
|
9
|
+
|
10
|
+
- Shape Content Data-Binding
|
11
|
+
|
3
12
|
## 0.12.5
|
4
13
|
|
5
14
|
- Prevent duplication of items in editable_combobox when updating items with an array that contains duplicates
|
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.12.
|
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.12.7
|
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
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
(**[Fukuoka Ruby Award Competition 2022 Special Award Winner](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html)** [[Award Announcement]](http://www.digitalfukuoka.jp/topics/187?locale=ja))
|
10
10
|
|
11
|
+
(**[***RubyConf 2024 Workshop - How To Build Basic Desktop Applications in Ruby***](https://www.youtube.com/watch?v=TTSqRdTVtDY)**)
|
12
|
+
|
11
13
|
(**[***RubyConf 2023 Workshop - How To Build Desktop Applications in Ruby***](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby)**)
|
12
14
|
|
13
15
|
(**[***RubyConf 2022 Talk - Building Native GUI Apps in Ruby***](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html)**)
|
@@ -464,7 +466,7 @@ gem install glimmer-dsl-libui
|
|
464
466
|
Or install via Bundler `Gemfile`:
|
465
467
|
|
466
468
|
```ruby
|
467
|
-
gem 'glimmer-dsl-libui', '~> 0.12.
|
469
|
+
gem 'glimmer-dsl-libui', '~> 0.12.7'
|
468
470
|
```
|
469
471
|
|
470
472
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -790,7 +792,7 @@ hello_world
|
|
790
792
|
When you are in a scaffolded application, you can scaffold a new [custom control](#custom-components) (a control that you can put anything in to represent a view concept in your application) by running this command:
|
791
793
|
|
792
794
|
```
|
793
|
-
glimmer scaffold:customcontrol[name,namespace]
|
795
|
+
glimmer "scaffold:customcontrol[name,namespace]"
|
794
796
|
```
|
795
797
|
|
796
798
|
The `name` represents the [custom control](#custom-components) view class name (it can be underscored, and Glimmer will automatically classify it).
|
@@ -800,13 +802,13 @@ The `namespace` is optional and represents the module that the [custom control](
|
|
800
802
|
You can also use the shorter `cc` alias for `customcontrol`:
|
801
803
|
|
802
804
|
```
|
803
|
-
glimmer scaffold:cc[name,namespace]
|
805
|
+
glimmer "scaffold:cc[name,namespace]"
|
804
806
|
```
|
805
807
|
|
806
808
|
For example by running this command under a `hello_world` application:
|
807
809
|
|
808
810
|
```
|
809
|
-
glimmer scaffold:cc[model_form]
|
811
|
+
glimmer "scaffold:cc[model_form]"
|
810
812
|
```
|
811
813
|
|
812
814
|
That will generate this class under `app/hello_world/view/model_form`:
|
@@ -880,7 +882,7 @@ window {
|
|
880
882
|
Here is an example that generates a [custom control](#custom-components) with a namespace:
|
881
883
|
|
882
884
|
```
|
883
|
-
glimmer scaffold:cc[model_form,common]
|
885
|
+
glimmer "scaffold:cc[model_form,common]"
|
884
886
|
```
|
885
887
|
|
886
888
|
That will generate this class under `app/common/view/model_form`:
|
@@ -980,7 +982,7 @@ A custom window is a specialization of a custom control that has a `window` as i
|
|
980
982
|
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:
|
981
983
|
|
982
984
|
```
|
983
|
-
glimmer scaffold:customwindow[name,namespace]
|
985
|
+
glimmer "scaffold:customwindow[name,namespace]"
|
984
986
|
```
|
985
987
|
|
986
988
|
The `name` represents the custom window view class name (it can be underscored, and Glimmer will automatically classify it).
|
@@ -990,13 +992,13 @@ The `namespace` is optional and represents the module that the custom window vie
|
|
990
992
|
You can also use the shorter `cw` alias for `customwindow`:
|
991
993
|
|
992
994
|
```
|
993
|
-
glimmer scaffold:cw[name,namespace]
|
995
|
+
glimmer "scaffold:cw[name,namespace]"
|
994
996
|
```
|
995
997
|
|
996
998
|
For example by running this command under a `hello_world` application:
|
997
999
|
|
998
1000
|
```
|
999
|
-
glimmer scaffold:cw[greeting_window]
|
1001
|
+
glimmer "scaffold:cw[greeting_window]"
|
1000
1002
|
```
|
1001
1003
|
|
1002
1004
|
That will generate this class under `app/hello_world/view/greeting_window`:
|
@@ -1057,7 +1059,7 @@ greeting_window.show
|
|
1057
1059
|
Here is an example that generates a custom window with a namespace:
|
1058
1060
|
|
1059
1061
|
```
|
1060
|
-
glimmer scaffold:cw[train,station]
|
1062
|
+
glimmer "scaffold:cw[train,station]"
|
1061
1063
|
```
|
1062
1064
|
|
1063
1065
|
That will generate this class under `app/station/view/train`:
|
@@ -1132,7 +1134,7 @@ hello_world__view__train.show
|
|
1132
1134
|
When you are in a scaffolded application, you can scaffold a new [custom shape](#custom-components) (a shape that you can put anything in to represent a view concept in your application) by running this command:
|
1133
1135
|
|
1134
1136
|
```
|
1135
|
-
glimmer scaffold:customshape[name,namespace]
|
1137
|
+
glimmer "scaffold:customshape[name,namespace]"
|
1136
1138
|
```
|
1137
1139
|
|
1138
1140
|
The `name` represents the [custom shape](#custom-components) view class name (it can be underscored, and Glimmer will automatically classify it).
|
@@ -1142,13 +1144,13 @@ The `namespace` is optional and represents the module that the [custom shape](#c
|
|
1142
1144
|
You can also use the shorter `cs` alias for `customshape`:
|
1143
1145
|
|
1144
1146
|
```
|
1145
|
-
glimmer scaffold:cs[name,namespace]
|
1147
|
+
glimmer "scaffold:cs[name,namespace]"
|
1146
1148
|
```
|
1147
1149
|
|
1148
1150
|
For example by running this command under a `hello_world` application:
|
1149
1151
|
|
1150
1152
|
```
|
1151
|
-
glimmer scaffold:cs[heart]
|
1153
|
+
glimmer "scaffold:cs[heart]"
|
1152
1154
|
```
|
1153
1155
|
|
1154
1156
|
That will generate this class under `app/hello_world/view/heart`:
|
@@ -1233,7 +1235,7 @@ window {
|
|
1233
1235
|
Here is an example that generates a [custom shape](#custom-components) with a namespace:
|
1234
1236
|
|
1235
1237
|
```
|
1236
|
-
glimmer scaffold:cs[heart,acme]
|
1238
|
+
glimmer "scaffold:cs[heart,acme]"
|
1237
1239
|
```
|
1238
1240
|
|
1239
1241
|
That will generate this class under `app/acme/view/heart`:
|
@@ -1330,7 +1332,7 @@ window {
|
|
1330
1332
|
You can scaffold a Ruby gem around a reusable [custom control](#custom-components) to expose publicly and make available for multiple projects by running this command:
|
1331
1333
|
|
1332
1334
|
```
|
1333
|
-
glimmer scaffold:gem:customcontrol[name,namespace]
|
1335
|
+
glimmer "scaffold:gem:customcontrol[name,namespace]"
|
1334
1336
|
```
|
1335
1337
|
|
1336
1338
|
That will generate a [custom control](#custom-components) gem project under the naming convention: `glimmer-libui-cc-name-namespace`
|
@@ -1344,7 +1346,7 @@ The `namespace` is needed to avoid clashing with other [custom control](#custom-
|
|
1344
1346
|
Here is a shorter alias for the [custom control](#custom-components) gem scaffolding command:
|
1345
1347
|
|
1346
1348
|
```
|
1347
|
-
glimmer scaffold:gem:cc[name,namespace]
|
1349
|
+
glimmer "scaffold:gem:cc[name,namespace]"
|
1348
1350
|
```
|
1349
1351
|
|
1350
1352
|
You can package the newly scaffolded project as a Ruby gem by running this command:
|
@@ -1398,7 +1400,7 @@ A custom window is a specialization of a custom control that has a `window` as i
|
|
1398
1400
|
You can scaffold a Ruby gem around a reusable custom window to expose publicly and make available for multiple projects by running this command:
|
1399
1401
|
|
1400
1402
|
```
|
1401
|
-
glimmer scaffold:gem:customwindow[name,namespace]
|
1403
|
+
glimmer "scaffold:gem:customwindow[name,namespace]"
|
1402
1404
|
```
|
1403
1405
|
|
1404
1406
|
That will generate a custom window gem project under the naming convention: `glimmer-libui-cw-name-namespace`
|
@@ -1412,7 +1414,7 @@ The `namespace` is needed to avoid clashing with other custom window gems that o
|
|
1412
1414
|
Here is a shorter alias for the custom window gem scaffolding command:
|
1413
1415
|
|
1414
1416
|
```
|
1415
|
-
glimmer scaffold:gem:cw[name,namespace]
|
1417
|
+
glimmer "scaffold:gem:cw[name,namespace]"
|
1416
1418
|
```
|
1417
1419
|
|
1418
1420
|
You can package the newly scaffolded project as a Ruby gem by running this command:
|
@@ -1458,7 +1460,7 @@ greeter.show
|
|
1458
1460
|
You can scaffold a Ruby gem around a reusable [custom shape](#custom-components) to expose publicly and make available for multiple projects by running this command:
|
1459
1461
|
|
1460
1462
|
```
|
1461
|
-
glimmer scaffold:gem:customshape[name,namespace]
|
1463
|
+
glimmer "scaffold:gem:customshape[name,namespace]"
|
1462
1464
|
```
|
1463
1465
|
|
1464
1466
|
That will generate a [custom shape](#custom-components) gem project under the naming convention: `glimmer-libui-cc-name-namespace`
|
@@ -1472,7 +1474,7 @@ The `namespace` is needed to avoid clashing with other [custom shape](#custom-co
|
|
1472
1474
|
Here is a shorter alias for the [custom shape](#custom-components) gem scaffolding command:
|
1473
1475
|
|
1474
1476
|
```
|
1475
|
-
glimmer scaffold:gem:cs[name,namespace]
|
1477
|
+
glimmer "scaffold:gem:cs[name,namespace]"
|
1476
1478
|
```
|
1477
1479
|
|
1478
1480
|
You can package the newly scaffolded project as a Ruby gem by running this command:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.12.
|
1
|
+
0.12.7
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Glimmer
|
2
|
+
module LibUI
|
3
|
+
module ContentBindable
|
4
|
+
# Data-binds the generation of nested content to a model/property (in binding args)
|
5
|
+
# consider providing an option to avoid initial rendering without any changes happening
|
6
|
+
def bind_content(*binding_args, &content_block)
|
7
|
+
# TODO in the future, consider optimizing code by diffing content if that makes sense
|
8
|
+
content_binding_work = proc do |*values|
|
9
|
+
children.dup.each { |child| child.destroy }
|
10
|
+
content(&content_block)
|
11
|
+
end
|
12
|
+
model_binding_observer = Glimmer::DataBinding::ModelBinding.new(*binding_args)
|
13
|
+
content_binding_observer = Glimmer::DataBinding::Observer.proc(&content_binding_work)
|
14
|
+
content_binding_observer.observe(model_binding_observer)
|
15
|
+
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]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -20,6 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/libui/data_bindable'
|
23
|
+
require 'glimmer/libui/content_bindable'
|
23
24
|
require 'glimmer/libui/parent'
|
24
25
|
|
25
26
|
module Glimmer
|
@@ -105,6 +106,7 @@ module Glimmer
|
|
105
106
|
end
|
106
107
|
|
107
108
|
include DataBindable
|
109
|
+
include ContentBindable
|
108
110
|
prepend Parent
|
109
111
|
|
110
112
|
KEYWORD_ALIASES = {
|
@@ -395,20 +397,6 @@ module Glimmer
|
|
395
397
|
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Libui::ControlExpression.new, @keyword, {post_add_content: @content_added}, &block)
|
396
398
|
end
|
397
399
|
|
398
|
-
# Data-binds the generation of nested content to a model/property (in binding args)
|
399
|
-
# consider providing an option to avoid initial rendering without any changes happening
|
400
|
-
def bind_content(*binding_args, &content_block)
|
401
|
-
# TODO in the future, consider optimizing code by diffing content if that makes sense
|
402
|
-
content_binding_work = proc do |*values|
|
403
|
-
children.dup.each { |child| child.destroy }
|
404
|
-
content(&content_block)
|
405
|
-
end
|
406
|
-
model_binding_observer = Glimmer::DataBinding::ModelBinding.new(*binding_args)
|
407
|
-
content_binding_observer = Glimmer::DataBinding::Observer.proc(&content_binding_work)
|
408
|
-
content_binding_observer.observe(model_binding_observer)
|
409
|
-
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]
|
410
|
-
end
|
411
|
-
|
412
400
|
private
|
413
401
|
|
414
402
|
def build_control
|
data/lib/glimmer/libui/shape.rb
CHANGED
@@ -23,6 +23,7 @@ require 'glimmer/libui/parent'
|
|
23
23
|
require 'glimmer/libui/control_proxy/area_proxy'
|
24
24
|
require 'glimmer/libui/control_proxy/path_proxy'
|
25
25
|
require 'glimmer/libui/data_bindable'
|
26
|
+
require 'glimmer/libui/content_bindable'
|
26
27
|
require 'glimmer/libui/perfect_shaped'
|
27
28
|
|
28
29
|
module Glimmer
|
@@ -72,6 +73,7 @@ module Glimmer
|
|
72
73
|
include Parent
|
73
74
|
include PerfectShaped
|
74
75
|
include DataBindable
|
76
|
+
include ContentBindable
|
75
77
|
|
76
78
|
KEYWORD_ALIASES = {
|
77
79
|
'shape' => 'composite_shape',
|
@@ -153,6 +153,7 @@ module Glimmer
|
|
153
153
|
mkdir 'app'
|
154
154
|
write "app/#{file_name(app_name)}.rb", app_main_file(app_name)
|
155
155
|
mkdir_p "app/#{file_name(app_name)}/model"
|
156
|
+
mkdir_p "app/#{file_name(app_name)}/presenter"
|
156
157
|
mkdir_p "app/#{file_name(app_name)}/view"
|
157
158
|
custom_window(class_name(app_name), current_dir_name, window_type, custom_window_class_name: 'Application')
|
158
159
|
app_model(current_dir_name)
|
@@ -195,9 +196,11 @@ module Glimmer
|
|
195
196
|
namespace ||= current_dir_name
|
196
197
|
root_dir = File.exist?('app') ? 'app' : 'lib'
|
197
198
|
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
|
198
|
-
|
199
|
+
custom_window_file_name_suffix = "_#{file_name(window_options[:custom_window_class_name])}" if window_options[:custom_window_class_name] == 'Application'
|
200
|
+
custom_window_file_name = "#{parent_dir}/#{file_name(custom_window_name)}#{custom_window_file_name_suffix}.rb"
|
201
|
+
return puts("The file '#{custom_window_file_name}' already exists. Please either remove or pick a different name.") if File.exist?(custom_window_file_name)
|
199
202
|
mkdir_p parent_dir unless File.exist?(parent_dir)
|
200
|
-
write
|
203
|
+
write custom_window_file_name, custom_window_file(custom_window_name, namespace, window_type, window_options)
|
201
204
|
end
|
202
205
|
|
203
206
|
def custom_control(custom_control_name, namespace)
|
@@ -437,7 +440,7 @@ module Glimmer
|
|
437
440
|
LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
|
438
441
|
end
|
439
442
|
|
440
|
-
require '#{file_name(app_name)}/view/#{file_name(app_name)}'
|
443
|
+
require '#{file_name(app_name)}/view/#{file_name(app_name)}_application.rb'
|
441
444
|
MULTI_LINE_STRING
|
442
445
|
end
|
443
446
|
|
@@ -457,9 +460,10 @@ module Glimmer
|
|
457
460
|
|
458
461
|
def app_launch_file(app_name)
|
459
462
|
<<~MULTI_LINE_STRING
|
463
|
+
# this is only a helper for the bin script to launch the app. Developers must generally not need to edit it.
|
460
464
|
require_relative '../#{file_name(app_name)}'
|
461
465
|
|
462
|
-
#{class_name(app_name)}::View::#{class_name(app_name)}.launch
|
466
|
+
#{class_name(app_name)}::View::#{class_name(app_name)}Application.launch
|
463
467
|
MULTI_LINE_STRING
|
464
468
|
end
|
465
469
|
|
@@ -545,7 +549,7 @@ require '#{window_type == :app ? current_dir_name : namespace}/model/greeting'
|
|
545
549
|
custom_window_file_content += <<-MULTI_LINE_STRING
|
546
550
|
#{namespace_type} #{class_name(namespace)}
|
547
551
|
module View
|
548
|
-
class #{class_name(custom_window_name)}
|
552
|
+
class #{class_name(custom_window_name)}#{window_options[:custom_window_class_name] if window_options[:custom_window_class_name] == 'Application'}
|
549
553
|
include Glimmer::LibUI::#{window_options[:custom_window_class_name]}
|
550
554
|
|
551
555
|
MULTI_LINE_STRING
|
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.12.
|
4
|
+
version: 0.12.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -526,6 +526,7 @@ files:
|
|
526
526
|
- lib/glimmer/launcher.rb
|
527
527
|
- lib/glimmer/libui.rb
|
528
528
|
- lib/glimmer/libui/attributed_string.rb
|
529
|
+
- lib/glimmer/libui/content_bindable.rb
|
529
530
|
- lib/glimmer/libui/control_proxy.rb
|
530
531
|
- lib/glimmer/libui/control_proxy/area_proxy.rb
|
531
532
|
- lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb
|