glimmer-dsl-swt 4.17.10.7 → 4.17.10.8

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: 00b44b39eadc5263ddccde3ac95a754a9b4ad32c9412c268e9cf481ce89b7b05
4
- data.tar.gz: 7a72f47c3a36921160c3217652cc98a1b377f8c5202c2c24ade6288106d87b7a
3
+ metadata.gz: f86e6ce8dc5b52db4661c0cb5aa9d9bce7e0cc644408ae1536aed5d2ea25d0cd
4
+ data.tar.gz: ccdbb42c7bebc81a2a73235ee80ef53ce6607810152ea66b6336e33490a8e83a
5
5
  SHA512:
6
- metadata.gz: c630340b8dad5f0fe4f12481aec9dd039e21cd5be5fec8350c8624b23d3a76aa4cd84ce3e5b85fd1506c1037ab5094e2872548061029cf02c906a13b56df5f5b
7
- data.tar.gz: 1bd3f35d763bb34095e3b600abaf013d38ad7c4545bbcff6e1f1739a9702d760e79b533bc29b863587307bac567e34604fe212980cac3552eb96b05595bbd5c9
6
+ metadata.gz: 7d1e3ee58b861a453d79cca264749bcfc17f0efd4e490864aadec61a4b4269ad033cc49fbf291ccf8b9840ed54813130e8620a557d1f15c3c6c25883276ee6cb
7
+ data.tar.gz: 7fb220ed34798e701839cf118e1a7df1ebf5492b938570a8ee7dd0ad6a0a624808f52fe74ac30d221f58e6269ff708dd6d71098b0251c3470d16fa2a5c472323
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.17.10.8
4
+
5
+ - Support editing sample code in the Glimmer Meta-Sample to enable experimentation and learning
6
+ - Add a "Reset" button to the Glimmer Meta-Sample to allow resetting sample code changes
7
+ - Refactor/revise hello_message_box.rb and hello_pop_up_context_menu.rb samples
8
+ - Upgrade to glimmer 1.0.6
9
+
3
10
  ### 4.17.10.7
4
11
 
5
12
  - Loosened dependencies on most Glimmer author-owned gems
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.17.10.7
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.17.10.8
2
2
 
3
3
  ## JRuby Desktop Development GUI Framework
4
4
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
@@ -449,7 +449,7 @@ jgem install glimmer-dsl-swt
449
449
 
450
450
  Or this command if you want a specific version:
451
451
  ```
452
- jgem install glimmer-dsl-swt -v 4.17.10.7
452
+ jgem install glimmer-dsl-swt -v 4.17.10.8
453
453
 
454
454
  ```
455
455
 
@@ -526,7 +526,7 @@ bin/glimmer samples
526
526
  Below are the full usage instructions that come up when running `glimmer` without args.
527
527
 
528
528
  ```
529
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.7
529
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.8
530
530
 
531
531
 
532
532
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
@@ -1003,8 +1003,8 @@ Output:
1003
1003
  Name Gem Version Author Description
1004
1004
 
1005
1005
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1006
- Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
1007
- Swt glimmer-dsl-swt 4.17.10.7
1006
+ Opal glimmer-dsl-opal 0.8.0 AndyMaleh Glimmer DSL for Opal
1007
+ Swt glimmer-dsl-swt 4.17.10.8
1008
1008
  AndyMaleh Glimmer DSL for SWT
1009
1009
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1010
1010
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
@@ -3286,10 +3286,8 @@ Glimmer Meta-Sample Code Example:
3286
3286
 
3287
3287
  ```ruby
3288
3288
  # ...
