glimmer-dsl-opal 0.23.0 → 0.24.0

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: 97154ebca855643dd407d82d30a6d7e127814fe5365bec2020a9f5ac14a20fbf
4
- data.tar.gz: bc7dc89a573bff5406666a6b59ecf8cfc623493f6f680190ce42655236f79dec
3
+ metadata.gz: f974d9526112e11c32284c5fbcd30e08226aafa3f799c08ccd67deabddf9f0ac
4
+ data.tar.gz: e77d826d4afb7a359a24f2a87dc49672e7d17e4da265feef11c278403370d468
5
5
  SHA512:
6
- metadata.gz: 65032ea2c5274c6d4b168225d321dbeb586084d7af987cd06fdc8f5cd9f640b7d1aabb5bb46de18c18b7e36116b337dacb39cfd48ac7a98afbd18a2c6cd666ef
7
- data.tar.gz: 2d663340cc508c4a7c20b4dfd7878ef52c2084868921610d07a2765b9a62e28902b1f2b4c4959f8b18e5ccbe7efe9152d848b588a795a9cfea9f1b9a7c281e6e
6
+ metadata.gz: 9295b9a8da3867580a975a43cc61708d635de4f03d30fae6d07913d9147783c2372fe1fe9f673d0f8bfe20988684579b0aaeaa6fbebcec189c4111bba3b62935
7
+ data.tar.gz: 5ea143577dc7c59c8c8b5d423f0a17580c71bcbefb29cd200c770e8078ca78cca75f29de4354801b38a2a440365285832f96a48ec50290afbe941b865aa73f14
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.24.0
4
+
5
+ - `widget#print` method
6
+ - Hello, Print! sample
7
+
3
8
  ## 0.23.0
4
9
 
5
10
  - Hello, Label! sample
data/README.md CHANGED
@@ -143,7 +143,7 @@ Hello, Table! Game Booked
143
143
 
144
144
  NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
145
145
 
146
- **Alpha Version** 0.23.0 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
146
+ **Alpha Version** 0.24.0 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
147
147
 
148
148
  Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
149
149
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
@@ -264,7 +264,7 @@ gem 'opal', '1.0.4'
264
264
  gem 'opal-rails', '1.1.2'
265
265
  gem 'opal-async', '~> 1.2.0'
266
266
  gem 'opal-jquery', '~> 0.4.4'
267
- gem 'glimmer-dsl-opal', '~> 0.23.0'
267
+ gem 'glimmer-dsl-opal', '~> 0.24.0'
268
268
  gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
269
269
  gem 'glimmer-dsl-css', '~> 1.2.0', require: false
270
270
 
@@ -472,9 +472,9 @@ class HelloCombo
472
472
 
473
473
  include Glimmer::UI::CustomShell
474
474
 
475
- before_body {
475
+ before_body do
476
476
  @person = Person.new
477
- }
477
+ end
478
478
 
