glimmer-cs-calculator 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +26 -7
- data/VERSION +1 -1
- data/bin/calculator +1 -1
- data/bin/glimmer-cs-calculator +0 -2
- data/glimmer-cs-calculator.gemspec +8 -6
- data/lib/glimmer-cs-calculator.rb +1 -0
- data/lib/models/glimmer/calculator/command/operation.rb +1 -1
- data/lib/views/glimmer/calculator.rb +49 -178
- data/package/macosx/Glimmer Calculator.icns +0 -0
- data/package/windows/Glimmer Calculator.ico +0 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec35f63a2331f52aeb09b998b3bec6314f140ab8b2377c2d8c6bae2ee39c4fd4
|
4
|
+
data.tar.gz: 0a586ad6ad389bace7d4f0edb0d9f3586bd6ffaaa540f88842f9c134d7923f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bef94466c9b52f77b328f821840bbf532f90a76ca6ed58add979e98db63fb58138a5ac59e919d94d9b2cb83160932262cac2cdd0e39bb8e9bdbea6e3fb3579b
|
7
|
+
data.tar.gz: 64e525f32d00449388ade751e304bdbb433fc51b53867797b47b02f55b01ab33f25ccbb3acfa922077fecbe36097411c6a1b9e4c5ef4c88e6ae3134c17257c35
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,22 +2,41 @@
|
|
2
2
|
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-cs-calculator.svg)](http://badge.fury.io/rb/glimmer-cs-calculator)
|
4
4
|
|
5
|
+
Glimmer Calculator on Mac
|
6
|
+
|
5
7
|
![Calculator](glimmer-cs-calculator-screenshot.png)
|
6
8
|
|
9
|
+
Glimmer Calculator on Windows
|
10
|
+
|
11
|
+
![Calculator](glimmer-cs-calculator-screenshot-windows.png)
|
12
|
+
|
13
|
+
Glimmer Calculator on Linux
|
14
|
+
|
15
|
+
![Calculator](glimmer-cs-calculator-screenshot-linux.png)
|
16
|
+
|
7
17
|
Glimmer Calculator is a sample desktop GUI application built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library).
|
8
18
|
|
9
|
-
|
19
|
+
Architectural Pattern is MVP (Model View Presenter) thanks to [Glimmer data-binding](https://github.com/AndyObtiva/glimmer-dsl-swt#data-binding) support.
|
20
|
+
|
21
|
+
Glimmer Calculator was developed test-first following TDD (Test Driven Development) after [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding).
|
22
|
+
|
10
23
|
Design Patterns discovered in the process were Presenter/Facade and Command Pattern.
|
11
24
|
|
12
|
-
|
25
|
+
Here are the calculator commands under the [models directory](lib/models/glimmer/calculator):
|
26
|
+
|
27
|
+
![Calculator Commands](glimmer-cs-calculator-command-pattern.png)
|
28
|
+
|
29
|
+
[<img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=40 />Download Glimmer Calculator v1.1.1 DMG for Mac](https://www.dropbox.com/s/2wbyy0z0w875n39/Glimmer%20Calculator-1.1.1.dmg?dl=1)
|
30
|
+
|
31
|
+
[<img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=40 />Download Glimmer Calculator v1.1.1 MSI for Windows](https://www.dropbox.com/s/e8b586s2xgjn9bg/Glimmer%20Calculator-1.1.1.msi?dl=1)
|
13
32
|
|
14
|
-
[<img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=40 />Download Glimmer Calculator v1.1.
|
33
|
+
[<img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=40 />Download Glimmer Calculator v1.1.1 GEM for Linux](#setup-instructions)
|
15
34
|
|
16
35
|
## Platforms
|
17
36
|
|
18
|
-
- Mac: Tested and [packaged](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) for
|
19
|
-
-
|
20
|
-
-
|
37
|
+
- Mac: Tested and [packaged](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) for Mac. ([Download Here](https://www.dropbox.com/s/2wbyy0z0w875n39/Glimmer%20Calculator-1.1.1.dmg?dl=1))
|
38
|
+
- Windows: Tested and [packaged](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) for Windows. ([Download Here](https://www.dropbox.com/s/e8b586s2xgjn9bg/Glimmer%20Calculator-1.1.1.msi?dl=1))
|
39
|
+
- Linux: Tested and [packaged](http://rubygems.org/gems/glimmer-cs-calculator) for Linux (Follow [setup instructions](#setup-instructions) to install [gem](http://rubygems.org/gems/glimmer-cs-calculator) and run `calculator` command)
|
21
40
|
|
22
41
|
## Development Environment Pre-requisites
|
23
42
|
|
@@ -46,7 +65,7 @@ To reuse Calculator as a Glimmer Custom Shell inside another Glimmer application
|
|
46
65
|
following to the application's `Gemfile`:
|
47
66
|
|
48
67
|
```
|
49
|
-
gem 'glimmer-cs-calculator', '1.1.
|
68
|
+
gem 'glimmer-cs-calculator', '1.1.1'
|
50
69
|
```
|
51
70
|
|
52
71
|
Run:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/bin/calculator
CHANGED
data/bin/glimmer-cs-calculator
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-cs-calculator 1.1.
|
5
|
+
# stub: glimmer-cs-calculator 1.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-cs-calculator".freeze
|
9
|
-
s.version = "1.1.
|
9
|
+
s.version = "1.1.1"
|
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 = ["Andy Maleh".freeze]
|
14
|
-
s.date = "2020-
|
14
|
+
s.date = "2020-10-14"
|
15
15
|
s.description = "Calculator - Glimmer Custom Shell".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer-cs-calculator".freeze, "calculator".freeze]
|
@@ -39,7 +39,9 @@ Gem::Specification.new do |s|
|
|
39
39
|
"lib/models/glimmer/calculator/command/operation/subtract.rb",
|
40
40
|
"lib/models/glimmer/calculator/command/point.rb",
|
41
41
|
"lib/models/glimmer/calculator/presenter.rb",
|
42
|
-
"lib/views/glimmer/calculator.rb"
|
42
|
+
"lib/views/glimmer/calculator.rb",
|
43
|
+
"package/macosx/Glimmer Calculator.icns",
|
44
|
+
"package/windows/Glimmer Calculator.ico"
|
43
45
|
]
|
44
46
|
s.homepage = "http://github.com/AndyObtiva/glimmer-cs-calculator".freeze
|
45
47
|
s.licenses = ["MIT".freeze]
|
@@ -51,7 +53,7 @@ Gem::Specification.new do |s|
|
|
51
53
|
end
|
52
54
|
|
53
55
|
if s.respond_to? :add_runtime_dependency then
|
54
|
-
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.
|
56
|
+
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.2", "< 5.0.0.0"])
|
55
57
|
s.add_runtime_dependency(%q<easily_typable>.freeze, ["~> 1.0.2"])
|
56
58
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
57
59
|
s.add_development_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
@@ -59,7 +61,7 @@ Gem::Specification.new do |s|
|
|
59
61
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
60
62
|
s.add_development_dependency(%q<glimmer-cs-gladiator>.freeze, [">= 0.3.0"])
|
61
63
|
else
|
62
|
-
s.add_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.
|
64
|
+
s.add_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.2", "< 5.0.0.0"])
|
63
65
|
s.add_dependency(%q<easily_typable>.freeze, ["~> 1.0.2"])
|
64
66
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
65
67
|
s.add_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
@@ -13,7 +13,7 @@ module Glimmer
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def calculate
|
16
|
-
calculation_result = number1.send(operation_method, number2)
|
16
|
+
calculation_result = BigDecimal.new(number1.to_s).send(operation_method, BigDecimal.new(number2.to_s)).to_f
|
17
17
|
calculation_result.to_s.match(/\.0+$/) ? calculation_result.to_i : calculation_result
|
18
18
|
end
|
19
19
|
|
@@ -6,6 +6,7 @@ module Glimmer
|
|
6
6
|
class Calculator
|
7
7
|
include Glimmer::UI::CustomShell
|
8
8
|
|
9
|
+
APP_ROOT = File.expand_path('../../../..', __FILE__)
|
9
10
|
VERSION = File.read(File.expand_path(File.join('..', '..', '..', '..', 'VERSION'), __FILE__))
|
10
11
|
LICENSE = File.read(File.expand_path(File.join('..', '..', '..', '..', 'LICENSE.txt'), __FILE__))
|
11
12
|
|
@@ -50,8 +51,8 @@ module Glimmer
|
|
50
51
|
#
|
51
52
|
body {
|
52
53
|
shell {
|
53
|
-
|
54
|
-
|
54
|
+
minimum_size (OS.mac? ? 320 : (OS.windows? ? 390 : 520)), 240
|
55
|
+
image File.join(APP_ROOT, 'package', 'windows', "Glimmer Calculator.ico") if OS.windows?
|
55
56
|
text "Glimmer - Calculator"
|
56
57
|
grid_layout 4, true
|
57
58
|
# Setting styled_text to multi in order for alignment options to activate
|
@@ -66,184 +67,54 @@ module Glimmer
|
|
66
67
|
editable false
|
67
68
|
caret nil
|
68
69
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
@presenter.press('/')
|
87
|
-
}
|
88
|
-
}
|
89
|
-
button {
|
90
|
-
text '×'
|
91
|
-
font @button_font_operation
|
92
|
-
|
93
|
-
layout_data(:fill, :fill, true, true)
|
94
|
-
|
95
|
-
on_widget_selected {
|
96
|
-
@presenter.press('*')
|
97
|
-
}
|
98
|
-
}
|
99
|
-
button {
|
100
|
-
text '−'
|
101
|
-
font @button_font_operation
|
102
|
-
|
103
|
-
layout_data(:fill, :fill, true, true)
|
104
|
-
|
105
|
-
on_widget_selected {
|
106
|
-
@presenter.press('-')
|
107
|
-
}
|
108
|
-
}
|
109
|
-
button {
|
110
|
-
text '7'
|
111
|
-
font @button_font
|
112
|
-
|
113
|
-
layout_data(:fill, :fill, true, true)
|
114
|
-
|
115
|
-
on_widget_selected {
|
116
|
-
@presenter.press('7')
|
117
|
-
}
|
118
|
-
}
|
119
|
-
button {
|
120
|
-
text '8'
|
121
|
-
font @button_font
|
122
|
-
|
123
|
-
layout_data(:fill, :fill, true, true)
|
124
|
-
|
125
|
-
on_widget_selected {
|
126
|
-
@presenter.press('8')
|
127
|
-
}
|
128
|
-
}
|
129
|
-
button {
|
130
|
-
text '9'
|
131
|
-
font @button_font
|
132
|
-
|
133
|
-
layout_data(:fill, :fill, true, true)
|
134
|
-
|
135
|
-
on_widget_selected {
|
136
|
-
@presenter.press('9')
|
137
|
-
}
|
138
|
-
}
|
139
|
-
button {
|
140
|
-
text '+'
|
141
|
-
font @button_font_big
|
142
|
-
|
143
|
-
layout_data(:fill, :fill, true, true) {
|
144
|
-
vertical_span 2
|
145
|
-
}
|
146
|
-
|
147
|
-
on_widget_selected {
|
148
|
-
@presenter.press('+')
|
149
|
-
}
|
150
|
-
}
|
151
|
-
button {
|
152
|
-
text '4'
|
153
|
-
font @button_font
|
154
|
-
|
155
|
-
layout_data(:fill, :fill, true, true)
|
156
|
-
|
157
|
-
on_widget_selected {
|
158
|
-
@presenter.press('4')
|
159
|
-
}
|
160
|
-
}
|
161
|
-
button {
|
162
|
-
text '5'
|
163
|
-
font @button_font
|
164
|
-
|
165
|
-
layout_data(:fill, :fill, true, true)
|
166
|
-
|
167
|
-
on_widget_selected {
|
168
|
-
@presenter.press('5')
|
169
|
-
}
|
170
|
-
}
|
171
|
-
button {
|
172
|
-
text '6'
|
173
|
-
font @button_font
|
174
|
-
|
175
|
-
layout_data(:fill, :fill, true, true)
|
176
|
-
|
177
|
-
on_widget_selected {
|
178
|
-
@presenter.press('6')
|
179
|
-
}
|
180
|
-
}
|
181
|
-
button {
|
182
|
-
text '1'
|
183
|
-
font @button_font
|
184
|
-
|
185
|
-
layout_data(:fill, :fill, true, true)
|
186
|
-
|
187
|
-
on_widget_selected {
|
188
|
-
@presenter.press('1')
|
189
|
-
}
|
190
|
-
}
|
191
|
-
button {
|
192
|
-
text '2'
|
193
|
-
font @button_font
|
194
|
-
|
195
|
-
layout_data(:fill, :fill, true, true)
|
196
|
-
|
197
|
-
on_widget_selected {
|
198
|
-
@presenter.press('2')
|
199
|
-
}
|
200
|
-
}
|
201
|
-
button {
|
202
|
-
text '3'
|
203
|
-
font @button_font
|
204
|
-
|
205
|
-
layout_data(:fill, :fill, true, true)
|
206
|
-
|
207
|
-
on_widget_selected {
|
208
|
-
@presenter.press('3')
|
209
|
-
}
|
210
|
-
}
|
211
|
-
button {
|
212
|
-
text '='
|
213
|
-
font @button_font_big
|
214
|
-
|
215
|
-
layout_data(:fill, :fill, true, true) {
|
216
|
-
vertical_span 2
|
217
|
-
}
|
218
|
-
|
219
|
-
on_widget_selected {
|
220
|
-
@presenter.press('=')
|
221
|
-
}
|
222
|
-
}
|
223
|
-
button {
|
224
|
-
text '0'
|
225
|
-
font @button_font
|
226
|
-
|
227
|
-
layout_data(:fill, :fill, true, true) {
|
228
|
-
horizontal_span 2
|
229
|
-
}
|
230
|
-
|
231
|
-
on_widget_selected {
|
232
|
-
@presenter.press('0')
|
233
|
-
}
|
234
|
-
}
|
235
|
-
button {
|
236
|
-
text '.'
|
237
|
-
font @button_font_operation
|
238
|
-
|
239
|
-
layout_data(:fill, :fill, true, true)
|
240
|
-
|
241
|
-
on_widget_selected {
|
242
|
-
@presenter.press('.')
|
243
|
-
}
|
244
|
-
}
|
70
|
+
command_button('AC')
|
71
|
+
operation_button('÷')
|
72
|
+
operation_button('×')
|
73
|
+
operation_button('−')
|
74
|
+
(7..9).each { |number|
|
75
|
+
number_button(number)
|
76
|
+
}
|
77
|
+
operation_button('+', font: @button_font_big, vertical_span: 2)
|
78
|
+
(4..6).each { |number|
|
79
|
+
number_button(number)
|
80
|
+
}
|
81
|
+
(1..3).each { |number|
|
82
|
+
number_button(number)
|
83
|
+
}
|
84
|
+
command_button('=', font: @button_font_big, vertical_span: 2)
|
85
|
+
number_button(0, horizontal_span: 2)
|
86
|
+
operation_button('.')
|
245
87
|
}
|
246
88
|
}
|
89
|
+
|
90
|
+
def number_button(number, options = {})
|
91
|
+
command_button(number, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def operation_button(operation, options = {})
|
95
|
+
command_button(operation, options.merge(font: @button_font_operation))
|
96
|
+
end
|
97
|
+
|
98
|
+
def command_button(command, options = {})
|
99
|
+
command = command.to_s
|
100
|
+
options[:font] ||= @button_font
|
101
|
+
options[:horizontal_span] ||= 1
|
102
|
+
options[:vertical_span] ||= 1
|
103
|
+
|
104
|
+
button { |proxy|
|
105
|
+
text command
|
106
|
+
font options[:font]
|
107
|
+
|
108
|
+
layout_data(:fill, :fill, true, true) {
|
109
|
+
horizontal_span options[:horizontal_span]
|
110
|
+
vertical_span options[:vertical_span]
|
111
|
+
}
|
112
|
+
|
113
|
+
on_widget_selected {
|
114
|
+
@presenter.press(command)
|
115
|
+
}
|
116
|
+
}
|
117
|
+
end
|
247
118
|
|
248
119
|
def display_about_dialog
|
249
120
|
message_box(body_root) {
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cs-calculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-14 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: 4.17.2.
|
18
|
+
version: 4.17.2.2
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 5.0.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 4.17.2.
|
29
|
+
version: 4.17.2.2
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 5.0.0.0
|
@@ -144,6 +144,8 @@ files:
|
|
144
144
|
- lib/models/glimmer/calculator/command/point.rb
|
145
145
|
- lib/models/glimmer/calculator/presenter.rb
|
146
146
|
- lib/views/glimmer/calculator.rb
|
147
|
+
- package/macosx/Glimmer Calculator.icns
|
148
|
+
- package/windows/Glimmer Calculator.ico
|
147
149
|
homepage: http://github.com/AndyObtiva/glimmer-cs-calculator
|
148
150
|
licenses:
|
149
151
|
- MIT
|