glimmer-dsl-swt 4.18.7.3 → 4.18.7.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 +9 -0
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +46 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +1 -1
- data/glimmer-dsl-swt.gemspec +3 -3
- data/lib/glimmer/rake_task.rb +36 -6
- data/lib/glimmer/rake_task/list.rb +8 -0
- data/lib/glimmer/rake_task/scaffold.rb +103 -0
- data/lib/glimmer/swt/custom/shape.rb +7 -3
- data/samples/elaborate/tetris.rb +1 -4
- data/samples/elaborate/tetris/view/bevel.rb +4 -1
- data/samples/elaborate/tetris/view/block.rb +1 -3
- 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: a27a28f23a9ca77db7405be0a2789396423d3634e42523440f92b3a86b33df9f
|
4
|
+
data.tar.gz: c6f3b4a9badd95f13c190772537ff0bfae688253573d3d11230f7935721aa9a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e62d4d5abe0c8c15f27363bbfc52d1e7ebb89ee090e4f6c494c0fda3b0e033928991f9d6898b585848a442b5411aa1d39f476b3d9124a1fa7d81f43f91f839
|
7
|
+
data.tar.gz: 1436f547b6ce8313a432b88e4758cebcd59c8da9f785487d04f96209b1a2b56aeffd6ed74e7942f676a1085efe7d491dfcac3e13c2499e1d0f7b8f8687117db3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.18.7.4
|
4
|
+
|
5
|
+
- Add `glimmer scaffold:customshape[name,namespace]` command
|
6
|
+
- Add `glimmer scaffold:gem:customshape[name,namespace]` command
|
7
|
+
- Add `glimmer list:gems:customshape[keyword]` command
|
8
|
+
- Support automatic inference of `fill: true` for `path` just like other shapes
|
9
|
+
- Support `filled: true` alternative for `fill: true` Canvas Shape DSL option
|
10
|
+
- Fix issue with having to pass base_color to `bevel` custom shape in Tetris before data-binding instead of data-binding being sufficient
|
11
|
+
|
3
12
|
### 4.18.7.3
|
4
13
|
|
5
14
|
- Support the ability for nested shapes to override their parent `shape` common shared properties
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.18.7.
|
1
|
+
4.18.7.4
|
@@ -67,6 +67,7 @@ Tasks are run via rake. Some tasks take arguments in square brackets.
|
|
67
67
|
Available tasks are below (if you do not see any, please add `require 'glimmer/rake_task'` to Rakefile and rerun or run rake -T):
|
68
68
|
|
69
69
|
Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
|
70
|
+
glimmer list:gems:customshape[query] # List Glimmer custom shape gems available at rubygems.org (query is optional) [alt: list:gems:cp]
|
70
71
|
‣ glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
|
71
72
|
glimmer list:gems:customwidget[query] # List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]
|
72
73
|
glimmer list:gems:dsl[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
|
@@ -81,8 +82,11 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
|
|
81
82
|
glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
|
82
83
|
glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
|
83
84
|
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
85
|
+
glimmer scaffold:customshape[name,namespace] # Scaffold Glimmer::UI::CustomShape subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cp]
|
84
86
|
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
85
87
|
glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
|
88
|
+
glimmer scaffold:desktopify[app_name,website] # Desktopify a web app
|
89
|
+
glimmer scaffold:gem:customshape[name,namespace] # Scaffold Glimmer::UI::CustomShape subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cp]
|
86
90
|
glimmer scaffold:gem:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:ge...
|
87
91
|
glimmer scaffold:gem:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]
|
88
92
|
```
|
@@ -333,7 +337,7 @@ glimmer scaffold:cs[name]
|
|
333
337
|
|
334
338
|
#### Custom Widget
|
335
339
|
|
336
|
-
To scaffold a Glimmer [custom widget](#custom-widgets) (part of a view) for an existing Glimmer app, run the following command:
|
340
|
+
To scaffold a Glimmer [custom widget](GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets) (part of a view) for an existing Glimmer app, run the following command:
|
337
341
|
|
338
342
|
```
|
339
343
|
glimmer scaffold:customwidget[name]
|
@@ -345,6 +349,20 @@ Or the following alternative abbreviation:
|
|
345
349
|
glimmer scaffold:cw[name]
|
346
350
|
```
|
347
351
|
|
352
|
+
#### Custom Shape
|
353
|
+
|
354
|
+
To scaffold a Glimmer [custom shape](GLIMMER_GUI_DSL_SYNTAX.md#custom-shapes) (a composite or customized shape) for an existing Glimmer app, run the following command:
|
355
|
+
|
356
|
+
```
|
357
|
+
glimmer scaffold:customshape[name]
|
358
|
+
```
|
359
|
+
|
360
|
+
Or the following alternative abbreviation:
|
361
|
+
|
362
|
+
```
|
363
|
+
glimmer scaffold:cp[name]
|
364
|
+
```
|
365
|
+
|
348
366
|
#### Custom Shell Gem
|
349
367
|
|
350
368
|
Custom shell gems are self-contained Glimmer apps as well as reusable [custom shells](#custom-shells).
|
@@ -382,7 +400,7 @@ Examples:
|
|
382
400
|
|
383
401
|
#### Custom Widget Gem
|
384
402
|
|
385
|
-
To scaffold a Glimmer [custom widget](#custom-widgets) gem (part of a view distributed as a Ruby gem), run the following command:
|
403
|
+
To scaffold a Glimmer [custom widget](GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets) gem (part of a view distributed as a Ruby gem), run the following command:
|
386
404
|
|
387
405
|
```
|
388
406
|
glimmer scaffold:gem:customwidget[name,namespace]
|
@@ -397,7 +415,7 @@ glimmer scaffold:gem:cw[name,namespace]
|
|
397
415
|
|
398
416
|
It is important to specify a namespace to avoid having your gem clash with existing gems.
|
399
417
|
|
400
|
-
The Ruby gem name will follow the convention "glimmer-cw-customwidgetname-namespace" (the 'cw' is for Custom Widget)
|
418
|
+
The Ruby gem name will follow the convention "glimmer-cw-customwidgetname-namespace" (the 'cw' is for Custom Widget; name words are not separated)
|
401
419
|
|
402
420
|
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video) Ruby gem)
|
403
421
|
|
@@ -406,6 +424,31 @@ Examples:
|
|
406
424
|
- [glimmer-cw-video](https://github.com/AndyObtiva/glimmer-cw-video): Video Widget
|
407
425
|
- [glimmer-cw-cdatetime-nebula](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula): Nebula CDateTime Widget
|
408
426
|
|
427
|
+
#### Custom Shape Gem
|
428
|
+
|
429
|
+
To scaffold a Glimmer [custom shape](GLIMMER_GUI_DSL_SYNTAX.md#custom-shapes) gem (part of a view distributed as a Ruby gem), run the following command:
|
430
|
+
|
431
|
+
```
|
432
|
+
glimmer scaffold:gem:customshape[name,namespace]
|
433
|
+
```
|
434
|
+
|
435
|
+
Or the following alternative abbreviation:
|
436
|
+
|
437
|
+
```
|
438
|
+
glimmer scaffold:gem:cp[name,namespace]
|
439
|
+
```
|
440
|
+
|
441
|
+
|
442
|
+
It is important to specify a namespace to avoid having your gem clash with existing gems.
|
443
|
+
|
444
|
+
The Ruby gem name will follow the convention "glimmer-cp-customshapename-namespace" (the 'cp' is for Custom Shape; name words are not separated)
|
445
|
+
|
446
|
+
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cp-bevel](https://rubygems.org/gems/glimmer-cp-bevel) Ruby gem)
|
447
|
+
|
448
|
+
Examples:
|
449
|
+
|
450
|
+
- [glimmer-cp-bevel](https://github.com/AndyObtiva/glimmer-cp-bevel): Bevel
|
451
|
+
|
409
452
|
### Gem Listing
|
410
453
|
|
411
454
|
The `glimmer` command comes with tasks for listing Glimmer related gems to make it easy to find Glimmer [Custom Shells](#custom-shells), [Custom Widgets](#custom-widgets), and DSLs published by others in the Glimmer community on [rubygems.org](http://www.rubygems.org).
|
@@ -1416,7 +1416,7 @@ Shape keywords and their args (including defaults) are listed below (they basica
|
|
1416
1416
|
- `text(string, x, y, is_transparent = true)` text with optional is_transparent to indicate if background is transparent (default is true)
|
1417
1417
|
- `text(string, x, y, flags)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be `:draw_delimiter` (i.e. new lines), `:draw_tab`, `:draw_mnemonic`, and `:draw_transparent` as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
|
1418
1418
|
|
1419
|
-
Shape keywords that can be filled with color can take a keyword argument `fill: true
|
1419
|
+
Shape keywords that can be filled with color can take a keyword argument `fill: true` (or `filled: true`). Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
|
1420
1420
|
Smart defaults can be applied to automatically infer `gradient: true` (rectangle with both foreground and background) and `round: true` (rectangle with more than 4 args, the extra args are numeric) as well.
|
1421
1421
|
|
1422
1422
|
Optionally, a shape keyword takes a block that can set any attributes from [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) (methods starting with `set`), which enable setting the `background` for filling and `foreground` for drawing.
|
data/glimmer-dsl-swt.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-swt 4.18.7.
|
5
|
+
# stub: glimmer-dsl-swt 4.18.7.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-swt".freeze
|
9
|
-
s.version = "4.18.7.
|
9
|
+
s.version = "4.18.7.4"
|
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 = "2021-03-
|
14
|
+
s.date = "2021-03-10"
|
15
15
|
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer".freeze, "girb".freeze]
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -54,7 +54,7 @@ namespace :glimmer do
|
|
54
54
|
if args[:app_path].nil?
|
55
55
|
require 'fileutils'
|
56
56
|
current_directory_name = File.basename(FileUtils.pwd)
|
57
|
-
assumed_shell_script = File.join('.', 'bin', current_directory_name)
|
57
|
+
assumed_shell_script = File.join('.', 'bin', current_directory_name)
|
58
58
|
assumed_shell_script = Dir.glob('./bin/*').detect {|f| File.file?(f)} if !File.exist?(assumed_shell_script)
|
59
59
|
Glimmer::Launcher.new([assumed_shell_script]).launch
|
60
60
|
else
|
@@ -145,6 +145,16 @@ namespace :glimmer do
|
|
145
145
|
task :custom_widget, [:name, :namespace] => :customwidget
|
146
146
|
task :"custom-widget", [:name, :namespace] => :customwidget
|
147
147
|
|
148
|
+
desc 'Scaffold Glimmer::UI::CustomShape subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cp]'
|
149
|
+
task :customshape, [:name, :namespace] do |t, args|
|
150
|
+
require_relative 'rake_task/scaffold'
|
151
|
+
Glimmer::RakeTask::Scaffold.custom_shape(args[:name], args[:namespace])
|
152
|
+
end
|
153
|
+
|
154
|
+
task :cp, [:name, :namespace] => :customshape
|
155
|
+
task :custom_shape, [:name, :namespace] => :customshape
|
156
|
+
task :"custom-shape", [:name, :namespace] => :customshape
|
157
|
+
|
148
158
|
desc 'Desktopify a web app'
|
149
159
|
task :desktopify, [:app_name, :website] do |t, args|
|
150
160
|
require_relative 'rake_task/scaffold'
|
@@ -170,13 +180,24 @@ namespace :glimmer do
|
|
170
180
|
|
171
181
|
task :cw, [:name, :namespace] => :customwidget
|
172
182
|
task :custom_widget, [:name, :namespace] => :customwidget
|
173
|
-
task :"custom-widget", [:name, :namespace] => :customwidget
|
183
|
+
task :"custom-widget", [:name, :namespace] => :customwidget
|
184
|
+
|
185
|
+
desc 'Scaffold Glimmer::UI::CustomShape subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cp]'
|
186
|
+
task :customshape, [:name, :namespace] do |t, args|
|
187
|
+
require_relative 'rake_task/scaffold'
|
188
|
+
Glimmer::RakeTask::Scaffold.custom_shape_gem(args[:name], args[:namespace])
|
189
|
+
end
|
190
|
+
|
191
|
+
task :cp, [:name, :namespace] => :customshape
|
192
|
+
task :custom_shape, [:name, :namespace] => :customshape
|
193
|
+
task :"custom-shape", [:name, :namespace] => :customshape
|
174
194
|
end
|
175
195
|
|
176
196
|
# legacy support
|
177
197
|
|
178
198
|
task :custom_shell_gem, [:name, :namespace] => 'gem:customshell'
|
179
199
|
task :custom_widget_gem, [:name, :namespace] => 'gem:customwidget'
|
200
|
+
task :custom_shape_gem, [:name, :namespace] => 'gem:customshape'
|
180
201
|
|
181
202
|
end
|
182
203
|
|
@@ -204,6 +225,15 @@ namespace :glimmer do
|
|
204
225
|
task :custom_shell, [:query] => :customshell
|
205
226
|
task :"custom-shell", [:query] => :customshell
|
206
227
|
|
228
|
+
desc 'List Glimmer custom shape gems available at rubygems.org (query is optional) [alt: list:gems:cp]'
|
229
|
+
task :customshape, [:query] => :list_require do |t, args|
|
230
|
+
Glimmer::RakeTask::List.custom_shape_gems(args[:query])
|
231
|
+
end
|
232
|
+
|
233
|
+
task :cp, [:query] => :customshape
|
234
|
+
task :custom_shape, [:query] => :customshape
|
235
|
+
task :"custom-shape", [:query] => :customshape
|
236
|
+
|
207
237
|
desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
|
208
238
|
task :dsl, [:query] => :list_require do |t, args|
|
209
239
|
Glimmer::RakeTask::List.dsl_gems(args[:query])
|
@@ -214,7 +244,7 @@ namespace :glimmer do
|
|
214
244
|
# legacy support
|
215
245
|
|
216
246
|
task :custom_shell_gems, [:name, :namespace] => 'gems:customshell'
|
217
|
-
task :custom_widget_gems, [:name, :namespace] => 'gems:customwidget'
|
247
|
+
task :custom_widget_gems, [:name, :namespace] => 'gems:customwidget'
|
218
248
|
|
219
249
|
end
|
220
250
|
end
|
@@ -45,6 +45,14 @@ module Glimmer
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def custom_shape_gems(query=nil)
|
49
|
+
list_gems('glimmer-cp-', query) do |result|
|
50
|
+
puts
|
51
|
+
puts " Glimmer Custom Shape Gems#{" matching [#{query}]" if query} at rubygems.org:"
|
52
|
+
puts result
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
48
56
|
def dsl_gems(query=nil)
|
49
57
|
list_gems('glimmer-dsl-', query) do |result|
|
50
58
|
puts
|
@@ -215,6 +215,15 @@ module Glimmer
|
|
215
215
|
write "#{parent_dir}/#{file_name(custom_widget_name)}.rb", custom_widget_file(custom_widget_name, namespace)
|
216
216
|
end
|
217
217
|
|
218
|
+
def custom_shape(custom_shape_name, namespace)
|
219
|
+
namespace ||= current_dir_name
|
220
|
+
root_dir = File.exists?('app') ? 'app' : 'lib'
|
221
|
+
parent_dir = "#{root_dir}/views/#{file_name(namespace)}"
|
222
|
+
return puts("The file '#{parent_dir}/#{file_name(custom_shape_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shape_name)}.rb")
|
223
|
+
mkdir_p parent_dir unless File.exists?(parent_dir)
|
224
|
+
write "#{parent_dir}/#{file_name(custom_shape_name)}.rb", custom_shape_file(custom_shape_name, namespace)
|
225
|
+
end
|
226
|
+
|
218
227
|
def custom_shell_gem(custom_shell_name, namespace)
|
219
228
|
gem_name = "glimmer-cs-#{compact_name(custom_shell_name)}"
|
220
229
|
gem_summary = "#{human_name(custom_shell_name)} - Glimmer Custom Shell"
|
@@ -334,6 +343,45 @@ module Glimmer
|
|
334
343
|
puts 'Run `rake release` to release into rubygems.org once ready.'
|
335
344
|
end
|
336
345
|
|
346
|
+
def custom_shape_gem(custom_shape_name, namespace)
|
347
|
+
return puts('Namespace is required! Usage: glimmer scaffold:custom_shape_gem[custom_shape_name,namespace]') unless `git config --get github.user`.to_s.strip == 'AndyObtiva'
|
348
|
+
gem_name = "glimmer-cp-#{compact_name(custom_shape_name)}"
|
349
|
+
gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
|
350
|
+
if namespace
|
351
|
+
gem_name += "-#{compact_name(namespace)}"
|
352
|
+
gem_summary += " (#{human_name(namespace)})"
|
353
|
+
else
|
354
|
+
namespace = 'glimmer'
|
355
|
+
end
|
356
|
+
|
357
|
+
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
|
358
|
+
system "jruby -S gem install juwelier -v2.4.9 --no-document" unless juwelier_exists?
|
359
|
+
system "jruby -S juwelier --markdown --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
|
360
|
+
return puts('Your Git user.name and/or github.user are missing! Please add in for Juwelier to help Glimmer with Scaffolding.') if `git config --get github.user`.strip.empty? && `git config --get user.name`.strip.empty?
|
361
|
+
cd gem_name
|
362
|
+
write '.gitignore', GITIGNORE
|
363
|
+
write '.ruby-version', RUBY_VERSION
|
364
|
+
write '.ruby-gemset', gem_name
|
365
|
+
write 'VERSION', '1.0.0'
|
366
|
+
write 'Gemfile', GEMFILE
|
367
|
+
write 'Rakefile', gem_rakefile
|
368
|
+
append "lib/#{gem_name}.rb", gem_main_file(custom_shape_name, namespace)
|
369
|
+
mkdir 'lib/views'
|
370
|
+
custom_shape(custom_shape_name, namespace)
|
371
|
+
if OS.windows?
|
372
|
+
system "bundle"
|
373
|
+
system "rspec --init"
|
374
|
+
else
|
375
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
|
376
|
+
end
|
377
|
+
write 'spec/spec_helper.rb', spec_helper_file
|
378
|
+
puts "Finished creating #{gem_name} Ruby gem."
|
379
|
+
puts 'Edit Rakefile to configure gem details.'
|
380
|
+
puts 'Run `rake` to execute specs.'
|
381
|
+
puts 'Run `rake build` to build gem.'
|
382
|
+
puts 'Run `rake release` to release into rubygems.org once ready.'
|
383
|
+
end
|
384
|
+
|
337
385
|
private
|
338
386
|
|
339
387
|
def juwelier_exists?
|
@@ -762,7 +810,62 @@ module Glimmer
|
|
762
810
|
end
|
763
811
|
MULTI_LINE_STRING
|
764
812
|
end
|
813
|
+
|
814
|
+
def custom_shape_file(custom_shape_name, namespace)
|
815
|
+
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
|
816
|
+
|
817
|
+
<<~MULTI_LINE_STRING
|
818
|
+
#{namespace_type} #{class_name(namespace)}
|
819
|
+
class #{class_name(custom_shape_name)}
|
820
|
+
include Glimmer::UI::CustomShape
|
821
|
+
|
822
|
+
## Add options like the following to configure CustomShape by outside consumers
|
823
|
+
#
|
824
|
+
# options :option1, option2, option3
|
825
|
+
option :background_color, default: :red
|
826
|
+
option :size_width, default: 100
|
827
|
+
option :size_height, default: 100
|
828
|
+
option :location_x, default: 0
|
829
|
+
option :location_y, default: 0
|
830
|
+
|
831
|
+
## Use before_body block to pre-initialize variables to use in body
|
832
|
+
#
|
833
|
+
#
|
834
|
+
# before_body {
|
835
|
+
#
|
836
|
+
# }
|
837
|
+
|
838
|
+
## Use after_body block to setup observers for shapes in body
|
839
|
+
#
|
840
|
+
# after_body {
|
841
|
+
#
|
842
|
+
# }
|
843
|
+
|
844
|
+
## Add shape content under custom shape body
|
845
|
+
#
|
846
|
+
body {
|
847
|
+
# Replace example content below with custom shape content
|
848
|
+
shape(location_x, location_y) {
|
849
|
+
path {
|
850
|
+
background background_color
|
851
|
+
cubic size_width - size_width*0.66, size_height/2 - size_height*0.33, size_width*0.65 - size_width*0.66, 0 - size_height*0.33, size_width/2 - size_width*0.66, size_height*0.75 - size_height*0.33, size_width - size_width*0.66, size_height - size_height*0.33
|
852
|
+
}
|
853
|
+
path {
|
854
|
+
background background_color
|
855
|
+
cubic size_width - size_width*0.66, size_height/2 - size_height*0.33, size_width*1.35 - size_width*0.66, 0 - size_height*0.33, size_width*1.5 - size_width*0.66, size_height*0.75 - size_height*0.33, size_width - size_width*0.66, size_height - size_height*0.33
|
856
|
+
}
|
857
|
+
}
|
858
|
+
}
|
859
|
+
|
860
|
+
end
|
861
|
+
end
|
862
|
+
MULTI_LINE_STRING
|
863
|
+
end
|
864
|
+
|
765
865
|
end
|
866
|
+
|
766
867
|
end
|
868
|
+
|
767
869
|
end
|
870
|
+
|
768
871
|
end
|
@@ -94,8 +94,10 @@ module Glimmer
|
|
94
94
|
|
95
95
|
def arg_options(args, extract: false)
|
96
96
|
arg_options_method = extract ? :pop : :last
|
97
|
-
options = args.send(arg_options_method) if args.last.is_a?(Hash)
|
98
|
-
|
97
|
+
options = args.send(arg_options_method).symbolize_keys if args.last.is_a?(Hash)
|
98
|
+
# normalize :filled option as an alias to :fill
|
99
|
+
# options[:fill] = options.delete(:filled) if options&.keys&.include?(:filled)
|
100
|
+
options.nil? ? {} : options
|
99
101
|
end
|
100
102
|
|
101
103
|
def method_name(keyword, method_arg_options)
|
@@ -400,7 +402,7 @@ module Glimmer
|
|
400
402
|
def amend_method_name_options_based_on_properties!
|
401
403
|
@original_method_name = @method_name
|
402
404
|
return if @name == 'point'
|
403
|
-
if @name != 'text' && @name != 'string' && has_some_background? && !has_some_foreground?
|
405
|
+
if (@name != 'text' && @name != 'string' && has_some_background? && !has_some_foreground?) || (@name == 'path' && has_some_background?)
|
404
406
|
@options[:fill] = true
|
405
407
|
elsif !has_some_background? && has_some_foreground?
|
406
408
|
@options[:fill] = false
|
@@ -474,7 +476,9 @@ module Glimmer
|
|
474
476
|
# TODO consider this optimization of preconverting args (removing conversion from other methods) to reject equal args
|
475
477
|
args = apply_property_arg_conversions(ruby_attribute_getter_name, args)
|
476
478
|
return if @properties[ruby_attribute_getter_name] == args
|
479
|
+
new_property = !@properties.keys.include?(ruby_attribute_getter_name)
|
477
480
|
@properties[ruby_attribute_getter_name] = args
|
481
|
+
amend_method_name_options_based_on_properties! if @content_added && new_property
|
478
482
|
property_change = true
|
479
483
|
end
|
480
484
|
if @content_added && perform_redraw && !drawable.is_disposed
|
data/samples/elaborate/tetris.rb
CHANGED
@@ -156,10 +156,7 @@ class Tetris
|
|
156
156
|
color = colored ? color(([:white] + Model::Tetromino::LETTER_COLORS.values).sample) : color(:white)
|
157
157
|
x = column * icon_block_size
|
158
158
|
y = row * icon_block_size
|
159
|
-
|
160
|
-
background color
|
161
|
-
bevel(base_color: color, size: icon_block_size)
|
162
|
-
}
|
159
|
+
bevel(x: x, y: y, base_color: color, size: icon_block_size)
|
163
160
|
}
|
164
161
|
}
|
165
162
|
}
|
@@ -26,13 +26,16 @@ class Tetris
|
|
26
26
|
include Glimmer::UI::CustomShape
|
27
27
|
|
28
28
|
options :base_color, :size, :bevel_pixel_size
|
29
|
+
option :x, default: 0
|
30
|
+
option :y, default: 0
|
29
31
|
|
30
32
|
before_body {
|
31
33
|
self.bevel_pixel_size = 0.16*size.to_f if bevel_pixel_size.nil?
|
32
34
|
}
|
33
35
|
|
34
36
|
body {
|
35
|
-
|
37
|
+
rectangle(x, y, size, size) {
|
38
|
+
background bind(self, :base_color)
|
36
39
|
polygon(0, 0, size, 0, size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
|
37
40
|
background bind(self, :base_color) { |color_value|
|
38
41
|
unless color_value.nil?
|
@@ -30,9 +30,7 @@ class Tetris
|
|
30
30
|
|
31
31
|
body {
|
32
32
|
canvas { |canvas_proxy|
|
33
|
-
|
34
|
-
|
35
|
-
bevel(base_color: game_playfield[row][column].color, size: block_size) {
|
33
|
+
bevel(size: block_size) {
|
36
34
|
base_color bind(game_playfield[row][column], :color)
|
37
35
|
}
|
38
36
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.18.7.
|
4
|
+
version: 4.18.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|