shoes-core 4.0.0.pre10 → 4.0.0.pre11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shoes/color.rb +1 -1
- data/lib/shoes/common/inspect.rb +1 -1
- data/lib/shoes/common/remove.rb +3 -3
- data/lib/shoes/common/state.rb +1 -1
- data/lib/shoes/console.rb +43 -9
- data/lib/shoes/core/version.rb +1 -1
- data/lib/shoes/dimension.rb +2 -2
- data/lib/shoes/download.rb +2 -2
- data/lib/shoes/mock/app.rb +8 -0
- data/lib/shoes/mock/dialog.rb +4 -0
- data/lib/shoes/slot.rb +1 -1
- data/lib/shoes/ui/picker.rb +1 -1
- data/lib/shoes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4b04df9c670f569189c22acf3d710762cb070648e055b8caa4df59bd9ee54fc
|
4
|
+
data.tar.gz: c3acdfe4ebb5e220cfa34f1c23ca267805c54e0e1140ecd84f0259dfea5fc4aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7b39734d1c215b6d74c9b59c4f3ad6a91f472a7f72dad13881ac05811ced22f44747d021a84ec262e9dff7d0fc72a7ec16b118b4169f7c0358f121c786ab38
|
7
|
+
data.tar.gz: ff7a77a85ea9f3c2c73c15ef602a9dda20d90bd95975d4ab2aa35536cdb6383abad68004ec2459b3ef8bb1ce50c85769e5e09c207ac0fa034281b92f65ecd719
|
data/lib/shoes/color.rb
CHANGED
data/lib/shoes/common/inspect.rb
CHANGED
data/lib/shoes/common/remove.rb
CHANGED
@@ -3,10 +3,10 @@ class Shoes
|
|
3
3
|
module Common
|
4
4
|
module Remove
|
5
5
|
def remove
|
6
|
-
parent
|
7
|
-
gui
|
6
|
+
parent&.remove_child self
|
7
|
+
gui&.remove if gui&.respond_to?(:remove)
|
8
8
|
|
9
|
-
@app
|
9
|
+
@app&.remove_mouse_hover_control(self)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/shoes/common/state.rb
CHANGED
data/lib/shoes/console.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class Shoes
|
3
3
|
class Console
|
4
|
+
attr_reader :messages, :message_stacks
|
5
|
+
|
4
6
|
def initialize
|
5
7
|
@messages = []
|
8
|
+
@message_stacks = []
|
6
9
|
end
|
7
10
|
|
8
11
|
def show
|
@@ -18,12 +21,11 @@ class Shoes
|
|
18
21
|
end
|
19
22
|
|
20
23
|
def create_app
|
21
|
-
# Capture
|
22
|
-
|
24
|
+
# Capture ourself for access inside our app block
|
25
|
+
console = self
|
23
26
|
|
24
27
|
@app = Shoes.app do
|
25
|
-
@
|
26
|
-
@message_stacks = []
|
28
|
+
@console = console
|
27
29
|
|
28
30
|
stack do
|
29
31
|
flow do
|
@@ -32,11 +34,16 @@ class Shoes
|
|
32
34
|
tagline "Shoes Console", stroke: white
|
33
35
|
end
|
34
36
|
|
35
|
-
button "
|
36
|
-
@
|
37
|
+
button "Copy", margin: 6, width: 80, height: 40, right: 170 do
|
38
|
+
@console.copy
|
39
|
+
end
|
40
|
+
|
41
|
+
button "Save", margin: 6, width: 80, height: 40, right: 90 do
|
42
|
+
@console.save
|
43
|
+
end
|
37
44
|
|
38
|
-
|
39
|
-
@
|
45
|
+
button "Clear", margin: 6, width: 80, height: 40, right: 10 do
|
46
|
+
@console.clear
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
@@ -73,7 +80,7 @@ class Shoes
|
|
73
80
|
|
74
81
|
@app.instance_exec do
|
75
82
|
append do
|
76
|
-
@message_stacks << stack do
|
83
|
+
@console.message_stacks << stack do
|
77
84
|
background "#f1f5e1" if index.even?
|
78
85
|
background rgb(220, 220, 220) if index.odd?
|
79
86
|
para type, stroke: blue
|
@@ -87,5 +94,32 @@ class Shoes
|
|
87
94
|
end
|
88
95
|
end
|
89
96
|
end
|
97
|
+
|
98
|
+
def formatted_messages
|
99
|
+
@messages.inject("") do |memo, (type, message)|
|
100
|
+
"#{memo}#{type.to_s.capitalize}\n #{message}\n\n"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def copy
|
105
|
+
@app.clipboard = formatted_messages if messages.any?
|
106
|
+
end
|
107
|
+
|
108
|
+
def save
|
109
|
+
filename = @app.ask_save_file
|
110
|
+
|
111
|
+
if filename
|
112
|
+
File.open(filename, "w") do |f|
|
113
|
+
f.write(formatted_messages)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def clear
|
119
|
+
messages.clear
|
120
|
+
|
121
|
+
message_stacks.each(&:remove)
|
122
|
+
message_stacks.clear
|
123
|
+
end
|
90
124
|
end
|
91
125
|
end
|
data/lib/shoes/core/version.rb
CHANGED
data/lib/shoes/dimension.rb
CHANGED
@@ -182,7 +182,7 @@ class Shoes
|
|
182
182
|
end
|
183
183
|
|
184
184
|
def negative?(result)
|
185
|
-
result && result
|
185
|
+
result && result.negative?
|
186
186
|
end
|
187
187
|
|
188
188
|
def calculate_negative(result)
|
@@ -233,7 +233,7 @@ class Shoes
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def adjust_start_for_center(value)
|
236
|
-
value - extent / 2 if extent && extent
|
236
|
+
value - extent / 2 if extent && extent.positive?
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
data/lib/shoes/download.rb
CHANGED
@@ -56,7 +56,7 @@ class Shoes
|
|
56
56
|
|
57
57
|
# needed for the specs (jay multi threading and specs)
|
58
58
|
def join_thread
|
59
|
-
@thread
|
59
|
+
@thread&.join
|
60
60
|
end
|
61
61
|
|
62
62
|
def percent
|
@@ -65,7 +65,7 @@ class Shoes
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def abort
|
68
|
-
@thread
|
68
|
+
@thread&.exit
|
69
69
|
end
|
70
70
|
|
71
71
|
# shoes 3 compatibility
|
data/lib/shoes/mock/app.rb
CHANGED
data/lib/shoes/mock/dialog.rb
CHANGED
data/lib/shoes/slot.rb
CHANGED
@@ -89,7 +89,7 @@ class Shoes
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def bump_parent_current_position(height_delta)
|
92
|
-
return unless height_delta
|
92
|
+
return unless height_delta.positive?
|
93
93
|
return unless parent.respond_to?(:bump_current_position)
|
94
94
|
|
95
95
|
parent.bump_current_position(self, height_delta)
|
data/lib/shoes/ui/picker.rb
CHANGED
data/lib/shoes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoes-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.pre11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Shoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Shoes is the best little GUI toolkit for Ruby. Shoes makes building for
|
14
14
|
Mac, Windows, and Linux super simple. This is the DSL for writing your app. You'll
|