3289
- code_text {
3290
- text bind(SampleDirectory, 'selected_sample.content')
3291
- editable false
3292
- caret nil
3289
+ @code_text = code_text {
3290
+ text bind(SampleDirectory, 'selected_sample.content', read_only: true)
3293
3291
  }
3294
3292
  # ...
3295
3293
  ```
@@ -3625,7 +3623,7 @@ https://www.eclipse.org/nebula/
3625
3623
 
3626
3624
  ## Samples
3627
3625
 
3628
- Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
3626
+ Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer samples` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
3629
3627
 
3630
3628
  You may run any sample via this command:
3631
3629
 
@@ -3637,6 +3635,8 @@ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elabora
3637
3635
 
3638
3636
  ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
3639
3637
 
3638
+ You may edit the code of any sample before launching it via the "Launch" button. This helps you learn by experiementing with Glimmer GUI DSL syntax. To go back to original code, simply hit the "Reset" button.
3639
+
3640
3640
  ### Hello Samples
3641
3641
 
3642
3642
  For hello-type simple samples, check the following.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.17.10.7
1
+ 4.17.10.8
@@ -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.17.10.7 ruby lib
5
+ # stub: glimmer-dsl-swt 4.17.10.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.17.10.7"
9
+ s.version = "4.17.10.8"
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 = "2020-12-15"
14
+ s.date = "2020-12-17"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -174,7 +174,7 @@ Gem::Specification.new do |s|
174
174
  end
175
175
 
176
176
  if s.respond_to? :add_runtime_dependency then
177
- s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
177
+ s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.6"])
178
178
  s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
179
179
  s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
180
180
  s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -193,7 +193,7 @@ Gem::Specification.new do |s|
193
193
  s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
194
194
  s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
195
195
  else
196
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
196
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.6"])
197
197
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
198
198
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
199
199
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -1,4 +1,8 @@
1
+ require 'fileutils'
2
+
1
3
  class Sample
4
+ include Glimmer::DataBinding::ObservableModel
5
+
2
6
  attr_accessor :sample_directory, :file, :selected
3
7
 
4
8
  def initialize(file, sample_directory: )
@@ -19,12 +23,33 @@ class Sample
19
23
  @name
20
24
  end
21
25
 
22
- def content
23
- @content = File.read(file)
26
+ def code
27
+ reset_code! if @code.nil?
28
+ @code
24
29
  end
25
-
26
- def launch
27
- load file
30
+
31
+ def reset_code!
32
+ @code = File.read(file)
33
+ notify_observers('code')
34
+ end
35
+
36
+ def launch(modified_code)
37
+ modified_file = File.join(File.dirname(file), ".#{File.basename(file)}")
38
+ begin
39
+ File.write(modified_file, modified_code)
40
+ begin
41
+ load(modified_file)
42
+ rescue StandardError, SyntaxError => launch_error
43
+ message_box {
44
+ text 'Error Launching'
45
+ message launch_error.full_message
46
+ }.open
47
+ end
48
+ rescue
49
+ load(file) # load original file if failed to write changes
50
+ ensure
51
+ FileUtils.rm_rf(modified_file)
52
+ end
28
53
  end
29
54
  end
30
55
 
@@ -111,15 +136,17 @@ end
111
136
  class MetaSampleApplication
112
137
  include Glimmer
113
138
 
139
+ def initialize
140
+ selected_sample_directory = SampleDirectory.sample_directories.first
141
+ selected_sample = selected_sample_directory.samples.first
142
+ selected_sample_directory.selected_sample_name = selected_sample.name
143
+ end
144
+
114
145
  def launch
115
146
  shell {
116
147
  minimum_size 1280, 768
117
148
  text 'Glimmer Meta-Sample (The Sample of Samples)'
118
149
 
119
- on_swt_show {
120
- SampleDirectory.selected_sample = SampleDirectory.all_samples.first
121
- }
122
-
123
150
  sash_form {
124
151
  composite {
125
152
  grid_layout 1, false
@@ -144,22 +171,31 @@ class MetaSampleApplication
144
171
  }
145
172
  }
146
173
 
147
- button {
174
+ composite {
175
+ fill_layout
148
176
  layout_data(:fill, :center, true, false) {
149
177
  height_hint 120
150
178
  }
151
- text 'Launch Sample'
152
- font height: 30
153
- on_widget_selected {
154
- SampleDirectory.selected_sample.launch
179
+
180
+ button {
181
+ text 'Launch'
182
+ font height: 30
183
+ on_widget_selected {
184
+ SampleDirectory.selected_sample.launch(@code_text.text)
185
+ }
186
+ }
187
+ button {
188
+ text 'Reset'
189
+ font height: 30
190
+ on_widget_selected {
191
+ SampleDirectory.selected_sample.reset_code!
192
+ }
155
193
  }
156
194
  }
157
195
  }
158
196
 
159
- code_text {
160
- text bind(SampleDirectory, 'selected_sample.content')
161
- editable false
162
- caret nil
197
+ @code_text = code_text {
198
+ text bind(SampleDirectory, 'selected_sample.code', read_only: true)
163
199
  }
164
200
 
165
201
  weights 4, 9
@@ -22,7 +22,9 @@
22
22
  include Glimmer
23
23
 
24
24
  shell {
25
+ text 'Hello, Browser!'
25
26
  minimum_size 1024, 860
27
+
26
28
  browser {
27
29
  url 'https://brightonresort.com/about'
28
30
  }
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
@@ -35,6 +35,7 @@ class HelloComputed
35
35
  def launch
36
36
  shell {
37
37
  text 'Hello, Computed!'
38
+
38
39
  composite {
39
40
  grid_layout {
40
41
  num_columns 2
@@ -42,6 +43,7 @@ class HelloComputed
42
43
  horizontal_spacing 20
43
44
  vertical_spacing 10
44
45
  }
46
+
45
47
  label {text 'First &Name: '}
46
48
  text {
47
49
  text bind(@contact, :first_name)
@@ -50,6 +52,7 @@ class HelloComputed
50
52
  grab_excess_horizontal_space true
51
53
  }
52
54
  }
55
+
53
56
  label {text '&Last Name: '}
54
57
  text {
55
58
  text bind(@contact, :last_name)
@@ -58,6 +61,7 @@ class HelloComputed
58
61
  grab_excess_horizontal_space true
59
62
  }
60
63
  }
64
+
61
65
  label {text '&Year of Birth: '}
62
66
  text {
63
67
  text bind(@contact, :year_of_birth)
@@ -66,6 +70,7 @@ class HelloComputed
66
70
  grab_excess_horizontal_space true
67
71
  }
68
72
  }
73
+
69
74
  label {text 'Name: '}
70
75
  label {
71
76
  text bind(@contact, :name, computed_by: [:first_name, :last_name])
@@ -74,6 +79,7 @@ class HelloComputed
74
79
  grab_excess_horizontal_space true
75
80
  }
76
81
  }
82
+
77
83
  label {text 'Age: '}
78
84
  label {
79
85
  text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
@@ -21,16 +21,17 @@
21
21
 
22
22
  include Glimmer
23
23
 
24
- @shell = shell {
24
+ shell {
25
25
  text 'Hello, Message Box!'
26
+
26
27
  button {
27
28
  text 'Please Click To Win a Surprise'
29
+
28
30
  on_widget_selected {
29
- message_box(@shell) {
31
+ message_box {
30
32
  text 'Surprise'
31
- message "Congratulations!\n\nYou have won $1,000,000!"
33
+ message "Congratulations!\n\nYou won $1,000,000!"
32
34
  }.open
33
35
  }
34
36
  }
35
- }
36
- @shell.open
37
+ }.open
@@ -21,12 +21,18 @@
21
21
 
22
22
  include Glimmer
23
23
 
24
- shell { |shell_proxy|
24
+ shell {
25
+ grid_layout {
26
+ margin_width 0
27
+ margin_height 0
28
+ }
29
+
25
30
  text 'Hello, Pop Up Context Menu!'
26
- grid_layout
31
+
27
32
  label {
28
- font height: 16
29
- text 'Right-Click To Pop Up a Context Menu'
33
+ text "Right-Click on the Text to\nPop Up a Context Menu"
34
+ font height: 50
35
+
30
36
  menu {
31
37
  menu {
32
38
  text '&History'
@@ -35,7 +41,7 @@ shell { |shell_proxy|
35
41
  menu_item {
36
42
  text 'File 1'
37
43
  on_widget_selected {
38
- message_box(shell_proxy) {
44
+ message_box {
39
45
  text 'File 1'
40
46
  message 'File 1 Contents'
41
47
  }.open
@@ -44,13 +50,34 @@ shell { |shell_proxy|
44
50
  menu_item {
45
51
  text 'File 2'
46
52
  on_widget_selected {
47
- message_box(shell_proxy) {
53
+ message_box {
48
54
  text 'File 2'
49
55
  message 'File 2 Contents'
50
56
  }.open
51
57
  }
52
58
  }
53
59
  }
60
+ menu {
61
+ text '&Archived'
62
+ menu_item {
63
+ text 'File 3'
64
+ on_widget_selected {
65
+ message_box {
66
+ text 'File 3'
67
+ message 'File 3 Contents'
68
+ }.open
69
+ }
70
+ }
71
+ menu_item {
72
+ text 'File 4'
73
+ on_widget_selected {
74
+ message_box {
75
+ text 'File 4'
76
+ message 'File 4 Contents'
77
+ }.open
78
+ }
79
+ }
80
+ }
54
81
  }
55
82
  }
56
83
  }
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.17.10.7
4
+ version: 4.17.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-15 00:00:00.000000000 Z
11
+ date: 2020-12-17 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: 1.0.5
18
+ version: 1.0.6
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: 1.0.5
26
+ version: 1.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements: