wads 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/lib/wads/app.rb +10 -1
- data/lib/wads/data_structures.rb +14 -1
- data/lib/wads/version.rb +1 -1
- data/lib/wads/widgets.rb +7 -0
- data/media/SampleGraph.png +0 -0
- data/media/StocksSample.png +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14aff80a445145535994cd93357eae0a5ed6b3b5ae31c722ab043e92857dc645
|
4
|
+
data.tar.gz: 5cbcc5dea862306c0d9e572f8781b78f1da32e77947f130ef49670ff3f9ef8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e43b86028c31695ecee423d4cda06a59e09386f55cd08507058443373541f2dd2914dae44d0f6c5d2937688546b37986f0c7cc66f7ae4f24d749d4457e390f3
|
7
|
+
data.tar.gz: 954a9e628886be15e7e91cdf3a7522c845480e48b49cd0c01666d91fb695f6885c06775933d1f36ff64ce3db75e508a2f2d37e20b8067fa8dce442dead4aa32d
|
data/README.md
CHANGED
@@ -27,6 +27,9 @@ cd ruby-wads
|
|
27
27
|
This will run the sample NASDAQ stocks analysis that features the use of the
|
28
28
|
Stats class, and a table Gosu widget used to display the results of the analysis.
|
29
29
|
|
30
|
+

|
31
|
+
|
32
|
+
|
30
33
|
You can also see the graph capabilities by running the Star Wars analysis example.
|
31
34
|
This uses a data set that captures all character interactions within Episode 4.
|
32
35
|
|
@@ -38,6 +41,34 @@ There is also a sample Graph display using the following command.
|
|
38
41
|
```
|
39
42
|
./run-sample-app -g
|
40
43
|
```
|
44
|
+
Note that you can construct graphs in one of two ways. The first approach uses Nodes directly.
|
45
|
+
```
|
46
|
+
root = Node.new("a")
|
47
|
+
b = root.add("b")
|
48
|
+
b.add("d")
|
49
|
+
b.add("e").add("f")
|
50
|
+
root.add("c")
|
51
|
+
Graph.new(root)
|
52
|
+
```
|
53
|
+
The second approach uses an overarching Graph object.
|
54
|
+
```
|
55
|
+
g = Graph.new
|
56
|
+
g.add("a")
|
57
|
+
g.add("b")
|
58
|
+
g.add("c")
|
59
|
+
g.add("d")
|
60
|
+
g.add("e")
|
61
|
+
g.add("f")
|
62
|
+
g.connect("a", "b")
|
63
|
+
g.connect("a", "c")
|
64
|
+
g.connect("b", "d")
|
65
|
+
g.connect("b", "e")
|
66
|
+
g.connect("e", "f")
|
67
|
+
```
|
68
|
+
|
69
|
+
Currently, the Graph object is used by the Graph Widget for display. For the code above, this appears by default as follows:
|
70
|
+
|
71
|
+

|
41
72
|
|
42
73
|
## References
|
43
74
|
|
data/lib/wads/app.rb
CHANGED
@@ -49,7 +49,7 @@ class WadsSampleApp < Gosu::Window
|
|
49
49
|
process_lottery_data
|
50
50
|
|
51
51
|
elsif opts[:graph]
|
52
|
-
graph = create_test_graph
|
52
|
+
graph = create_test_graph #_using_nodes
|
53
53
|
if not opts[:text]
|
54
54
|
@display_widget = SampleGraphDisplay.new(@small_font, graph)
|
55
55
|
show
|
@@ -204,6 +204,15 @@ class WadsSampleApp < Gosu::Window
|
|
204
204
|
g.connect("e", "f")
|
205
205
|
g
|
206
206
|
end
|
207
|
+
|
208
|
+
def create_test_graph_using_nodes
|
209
|
+
root = Node.new("a")
|
210
|
+
b = root.add("b")
|
211
|
+
b.add("d")
|
212
|
+
b.add("e").add("f")
|
213
|
+
root.add("c")
|
214
|
+
Graph.new(root)
|
215
|
+
end
|
207
216
|
end
|
208
217
|
|
209
218
|
class SampleStocksDisplay < Widget
|
data/lib/wads/data_structures.rb
CHANGED
@@ -271,6 +271,14 @@ module Wads
|
|
271
271
|
@visited = false
|
272
272
|
@tags = tags
|
273
273
|
end
|
274
|
+
|
275
|
+
def add(name, value = nil, tags = {})
|
276
|
+
add_output_node(Node.new(name, value, tags))
|
277
|
+
end
|
278
|
+
|
279
|
+
def children
|
280
|
+
@outputs
|
281
|
+
end
|
274
282
|
|
275
283
|
def add_child(name, value)
|
276
284
|
add_output(name, value)
|
@@ -400,9 +408,14 @@ module Wads
|
|
400
408
|
attr_accessor :node_list
|
401
409
|
attr_accessor :node_map
|
402
410
|
|
403
|
-
def initialize
|
411
|
+
def initialize(root_node = nil)
|
404
412
|
@node_list = []
|
405
413
|
@node_map = {}
|
414
|
+
if root_node
|
415
|
+
root_node.visit do |n|
|
416
|
+
add_node(n)
|
417
|
+
end
|
418
|
+
end
|
406
419
|
end
|
407
420
|
|
408
421
|
def add(name, value = nil, tags = {})
|
data/lib/wads/version.rb
CHANGED
data/lib/wads/widgets.rb
CHANGED
@@ -946,6 +946,9 @@ module Wads
|
|
946
946
|
|
947
947
|
def is_row_selected(mouse_y)
|
948
948
|
row_number = determine_row_number(mouse_y)
|
949
|
+
if row_number.nil?
|
950
|
+
return false
|
951
|
+
end
|
949
952
|
@selected_rows.include?(@current_row + row_number)
|
950
953
|
end
|
951
954
|
|
@@ -995,6 +998,9 @@ module Wads
|
|
995
998
|
def handle_mouse_down mouse_x, mouse_y
|
996
999
|
if contains_click(mouse_x, mouse_y)
|
997
1000
|
row_number = determine_row_number(mouse_y)
|
1001
|
+
if row_number.nil?
|
1002
|
+
return WidgetResult.new(false)
|
1003
|
+
end
|
998
1004
|
# First check if its the delete button that got this
|
999
1005
|
delete_this_row = false
|
1000
1006
|
@delete_buttons.each do |db|
|
@@ -1423,6 +1429,7 @@ module Wads
|
|
1423
1429
|
@rendered_nodes.values.each do |vn|
|
1424
1430
|
vn.draw
|
1425
1431
|
end
|
1432
|
+
|
1426
1433
|
# Draw the connections between nodes
|
1427
1434
|
@visible_data_nodes.values.each do |data_node|
|
1428
1435
|
data_node.outputs.each do |connected_data_node|
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dbroemme
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -77,6 +77,8 @@ files:
|
|
77
77
|
- lib/wads/version.rb
|
78
78
|
- lib/wads/widgets.rb
|
79
79
|
- media/Banner.png
|
80
|
+
- media/SampleGraph.png
|
81
|
+
- media/StocksSample.png
|
80
82
|
- media/WadsScreenshot.png
|
81
83
|
- run-sample-app
|
82
84
|
- sample_app.rb
|