glimmer-cs-calculator 1.0.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +49 -12
- data/VERSION +1 -1
- data/bin/calculator +1 -1
- data/bin/glimmer-cs-calculator +1 -7
- data/glimmer-cs-calculator.gemspec +74 -0
- data/lib/glimmer-cs-calculator.rb +1 -0
- data/lib/glimmer-cs-calculator/launch.rb +5 -0
- data/lib/models/glimmer/calculator/command.rb +11 -1
- data/lib/models/glimmer/calculator/command/operation.rb +1 -1
- data/lib/views/glimmer/calculator.rb +55 -186
- data/package/macosx/Glimmer Calculator.icns +0 -0
- data/package/windows/Glimmer Calculator.ico +0 -0
- metadata +40 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d93ed877d6e253a93f0cfbf23ddfb6d2dddf526a6cc311e9d0f98f69073623f
|
4
|
+
data.tar.gz: cd774f43b245c75868f647b09c09fcac37709f0f6b8ef99783c2c6818fe74eb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bac3aefcd30c6ac3ca82805001b0793e798ebfac79f029d29eabcf7689e5853087e77ae6467c1a6413ebcab24cd03957123e9457d7102f89d2a530c9c4dd09d
|
7
|
+
data.tar.gz: 51bc9e0d3c9098132d15d45a0751b77918517fcdbe8abd04a178c5b376658e3c1e51fc3c12ab471b2c277fc345a7203ce629693effe63a9e7e6eb1dba9057409
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 1.1.3
|
4
|
+
|
5
|
+
- Added back the `glimmer-dsl-swt` gem dependency (was mistakenly removed while testing with Glimmer DSL for Opal)
|
6
|
+
|
7
|
+
## 1.1.2
|
8
|
+
|
9
|
+
- Official Opal (Web) support via [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal)
|
10
|
+
|
11
|
+
## 1.1.1
|
12
|
+
|
13
|
+
- Official Windows support
|
14
|
+
- Official Linux support
|
15
|
+
- Refactorings, extracting method-based custom widgets
|
16
|
+
|
17
|
+
## 1.1.0
|
18
|
+
|
19
|
+
- Upgrade support for glimmer-dsl-swt to 4.17.2.0 up to 5.0.0.0
|
20
|
+
|
21
|
+
## 1.0.2
|
22
|
+
|
23
|
+
- Relaxed dependency on glimmer-dsl-swt (>= 0.1.1 < 2.0.0) / updated logo / used new Glimmer `message_box` keyword syntax
|
24
|
+
|
25
|
+
## 1.0.1
|
26
|
+
|
27
|
+
- Upgraded to glimmer-dsl-swt v0.1.1 / added delete/backspace shortcut for AC / fixed issues with pressing operations without any number
|
28
|
+
|
29
|
+
## 1.0.0
|
30
|
+
|
31
|
+
- Initial calculator implementation
|
data/README.md
CHANGED
@@ -1,20 +1,47 @@
|
|
1
|
-
# <img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png"
|
1
|
+
# <img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=85 /> Glimmer Calculator
|
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)
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-cs-calculator.svg)](http://badge.fury.io/rb/glimmer-cs-calculator)
|
3
4
|
|
5
|
+
Glimmer Calculator on Mac
|
6
|
+
|
4
7
|
![Calculator](glimmer-cs-calculator-screenshot.png)
|
5
8
|
|
6
|
-
|
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
|
+
|
17
|
+
Glimmer Calculator on [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) (Web)
|
18
|
+
|
19
|
+
![Calculator](glimmer-cs-calculator-screenshot-opal.png)
|
20
|
+
|
21
|
+
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).
|
22
|
+
|
23
|
+
Architectural Pattern is MVP (Model View Presenter) thanks to [Glimmer data-binding](https://github.com/AndyObtiva/glimmer-dsl-swt#data-binding) support.
|
24
|
+
|
25
|
+
Glimmer Calculator was developed test-first following TDD (Test Driven Development) after [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding).
|
7
26
|
|
8
|
-
It is developed test-first following TDD (Test Driven Development).
|
9
27
|
Design Patterns discovered in the process were Presenter/Facade and Command Pattern.
|
10
28
|
|
11
|
-
|
29
|
+
Here are the calculator commands under the [models directory](lib/models/glimmer/calculator):
|
30
|
+
|
31
|
+
![Calculator Commands](glimmer-cs-calculator-command-pattern.png)
|
32
|
+
|
33
|
+
[<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)
|
34
|
+
|
35
|
+
[<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)
|
36
|
+
|
37
|
+
[<img alt="Glimmer Calculator Icon" src="glimmer-cs-calculator-icon.png" height=40 />Download Glimmer Calculator v1.1.3 GEM for Linux](#setup-instructions)
|
12
38
|
|
13
39
|
## Platforms
|
14
40
|
|
15
|
-
- Mac: Tested and [packaged](https://github.com/AndyObtiva/glimmer#packaging--distribution) for
|
16
|
-
-
|
17
|
-
-
|
41
|
+
- 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))
|
42
|
+
- 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))
|
43
|
+
- 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)
|
44
|
+
- Opal (Web): Tested with [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal)
|
18
45
|
|
19
46
|
## Development Environment Pre-requisites
|
20
47
|
|
@@ -43,7 +70,7 @@ To reuse Calculator as a Glimmer Custom Shell inside another Glimmer application
|
|
43
70
|
following to the application's `Gemfile`:
|
44
71
|
|
45
72
|
```
|
46
|
-
gem 'glimmer-cs-calculator', '1.
|
73
|
+
gem 'glimmer-cs-calculator', '1.1.3'
|
47
74
|
```
|
48
75
|
|
49
76
|
Run:
|
@@ -54,10 +81,13 @@ jruby -S bundle
|
|
54
81
|
|
55
82
|
And, then instantiate the Calculator custom shell in your Glimmer application via the `calculator` Glimmer DSL keyword.
|
56
83
|
|
84
|
+
## Feature Suggestions
|
85
|
+
|
86
|
+
[TODO.md](TODO.md)
|
87
|
+
|
57
88
|
## Change Log
|
58
89
|
|
59
|
-
|
60
|
-
- 1.0.0: Initial calculator implementation
|
90
|
+
[CHANGELOG.md](CHANGELOG.md)
|
61
91
|
|
62
92
|
## Contributing to glimmer-cs-calculator
|
63
93
|
|
@@ -71,5 +101,12 @@ And, then instantiate the Calculator custom shell in your Glimmer application vi
|
|
71
101
|
|
72
102
|
## Copyright
|
73
103
|
|
74
|
-
|
75
|
-
|
104
|
+
[MIT](https://opensource.org/licenses/MIT)
|
105
|
+
|
106
|
+
Copyright (c) 2020 Andy Maleh. See [LICENSE.txt](LICENSE.txt) for further details.
|
107
|
+
|
108
|
+
--
|
109
|
+
|
110
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library)
|
111
|
+
|
112
|
+
Gladiator icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.3
|
data/bin/calculator
CHANGED
data/bin/glimmer-cs-calculator
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: glimmer-cs-calculator 1.1.3 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "glimmer-cs-calculator".freeze
|
9
|
+
s.version = "1.1.3"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Andy Maleh".freeze]
|
14
|
+
s.date = "2020-10-15"
|
15
|
+
s.description = "Calculator - Glimmer Custom Shell".freeze
|
16
|
+
s.email = "andy.am@gmail.com".freeze
|
17
|
+
s.executables = ["glimmer-cs-calculator".freeze, "calculator".freeze]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
"CHANGELOG.md",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"VERSION",
|
27
|
+
"bin/calculator",
|
28
|
+
"bin/glimmer-cs-calculator",
|
29
|
+
"glimmer-cs-calculator.gemspec",
|
30
|
+
"lib/glimmer-cs-calculator.rb",
|
31
|
+
"lib/glimmer-cs-calculator/launch.rb",
|
32
|
+
"lib/models/glimmer/calculator/command.rb",
|
33
|
+
"lib/models/glimmer/calculator/command/all_clear.rb",
|
34
|
+
"lib/models/glimmer/calculator/command/equals.rb",
|
35
|
+
"lib/models/glimmer/calculator/command/number.rb",
|
36
|
+
"lib/models/glimmer/calculator/command/operation.rb",
|
37
|
+
"lib/models/glimmer/calculator/command/operation/add.rb",
|
38
|
+
"lib/models/glimmer/calculator/command/operation/divide.rb",
|
39
|
+
"lib/models/glimmer/calculator/command/operation/multiply.rb",
|
40
|
+
"lib/models/glimmer/calculator/command/operation/subtract.rb",
|
41
|
+
"lib/models/glimmer/calculator/command/point.rb",
|
42
|
+
"lib/models/glimmer/calculator/presenter.rb",
|
43
|
+
"lib/views/glimmer/calculator.rb",
|
44
|
+
"package/macosx/Glimmer Calculator.icns",
|
45
|
+
"package/windows/Glimmer Calculator.ico"
|
46
|
+
]
|
47
|
+
s.homepage = "http://github.com/AndyObtiva/glimmer-cs-calculator".freeze
|
48
|
+
s.licenses = ["MIT".freeze]
|
49
|
+
s.rubygems_version = "3.1.4".freeze
|
50
|
+
s.summary = "Calculator - Glimmer Custom Shell".freeze
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
s.specification_version = 4
|
54
|
+
end
|
55
|
+
|
56
|
+
if s.respond_to? :add_runtime_dependency then
|
57
|
+
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.2", "< 5.0.0.0"])
|
58
|
+
s.add_runtime_dependency(%q<easily_typable>.freeze, ["~> 1.0.2"])
|
59
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
61
|
+
s.add_development_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
62
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<glimmer-cs-gladiator>.freeze, [">= 0.3.0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.17.2.2", "< 5.0.0.0"])
|
66
|
+
s.add_dependency(%q<easily_typable>.freeze, ["~> 1.0.2"])
|
67
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
68
|
+
s.add_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
69
|
+
s.add_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
70
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
71
|
+
s.add_dependency(%q<glimmer-cs-gladiator>.freeze, [">= 0.3.0"])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -86,4 +86,14 @@ module Glimmer
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
Dir[File.join(File.dirname(__FILE__), 'command', '**', '*.rb')].each {|f| require(f)}
|
89
|
+
# Dir[File.join(File.dirname(__FILE__), 'command', '**', '*.rb')].each {|f| require(f)}
|
90
|
+
|
91
|
+
require 'models/glimmer/calculator/command/all_clear'
|
92
|
+
require 'models/glimmer/calculator/command/equals'
|
93
|
+
require 'models/glimmer/calculator/command/number'
|
94
|
+
require 'models/glimmer/calculator/command/operation'
|
95
|
+
require 'models/glimmer/calculator/command/point'
|
96
|
+
require 'models/glimmer/calculator/command/operation/add'
|
97
|
+
require 'models/glimmer/calculator/command/operation/divide'
|
98
|
+
require 'models/glimmer/calculator/command/operation/multiply'
|
99
|
+
require 'models/glimmer/calculator/command/operation/subtract'
|
@@ -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
|
|
@@ -29,10 +30,10 @@ module Glimmer
|
|
29
30
|
display_about_dialog
|
30
31
|
}
|
31
32
|
on_preferences {
|
32
|
-
|
33
|
+
# No need for preferences. Just display about dialog.
|
33
34
|
display_about_dialog
|
34
35
|
}
|
35
|
-
|
36
|
+
on_swt_keydown { |key_event|
|
36
37
|
char = key_event.character.chr rescue nil
|
37
38
|
@presenter.press(char)
|
38
39
|
}
|
@@ -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,192 +67,60 @@ 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
|
-
message_box
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
message_box.setMessage(message)
|
254
|
-
message_box.open
|
120
|
+
message_box(body_root) {
|
121
|
+
text 'About'
|
122
|
+
message "Glimmer - Calculator #{VERSION}\n#{LICENSE}"
|
123
|
+
}.open
|
255
124
|
end
|
256
125
|
|
257
126
|
end
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cs-calculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.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: 2020-
|
11
|
+
date: 2020-10-15 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:
|
18
|
+
version: 4.17.2.2
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 5.0.0.0
|
19
22
|
name: glimmer-dsl-swt
|
20
|
-
type: :runtime
|
21
23
|
prerelease: false
|
24
|
+
type: :runtime
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.17.2.2
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
32
|
+
version: 5.0.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
@@ -31,8 +37,8 @@ dependencies:
|
|
31
37
|
- !ruby/object:Gem::Version
|
32
38
|
version: 1.0.2
|
33
39
|
name: easily_typable
|
34
|
-
type: :runtime
|
35
40
|
prerelease: false
|
41
|
+
type: :runtime
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
@@ -45,8 +51,8 @@ dependencies:
|
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: 3.5.0
|
47
53
|
name: rspec
|
48
|
-
type: :development
|
49
54
|
prerelease: false
|
55
|
+
type: :development
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
@@ -59,13 +65,27 @@ dependencies:
|
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: 2.3.9
|
61
67
|
name: jeweler
|
62
|
-
type: :development
|
63
68
|
prerelease: false
|
69
|
+
type: :development
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - '='
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: 2.3.9
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2.0.5
|
81
|
+
name: warbler
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.0.5
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
requirement: !ruby/object:Gem::Requirement
|
71
91
|
requirements:
|
@@ -73,8 +93,8 @@ dependencies:
|
|
73
93
|
- !ruby/object:Gem::Version
|
74
94
|
version: '0'
|
75
95
|
name: simplecov
|
76
|
-
type: :development
|
77
96
|
prerelease: false
|
97
|
+
type: :development
|
78
98
|
version_requirements: !ruby/object:Gem::Requirement
|
79
99
|
requirements:
|
80
100
|
- - ">="
|
@@ -85,15 +105,15 @@ dependencies:
|
|
85
105
|
requirements:
|
86
106
|
- - ">="
|
87
107
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
108
|
+
version: 0.3.0
|
89
109
|
name: glimmer-cs-gladiator
|
90
|
-
type: :development
|
91
110
|
prerelease: false
|
111
|
+
type: :development
|
92
112
|
version_requirements: !ruby/object:Gem::Requirement
|
93
113
|
requirements:
|
94
114
|
- - ">="
|
95
115
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
116
|
+
version: 0.3.0
|
97
117
|
description: Calculator - Glimmer Custom Shell
|
98
118
|
email: andy.am@gmail.com
|
99
119
|
executables:
|
@@ -104,12 +124,15 @@ extra_rdoc_files:
|
|
104
124
|
- LICENSE.txt
|
105
125
|
- README.md
|
106
126
|
files:
|
127
|
+
- CHANGELOG.md
|
107
128
|
- LICENSE.txt
|
108
129
|
- README.md
|
109
130
|
- VERSION
|
110
131
|
- bin/calculator
|
111
132
|
- bin/glimmer-cs-calculator
|
133
|
+
- glimmer-cs-calculator.gemspec
|
112
134
|
- lib/glimmer-cs-calculator.rb
|
135
|
+
- lib/glimmer-cs-calculator/launch.rb
|
113
136
|
- lib/models/glimmer/calculator/command.rb
|
114
137
|
- lib/models/glimmer/calculator/command/all_clear.rb
|
115
138
|
- lib/models/glimmer/calculator/command/equals.rb
|
@@ -122,6 +145,8 @@ files:
|
|
122
145
|
- lib/models/glimmer/calculator/command/point.rb
|
123
146
|
- lib/models/glimmer/calculator/presenter.rb
|
124
147
|
- lib/views/glimmer/calculator.rb
|
148
|
+
- package/macosx/Glimmer Calculator.icns
|
149
|
+
- package/windows/Glimmer Calculator.ico
|
125
150
|
homepage: http://github.com/AndyObtiva/glimmer-cs-calculator
|
126
151
|
licenses:
|
127
152
|
- MIT
|
@@ -141,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
166
|
- !ruby/object:Gem::Version
|
142
167
|
version: '0'
|
143
168
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.1.4
|
145
170
|
signing_key:
|
146
171
|
specification_version: 4
|
147
172
|
summary: Calculator - Glimmer Custom Shell
|