479
479
  body {
480
480
  shell {
@@ -578,13 +578,13 @@ class HelloComputed
578
578
 
579
579
  include Glimmer::UI::CustomShell
580
580
 
581
- before_body {
581
+ before_body do
582
582
  @contact = Contact.new(
583
583
  first_name: 'Barry',
584
584
  last_name: 'McKibbin',
585
585
  year_of_birth: 1985
586
586
  )
587
- }
587
+ end
588
588
 
589
589
  body {
590
590
  shell {
@@ -600,51 +600,43 @@ class HelloComputed
600
600
 
601
601
  label {text 'First &Name: '}
602
602
  text {
603
+ fill_horizontally_layout_data
603
604
  text <=> [@contact, :first_name]
604
- layout_data {
605
- horizontal_alignment :fill
606
- grab_excess_horizontal_space true
607
- }
608
605
  }
609
606
 
610
607
  label {text '&Last Name: '}
611
608
  text {
609
+ fill_horizontally_layout_data
612
610
  text <=> [@contact, :last_name]
613
- layout_data {
614
- horizontal_alignment :fill
615
- grab_excess_horizontal_space true
616
- }
617
611
  }
618
612
 
619
613
  label {text '&Year of Birth: '}
620
614
  text {
615
+ fill_horizontally_layout_data
621
616
  text <=> [@contact, :year_of_birth]
622
- layout_data {
623
- horizontal_alignment :fill
624
- grab_excess_horizontal_space true
625
- }
626
617
  }
627
618
 
628
619
  label {text 'Name: '}
629
620
  label {
621
+ fill_horizontally_layout_data
630
622
  text <= [@contact, :name, computed_by: [:first_name, :last_name]]
631
- layout_data {
632
- horizontal_alignment :fill
633
- grab_excess_horizontal_space true
634
- }
635
623
  }
636
624
 
637
625
  label {text 'Age: '}
638
626
  label {
627
+ fill_horizontally_layout_data
639
628
  text <= [@contact, :age, on_write: :to_i, computed_by: [:year_of_birth]]
640
- layout_data {
641
- horizontal_alignment :fill
642
- grab_excess_horizontal_space true
643
- }
644
629
  }
645
630
  }
646
631
  }
647
632
  }
633
+
634
+ def fill_horizontally_layout_data
635
+ layout_data {
636
+ horizontal_alignment :fill
637
+ grab_excess_horizontal_space true
638
+ }
639
+ end
648
640
  end
649
641
 
650
642
  HelloComputed.launch
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.0
1
+ 0.24.0
@@ -35,9 +35,9 @@ class HelloCombo
35
35
 
36
36
  include Glimmer::UI::CustomShell
37
37
 
38
- before_body {
38
+ before_body do
39
39
  @person = Person.new
40
- }
40
+ end
41
41
 
42
42
  body {
43
43
  shell {
@@ -42,13 +42,13 @@ class HelloComputed
42
42
 
43
43
  include Glimmer::UI::CustomShell
44
44
 
45
- before_body {
45
+ before_body do
46
46
  @contact = Contact.new(
47
47
  first_name: 'Barry',
48
48
  last_name: 'McKibbin',
49
49
  year_of_birth: 1985
50
50
  )
51
- }
51
+ end
52
52
 
53
53
  body {
54
54
  shell {
@@ -64,51 +64,43 @@ class HelloComputed
64
64
 
65
65
  label {text 'First &Name: '}
66
66
  text {
67
+ fill_horizontally_layout_data
67
68
  text <=> [@contact, :first_name]
68
- layout_data {
69
- horizontal_alignment :fill
70
- grab_excess_horizontal_space true
71
- }
72
69
  }
73
70
 
74
71
  label {text '&Last Name: '}
75
72
  text {
73
+ fill_horizontally_layout_data
76
74
  text <=> [@contact, :last_name]
77
- layout_data {
78
- horizontal_alignment :fill
79
- grab_excess_horizontal_space true
80
- }
81
75
  }
82
76
 
83
77
  label {text '&Year of Birth: '}
84
78
  text {
79
+ fill_horizontally_layout_data
85
80
  text <=> [@contact, :year_of_birth]
86
- layout_data {
87
- horizontal_alignment :fill
88
- grab_excess_horizontal_space true
89
- }
90
81
  }
91
82
 
92
83
  label {text 'Name: '}
93
84
  label {
85
+ fill_horizontally_layout_data
94
86
  text <= [@contact, :name, computed_by: [:first_name, :last_name]]
95
- layout_data {
96
- horizontal_alignment :fill
97
- grab_excess_horizontal_space true
98
- }
99
87
  }
100
88
 
101
89
  label {text 'Age: '}
102
90
  label {
91
+ fill_horizontally_layout_data
103
92
  text <= [@contact, :age, on_write: :to_i, computed_by: [:year_of_birth]]
104
- layout_data {
105
- horizontal_alignment :fill
106
- grab_excess_horizontal_space true
107
- }
108
93
  }
109
94
  }
110
95
  }
111
96
  }
97
+
98
+ def fill_horizontally_layout_data
99
+ layout_data {
100
+ horizontal_alignment :fill
101
+ grab_excess_horizontal_space true
102
+ }
103
+ end
112
104
  end
113
105
 
114
106
  HelloComputed.launch
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2020-2021 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
+ class HelloPrint
23
+ include Glimmer::UI::CustomShell
24
+
25
+ body {
26
+ shell {
27
+ text 'Hello, Print!'
28
+ @composite = composite {
29
+ row_layout(:vertical) {
30
+ fill true
31
+ center true
32
+ }
33
+
34
+ label(:center) {
35
+ text "Whatever you see inside the app composite\nwill get printed when clicking the Print button."
36
+ font height: 16
37
+ }
38
+
39
+ button {
40
+ text 'Print'
41
+
42
+ on_widget_selected do
43
+ # Unlike the SWT version, Opal's print always prints the entire window no matter what widget
44
+ # the print method is invoked from
45
+ unless @composite.print
46
+ message_box {
47
+ text 'Unable To Print'
48
+ message 'Sorry! Printing is not supported on this platform!'
49
+ }.open
50
+ end
51
+ end
52
+ }
53
+ }
54
+ }
55
+ }
56
+ end
57
+
58
+ HelloPrint.launch
@@ -241,6 +241,11 @@ module Glimmer
241
241
  def dialog_ancestor
242
242
  parents.detect {|p| p.is_a?(DialogProxy)}
243
243
  end
244
+
245
+ def print
246
+ `window.print()`
247
+ true
248
+ end
244
249
 
245
250
  def enabled=(value)
246
251
  @enabled = value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -308,6 +308,7 @@ files:
308
308
  - lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb
309
309
  - lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb
310
310
  - lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb
311
+ - lib/glimmer-dsl-opal/samples/hello/hello_print.rb
311
312
  - lib/glimmer-dsl-opal/samples/hello/hello_radio.rb
312
313
  - lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb
313
314
  - lib/glimmer-dsl-opal/samples/hello/hello_scale.rb