glimmer-dsl-swt 4.23.1.0 → 4.23.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56654c61fc60401e8b1924bb81f474e5694ab7fc5c2c4a3b592932ccd348e0cb
4
- data.tar.gz: daa2b79e4a10af9b093f21c6358eaaba1bb93e4dc7fbc8520c7c658ccc2b20f2
3
+ metadata.gz: c56f6eab2f22aaac950b9e566a79c94bdd0f39085de6e4e8221a76883e8a8f05
4
+ data.tar.gz: 8af3b454dd1c3e921530f70b7771e2bd4261d16eb733c312e8e79eee29a8d420
5
5
  SHA512:
6
- metadata.gz: a02f5c3157fdd1805902042d154f7f452258f56129905b7641ed7ea88a7178c6de64e36e07c8a99608a2db8f26094e90775ecc1ce1d1ed55062b573704a3f46e
7
- data.tar.gz: 568739a4d7954ef9d12515dbe9e4a0b1ae60bb06887067a7636247e173da6dbe9ee0c9765c1e63a3d7be261ef552ad3cff7eae90be8317cac7a9f70634e98e39
6
+ metadata.gz: 9e602c4e3b8cba6ea17509be4b015a44e6e9587f2f57d569e24592b4162d168f00df1466b057027c399733c8960117b8742020efb8e6603ba34569aa42c3554e
7
+ data.tar.gz: 491bbfbaa41427da7a172c5990b5579b1570314b4e20152e1e79937985def33c03367f4d4f27ca7f8b514c9fc19d8511c4b22f7f6a2cbbe26175ce15a027fa26
data/CHANGELOG.md CHANGED
@@ -1,10 +1,30 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.23.1.3
4
+
5
+ - Update initial tab folder width in Weather sample
6
+ - Add Help menu to scaffolded apps/gems with About menu item that used to be in the scaffolded File menu
7
+ - Fix names of icons generated for custom shell gems to get them picked up by the `glimmer package` command
8
+ - Fix issue with shell not packing layout correctly on initial open (might be caused by the latest version of SWT under certain scenarios)
9
+ - Fix setting of Display app_name and app_version in scaffolded apps and custom shells
10
+
11
+ ## 4.23.1.2
12
+
13
+ - Add Hello, Pop Up Context Menu! video tutorial to Glimmer Meta-Sample
14
+ - Add Hello, Menu Bar! video tutorial to Glimmer Meta-Sample
15
+ - Add Language & Country menus to Hello, Menu Bar!
16
+ - Fix "Last Name" label in Hello, Tree! (was a duplicate "First Name" by mistake)
17
+
18
+ ## 4.23.1.1
19
+
20
+ - Switch order of buttons in Glimmer Meta-Sample to put Tutorial first
21
+ - Make Glimmer Meta-Sample pull list of tutorials from GitHub to avoid needing to update gem when adding new tutorials
22
+
3
23
  ## 4.23.1.0
4
24
 
5
25
  - Upgrade to JRuby 9.3.4.0
6
26
  - Upgrade to glimmer 2.7.3
7
- - Add "Tutorial" button to Hello, Meta Sample! to show Youtube Video Tutorial
27
+ - Add "Tutorial" button to Glimmer Meta-Sample to show Youtube Video Tutorial
8
28
 
9
29
  ## 4.23.0.1
10
30
 
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.23.1.0
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.3
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)
@@ -19,7 +19,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
19
19
 
20
20
  ![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
21
21
 
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.
22
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.23.1.3 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.
23
23
 
24
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.
25
25
 
@@ -333,7 +333,7 @@ jgem install glimmer-dsl-swt
333
333
 
334
334
  Or this command if you want a specific version:
335
335
  ```
336
- jgem install glimmer-dsl-swt -v 4.23.1.0
336
+ jgem install glimmer-dsl-swt -v 4.23.1.3
337
337
  ```
338
338
 
339
339
  `jgem` is JRuby's version of `gem` command.
@@ -361,7 +361,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
361
361
 
362
362
  Add the following to `Gemfile`:
363
363
  ```
364
- gem 'glimmer-dsl-swt', '~> 4.23.1.0'
364
+ gem 'glimmer-dsl-swt', '~> 4.23.1.3'
365
365
  ```
366
366
 
367
367
  And, then run:
@@ -384,7 +384,7 @@ glimmer
384
384
  ```
385
385
 
386
386
  ```
387
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.23.1.0
387
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.23.1.3
388
388
 
389
389
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
390
390
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.23.1.0
1
+ 4.23.1.3
@@ -938,12 +938,10 @@ shell {
938
938
 
939
939
  The system tray allows showing icons for various apps that need to stay on for extended periods of time and provide quick access.
940
940
 
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.
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. It is recommended that the related shell is declared with the `:on_top` style (in addition to the default style `:shell_trim`) to ensure it opens above all apps when shown.
942
942
 
943
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
944
 
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.
946
-
947
945
  Example code:
948
946
 
949
947
  ```ruby
@@ -1044,6 +1042,10 @@ It can be customized with the `weights` attribute by setting initial weights to
1044
1042
 
1045
1043
  One noteworthy thing about the Glimmer implementation is that, unlike behavior in SWT, it allows declaring `weights` before the content of the `sash_form`, thus providing more natural and convenient syntax (Glimmer automatically takes care of sending that declaration to SWT at the end of declaring `sash_form` content as per the SWT requirements)
1046
1044
 
1045
+ You can customize the color of the sash by setting the `background` attribute.
1046
+
1047
+ Also, you can customize the `sash_width` (`Integer`) and `orientation` properties (`swt(:horizontal)` or `swt(:vertical)`).
1048
+
1047
1049
  Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1048
1050
 
1049
1051
  ```ruby
@@ -3606,7 +3608,7 @@ Learn more at the [Hello, Tree!](/docs/reference/GLIMMER_SAMPLES.md#hello-tree)
3606
3608
 
3607
3609
  #### DateTime
3608
3610
 
3609
- `date_time` represents the SWT DateTime widget.
3611
+ `date_time` represents the SWT [DateTime](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/DateTime.html) widget.
3610
3612
 
3611
3613
  Glimmer s the following alias keywords for it for convenience:
3612
3614
  - `date`: `date_time(:date)`
@@ -3615,15 +3617,15 @@ Glimmer s the following alias keywords for it for convenience:
3615
3617
  - `calendar`: `date_time(:calendar)`
3616
3618
 
3617
3619
  You can data-bind any of these properties:
3618
- - `date_time bind(model, :property)`: produces a Ruby DateTime object
3619
- - `date bind(model, :property)`: produces a Ruby Date object
3620
- - `time bind(model, :property)`: produces a Ruby Time object
3621
- - `year bind(model, :property)`: produces an integer
3622
- - `month bind(model, :property)`: produces an integer
3623
- - `day bind(model, :property)`: produces an integer
3624
- - `hours bind(model, :property)`: produces an integer
3625
- - `minutes bind(model, :property)`: produces an integer
3626
- - `seconds bind(model, :property)`: produces an integer
3620
+ - `date_time <=> [model, :property]`: produces a Ruby DateTime object
3621
+ - `date <=> [model, :property]`: produces a Ruby Date object
3622
+ - `time <=> [model, :property]`: produces a Ruby Time object
3623
+ - `year <=> [model, :property]`: produces an integer
3624
+ - `month <=> [model, :property]`: produces an integer
3625
+ - `day <=> [model, :property]`: produces an integer
3626
+ - `hours <=> [model, :property]`: produces an integer
3627
+ - `minutes <=> [model, :property]`: produces an integer
3628
+ - `seconds <=> [model, :property]`: produces an integer
3627
3629
 
3628
3630
  Learn more at the [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) sample.
3629
3631
 
@@ -682,7 +682,7 @@ Hello, Print!
682
682
 
683
683
  #### Hello, Date Time!
684
684
 
685
- This sample demonstrates the use of [date_time](#datetime) widget keywords in Glimmer: `date`, `date_drop_down`, `time`, and `calendar`
685
+ This sample demonstrates the use of [date_time](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#datetime) widget keywords in Glimmer: `date`, `date_drop_down`, `time`, and `calendar`
686
686
 
687
687
  Code:
688
688
 
@@ -1429,6 +1429,12 @@ Gladiator is a good demonstration of:
1429
1429
 
1430
1430
  [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
1431
1431
 
1432
+ #### Contact Manager
1433
+
1434
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/contact_manager/master/icons/linux/Contact%20Manager.png" height=40 /> Contact Manager](https://github.com/AndyObtiva/contact_manager) is an enhanced version of the included Contact Manager elaborate sample, which demonstrates how to connect to a [SQLite database](https://www.sqlite.org/index.html) with [ActiveRecord](https://rubygems.org/gems/activerecord).
1435
+
1436
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/contact_manager/master/screenshots/contact-manager.png" /> ](https://github.com/AndyObtiva/contact_manager)
1437
+
1432
1438
  ## License
1433
1439
 
1434
1440
  [MIT](LICENSE.txt)
Binary file
@@ -280,17 +280,17 @@ module Glimmer
280
280
  write 'spec/spec_helper.rb', spec_helper_file
281
281
 
282
282
  mkdir_p 'icons/windows'
283
- icon_file = "icons/windows/#{human_name(custom_shell_name)}.ico"
283
+ icon_file = "icons/windows/#{human_name(gem_name)}.ico"
284
284
  cp File.expand_path('../../../../icons/scaffold_app.ico', __FILE__), icon_file
285
285
  puts "Created #{current_dir_name}/#{icon_file}"
286
286
 
287
287
  mkdir_p 'icons/macosx'
288
- icon_file = "icons/macosx/#{human_name(custom_shell_name)}.icns"
288
+ icon_file = "icons/macosx/#{human_name(gem_name)}.icns"
289
289
  cp File.expand_path('../../../../icons/scaffold_app.icns', __FILE__), icon_file
290
290
  puts "Created #{current_dir_name}/#{icon_file}"
291
291
 
292
292
  mkdir_p 'icons/linux'
293
- icon_file = "icons/linux/#{human_name(custom_shell_name)}.png"
293
+ icon_file = "icons/linux/#{human_name(gem_name)}.png"
294
294
  cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
295
295
  puts "Created #{current_dir_name}/#{icon_file}"
296
296
 
@@ -445,9 +445,13 @@ module Glimmer
445
445
  end
446
446
 
447
447
  class #{class_name(app_name)}
448
+ include Glimmer
449
+
448
450
  APP_ROOT = File.expand_path('../..', __FILE__)
449
451
  VERSION = File.read(File.join(APP_ROOT, 'VERSION'))
450
452
  LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
453
+ Display.app_name = '#{human_name(app_name)}'
454
+ Display.app_version = VERSION
451
455
  end
452
456
 
453
457
  require '#{file_name(app_name)}/view/app_view'
@@ -574,6 +578,8 @@ module Glimmer
574
578
  APP_ROOT = File.expand_path('../../../..', __FILE__)
575
579
  VERSION = File.read(File.join(APP_ROOT, 'VERSION'))
576
580
  LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
581
+ Display.app_name = '#{human_name(custom_shell_name)}'
582
+ Display.app_version = VERSION
577
583
 
578
584
  MULTI_LINE_STRING
579
585
  end
@@ -594,8 +600,6 @@ module Glimmer
594
600
  if %i[gem app desktopify].include?(shell_type)
595
601
  custom_shell_file_content += <<-MULTI_LINE_STRING
596
602
  before_body do
597
- Display.app_name = '#{shell_type == :gem ? human_name(custom_shell_name) : human_name(namespace)}'
598
- Display.app_version = VERSION
599
603
  @display = display {
600
604
  on_about do
601
605
  display_about_dialog
@@ -630,8 +634,8 @@ module Glimmer
630
634
  shell#{'(:fill_screen)' if shell_type == :desktopify} {
631
635
  # Replace example content below with custom shell content
632
636
  minimum_size #{shell_type == :desktopify ? '768, 432' : '420, 240'}
633
- image File.join(APP_ROOT, 'icons', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
634
- image File.join(APP_ROOT, 'icons', 'linux', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.png") unless OS.windows?
637
+ image File.join(APP_ROOT, 'icons', 'windows', "#{human_name(current_dir_name)}.ico") if OS.windows?
638
+ image File.join(APP_ROOT, 'icons', 'linux', "#{human_name(current_dir_name)}.png") unless OS.windows?
635
639
  text "#{human_name(namespace)}#{' - ' + human_name(custom_shell_name) if shell_type != :desktopify}"
636
640
 
637
641
  MULTI_LINE_STRING
@@ -661,18 +665,21 @@ module Glimmer
661
665
  text '&File'
662
666
 
663
667
  menu_item {
664
- text '&About...'
668
+ text '&Preferences...'
665
669
 
666
670
  on_widget_selected do
667
- display_about_dialog
671
+ #{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
668
672
  end
669
673
  }
674
+ }
675
+ menu {
676
+ text '&Help'
670
677
 
671
678
  menu_item {
672
- text '&Preferences...'
679
+ text '&About...'
673
680
 
674
681
  on_widget_selected do
675
- #{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
682
+ display_about_dialog
676
683
  end
677
684
  }
678
685
  }
@@ -146,17 +146,11 @@ module Glimmer
146
146
  @line_numbers_styled_text_proxy = styled_text(swt(swt(swt_style), :h_scroll!, :v_scroll!)) {
147
147
  layout_data(:right, :fill, false, true)
148
148
 
149
- text bind(self,
150
- :styled_text_proxy_text,
151
- read_only: true,
152
- on_read: lambda { |text_value|
153
- line_numbers_text_from(text_value)
154
- },
155
- after_read: lambda {
156
- @line_numbers_styled_text_proxy&.top_pixel = styled_text_proxy_top_pixel unless styled_text_proxy_top_pixel.nil?
157
- }
158
- )
159
- top_pixel bind(self, :styled_text_proxy_top_pixel, read_only: true)
149
+ text <= [self, :styled_text_proxy_text,
150
+ on_read: lambda { |text_value| line_numbers_text_from(text_value) },
151
+ after_read: lambda { @line_numbers_styled_text_proxy&.top_pixel = styled_text_proxy_top_pixel unless styled_text_proxy_top_pixel.nil? }
152
+ ]
153
+ top_pixel <= [self, :styled_text_proxy_top_pixel]
160
154
  font name: @font_name, height: OS.mac? ? 15 : 12
161
155
  background color(:widget_background)
162
156
  foreground :dark_blue
@@ -190,8 +184,8 @@ module Glimmer
190
184
  # custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
191
185
  layout_data :fill, :fill, true, true if lines
192
186
 
193
- text bind(self, :styled_text_proxy_text) if lines
194
- top_pixel bind(self, :styled_text_proxy_top_pixel) if lines
187
+ text <=> [self, :styled_text_proxy_text] if lines
188
+ top_pixel <=> [self, :styled_text_proxy_top_pixel] if lines
195
189
  font name: @font_name, height: OS.mac? ? 15 : 12
196
190
  foreground rgb(75, 75, 75)
197
191
  left_margin 5
@@ -223,10 +217,10 @@ module Glimmer
223
217
  }
224
218
  end
225
219
 
226
- on_modify_text { |event|
220
+ on_modify_text do |event|
227
221
  # clear unnecessary syntax highlighting cache on text updates, and do it async to avoid affecting performance
228
222
  new_text = event.data
229
- async_exec {
223
+ async_exec do
230
224
  unless @syntax_highlighting.nil?
231
225
  lines = new_text.to_s.split("\n")
232
226
  line_diff = @syntax_highlighting.keys - lines
@@ -234,10 +228,10 @@ module Glimmer
234
228
  @syntax_highlighting.delete(line)
235
229
  end
236
230
  end
237
- }
238
- }
231
+ end
232
+ end
239
233
 
240
- on_line_get_style { |line_style_event|
234
+ on_line_get_style do |line_style_event|
241
235
  begin
242
236
  styles = []
243
237
  style_data = nil
@@ -259,7 +253,7 @@ module Glimmer
259
253
  Glimmer::Config.logger.error {e.message}
260
254
  Glimmer::Config.logger.error {e.full_message}
261
255
  end
262
- }
256
+ end
263
257
  }
264
258
  end
265
259
 
@@ -121,7 +121,8 @@ module Glimmer
121
121
  @swt_widget.setVisible(true)
122
122
  else
123
123
  @opened_before = true
124
- @swt_widget.pack
124
+ @swt_widget.layout(true, true)
125
+ @swt_widget.pack(true)
125
126
  center_within_display
126
127
  @swt_widget.open
127
128
  end
@@ -0,0 +1,19 @@
1
+ ---
2
+ Hello, World!: Mi5phsSdNAA
3
+ Hello, Message Box!: N0sDcr0xp40
4
+ Hello, Tab!: cMwlYZ78uaQ
5
+ Hello, Layout!: dAVFR9Y_thY
6
+ Hello, File Dialog!: HwZRgdvKIDo
7
+ Hello, Label!: i1PFHr-F8fQ
8
+ Hello, Text!: pOaYB43G2pg
9
+ Login: C_vSvXH9ISw
10
+ Hello, Canvas Shape Listeners!: PV13YE-43M4
11
+ Hello, Styled Text!: ahs54DPmmso
12
+ Hello, Code Text!: y0rNzMURnHY
13
+ Hello, Tree!: M-ZOFyzbEKo
14
+ Hello, Table!: 3zyyXq7WJwc
15
+ Hello, Pop Up Context Menu!: kupwWSZdsQE
16
+ Hello, Menu Bar!: 3RRVFIfA_UM
17
+ Weather: rC6x6aj1MdA
18
+ Hello, Date Time!: MpXbPEMUrns
19
+ Hello, Sash Form!: F7j2TTpbX6s
@@ -21,8 +21,15 @@
21
21
 
22
22
  require 'glimmer-dsl-swt'
23
23
  require 'fileutils'
24
+ require 'yaml'
25
+ require 'net/http'
24
26
 
25
27
  class Sample
28
+ UNEDITABLE = ['meta_sample.rb'] + (OS.windows? ? ['calculator.rb', 'weather.rb'] : []) # Windows StyledText does not support unicode characters found in certain samples
29
+ URL_TUTORIALS = 'https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-swt/master/samples/elaborate/meta_sample/tutorials.yml'
30
+ FILE_TUTORIALS = File.expand_path(File.join('meta_sample', 'tutorials.yml'), __dir__)
31
+ TUTORIALS = YAML.load_file(FILE_TUTORIALS)
32
+
26
33
  class << self
27
34
  def glimmer_directory
28
35
  File.expand_path('../../..', __FILE__)
@@ -39,28 +46,35 @@ class Sample
39
46
  @ensured_glimmer_directory = true
40
47
  end
41
48
  end
49
+
50
+ def tutorials
51
+ if remote_tutorials && !remote_tutorials.empty? && remote_tutorials != local_tutorials
52
+ remote_tutorials
53
+ else
54
+ local_tutorials
55
+ end
56
+ end
57
+
58
+ def remote_tutorials
59
+ if @remote_tutorials.nil?
60
+ remote_tutorials_response = Net::HTTP.get_response(URI(URL_TUTORIALS))
61
+ raise "Error downloading remote tutorial list from #{URL_TUTORIALS} (defaulting to local list): HTTP status #{remote_tutorials_response.code} #{remote_tutorials_response.message}!" unless remote_tutorials_response.code.to_i.between?(200, 299)
62
+ remote_tutorials_yaml = remote_tutorials_response.body
63
+ @remote_tutorials = YAML.load(remote_tutorials_yaml)
64
+ end
65
+ @remote_tutorials
66
+ rescue => e
67
+ Glimmer::Config.logger.error e.full_message
68
+ nil
69
+ end
70
+
71
+ def local_tutorials
72
+ TUTORIALS
73
+ end
42
74
  end
43
75
 
44
76
  include Glimmer::DataBinding::ObservableModel
45
-
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
- }
63
-
77
+
64
78
  attr_accessor :sample_directory, :file, :selected
65
79
 
66
80
  def initialize(file, sample_directory: )
@@ -105,7 +119,7 @@ class Sample
105
119
  end
106
120
 
107
121
  def tutorial
108
- TEACHABLE[name]
122
+ Sample.tutorials[name]
109
123
  end
110
124
 
111
125
  def file_relative_path
@@ -273,20 +287,6 @@ class MetaSampleApplication
273
287
  height_hint 96
274
288
  }
275
289
 
276
- button {
277
- text 'Launch'
278
- font height: 25
279
- enabled <= [SampleDirectory, 'selected_sample.launchable']
280
-
281
- on_widget_selected do
282
- begin
283
- SampleDirectory.selected_sample.launch(@code_text.text)
284
- rescue LoadError, StandardError, SyntaxError => launch_error
285
- error_dialog(message: launch_error.full_message).open
286
- end
287
- end
288
- }
289
-
290
290
  button {
291
291
  text 'Tutorial'
292
292
  font height: 25
@@ -303,6 +303,20 @@ class MetaSampleApplication
303
303
  end
304
304
  }
305
305
 
306
+ button {
307
+ text 'Launch'
308
+ font height: 25
309
+ enabled <= [SampleDirectory, 'selected_sample.launchable']
310
+
311
+ on_widget_selected do
312
+ begin
313
+ SampleDirectory.selected_sample.launch(@code_text.text)
314
+ rescue LoadError, StandardError, SyntaxError => launch_error
315
+ error_dialog(message: launch_error.full_message).open
316
+ end
317
+ end
318
+ }
319
+
306
320
  button {
307
321
  text 'Reset'
308
322
  font height: 25
@@ -72,7 +72,9 @@ class Weather
72
72
  }
73
73
 
74
74
  tab_folder {
75
- layout_data(:center, :center, true, true)
75
+ layout_data(:center, :center, true, true) {
76
+ width_hint 250
77
+ }
76
78
 
77
79
  ['℃', '℉'].each do |temp_unit|
78
80
  tab_item {
@@ -41,6 +41,7 @@ shell {
41
41
  menu_bar {
42
42
  menu {
43
43
  text '&File'
44
+
44
45
  menu_item {
45
46
  text '&New'
46
47
  accelerator :command, :N
@@ -52,6 +53,7 @@ shell {
52
53
  }.open
53
54
  end
54
55
  }
56
+
55
57
  menu_item {
56
58
  text '&Open...'
57
59
  accelerator :command, :O
@@ -63,10 +65,13 @@ shell {
63
65
  }.open
64
66
  end
65
67
  }
68
+
66
69
  menu {
67
70
  text 'Open &Recent'
71
+
68
72
  menu_item {
69
73
  text 'File 1'
74
+
70
75
  on_widget_selected do
71
76
  message_box {
72
77
  text 'File 1'
@@ -74,8 +79,10 @@ shell {
74
79
  }.open
75
80
  end
76
81
  }
82
+
77
83
  menu_item {
78
84
  text 'File 2'
85
+
79
86
  on_widget_selected do
80
87
  message_box {
81
88
  text 'File 2'
@@ -84,7 +91,9 @@ shell {
84
91
  end
85
92
  }
86
93
  }
94
+
87
95
  menu_item(:separator)
96
+
88
97
  menu_item {
89
98
  text 'E&xit'
90
99
 
@@ -93,21 +102,26 @@ shell {
93
102
  end
94
103
  }
95
104
  }
105
+
96
106
  menu {
97
107
  text '&Edit'
108
+
98
109
  menu_item {
99
110
  text 'Cut'
100
111
  accelerator :command, :X
101
112
  }
113
+
102
114
  menu_item {
103
115
  text 'Copy'
104
116
  accelerator :command, :C
105
117
  }
118
+
106
119
  menu_item {
107
120
  text 'Paste'
108
121
  accelerator :command, :V
109
122
  }
110
123
  }
124
+
111
125
  menu {
112
126
  text '&Options'
113
127
 
@@ -119,6 +133,7 @@ shell {
119
133
  @select_multiple_menu.enabled = true
120
134
  end
121
135
  }
136
+
122
137
  @select_one_menu = menu {
123
138
  text '&Select One'
124
139
  enabled false
@@ -126,13 +141,16 @@ shell {
126
141
  menu_item(:radio) {
127
142
  text 'Option 1'
128
143
  }
144
+
129
145
  menu_item(:radio) {
130
146
  text 'Option 2'
131
147
  }
148
+
132
149
  menu_item(:radio) {
133
150
  text 'Option 3'
134
151
  }
135
152
  }
153
+
136
154
  @select_multiple_menu = menu {
137
155
  text '&Select Multiple'
138
156
  enabled false
@@ -140,18 +158,64 @@ shell {
140
158
  menu_item(:check) {
141
159
  text 'Option 4'
142
160
  }
161
+
143
162
  menu_item(:check) {
144
163
  text 'Option 5'
145
164
  }
165
+
146
166
  menu_item(:check) {
147
167
  text 'Option 6'
148
168
  }
149
169
  }
150
170
  }
171
+
172
+ menu {
173
+ text '&Language'
174
+
175
+ ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
176
+ menu_item(:radio) { |a_menu_item|
177
+ image File.expand_path("images/#{image_name}.png", __dir__)
178
+ selection image_name == 'usa'
179
+
180
+ on_widget_selected do
181
+ if a_menu_item.selection
182
+ message_box {
183
+ text 'Language Selection'
184
+ message "You selected the language of #{image_name.capitalize}!"
185
+ }.open
186
+ end
187
+ end
188
+ }
189
+ end
190
+ }
191
+
192
+ menu {
193
+ text '&Country'
194
+
195
+ ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
196
+ menu_item(:radio) { |a_menu_item|
197
+ text image_name.capitalize
198
+ image File.expand_path("images/#{image_name}.png", __dir__)
199
+ selection image_name == 'usa'
200
+
201
+ on_widget_selected do
202
+ if a_menu_item.selection
203
+ message_box {
204
+ text 'Country Selection'
205
+ message "You selected the country of #{image_name.capitalize}!"
206
+ }.open
207
+ end
208
+ end
209
+ }
210
+ end
211
+ }
212
+
151
213
  menu {
152
214
  text '&Format'
215
+
153
216
  menu {
154
217
  text '&Background Color'
218
+
155
219
  COLORS.each { |color_style|
156
220
  menu_item(:radio) {
157
221
  text color_style.to_s.split('_').map(&:capitalize).join(' ')
@@ -162,8 +226,10 @@ shell {
162
226
  }
163
227
  }
164
228
  }
229
+
165
230
  menu {
166
231
  text 'Foreground &Color'
232
+
167
233
  COLORS.each { |color_style|
168
234
  menu_item(:radio) {
169
235
  text color_style.to_s.split('_').map(&:capitalize).join(' ')
@@ -175,8 +241,10 @@ shell {
175
241
  }
176
242
  }
177
243
  }
244
+
178
245
  menu {
179
246
  text '&View'
247
+
180
248
  menu_item(:radio) {
181
249
  text 'Small'
182
250
 
@@ -185,6 +253,7 @@ shell {
185
253
  @label.parent.pack
186
254
  end
187
255
  }
256
+
188
257
  menu_item(:radio) {
189
258
  text 'Medium'
190
259
  selection true
@@ -194,6 +263,7 @@ shell {
194
263
  @label.parent.pack
195
264
  end
196
265
  }
266
+
197
267
  menu_item(:radio) {
198
268
  text 'Large'
199
269
 
@@ -203,8 +273,10 @@ shell {
203
273
  end
204
274
  }
205
275
  }
276
+
206
277
  menu {
207
278
  text '&Help'
279
+
208
280
  menu_item {
209
281
  text '&Manual'
210
282
  accelerator :command, :shift, :M
@@ -216,6 +288,7 @@ shell {
216
288
  }.open
217
289
  end
218
290
  }
291
+
219
292
  menu_item {
220
293
  text '&Tutorial'
221
294
  accelerator :command, :shift, :T
@@ -227,7 +300,9 @@ shell {
227
300
  }.open
228
301
  end
229
302
  }
303
+
230
304
  menu_item(:separator)
305
+
231
306
  menu_item {
232
307
  text '&Report an Issue...'
233
308
 
@@ -335,7 +335,7 @@ class HelloTree
335
335
 
336
336
  label {
337
337
  layout_data(:fill, :center, false, false)
338
- text 'First Name:'
338
+ text 'Last Name:'
339
339
  font height: 16, style: :bold
340
340
  }
341
341
  text {
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.23.1.0
4
+ version: 4.23.1.3
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-05-01 00:00:00.000000000 Z
11
+ date: 2022-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -564,6 +564,7 @@ files:
564
564
  - samples/elaborate/login.rb
565
565
  - samples/elaborate/mandelbrot_fractal.rb
566
566
  - samples/elaborate/meta_sample.rb
567
+ - samples/elaborate/meta_sample/tutorials.yml
567
568
  - samples/elaborate/metronome.rb
568
569
  - samples/elaborate/parking.rb
569
570
  - samples/elaborate/parking/model/parking_floor.rb