vedeu 0.4.56 → 0.4.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/borders_app.rb +22 -24
- data/examples/colours_app.rb +4 -6
- data/examples/configuration_app.rb +5 -7
- data/examples/drb_app.rb +1 -1
- data/examples/focus_app.rb +1 -1
- data/examples/geometry_app.rb +8 -10
- data/examples/hello_world.rb +4 -6
- data/examples/material_colours_app.rb +19 -9
- data/examples/material_colours_app_20150721.svg +2285 -0
- data/examples/panel_app.rb +6 -8
- data/examples/typed_commands/typed_commands_app.rb +15 -17
- data/examples/view_templates_app/view_templates_app.rb +1 -1
- data/lib/vedeu/all.rb +82 -10
- data/lib/vedeu/api.rb +34 -14
- data/lib/vedeu/application.rb +0 -1
- data/lib/vedeu/application/application_controller.rb +0 -1
- data/lib/vedeu/application/application_helper.rb +0 -1
- data/lib/vedeu/application/application_view.rb +0 -1
- data/lib/vedeu/application/controller.rb +0 -1
- data/lib/vedeu/application/helper.rb +0 -1
- data/lib/vedeu/application/view.rb +0 -1
- data/lib/vedeu/bindings/all.rb +0 -1
- data/lib/vedeu/bindings/visibility.rb +2 -19
- data/lib/vedeu/buffers/buffer.rb +0 -1
- data/lib/vedeu/buffers/display_buffer.rb +0 -1
- data/lib/vedeu/cli/generator/application.rb +0 -1
- data/lib/vedeu/cli/generator/helpers.rb +0 -1
- data/lib/vedeu/cli/generator/view.rb +0 -1
- data/lib/vedeu/colours/background.rb +0 -1
- data/lib/vedeu/colours/colour.rb +0 -1
- data/lib/vedeu/colours/colour_translator.rb +0 -1
- data/lib/vedeu/colours/foreground.rb +0 -1
- data/lib/vedeu/common.rb +0 -1
- data/lib/vedeu/configuration/configuration.rb +0 -1
- data/lib/vedeu/cursor/cursor.rb +0 -1
- data/lib/vedeu/cursor/move.rb +0 -1
- data/lib/vedeu/cursor/refresh_cursor.rb +0 -1
- data/lib/vedeu/cursor/reposition.rb +0 -1
- data/lib/vedeu/distributed/client.rb +2 -0
- data/lib/vedeu/distributed/server.rb +2 -0
- data/lib/vedeu/distributed/uri.rb +2 -1
- data/lib/vedeu/exceptions.rb +0 -7
- data/lib/vedeu/geometry/area.rb +0 -1
- data/lib/vedeu/geometry/coordinate.rb +0 -1
- data/lib/vedeu/geometry/dimension.rb +14 -1
- data/lib/vedeu/geometry/geometry.rb +0 -1
- data/lib/vedeu/geometry/index_position.rb +0 -1
- data/lib/vedeu/geometry/position.rb +0 -1
- data/lib/vedeu/geometry/position_index.rb +0 -1
- data/lib/vedeu/geometry/position_validator.rb +0 -1
- data/lib/vedeu/input/input.rb +0 -1
- data/lib/vedeu/input/key.rb +0 -1
- data/lib/vedeu/input/keymap.rb +0 -1
- data/lib/vedeu/input/mapper.rb +0 -1
- data/lib/vedeu/log.rb +0 -1
- data/lib/vedeu/main_loop.rb +0 -1
- data/lib/vedeu/models/cell.rb +0 -1
- data/lib/vedeu/models/char.rb +0 -1
- data/lib/vedeu/models/composition.rb +0 -1
- data/lib/vedeu/models/escape.rb +0 -1
- data/lib/vedeu/models/focus.rb +0 -1
- data/lib/vedeu/models/group.rb +37 -15
- data/lib/vedeu/models/interface.rb +1 -2
- data/lib/vedeu/models/line.rb +0 -1
- data/lib/vedeu/models/menu.rb +0 -1
- data/lib/vedeu/models/stream.rb +0 -1
- data/lib/vedeu/models/toggleable.rb +21 -11
- data/lib/vedeu/null/all.rb +0 -1
- data/lib/vedeu/null/border.rb +0 -1
- data/lib/vedeu/null/buffer.rb +0 -1
- data/lib/vedeu/null/generic.rb +0 -1
- data/lib/vedeu/null/geometry.rb +0 -1
- data/lib/vedeu/null/interface.rb +0 -1
- data/lib/vedeu/output/border.rb +0 -1
- data/lib/vedeu/output/clear/named_group.rb +3 -2
- data/lib/vedeu/output/clear/named_interface.rb +2 -1
- data/lib/vedeu/output/compressor.rb +0 -1
- data/lib/vedeu/output/html_char.rb +0 -1
- data/lib/vedeu/output/output.rb +0 -1
- data/lib/vedeu/output/presentation.rb +0 -1
- data/lib/vedeu/output/refresh_group.rb +0 -1
- data/lib/vedeu/output/render_border.rb +0 -1
- data/lib/vedeu/output/renderers/all.rb +0 -1
- data/lib/vedeu/output/renderers/escape_sequence.rb +0 -1
- data/lib/vedeu/output/renderers/file.rb +0 -1
- data/lib/vedeu/output/renderers/html.rb +0 -1
- data/lib/vedeu/output/renderers/json.rb +0 -1
- data/lib/vedeu/output/renderers/null.rb +0 -1
- data/lib/vedeu/output/renderers/renderer_options.rb +0 -1
- data/lib/vedeu/output/renderers/terminal.rb +0 -1
- data/lib/vedeu/output/renderers/text.rb +0 -1
- data/lib/vedeu/output/style.rb +0 -1
- data/lib/vedeu/output/text.rb +0 -1
- data/lib/vedeu/output/viewport.rb +0 -1
- data/lib/vedeu/output/virtual_terminal.rb +0 -1
- data/lib/vedeu/output/wordwrap.rb +0 -1
- data/lib/vedeu/repositories/collection.rb +0 -7
- data/lib/vedeu/repositories/model.rb +0 -1
- data/lib/vedeu/repositories/registerable.rb +0 -1
- data/lib/vedeu/repositories/repository.rb +0 -1
- data/lib/vedeu/repositories/store.rb +0 -1
- data/lib/vedeu/templating/directive.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +1 -1
- data/lib/vedeu/templating/preprocessor.rb +1 -1
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/traps.rb +0 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +8 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +5 -0
- data/test/lib/vedeu/cursor/reposition_test.rb +5 -5
- data/test/lib/vedeu/models/group_test.rb +4 -3
- data/test/lib/vedeu/models/interface_test.rb +15 -1
- data/test/lib/vedeu/null/interface_test.rb +7 -21
- data/test/lib/vedeu/output/esc_test.rb +105 -109
- metadata +3 -15
- data/lib/vedeu/application/all.rb +0 -6
- data/lib/vedeu/buffers/all.rb +0 -3
- data/lib/vedeu/cli/all.rb +0 -1
- data/lib/vedeu/colours/all.rb +0 -7
- data/lib/vedeu/configuration/all.rb +0 -3
- data/lib/vedeu/cursor/all.rb +0 -7
- data/lib/vedeu/distributed/all.rb +0 -15
- data/lib/vedeu/events/all.rb +0 -5
- data/lib/vedeu/geometry/all.rb +0 -14
- data/lib/vedeu/models/all.rb +0 -16
- data/lib/vedeu/output/all.rb +0 -21
- data/lib/vedeu/output/clear/all.rb +0 -13
- data/lib/vedeu/templating/all.rb +0 -13
data/lib/vedeu/models/group.rb
CHANGED
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# Interfaces can be associated with one another by being members of the same
|
6
6
|
# Group. A Group is a collection of interface names.
|
7
7
|
#
|
8
|
-
# @api private
|
9
8
|
class Group
|
10
9
|
|
11
10
|
include Vedeu::Model
|
@@ -17,20 +16,22 @@ module Vedeu
|
|
17
16
|
|
18
17
|
# Return a new instance of Vedeu::Group.
|
19
18
|
#
|
19
|
+
# @note
|
20
|
+
# A group being visible or not may not necessarily mean the members are of
|
21
|
+
# the same state.
|
22
|
+
#
|
20
23
|
# @param attributes [Hash]
|
21
|
-
# @option attributes members [
|
24
|
+
# @option attributes members [Set] A collection of names of interfaces
|
22
25
|
# belonging to this group.
|
23
26
|
# @option attributes name [String] The name of the group.
|
24
27
|
# @option attributes repository [Vedeu::Repository] The storage for all
|
25
28
|
# Group models.
|
29
|
+
# @option attributes visible [Boolean] Whether the group is visible or not.
|
26
30
|
# @return [Vedeu::Group]
|
27
31
|
def initialize(attributes = {})
|
28
32
|
@attributes = defaults.merge!(attributes)
|
29
33
|
|
30
|
-
@
|
31
|
-
@name = @attributes[:name]
|
32
|
-
@repository = @attributes[:repository]
|
33
|
-
@visible = @attributes[:visible]
|
34
|
+
@attributes.each { |key, value| instance_variable_set("@#{key}", value) }
|
34
35
|
end
|
35
36
|
|
36
37
|
# Add a member to the group by name.
|
@@ -38,15 +39,33 @@ module Vedeu
|
|
38
39
|
# @param member [String]
|
39
40
|
# @return [Vedeu::Group]
|
40
41
|
def add(member)
|
41
|
-
|
42
|
+
attrs = attributes.merge!(members: members.add(member))
|
42
43
|
|
43
|
-
Vedeu::Group.new(
|
44
|
+
Vedeu::Group.new(attrs).store
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns the attributes of the group.
|
48
|
+
#
|
49
|
+
# @return [Hash<Symbol => void>]
|
50
|
+
def attributes
|
51
|
+
{
|
52
|
+
name: name,
|
53
|
+
members: members,
|
54
|
+
repository: repository,
|
55
|
+
visible: visible,
|
56
|
+
}
|
44
57
|
end
|
45
58
|
|
46
59
|
# Hide the named group of interfaces, or without a name, the group of the
|
47
|
-
# currently focussed interface.
|
60
|
+
# currently focussed interface. Useful for hiding part of that which is
|
61
|
+
# currently displaying in the terminal.
|
62
|
+
#
|
63
|
+
# @note
|
64
|
+
# The action of showing a group will effectively clear the terminal and
|
65
|
+
# show the new group, therefore hiding the group may not be necessary.
|
48
66
|
#
|
49
67
|
# @example
|
68
|
+
# Vedeu.trigger(:_hide_group_, name)
|
50
69
|
# Vedeu.hide_group(name)
|
51
70
|
#
|
52
71
|
# @return [Vedeu::Group]
|
@@ -58,11 +77,11 @@ module Vedeu
|
|
58
77
|
self
|
59
78
|
end
|
60
79
|
|
61
|
-
# Return the members
|
80
|
+
# Return the members of the group.
|
62
81
|
#
|
63
82
|
# @return [Set]
|
64
83
|
def members
|
65
|
-
@members
|
84
|
+
@_members ||= Set.new(@members)
|
66
85
|
end
|
67
86
|
|
68
87
|
# Remove a member from the group by name.
|
@@ -70,22 +89,25 @@ module Vedeu
|
|
70
89
|
# @param member [String]
|
71
90
|
# @return [Vedeu::Group]
|
72
91
|
def remove(member)
|
73
|
-
|
92
|
+
attrs = attributes.merge!(members: members.delete(member))
|
74
93
|
|
75
|
-
Vedeu::Group.new(
|
94
|
+
Vedeu::Group.new(attrs).store
|
76
95
|
end
|
77
96
|
|
78
97
|
# Remove all members from the group.
|
79
98
|
#
|
80
99
|
# @return [Vedeu::Group]
|
81
100
|
def reset
|
82
|
-
|
101
|
+
attrs = defaults.merge!(name: name)
|
102
|
+
|
103
|
+
Vedeu::Group.new(attrs).store
|
83
104
|
end
|
84
105
|
|
85
106
|
# Show the named group of interfaces, or without a name, the group of the
|
86
107
|
# currently focussed interface.
|
87
108
|
#
|
88
109
|
# @example
|
110
|
+
# Vedeu.trigger(:_show_group_, name)
|
89
111
|
# Vedeu.show_group(name)
|
90
112
|
#
|
91
113
|
# @return [Vedeu::Group]
|
@@ -104,7 +126,7 @@ module Vedeu
|
|
104
126
|
# @return [Hash]
|
105
127
|
def defaults
|
106
128
|
{
|
107
|
-
members:
|
129
|
+
members: Set.new,
|
108
130
|
name: '',
|
109
131
|
repository: Vedeu.groups,
|
110
132
|
visible: true,
|
@@ -10,7 +10,6 @@ module Vedeu
|
|
10
10
|
# {Vedeu::Geometry}. It is a container for {Vedeu::Line} and {Vedeu::Stream}
|
11
11
|
# objects.
|
12
12
|
#
|
13
|
-
# @api private
|
14
13
|
class Interface
|
15
14
|
|
16
15
|
include Vedeu::Model
|
@@ -134,8 +133,8 @@ module Vedeu
|
|
134
133
|
|
135
134
|
output = [
|
136
135
|
Vedeu::Clear::NamedInterface.render(name),
|
137
|
-
Vedeu.borders.by_name(name).render,
|
138
136
|
Vedeu::Viewport.render(self),
|
137
|
+
Vedeu.borders.by_name(name).render,
|
139
138
|
]
|
140
139
|
|
141
140
|
Vedeu.trigger(:_show_cursor_, name)
|
data/lib/vedeu/models/line.rb
CHANGED
data/lib/vedeu/models/menu.rb
CHANGED
data/lib/vedeu/models/stream.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
#
|
3
|
+
# This module provides behaviour for certain classes which can be toggled
|
4
|
+
# between being shown and hidden.
|
5
|
+
#
|
6
|
+
# Currently using this are: {Vedeu::Cursor}, {Vedeu::Group} and
|
7
|
+
# {Vedeu::Interface}.
|
4
8
|
#
|
5
|
-
# @api private
|
6
9
|
module Toggleable
|
7
10
|
|
8
11
|
# @!attribute [rw] visible
|
@@ -10,6 +13,8 @@ module Vedeu
|
|
10
13
|
attr_accessor :visible
|
11
14
|
alias_method :visible?, :visible
|
12
15
|
|
16
|
+
# Set the visible state to false and store the model.
|
17
|
+
#
|
13
18
|
# @return [FalseClass]
|
14
19
|
def hide
|
15
20
|
@visible = false
|
@@ -17,6 +22,8 @@ module Vedeu
|
|
17
22
|
store
|
18
23
|
end
|
19
24
|
|
25
|
+
# Set the visible state to true and store the model.
|
26
|
+
#
|
20
27
|
# @return [TrueClass]
|
21
28
|
def show
|
22
29
|
@visible = true
|
@@ -24,6 +31,8 @@ module Vedeu
|
|
24
31
|
store
|
25
32
|
end
|
26
33
|
|
34
|
+
# Toggle the visible state and store the model.
|
35
|
+
#
|
27
36
|
# @return [FalseClass|TrueClass]
|
28
37
|
def toggle
|
29
38
|
if visible?
|
@@ -35,11 +44,12 @@ module Vedeu
|
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
38
|
-
#
|
47
|
+
# Provide class methods to models to allow the visibility to be changed.
|
39
48
|
#
|
40
|
-
# @api private
|
41
49
|
module ClassMethods
|
42
50
|
|
51
|
+
# Hides the model.
|
52
|
+
#
|
43
53
|
# @param name [String]
|
44
54
|
# @return [void]
|
45
55
|
def hide(name = nil)
|
@@ -49,6 +59,8 @@ module Vedeu
|
|
49
59
|
alias_method :hide_group, :hide
|
50
60
|
alias_method :hide_interface, :hide
|
51
61
|
|
62
|
+
# Shows the model.
|
63
|
+
#
|
52
64
|
# @param name [String]
|
53
65
|
# @return [void]
|
54
66
|
def show(name = nil)
|
@@ -58,6 +70,8 @@ module Vedeu
|
|
58
70
|
alias_method :show_group, :show
|
59
71
|
alias_method :show_interface, :show
|
60
72
|
|
73
|
+
# Toggles the visibility of the model.
|
74
|
+
#
|
61
75
|
# @param name [String]
|
62
76
|
# @return [void]
|
63
77
|
def toggle(name = nil)
|
@@ -69,17 +83,13 @@ module Vedeu
|
|
69
83
|
|
70
84
|
private
|
71
85
|
|
86
|
+
# Fetch the model by name.
|
87
|
+
#
|
72
88
|
# @param name [String]
|
73
89
|
# @param klass [void] The repository of the model.
|
74
90
|
# @return [void]
|
75
91
|
def model_by_name(name = nil, klass)
|
76
|
-
klass.by_name(
|
77
|
-
end
|
78
|
-
|
79
|
-
# @param name [String]
|
80
|
-
# @return [void]
|
81
|
-
def model_name(name = nil)
|
82
|
-
name || Vedeu.focus
|
92
|
+
klass.by_name(name || Vedeu.focus)
|
83
93
|
end
|
84
94
|
|
85
95
|
end # ClassMethods
|
data/lib/vedeu/null/all.rb
CHANGED
data/lib/vedeu/null/border.rb
CHANGED
data/lib/vedeu/null/buffer.rb
CHANGED
data/lib/vedeu/null/generic.rb
CHANGED
data/lib/vedeu/null/geometry.rb
CHANGED
data/lib/vedeu/null/interface.rb
CHANGED
data/lib/vedeu/output/border.rb
CHANGED
data/lib/vedeu/output/output.rb
CHANGED