glimmer-dsl-swt 4.22.2.6 → 4.23.1.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 +17 -0
- data/README.md +21 -15
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +6 -4
- data/docs/reference/GLIMMER_SAMPLES.md +10 -11
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/rake_task/package.rb +1 -1
- data/samples/elaborate/meta_sample.rb +42 -0
- data/samples/elaborate/tetris/model/game.rb +26 -24
- data/samples/elaborate/tetris/view/score_lane.rb +5 -1
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +19 -0
- data/samples/hello/hello_code_text.rb +11 -0
- data/samples/hello/hello_styled_text.rb +4 -4
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56654c61fc60401e8b1924bb81f474e5694ab7fc5c2c4a3b592932ccd348e0cb
|
4
|
+
data.tar.gz: daa2b79e4a10af9b093f21c6358eaaba1bb93e4dc7fbc8520c7c658ccc2b20f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a02f5c3157fdd1805902042d154f7f452258f56129905b7641ed7ea88a7178c6de64e36e07c8a99608a2db8f26094e90775ecc1ce1d1ed55062b573704a3f46e
|
7
|
+
data.tar.gz: 568739a4d7954ef9d12515dbe9e4a0b1ae60bb06887067a7636247e173da6dbe9ee0c9765c1e63a3d7be261ef552ad3cff7eae90be8317cac7a9f70634e98e39
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.23.1.0
|
4
|
+
|
5
|
+
- Upgrade to JRuby 9.3.4.0
|
6
|
+
- Upgrade to glimmer 2.7.3
|
7
|
+
- Add "Tutorial" button to Hello, Meta Sample! to show Youtube Video Tutorial
|
8
|
+
|
9
|
+
## 4.23.0.1
|
10
|
+
|
11
|
+
- Add "Speed" menu to the Tetris sample
|
12
|
+
- Add "Show Next Block Preview" View menu item to the Tetris sample
|
13
|
+
- Document Glimmer::UI::Application alias for Glimmer::UI::CustomShell
|
14
|
+
|
15
|
+
## 4.23.0.0
|
16
|
+
|
17
|
+
- Upgrade to SWT 4.23
|
18
|
+
- Upgrade to JDK 18
|
19
|
+
|
3
20
|
## 4.22.2.6
|
4
21
|
|
5
22
|
- Fix issue whereby updating `string` property on the `text`/`string` shape does not trigger a redraw on the shape because the text dimensions remained the same despite the change of content (e.g. switching from `string` content of letter `A` to `S` results in the same dimensions)
|
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 SWT 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 SWT 4.23.1.0
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
**(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
|
10
10
|
|
11
|
+
[GLIMMER VIDEO TUTORIAL CHANNEL](https://www.youtube.com/channel/UC5hzDE23HZXsZLAxYk2UJEw)
|
12
|
+
|
11
13
|
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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 afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and DEB/RPM files on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
|
12
14
|
|
13
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
@@ -17,7 +19,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
17
19
|
|
18
20
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
19
21
|
|
20
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.
|
22
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.23.1.0 includes [SWT 4.23](https://download.eclipse.org/eclipse/downloads/drops4/R-4.23-202203080310/), which was released on March 8, 2022. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
|
21
23
|
|
22
24
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword.
|
23
25
|
|
@@ -201,7 +203,7 @@ Glimmer app:
|
|
201
203
|
|
202
204
|
### Desktop Apps Built with Glimmer DSL for SWT
|
203
205
|
|
204
|
-
[<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet) - Small Project Tracking App
|
206
|
+
[<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet) - Small Project Tracking App (leveraging [ActiveRecord](https://rubygems.org/gems/activerecord) and [SQLite](https://www.sqlite.org/index.html))
|
205
207
|
|
206
208
|
[![Are We There Yet? App Screenshot](https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-screenshot-windows.png)](https://github.com/AndyObtiva/are-we-there-yet)
|
207
209
|
|
@@ -240,7 +242,7 @@ Glimmer app:
|
|
240
242
|
|
241
243
|
## Background
|
242
244
|
|
243
|
-
[Ruby](https://www.ruby-lang.org) is a dynamically-typed object-oriented language, which provides great productivity gains due to its
|
245
|
+
[Ruby](https://www.ruby-lang.org) is a dynamically-typed object-oriented language, which provides great productivity gains due to its expressive syntax and dynamic nature. While it is proven by the [Ruby](https://www.ruby-lang.org) on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that [Java](https://www.oracle.com/ca-en/java/) libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as [SWT](https://www.eclipse.org/swt/), JFace, and RCP can help fill the gap of desktop application development with Ruby.
|
244
246
|
|
245
247
|
## Software Architecture
|
246
248
|
|
@@ -299,10 +301,10 @@ https://www.eclipse.org/swt/faq.php
|
|
299
301
|
|
300
302
|
## Pre-requisites
|
301
303
|
|
302
|
-
- JDK
|
303
|
-
- [RVM](http://rvm.io) on Mac & Linux (not
|
304
|
-
- JRuby 9.3.
|
305
|
-
- SWT 4.
|
304
|
+
- JDK 18 (find at https://www.oracle.com/java/technologies/downloads / Ensure `PATH` env var includes Java bin directory for `jpackage` command to work when packaging Glimmer applications / Preferably setup `JAVA_HOME` env var too to point to JDK home directory before installing JRuby)
|
305
|
+
- [RVM](http://rvm.io) on Mac & Linux (not needed on Windows)
|
306
|
+
- JRuby 9.3.4.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.4.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
|
307
|
+
- SWT 4.23 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT supports ARM64/AARCH64 on Mac and Linux since version 4.20
|
306
308
|
- Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
|
307
309
|
|
308
310
|
Glimmer might still work on other versions of Java, JRuby and SWT, but there are no guarantees, so it is best to stick to the pre-requisites outlined above.
|
@@ -331,7 +333,7 @@ jgem install glimmer-dsl-swt
|
|
331
333
|
|
332
334
|
Or this command if you want a specific version:
|
333
335
|
```
|
334
|
-
jgem install glimmer-dsl-swt -v 4.
|
336
|
+
jgem install glimmer-dsl-swt -v 4.23.1.0
|
335
337
|
```
|
336
338
|
|
337
339
|
`jgem` is JRuby's version of `gem` command.
|
@@ -359,7 +361,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
359
361
|
|
360
362
|
Add the following to `Gemfile`:
|
361
363
|
```
|
362
|
-
gem 'glimmer-dsl-swt', '~> 4.
|
364
|
+
gem 'glimmer-dsl-swt', '~> 4.23.1.0'
|
363
365
|
```
|
364
366
|
|
365
367
|
And, then run:
|
@@ -382,7 +384,7 @@ glimmer
|
|
382
384
|
```
|
383
385
|
|
384
386
|
```
|
385
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.
|
387
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.23.1.0
|
386
388
|
|
387
389
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
388
390
|
|
@@ -489,7 +491,7 @@ table(:multi) {
|
|
489
491
|
}
|
490
492
|
```
|
491
493
|
|
492
|
-
3. Listeners
|
494
|
+
3. Listeners
|
493
495
|
|
494
496
|
Listeners embody the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) and always start with `on_` followed by an event name (e.g. `on_widget_selected`). Also, they are an exception to Glimmer's syntax that requires a `do; end` style block to clearly demarcate as logic as opposed to View syntax.
|
495
497
|
|
@@ -565,13 +567,13 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
565
567
|
|
566
568
|
### Are We There Yet?
|
567
569
|
|
568
|
-
This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a database using [ActiveRecord](https://rubygems.org/gems/activerecord).
|
570
|
+
This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a [SQLite](https://www.sqlite.org/index.html) database using [ActiveRecord](https://rubygems.org/gems/activerecord).
|
569
571
|
|
570
572
|
[<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet): A tool that helps you learn when your small projects will finish
|
571
573
|
|
572
574
|
### Garderie Rainbow Daily Agenda
|
573
575
|
|
574
|
-
This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a [Rails](https://rubyonrails.org/) server to submit
|
576
|
+
This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a [Rails](https://rubyonrails.org/) server to submit a nursery child daily agenda via a REST API, storing data in [PostgreSQL](https://www.postgresql.org/).
|
575
577
|
|
576
578
|
[<img alt="Garderie Rainbow Daily Agenda Logo" src="https://github.com/AndyObtiva/garderie_rainbow_daily_agenda/raw/master/images/garderie_rainbow_daily_agenda_logo.png" width="40" />Garderie Rainbow Daily Agenda](https://github.com/AndyObtiva/garderie_rainbow_daily_agenda): A child nursery daily agenda reporting desktop app
|
577
579
|
|
@@ -591,6 +593,10 @@ This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) applicatio
|
|
591
593
|
|
592
594
|
[Befunge 98 GUI](https://github.com/AndyObtiva/befunge98/tree/gui)
|
593
595
|
|
596
|
+
### Glimmer Klondike Solitaire
|
597
|
+
|
598
|
+
[<img alt="Glimmer Klondike Solitaire Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/icons/linux/Glimmer%20Klondike%20Solitaire.png" height=40 /> Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire)
|
599
|
+
|
594
600
|
### Glimmer Metronome
|
595
601
|
|
596
602
|
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/icons/linux/Glimmer%20Metronome.png" height=40 /> Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome)
|
@@ -636,7 +642,7 @@ Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/maste
|
|
636
642
|
|
637
643
|
## Resources
|
638
644
|
|
639
|
-
* [Glimmer DSL for SWT Video Tutorials](https://andymaleh.blogspot.com/search/label/Tutorial+SWT)
|
645
|
+
* [Glimmer DSL for SWT Video Tutorials](https://andymaleh.blogspot.com/search/label/Tutorial+SWT) ([Video Tutorial Playlist](https://www.youtube.com/watch?v=Mi5phsSdNAA&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem) and [Video Tutorial Channel](https://www.youtube.com/channel/UC5hzDE23HZXsZLAxYk2UJEw))
|
640
646
|
* [Code Master Blog](http://andymaleh.blogspot.com/search/label/Glimmer)
|
641
647
|
* [JRuby Cookbook by Justin Edelson & Henry Liu](http://shop.oreilly.com/product/9780596519650.do)
|
642
648
|
* [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt)
|
data/RUBY_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jruby-9.3.
|
1
|
+
jruby-9.3.4.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.23.1.0
|
@@ -332,8 +332,8 @@ This is not an exaustive list, but should give you a good start in learning Glim
|
|
332
332
|
- `time`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
333
333
|
- `tool_bar`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
334
334
|
- `tool_item`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
335
|
-
- Glimmer::UI::CustomWidget
|
336
|
-
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window
|
335
|
+
- `Glimmer::UI::CustomWidget`: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
|
336
|
+
- `Glimmer::UI::CustomShell` (alias: `Glimmer::UI::Application`): ability to define any keyword as a custom shell (aka custom window or app) - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell)
|
337
337
|
|
338
338
|
**Layouts:**
|
339
339
|
- `grid_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
@@ -940,6 +940,8 @@ The system tray allows showing icons for various apps that need to stay on for e
|
|
940
940
|
|
941
941
|
In Glimmer DSL for SWT, generating tray items is automated via the `tray_item` keyword, which can be nested under `shell` and then have a child `menu` underneath that pops up when the user clicks on its icon in the system tray.
|
942
942
|
|
943
|
+
Note that if you would like to display notifications, you can use the [Nebula Notifier custom widget](https://github.com/AndyObtiva/glimmer-cw-nebula#notifier). Alternatively, you can look into the [Two Slices](https://github.com/sshtools/two-slices) Java library.
|
944
|
+
|
943
945
|
Note how the shell was declared with the `:on_top` style (in addition to the default, which is `:shell_trim`) to ensure it opens above all apps when the "Show Application" menu item is selected.
|
944
946
|
|
945
947
|
Example code:
|
@@ -3574,8 +3576,8 @@ Example:
|
|
3574
3576
|
```ruby
|
3575
3577
|
shell {
|
3576
3578
|
@tree = tree {
|
3577
|
-
items
|
3578
|
-
selection
|
3579
|
+
items <= [company, :owner, tree_properties: {children: :coworkers, text: :name}]
|
3580
|
+
selection <=> [company, :selected_coworker]
|
3579
3581
|
}
|
3580
3582
|
}
|
3581
3583
|
```
|
@@ -84,7 +84,6 @@
|
|
84
84
|
- [Glimmer Calculator](#glimmer-calculator)
|
85
85
|
- [Gladiator](#gladiator)
|
86
86
|
- [Timer](#timer)
|
87
|
-
- [Glimmer Klondike Solitaire](#glimmer-klondike-solitaire)
|
88
87
|
- [License](#license)
|
89
88
|
|
90
89
|
## Samples
|
@@ -115,6 +114,8 @@ For hello-type simple samples, check the following.
|
|
115
114
|
|
116
115
|
#### Hello, World!
|
117
116
|
|
117
|
+
[Hello, World! Video Tutorial](https://www.youtube.com/watch?v=Mi5phsSdNAA&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=1)
|
118
|
+
|
118
119
|
Code:
|
119
120
|
|
120
121
|
[samples/hello/hello_world.rb](/samples/hello/hello_world.rb)
|
@@ -195,6 +196,8 @@ Code:
|
|
195
196
|
|
196
197
|
#### Hello, Layout!
|
197
198
|
|
199
|
+
[Hello, Layout! Video Tutorial](https://www.youtube.com/watch?v=dAVFR9Y_thY&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=4)
|
200
|
+
|
198
201
|
This sample demonstrates the standard 3 layouts in SWT (though one can write their own for very advanced applications): `fill_layout`, `row_layout`, and `grid_layout`
|
199
202
|
|
200
203
|
Code:
|
@@ -261,6 +264,8 @@ Always On Top Shell
|
|
261
264
|
|
262
265
|
#### Hello, Tab!
|
263
266
|
|
267
|
+
[Hello, Tab! Video Tutorial](https://www.youtube.com/watch?v=cMwlYZ78uaQ&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=3)
|
268
|
+
|
264
269
|
Code:
|
265
270
|
|
266
271
|
[samples/hello/hello_tab.rb](/samples/hello/hello_tab.rb)
|
@@ -360,6 +365,8 @@ Code:
|
|
360
365
|
|
361
366
|
#### Hello, Message Box!
|
362
367
|
|
368
|
+
[Hello, Message Box! Video Tutorial](https://www.youtube.com/watch?v=N0sDcr0xp40&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=2)
|
369
|
+
|
363
370
|
This sample demonstrates a `message_box` dialog.
|
364
371
|
|
365
372
|
Code:
|
@@ -1075,7 +1082,7 @@ Hello, Cool Bar!
|
|
1075
1082
|
|
1076
1083
|
#### Hello, Tray Item!
|
1077
1084
|
|
1078
|
-
This sample demonstrates the use of `tray_item
|
1085
|
+
This sample demonstrates the use of [`tray_item`](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#tray-item), which enables hiding an app (sending to background) and showing again on top of all other apps. It can also show an About Message Box and exit completely if needed.
|
1079
1086
|
|
1080
1087
|
Code:
|
1081
1088
|
|
@@ -1251,7 +1258,7 @@ Code:
|
|
1251
1258
|
|
1252
1259
|
![Klondike Solitaire Played](/images/glimmer-klondike-solitaire-played.png)
|
1253
1260
|
|
1254
|
-
Check out a souped up large-card-size packaged version of the game in the [Glimmer Klondike Solitaire](
|
1261
|
+
Check out a souped up large-card-size packaged version of the game in the [Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire) application.
|
1255
1262
|
|
1256
1263
|
#### Battleship
|
1257
1264
|
|
@@ -1422,14 +1429,6 @@ Gladiator is a good demonstration of:
|
|
1422
1429
|
|
1423
1430
|
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
|
1424
1431
|
|
1425
|
-
#### Glimmer Klondike Solitaire
|
1426
|
-
|
1427
|
-
This is a souped up version of the Klondike Solitaire elaborate sample, which is built as an external application to enable packaging as a native executable installer. Enjoy!
|
1428
|
-
|
1429
|
-
[<img alt="Glimmer Klondike Solitaire Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/package/linux/Glimmer%20Klondike%20Solitaire.png" height=40 /> Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire)
|
1430
|
-
|
1431
|
-
![Glimmer Klondike Solitaire](https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/images/glimmer-klondike-solitaire.png)
|
1432
|
-
|
1433
1432
|
## License
|
1434
1433
|
|
1435
1434
|
[MIT](LICENSE.txt)
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -44,6 +44,22 @@ class Sample
|
|
44
44
|
include Glimmer::DataBinding::ObservableModel
|
45
45
|
|
46
46
|
UNEDITABLE = ['meta_sample.rb'] + (OS.windows? ? ['calculator.rb', 'weather.rb'] : []) # Windows StyledText does not support unicode characters found in certain samples
|
47
|
+
|
48
|
+
TEACHABLE = {
|
49
|
+
'Hello, World!' => 'Mi5phsSdNAA',
|
50
|
+
'Hello, Message Box!' => 'N0sDcr0xp40',
|
51
|
+
'Hello, Tab!' => 'cMwlYZ78uaQ',
|
52
|
+
'Hello, Layout!' => 'dAVFR9Y_thY',
|
53
|
+
'Hello, File Dialog!' => 'HwZRgdvKIDo',
|
54
|
+
'Hello, Label!' => 'i1PFHr-F8fQ',
|
55
|
+
'Hello, Text!' => 'pOaYB43G2pg',
|
56
|
+
'Login' => 'C_vSvXH9ISw',
|
57
|
+
'Hello, Canvas Shape Listeners!' => 'PV13YE-43M4',
|
58
|
+
'Hello, Styled Text!' => 'ahs54DPmmso',
|
59
|
+
'Hello, Code Text!' => 'y0rNzMURnHY',
|
60
|
+
'Hello, Tree!' => 'M-ZOFyzbEKo',
|
61
|
+
'Hello, Table!' => '3zyyXq7WJwc',
|
62
|
+
}
|
47
63
|
|
48
64
|
attr_accessor :sample_directory, :file, :selected
|
49
65
|
|
@@ -84,6 +100,14 @@ class Sample
|
|
84
100
|
File.basename(file) != 'meta_sample.rb'
|
85
101
|
end
|
86
102
|
|
103
|
+
def teachable
|
104
|
+
!!tutorial
|
105
|
+
end
|
106
|
+
|
107
|
+
def tutorial
|
108
|
+
TEACHABLE[name]
|
109
|
+
end
|
110
|
+
|
87
111
|
def file_relative_path
|
88
112
|
file.sub(self.class.glimmer_directory, '')
|
89
113
|
end
|
@@ -244,6 +268,7 @@ class MetaSampleApplication
|
|
244
268
|
|
245
269
|
composite {
|
246
270
|
fill_layout
|
271
|
+
|
247
272
|
layout_data(:fill, :center, true, false) {
|
248
273
|
height_hint 96
|
249
274
|
}
|
@@ -261,6 +286,23 @@ class MetaSampleApplication
|
|
261
286
|
end
|
262
287
|
end
|
263
288
|
}
|
289
|
+
|
290
|
+
button {
|
291
|
+
text 'Tutorial'
|
292
|
+
font height: 25
|
293
|
+
enabled <= [SampleDirectory, 'selected_sample.teachable']
|
294
|
+
|
295
|
+
on_widget_selected do
|
296
|
+
shell(:fill_screen) {
|
297
|
+
text "Glimmer DSL for SWT Video Tutorial - #{SampleDirectory.selected_sample.name}"
|
298
|
+
|
299
|
+
browser {
|
300
|
+
text "<iframe src='https://www.youtube.com/embed/#{SampleDirectory.selected_sample.tutorial}?autoplay=1' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen style='width: 100%; height: 100%;'></iframe>"
|
301
|
+
}
|
302
|
+
}.open
|
303
|
+
end
|
304
|
+
}
|
305
|
+
|
264
306
|
button {
|
265
307
|
text 'Reset'
|
266
308
|
font height: 25
|
@@ -36,21 +36,27 @@ class Tetris
|
|
36
36
|
PREVIEW_PLAYFIELD_WIDTH = 4
|
37
37
|
PREVIEW_PLAYFIELD_HEIGHT = 2
|
38
38
|
SCORE_MULTIPLIER = {1 => 40, 2 => 100, 3 => 300, 4 => 1200}
|
39
|
+
UP_ARROW_ACTIONS = %i[instant_down rotate_right rotate_left]
|
40
|
+
SPEEDS = %i[snail sloth turtle rabbit gorilla bear horse gazelle cheetah falcon]
|
41
|
+
SPEED_INITIAL_DELAYS = SPEEDS.each_with_index.inject({}) {|hash, speed_index_pair| hash.merge(speed_index_pair.first => 1.1 - speed_index_pair.last*(0.1)) }
|
39
42
|
|
40
43
|
attr_reader :playfield_width, :playfield_height
|
41
|
-
attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action
|
44
|
+
attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action, :show_preview_tetromino, :initial_delay
|
42
45
|
alias game_over? game_over
|
43
46
|
alias paused? paused
|
44
47
|
alias beeping? beeping
|
45
48
|
alias added_high_score? added_high_score
|
49
|
+
alias show_preview_tetromino? show_preview_tetromino
|
46
50
|
|
47
51
|
def initialize(playfield_width = PLAYFIELD_WIDTH, playfield_height = PLAYFIELD_HEIGHT)
|
52
|
+
@initial_delay = SPEED_INITIAL_DELAYS[:snail]
|
48
53
|
@playfield_width = playfield_width
|
49
54
|
@playfield_height = playfield_height
|
50
55
|
@high_scores = []
|
51
56
|
@show_high_scores = false
|
52
57
|
@beeping = true
|
53
58
|
@up_arrow_action = :rotate_left
|
59
|
+
@show_preview_tetromino = true
|
54
60
|
load_high_scores!
|
55
61
|
end
|
56
62
|
|
@@ -198,35 +204,31 @@ class Tetris
|
|
198
204
|
end
|
199
205
|
|
200
206
|
def delay
|
201
|
-
[
|
207
|
+
[@initial_delay - (level.to_i * 0.1), 0.001].max
|
202
208
|
end
|
203
209
|
|
204
210
|
def beep
|
205
211
|
@beeper&.call if beeping
|
206
212
|
end
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
def rotate_right_on_up=(value)
|
217
|
-
self.up_arrow_action = :rotate_right if value
|
218
|
-
end
|
219
|
-
|
220
|
-
def rotate_right_on_up
|
221
|
-
self.up_arrow_action == :rotate_right
|
222
|
-
end
|
223
|
-
|
224
|
-
def rotate_left_on_up=(value)
|
225
|
-
self.up_arrow_action = :rotate_left if value
|
213
|
+
|
214
|
+
SPEED_INITIAL_DELAYS.each do |speed, speed_initial_day|
|
215
|
+
define_method("speed_#{speed}=") do |is_true|
|
216
|
+
self.initial_delay = speed_initial_day if is_true
|
217
|
+
end
|
218
|
+
|
219
|
+
define_method("speed_#{speed}") do
|
220
|
+
self.initial_delay == speed_initial_day
|
221
|
+
end
|
226
222
|
end
|
227
|
-
|
228
|
-
|
229
|
-
|
223
|
+
|
224
|
+
UP_ARROW_ACTIONS.each do |up_arrow_action_symbol|
|
225
|
+
define_method("#{up_arrow_action_symbol}_on_up=") do |is_true|
|
226
|
+
self.up_arrow_action = up_arrow_action_symbol if is_true
|
227
|
+
end
|
228
|
+
|
229
|
+
define_method("#{up_arrow_action_symbol}_on_up") do
|
230
|
+
self.up_arrow_action == up_arrow_action_symbol
|
231
|
+
end
|
230
232
|
end
|
231
233
|
|
232
234
|
def reset_tetrominoes
|
@@ -44,11 +44,15 @@ class Tetris
|
|
44
44
|
margin_right block_size
|
45
45
|
margin_height block_size
|
46
46
|
}
|
47
|
+
|
47
48
|
label(:center) {
|
48
49
|
text 'Next'
|
49
50
|
font name: @font_name, height: @font_height, style: FONT_TITLE_STYLE
|
51
|
+
visible <= [game, :show_preview_tetromino]
|
52
|
+
}
|
53
|
+
playfield(game_playfield: game.preview_playfield, playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size) {
|
54
|
+
visible <= [game, :show_preview_tetromino]
|
50
55
|
}
|
51
|
-
playfield(game_playfield: game.preview_playfield, playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
52
56
|
|
53
57
|
label(:center) {
|
54
58
|
text 'Score'
|
@@ -71,6 +71,14 @@ class Tetris
|
|
71
71
|
menu {
|
72
72
|
text '&View'
|
73
73
|
|
74
|
+
menu_item(:check) {
|
75
|
+
text 'Show Next Block Preview'
|
76
|
+
accelerator COMMAND_KEY, :shift, :p
|
77
|
+
selection <=> [game, :show_preview_tetromino]
|
78
|
+
}
|
79
|
+
|
80
|
+
menu_item(:separator)
|
81
|
+
|
74
82
|
menu {
|
75
83
|
text '&High Scores'
|
76
84
|
menu_item(:check) {
|
@@ -89,6 +97,17 @@ class Tetris
|
|
89
97
|
}
|
90
98
|
} # end of menu
|
91
99
|
|
100
|
+
menu {
|
101
|
+
text '&Speed'
|
102
|
+
|
103
|
+
Model::Game::SPEEDS.each do |speed|
|
104
|
+
menu_item(:radio) {
|
105
|
+
text speed.to_s.capitalize
|
106
|
+
selection <=> [game, "speed_#{speed}", computed_by: :initial_delay]
|
107
|
+
}
|
108
|
+
end
|
109
|
+
}
|
110
|
+
|
92
111
|
menu {
|
93
112
|
text '&Options'
|
94
113
|
menu_item(:check) {
|
@@ -83,30 +83,41 @@ class HelloCodeText
|
|
83
83
|
tab_folder {
|
84
84
|
tab_item {
|
85
85
|
fill_layout
|
86
|
+
|
86
87
|
text 'Ruby (glimmer theme)'
|
88
|
+
|
87
89
|
code_text(language: 'ruby', theme: 'glimmer', lines: true) {
|
88
90
|
text <=> [self, :ruby_code]
|
89
91
|
}
|
90
92
|
}
|
93
|
+
|
91
94
|
tab_item {
|
92
95
|
fill_layout
|
96
|
+
|
93
97
|
text 'JavaScript (pastie theme)'
|
98
|
+
|
94
99
|
code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'pastie', lines: {width: 2}) {
|
95
100
|
root {
|
96
101
|
grid_layout(2, false) {
|
97
102
|
margin_width 2
|
98
103
|
}
|
104
|
+
|
99
105
|
background :white
|
100
106
|
}
|
107
|
+
|
101
108
|
line_numbers {
|
102
109
|
background :white
|
103
110
|
}
|
111
|
+
|
104
112
|
text <=> [self, :js_code]
|
105
113
|
}
|
106
114
|
}
|
115
|
+
|
107
116
|
tab_item {
|
108
117
|
fill_layout
|
118
|
+
|
109
119
|
text 'HTML (github theme)'
|
120
|
+
|
110
121
|
code_text(language: 'html', theme: 'github') { # default is lines: false
|
111
122
|
text <=> [self, :html_code]
|
112
123
|
}
|
@@ -82,22 +82,22 @@ shell {
|
|
82
82
|
line_size = line_style_event.lineText.size
|
83
83
|
style_range = StyleRange.new(line_offset, line_size, color(:blue).swt_color, nil, swt(:italic))
|
84
84
|
style_range.font = Font.new(display.swt_display, 'Times New Roman', 18, swt(:normal))
|
85
|
-
line_style_event.styles = [style_range]
|
85
|
+
line_style_event.styles = [style_range]
|
86
86
|
elsif @presenter.line_index_for_offset(line_offset) % 52 < 26
|
87
87
|
line_size = line_style_event.lineText.size
|
88
88
|
style_range = StyleRange.new(line_offset, line_size, color(:dark_green).swt_color, color(:yellow).swt_color, swt(:bold))
|
89
|
-
line_style_event.styles = [style_range]
|
89
|
+
line_style_event.styles = [style_range]
|
90
90
|
elsif @presenter.line_index_for_offset(line_offset) % 52 < 39
|
91
91
|
line_size = line_style_event.lineText.size
|
92
92
|
style_range = StyleRange.new(line_offset, line_size, color(:red).swt_color, nil, swt(:normal))
|
93
93
|
style_range.underline = true
|
94
94
|
style_range.font = Font.new(display.swt_display, 'Arial', 16, swt(:normal))
|
95
|
-
line_style_event.styles = [style_range]
|
95
|
+
line_style_event.styles = [style_range]
|
96
96
|
else
|
97
97
|
line_size = line_style_event.lineText.size
|
98
98
|
style_range = StyleRange.new(line_offset, line_size, color(:dark_magenta).swt_color, color(:cyan).swt_color, swt(:normal))
|
99
99
|
style_range.strikeout = true
|
100
|
-
line_style_event.styles = [style_range]
|
100
|
+
line_style_event.styles = [style_range]
|
101
101
|
end
|
102
102
|
end
|
103
103
|
}
|
data/vendor/swt/linux/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/mac/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/windows/swt.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.23.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.
|
18
|
+
version: 2.7.3
|
19
19
|
name: glimmer
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|