glimmer-dsl-swt 4.24.1.3 → 4.24.2.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 +8 -0
- data/README.md +7 -5
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/bin/glimmer +0 -0
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +12 -5
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/ext/rouge/themes/glimmer_dark.rb +53 -0
- data/lib/glimmer/swt/custom/code_text.rb +26 -6
- data/samples/elaborate/meta_sample/tutorials.yml +2 -0
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/hello/hello_code_text.rb +8 -5
- data/samples/hello/hello_custom_shell.rb +66 -24
- data/samples/hello/hello_custom_widget.rb +8 -4
- 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: e022ad5b5e0334818e996c918fbf384bee80a9e5a628503da14f857842ab7da0
|
4
|
+
data.tar.gz: 86d06e30bbe172f7de677ecbfa9338b5874a9a92ab3d73f67f05dca975fb1500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc32f76c5467e573db93f650bd8b4eef2dd074c952926f6c92bfaa6798f240be09ae21262e3e062f916f1a86cf1cedd8e7c2f3de4d107a55bcbc950a638b9ae
|
7
|
+
data.tar.gz: '097eb1e61863157609a431e16345ffc73b0d06b7db44311e56ef1ba53d5d1619782f8ee0bc6e34d441d3cbbcb909237801d68b42446d6ca7d1d8ec731f856b80'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.2.0
|
4
|
+
|
5
|
+
- Update `code_text` to support Dark Mode with `glimmer_dark` theme, which is applied by default when app is run with OS in dark mode
|
6
|
+
- Fix issue with `code_text` showing gibberish on Linux when Courier & Consolas fonts are not available. It will attempt to use the first Monospace font it finds now or otherwise stick to the default font.
|
7
|
+
- Update Hello, Code Text! and Glimmer Meta-Sample to support Dark Mode
|
8
|
+
- Refactor Hello, Custom Widget! with on_widget_disposed thread cleanup code
|
9
|
+
- Refactor Hello, Custom Shell! to support keyboard display of emails by hitting ENTER/SPACE after selecting a table row
|
10
|
+
|
3
11
|
## 4.24.1.3
|
4
12
|
|
5
13
|
- Fix Windows freezing issue with warbler during packaging with the `glimmer package` command (caused by bundler included in JRuby on JDK18, fixed by installing latest bundler)
|
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.24.
|
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.24.2.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)
|
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
[GLIMMER VIDEO TUTORIAL CHANNEL](https://www.youtube.com/channel/UC5hzDE23HZXsZLAxYk2UJEw)
|
12
12
|
|
13
|
+
![Glimmer DSL for SWT Demo of Hello, World!](/images/glimmer-dsl-swt-demo-hello-world.gif)
|
14
|
+
|
13
15
|
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native GUI (Graphical User Interface) cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster [JVM](https://www.java.com/en/download/help/whatis_java.html) 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) (Domain Specific Language) 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.
|
14
16
|
|
15
17
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
@@ -19,7 +21,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
19
21
|
|
20
22
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
21
23
|
|
22
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.
|
24
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.2.0 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 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.
|
23
25
|
|
24
26
|
**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. That was [originally conceived back in 2007](https://andymaleh.blogspot.com/2007/12/data-shining-in-glimmer.html).
|
25
27
|
|
@@ -336,7 +338,7 @@ jgem install glimmer-dsl-swt
|
|
336
338
|
|
337
339
|
Or this command if you want a specific version:
|
338
340
|
```
|
339
|
-
jgem install glimmer-dsl-swt -v 4.24.
|
341
|
+
jgem install glimmer-dsl-swt -v 4.24.2.0
|
340
342
|
```
|
341
343
|
|
342
344
|
`jgem` is JRuby's version of `gem` command.
|
@@ -364,7 +366,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
364
366
|
|
365
367
|
Add the following to `Gemfile`:
|
366
368
|
```
|
367
|
-
gem 'glimmer-dsl-swt', '~> 4.24.
|
369
|
+
gem 'glimmer-dsl-swt', '~> 4.24.2.0'
|
368
370
|
```
|
369
371
|
|
370
372
|
And, then run:
|
@@ -387,7 +389,7 @@ glimmer
|
|
387
389
|
```
|
388
390
|
|
389
391
|
```
|
390
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.
|
392
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.2.0
|
391
393
|
|
392
394
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
393
395
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.24.
|
1
|
+
4.24.2.0
|
data/bin/girb
CHANGED
File without changes
|
data/bin/glimmer
CHANGED
File without changes
|
@@ -162,7 +162,7 @@ Glimmer DSL syntax consists mainly of:
|
|
162
162
|
|
163
163
|
Glimmer supports a new and radical Ruby DSL concept called DSL Auto-Expansion. To explain, let's first mention the two types of Glimmer GUI DSL keywords: static and dynamic.
|
164
164
|
|
165
|
-
Static keywords are pre-identified keywords in the Glimmer DSL, such as `shell
|
165
|
+
Static keywords are pre-identified keywords in the Glimmer DSL, such as `shell` (alias: `window`), `display`, `message_box`, `async_exec`, `sync_exec`, and `bind`.
|
166
166
|
|
167
167
|
Dynamic keywords are dynamically figured out from currently imported (aka required/loaded) SWT widgets and custom widgets. Examples are: `label`, `combo`, and `list` for SWT widgets and `c_date_time`, `video`, and `gantt_chart` for custom widgets.
|
168
168
|
|
@@ -191,7 +191,7 @@ This screenshot taken from the link above should give a glimpse of how SWT widge
|
|
191
191
|
In Glimmer DSL, widgets are declared with lowercase underscored names mirroring their SWT names minus the package name.
|
192
192
|
|
193
193
|
For example, here are some Glimmer widgets and their SWT counterparts:
|
194
|
-
- `shell` instantiates `org.eclipse.swt.widgets.Shell
|
194
|
+
- `shell` (alias: `window`) instantiates `org.eclipse.swt.widgets.Shell`, which represents a window
|
195
195
|
- `text` instantiates `org.eclipse.swt.widgets.Text`
|
196
196
|
- `button` instantiates `org.eclipse.swt.widgets.Button`
|
197
197
|
- `label` instantiates `org.eclipse.swt.widgets.Label`
|
@@ -220,7 +220,7 @@ shell {
|
|
220
220
|
}.open
|
221
221
|
```
|
222
222
|
|
223
|
-
Note that `shell` instantiates the outer shell **widget**, in other words, the window that houses all of the desktop graphical user interface.
|
223
|
+
Note that `shell` (alias: `window`) instantiates the outer shell **widget**, in other words, the window that houses all of the desktop graphical user interface.
|
224
224
|
|
225
225
|
`shell` is then followed by a ***block*** that contains
|
226
226
|
|
@@ -248,7 +248,7 @@ shell {|shell_proxy|
|
|
248
248
|
}
|
249
249
|
```
|
250
250
|
|
251
|
-
Remember that The `shell` widget is always the outermost widget containing all others in a Glimmer desktop windowed application.
|
251
|
+
Remember that The `shell` (alias: `window`) widget is always the outermost widget containing all others in a Glimmer desktop windowed application.
|
252
252
|
|
253
253
|
After it is declared, a `shell` must be opened with the `#open` method, which can be called on the block directly as in the example above, or by capturing `shell` in a `@shell` variable (shown in example below), and calling `#open` on it independently (recommended in actual apps)
|
254
254
|
|
@@ -1114,7 +1114,7 @@ shell {
|
|
1114
1114
|
|
1115
1115
|
This relies on Glimmer's [Multi-DSL Support](#multi-dsl-support) for building the HTML text using [Glimmer XML DSL](https://github.com/AndyObtiva/glimmer-dsl-xml).
|
1116
1116
|
|
1117
|
-
Learn more at:
|
1117
|
+
Learn more at:
|
1118
1118
|
- [SWT Browser API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html)
|
1119
1119
|
- [SWT Browser FAQ](https://www.eclipse.org/swt/faq.php#whatisbrowser).
|
1120
1120
|
|
@@ -4809,6 +4809,12 @@ You may see another example at the [Hello, Radio Group!](/docs/reference/GLIMMER
|
|
4809
4809
|
|
4810
4810
|
`code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
|
4811
4811
|
|
4812
|
+
It attempts to use a monospace font if available, seeking fonts in the following order:
|
4813
|
+
1. Consolas
|
4814
|
+
2. Courier
|
4815
|
+
3. Any font that contains the word "Mono"
|
4816
|
+
4. Default system font (if no other font is found)
|
4817
|
+
|
4812
4818
|
It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
4813
4819
|
|
4814
4820
|
![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
|
@@ -4842,6 +4848,7 @@ Keep in mind that if the text grows and required a wider line numbers area, it g
|
|
4842
4848
|
|
4843
4849
|
Changes syntax color highlighting theme. Can be one of the following:
|
4844
4850
|
- glimmer
|
4851
|
+
- glimmer_dark (always applied when OS is in dark mode)
|
4845
4852
|
- github
|
4846
4853
|
- pastie
|
4847
4854
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright (c) 2007-2022 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Rouge
|
23
|
+
module Themes
|
24
|
+
# A port of the pastie style from Pygments.
|
25
|
+
# See https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/styles/pastie.py
|
26
|
+
class GlimmerDark < Github
|
27
|
+
name 'glimmer_dark'
|
28
|
+
style Comment::Single, fg: [149, 140, 130], italic: true # Also, Comments
|
29
|
+
style Keyword::Pseudo, fg: [188, 255, 255]
|
30
|
+
style Keyword::Declaration, fg: [188, 255, 255]
|
31
|
+
style Keyword, fg: [153, 38, 16], bold: true
|
32
|
+
style Literal::String::Single, fg: [149, 140, 130] # Also, Comments
|
33
|
+
style Literal::String::Double, fg: [255, 163, 58]
|
34
|
+
style Literal::String::Escape, fg: [6, 217, 141]
|
35
|
+
style Literal::Number::Integer, fg: [153, 38, 16], bold: true
|
36
|
+
style Literal::String::Interpol, fg: [153, 38, 16], bold: true
|
37
|
+
style Literal::String::Symbol, fg: [255, 127, 255]
|
38
|
+
style Literal::String, fg: [163, 215, 252]
|
39
|
+
style Name::Builtin, fg: [40, 197, 182]
|
40
|
+
style Name::Class, fg: [252, 208, 157]
|
41
|
+
style Name::Namespace, fg: [252, 208, 157]
|
42
|
+
style Name::Constant, fg: [255, 163, 58]
|
43
|
+
style Name::Function, fg: [153, 38, 16], bold: true
|
44
|
+
style Name::Variable::Instance, fg: [28, 157, 246]
|
45
|
+
style Name::Tag, fg: [247, 250, 136]
|
46
|
+
style Name::Attribute, fg: [255, 127, 127]
|
47
|
+
style Name, fg: [144, 189, 62] #inverse of purple
|
48
|
+
style Operator, fg: [6, 217, 141]
|
49
|
+
style Punctuation, fg: [102, 217, 239]
|
50
|
+
style Text, fg: [180, 180, 180]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -124,8 +124,12 @@ module Glimmer
|
|
124
124
|
before_body do
|
125
125
|
require 'rouge'
|
126
126
|
require 'ext/rouge/themes/glimmer'
|
127
|
+
require 'ext/rouge/themes/glimmer_dark'
|
128
|
+
@dark_mode = Java::OrgEclipseSwtWidgets::Display.system_dark_theme?
|
129
|
+
self.theme = 'glimmer_dark' if @dark_mode
|
130
|
+
@dark_theme = theme.include?('dark')
|
127
131
|
@swt_style = swt_style == 0 ? [:border, :multi, :v_scroll, :h_scroll] : swt_style
|
128
|
-
|
132
|
+
select_best_font
|
129
133
|
if lines == true
|
130
134
|
@lines_width = 4
|
131
135
|
elsif lines.is_a?(Hash)
|
@@ -151,9 +155,9 @@ module Glimmer
|
|
151
155
|
after_read: lambda { @line_numbers_styled_text_proxy&.top_pixel = styled_text_proxy_top_pixel unless styled_text_proxy_top_pixel.nil? }
|
152
156
|
]
|
153
157
|
top_pixel <= [self, :styled_text_proxy_top_pixel]
|
154
|
-
font
|
158
|
+
font @font_options
|
155
159
|
background color(:widget_background)
|
156
|
-
foreground :dark_blue
|
160
|
+
foreground @dark_mode ? rgb(255, 255, 127) : :dark_blue
|
157
161
|
top_margin 5
|
158
162
|
right_margin 5
|
159
163
|
bottom_margin 5
|
@@ -186,7 +190,8 @@ module Glimmer
|
|
186
190
|
|
187
191
|
text <=> [self, :styled_text_proxy_text] if lines
|
188
192
|
top_pixel <=> [self, :styled_text_proxy_top_pixel] if lines
|
189
|
-
font
|
193
|
+
font @font_options
|
194
|
+
background :black if @dark_mode
|
190
195
|
foreground rgb(75, 75, 75)
|
191
196
|
left_margin 5
|
192
197
|
top_margin 5
|
@@ -239,8 +244,8 @@ module Glimmer
|
|
239
244
|
start_index = token_hash[:token_index]
|
240
245
|
size = token_hash[:token_text].size
|
241
246
|
style_data = Rouge::Theme.find(theme).new.style_for(token_hash[:token_type])
|
242
|
-
foreground_color = hex_color_to_swt_color(style_data[:fg], [:black])
|
243
|
-
background_color = hex_color_to_swt_color(style_data[:bg], [:white])
|
247
|
+
foreground_color = hex_color_to_swt_color(style_data[:fg], [@dark_mode ? :white : :black])
|
248
|
+
background_color = hex_color_to_swt_color(style_data[:bg], [@dark_mode ? :black : :white])
|
244
249
|
font_styles = []
|
245
250
|
font_styles << :bold if style_data[:bold]
|
246
251
|
font_styles << :italic if style_data[:italic]
|
@@ -310,6 +315,21 @@ module Glimmer
|
|
310
315
|
@lines_width = lines_text_size if lines_text_size > @lines_width
|
311
316
|
line_count.times.map {|n| (' ' * (lines_text_size - (n+1).to_s.size)) + (n+1).to_s }.join("\n") + "\n"
|
312
317
|
end
|
318
|
+
|
319
|
+
def select_best_font
|
320
|
+
select_best_font_name
|
321
|
+
@font_options = {height: OS.mac? ? 15 : 12}
|
322
|
+
@font_options.merge!(name: @font_name) if @font_name
|
323
|
+
@font_options
|
324
|
+
end
|
325
|
+
|
326
|
+
def select_best_font_name
|
327
|
+
all_font_names = display.get_font_list(nil, true).map(&:name)
|
328
|
+
@font_name ||= 'Consolas' if all_font_names.include?('Consolas')
|
329
|
+
@font_name ||= 'Courier' if all_font_names.include?('Courier')
|
330
|
+
@font_name ||= all_font_names.find {|font_name| font_name.downcase.include?('mono')}
|
331
|
+
@font_name
|
332
|
+
end
|
313
333
|
end
|
314
334
|
end
|
315
335
|
end
|
@@ -340,7 +340,7 @@ class MetaSampleApplication
|
|
340
340
|
}
|
341
341
|
}
|
342
342
|
line_numbers {
|
343
|
-
background :white
|
343
|
+
background Display.system_dark_theme? ? :black : :white
|
344
344
|
}
|
345
345
|
text <=> [SampleDirectory, 'selected_sample.code']
|
346
346
|
editable <= [SampleDirectory, 'selected_sample.editable']
|
@@ -86,7 +86,8 @@ class HelloCodeText
|
|
86
86
|
|
87
87
|
text 'Ruby (glimmer theme)'
|
88
88
|
|
89
|
-
|
89
|
+
# Note: code_text theme is currently ignored in dark mode
|
90
|
+
code_text(language: 'ruby', theme: 'glimmer_dark', lines: true) { # theme is currently ignored in dark mode
|
90
91
|
text <=> [self, :ruby_code]
|
91
92
|
}
|
92
93
|
}
|
@@ -96,17 +97,18 @@ class HelloCodeText
|
|
96
97
|
|
97
98
|
text 'JavaScript (pastie theme)'
|
98
99
|
|
99
|
-
|
100
|
+
# Note: code_text theme is currently ignored in dark mode
|
101
|
+
code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'glimmer_dark', lines: {width: 2}) {
|
100
102
|
root {
|
101
103
|
grid_layout(2, false) {
|
102
104
|
margin_width 2
|
103
105
|
}
|
104
106
|
|
105
|
-
background :white
|
107
|
+
background Display.system_dark_theme? ? :black : :white
|
106
108
|
}
|
107
109
|
|
108
110
|
line_numbers {
|
109
|
-
background :white
|
111
|
+
background Display.system_dark_theme? ? :black : :white
|
110
112
|
}
|
111
113
|
|
112
114
|
text <=> [self, :js_code]
|
@@ -118,7 +120,8 @@ class HelloCodeText
|
|
118
120
|
|
119
121
|
text 'HTML (github theme)'
|
120
122
|
|
121
|
-
|
123
|
+
# Note: code_text theme is currently ignored in dark mode
|
124
|
+
code_text(language: 'html', theme: 'glimmer_dark') { # default is lines: false
|
122
125
|
text <=> [self, :html_code]
|
123
126
|
}
|
124
127
|
}
|
@@ -26,7 +26,8 @@ require 'date'
|
|
26
26
|
# Used to view an email message
|
27
27
|
class EmailShell
|
28
28
|
# including Glimmer::UI::CustomShell enables declaring as an `email_shell` custom widget Glimmer GUI DSL keyword
|
29
|
-
|
29
|
+
# Glimmer::UI::CustomShell is a specialized Glimmer::UI::CustomWidget that has `shell` as its `body_root`
|
30
|
+
include Glimmer::UI::CustomShell # aliases: Glimmer::UI::CustomWindow & Glimmer::UI::Application
|
30
31
|
|
31
32
|
# multiple options without default values
|
32
33
|
options :parent_shell, :date, :subject, :from, :message
|
@@ -88,26 +89,56 @@ class EmailShell
|
|
88
89
|
end
|
89
90
|
|
90
91
|
class HelloCustomShell
|
91
|
-
include Glimmer
|
92
|
+
include Glimmer::UI::Application # aliases: Glimmer::UI::CustomShell & Glimmer::UI::CustomWindow
|
92
93
|
|
93
94
|
Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
|
94
|
-
EmailSystem = Struct.new(:emails, keyword_init: true)
|
95
|
+
EmailSystem = Struct.new(:emails, :selected_email, keyword_init: true)
|
95
96
|
|
96
|
-
|
97
|
+
before_body do
|
97
98
|
@email_system = EmailSystem.new(
|
98
99
|
emails: [
|
99
|
-
Email.new(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
Email.new(
|
101
|
+
date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'),
|
102
|
+
subject: '3rd Week Report',
|
103
|
+
from: '"Dianne Tux" <dianne.tux@example.com>',
|
104
|
+
message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"
|
105
|
+
),
|
106
|
+
Email.new(
|
107
|
+
date: DateTime.new(2029, 10, 21, 8, 1, 0).strftime('%F %I:%M %p'),
|
108
|
+
subject: 'Glimmer Upgrade v100.0',
|
109
|
+
from: '"Robert McGabbins" <robert.mcgabbins@example.com>',
|
110
|
+
message: "Team,\n\nWe are upgrading to Glimmer version 100.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"
|
111
|
+
),
|
112
|
+
Email.new(
|
113
|
+
date: DateTime.new(2029, 10, 19, 16, 58, 0).strftime('%F %I:%M %p'),
|
114
|
+
subject: 'Christmas Party',
|
115
|
+
from: '"Lisa Ferreira" <lisa.ferreira@example.com>',
|
116
|
+
message: "Merry Christmas,\n\nAll office Christmas Party arrangements have been set\n\nMake sure to bring a Secret Santa gift\n\nBest regards,\n\nLisa Ferreira"
|
117
|
+
),
|
118
|
+
Email.new(
|
119
|
+
date: DateTime.new(2029, 10, 16, 9, 43, 0).strftime('%F %I:%M %p'),
|
120
|
+
subject: 'Glimmer Upgrade v99.0',
|
121
|
+
from: '"Robert McGabbins" <robert.mcgabbins@example.com>',
|
122
|
+
message: "Team,\n\nWe are upgrading to Glimmer version 99.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"
|
123
|
+
),
|
124
|
+
Email.new(
|
125
|
+
date: DateTime.new(2029, 10, 15, 11, 2, 0).strftime('%F %I:%M %p'),
|
126
|
+
subject: '2nd Week Report',
|
127
|
+
from: '"Dianne Tux" <dianne.tux@example.com>',
|
128
|
+
message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"
|
129
|
+
),
|
130
|
+
Email.new(
|
131
|
+
date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'),
|
132
|
+
subject: 'Glimmer Upgrade v98.0',
|
133
|
+
from: '"Robert McGabbins" <robert.mcgabbins@example.com>',
|
134
|
+
message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"
|
135
|
+
),
|
105
136
|
]
|
106
137
|
)
|
107
138
|
end
|
108
139
|
|
109
|
-
|
110
|
-
shell {
|
140
|
+
body {
|
141
|
+
shell {
|
111
142
|
grid_layout
|
112
143
|
|
113
144
|
text 'Hello, Custom Shell!'
|
@@ -139,22 +170,33 @@ class HelloCustomShell
|
|
139
170
|
}
|
140
171
|
|
141
172
|
items <=> [@email_system, :emails, column_properties: [:date, :subject, :from]]
|
173
|
+
selection <=> [@email_system, :selected_email]
|
142
174
|
|
143
175
|
on_mouse_up do |event|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
from: email.from,
|
152
|
-
message: email.message
|
153
|
-
).open
|
176
|
+
open_email(@email_system.selected_email)
|
177
|
+
end
|
178
|
+
|
179
|
+
on_key_pressed do |event|
|
180
|
+
if [swt(:cr), swt(:space)].include?(event.keyCode)
|
181
|
+
open_email(@email_system.selected_email)
|
182
|
+
end
|
154
183
|
end
|
155
184
|
}
|
156
|
-
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
def open_email(email)
|
189
|
+
return if email.nil?
|
190
|
+
|
191
|
+
# open a custom email shell
|
192
|
+
email_shell(
|
193
|
+
parent_shell: body_root,
|
194
|
+
date: email.date,
|
195
|
+
subject: email.subject,
|
196
|
+
from: email.from,
|
197
|
+
message: email.message
|
198
|
+
).open
|
157
199
|
end
|
158
200
|
end
|
159
201
|
|
160
|
-
HelloCustomShell.
|
202
|
+
HelloCustomShell.launch
|
@@ -55,13 +55,13 @@ class GreetingLabel
|
|
55
55
|
after_body do
|
56
56
|
return if colors.nil?
|
57
57
|
|
58
|
-
Thread.new
|
59
|
-
colors.cycle
|
58
|
+
@thread = Thread.new do
|
59
|
+
colors.cycle do |color|
|
60
60
|
self.label_color = color
|
61
61
|
@color_changed_handlers&.each {|handler| handler.call(color)}
|
62
62
|
sleep(1)
|
63
|
-
|
64
|
-
|
63
|
+
end
|
64
|
+
end
|
65
65
|
end
|
66
66
|
|
67
67
|
body {
|
@@ -70,6 +70,10 @@ class GreetingLabel
|
|
70
70
|
text "#{greeting}, #{name}!"
|
71
71
|
font @font
|
72
72
|
foreground <=> [self, :label_color]
|
73
|
+
|
74
|
+
on_widget_disposed do
|
75
|
+
@thread&.kill # safe since it does not involve data
|
76
|
+
end
|
73
77
|
}
|
74
78
|
}
|
75
79
|
|
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.24.
|
4
|
+
version: 4.24.2.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-08-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -399,6 +399,7 @@ files:
|
|
399
399
|
- lib/ext/glimmer.rb
|
400
400
|
- lib/ext/glimmer/config.rb
|
401
401
|
- lib/ext/rouge/themes/glimmer.rb
|
402
|
+
- lib/ext/rouge/themes/glimmer_dark.rb
|
402
403
|
- lib/glimmer-dsl-swt.rb
|
403
404
|
- lib/glimmer/Rakefile
|
404
405
|
- lib/glimmer/data_binding/list_selection_binding.rb
|