vedeu 0.4.32 → 0.4.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/vedeu +3 -0
- data/docs/dsl.md +36 -2
- data/examples/borders_app.rb +5 -0
- data/examples/colours_app.rb +5 -0
- data/examples/configuration_app.rb +5 -0
- data/examples/drb_app.rb +4 -0
- data/examples/focus_app.rb +5 -0
- data/examples/geometry_app.rb +4 -0
- data/examples/hello_world.rb +5 -0
- data/examples/material_colours_app.rb +15 -8
- data/examples/panel_app.rb +5 -0
- data/examples/typed_commands/typed_commands_app.rb +4 -4
- data/examples/view_templates_app/view_templates_app.rb +4 -4
- data/lib/vedeu/application.rb +2 -0
- data/lib/vedeu/bindings.rb +1 -0
- data/lib/vedeu/buffers/buffer.rb +2 -0
- data/lib/vedeu/buffers/display_buffer.rb +1 -0
- data/lib/vedeu/configuration/api.rb +2 -0
- data/lib/vedeu/configuration/cli.rb +2 -0
- data/lib/vedeu/configuration/configuration.rb +1 -0
- data/lib/vedeu/cursor/cursor.rb +2 -0
- data/lib/vedeu/cursor/move.rb +2 -0
- data/lib/vedeu/cursor/refresh_cursor.rb +2 -0
- data/lib/vedeu/debug.rb +1 -0
- data/lib/vedeu/distributed/uri.rb +2 -0
- data/lib/vedeu/dsl/all.rb +1 -0
- data/lib/vedeu/dsl/border.rb +3 -0
- data/lib/vedeu/dsl/composition.rb +1 -0
- data/lib/vedeu/dsl/geometry.rb +1 -0
- data/lib/vedeu/dsl/group.rb +2 -0
- data/lib/vedeu/dsl/interface.rb +22 -1
- data/lib/vedeu/dsl/presentation.rb +0 -1
- data/lib/vedeu/dsl/text.rb +1 -0
- data/lib/vedeu/dsl/use.rb +3 -1
- data/lib/vedeu/events/event.rb +2 -0
- data/lib/vedeu/events/trigger.rb +2 -0
- data/lib/vedeu/geometry/area.rb +2 -0
- data/lib/vedeu/geometry/coordinate.rb +2 -0
- data/lib/vedeu/geometry/dimension.rb +2 -0
- data/lib/vedeu/geometry/geometry.rb +1 -0
- data/lib/vedeu/geometry/grid.rb +2 -0
- data/lib/vedeu/geometry/index_position.rb +2 -0
- data/lib/vedeu/geometry/position.rb +2 -0
- data/lib/vedeu/geometry/position_index.rb +2 -0
- data/lib/vedeu/geometry/position_validator.rb +2 -0
- data/lib/vedeu/input/input.rb +2 -0
- data/lib/vedeu/input/key.rb +2 -0
- data/lib/vedeu/input/keymap.rb +2 -0
- data/lib/vedeu/input/mapper.rb +2 -0
- data/lib/vedeu/main_loop.rb +1 -0
- data/lib/vedeu/models/cell.rb +2 -0
- data/lib/vedeu/models/char.rb +2 -0
- data/lib/vedeu/models/composition.rb +2 -0
- data/lib/vedeu/models/escape_char.rb +2 -0
- data/lib/vedeu/models/focus.rb +1 -0
- data/lib/vedeu/models/group.rb +2 -0
- data/lib/vedeu/models/interface.rb +2 -0
- data/lib/vedeu/models/line.rb +2 -0
- data/lib/vedeu/models/menu.rb +2 -0
- data/lib/vedeu/models/panel.rb +2 -0
- data/lib/vedeu/models/stream.rb +2 -0
- data/lib/vedeu/null/all.rb +2 -0
- data/lib/vedeu/null/border.rb +2 -0
- data/lib/vedeu/null/buffer.rb +2 -0
- data/lib/vedeu/null/generic.rb +2 -0
- data/lib/vedeu/null/geometry.rb +2 -0
- data/lib/vedeu/null/interface.rb +2 -0
- data/lib/vedeu/output/background.rb +2 -0
- data/lib/vedeu/output/border.rb +2 -0
- data/lib/vedeu/output/clear.rb +2 -0
- data/lib/vedeu/output/colour.rb +1 -0
- data/lib/vedeu/output/compressor.rb +2 -0
- data/lib/vedeu/output/esc.rb +1 -0
- data/lib/vedeu/output/foreground.rb +2 -0
- data/lib/vedeu/output/html_char.rb +2 -0
- data/lib/vedeu/output/output.rb +2 -0
- data/lib/vedeu/output/presentation.rb +1 -0
- data/lib/vedeu/output/refresh.rb +1 -0
- data/lib/vedeu/output/renderers/all.rb +3 -0
- data/lib/vedeu/output/renderers/escape_sequence.rb +2 -0
- data/lib/vedeu/output/renderers/file.rb +2 -0
- data/lib/vedeu/output/renderers/html.rb +2 -0
- data/lib/vedeu/output/renderers/json.rb +2 -0
- data/lib/vedeu/output/renderers/null.rb +2 -0
- data/lib/vedeu/output/renderers/terminal.rb +2 -0
- data/lib/vedeu/output/renderers/text.rb +2 -0
- data/lib/vedeu/output/style.rb +1 -0
- data/lib/vedeu/output/text.rb +2 -0
- data/lib/vedeu/output/translator.rb +2 -0
- data/lib/vedeu/output/viewport.rb +2 -0
- data/lib/vedeu/output/virtual_terminal.rb +2 -0
- data/lib/vedeu/output/wordwrap.rb +2 -0
- data/lib/vedeu/repositories/collection.rb +2 -0
- data/lib/vedeu/repositories/collections/all.rb +12 -0
- data/lib/vedeu/repositories/model.rb +2 -0
- data/lib/vedeu/repositories/registerable.rb +2 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +2 -0
- data/lib/vedeu/repositories/repositories/borders.rb +2 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +2 -0
- data/lib/vedeu/repositories/repositories/colours.rb +2 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +2 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +2 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +2 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +2 -0
- data/lib/vedeu/repositories/repositories/groups.rb +2 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +2 -0
- data/lib/vedeu/repositories/repositories/menus.rb +2 -0
- data/lib/vedeu/repositories/repository.rb +3 -3
- data/lib/vedeu/storage/associative_store.rb +2 -0
- data/lib/vedeu/storage/conveyor_store.rb +2 -0
- data/lib/vedeu/storage/fifo_store.rb +2 -0
- data/lib/vedeu/storage/store.rb +1 -0
- data/lib/vedeu/support/common.rb +1 -0
- data/lib/vedeu/support/log.rb +3 -0
- data/lib/vedeu/support/options.rb +2 -0
- data/lib/vedeu/support/template.rb +2 -0
- data/lib/vedeu/support/terminal.rb +1 -0
- data/lib/vedeu/support/timer.rb +2 -1
- data/lib/vedeu/support/visibility.rb +2 -0
- data/lib/vedeu/templating/directive.rb +3 -0
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/preprocessor.rb +4 -0
- data/lib/vedeu/traps.rb +1 -0
- data/lib/vedeu/version.rb +2 -1
- data/test/lib/vedeu/dsl/border_test.rb +19 -0
- data/test/lib/vedeu/dsl/geometry_test.rb +19 -0
- data/test/lib/vedeu/dsl/interface_test.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b62c5ba6eef01e883bf71b71a52223214dcffa48
|
4
|
+
data.tar.gz: 6217942929014ce27de055b78a2e533a56bb638d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b40fb9d5ee9ffc2660ebd062a12f2eb64903330b5f80f50daf4133c9adec364caa31cb31140981ac9a0de585d065d472208e33cb85363c235ef2720ac4101b2
|
7
|
+
data.tar.gz: e6cdfbc8f776b1ad7f5f611dadf8cc7bce21f8ec0375650f7995dc9e1070922e755e7e6143230f6bb1a2ca426c23595ba4046513ccc4ac710d22331eb9e736ef
|
data/bin/vedeu
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
lib_dir = File.dirname(__FILE__) + '/../lib'
|
4
4
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
5
|
|
6
|
+
require 'vedeu/version'
|
7
|
+
|
8
|
+
puts "Vedeu (#{Vedeu::VERSION})"
|
6
9
|
puts ''
|
7
10
|
puts 'Vedeu is a Ruby gem. This executable serves for a future in which ' \
|
8
11
|
'Vedeu can generate a starting point for your terminal-based GUI ' \
|
data/docs/dsl.md
CHANGED
@@ -13,8 +13,42 @@ Borders are defined by name for each of the client application's interfaces or
|
|
13
13
|
|
14
14
|
### Geometry
|
15
15
|
|
16
|
-
Geometry
|
17
|
-
|
16
|
+
Geometry allows the configuration of the position and size of an interface.
|
17
|
+
|
18
|
+
Here is an example of declarations for a `geometry` block:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
interface 'main' do
|
22
|
+
geometry do
|
23
|
+
height 5 # Sets the height of the view to 5
|
24
|
+
width 20 # Sets the width of the view to 20
|
25
|
+
x 3 # Start drawing 3 spaces from left
|
26
|
+
y 10 # Start drawing 10 spaces from top
|
27
|
+
xn 30 # Stop drawing 30 spaces from the left
|
28
|
+
yn 20 # Stop drawing 20 spaces from top
|
29
|
+
end
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
If a declaration is omitted for `height` or `width` the full remaining space
|
34
|
+
available in the terminal will be used. `x` and `y` both default to 0.
|
35
|
+
|
36
|
+
You can also make a geometry declaration dependent on another view:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
interface 'other_panel' do
|
40
|
+
# other code ...
|
41
|
+
end
|
42
|
+
|
43
|
+
interface 'main' do
|
44
|
+
geometry do
|
45
|
+
height 10
|
46
|
+
y { use('other_panel').south }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
This view will begin just below "other\_panel".
|
18
52
|
|
19
53
|
### Groups
|
20
54
|
|
data/examples/borders_app.rb
CHANGED
@@ -6,6 +6,11 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
6
6
|
require 'vedeu'
|
7
7
|
|
8
8
|
# An example application to demonstrate borders.
|
9
|
+
#
|
10
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
11
|
+
#
|
12
|
+
# ./examples/borders_app.rb
|
13
|
+
#
|
9
14
|
class VedeuBordersApp
|
10
15
|
|
11
16
|
include Vedeu
|
data/examples/colours_app.rb
CHANGED
@@ -6,6 +6,11 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
6
6
|
require 'vedeu'
|
7
7
|
|
8
8
|
# An example application to demonstrate colours.
|
9
|
+
#
|
10
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
11
|
+
#
|
12
|
+
# ./examples/colours_app.rb
|
13
|
+
#
|
9
14
|
class VedeuColoursApp
|
10
15
|
|
11
16
|
include Vedeu
|
@@ -7,6 +7,10 @@ require 'vedeu'
|
|
7
7
|
|
8
8
|
# This example application shows how configuration works.
|
9
9
|
#
|
10
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
11
|
+
#
|
12
|
+
# ./examples/configuration_app.rb
|
13
|
+
#
|
10
14
|
# First, we use the configuration API to switch debugging on, and set the
|
11
15
|
# logging to go to a file in the /tmp directory.
|
12
16
|
#
|
@@ -15,6 +19,7 @@ require 'vedeu'
|
|
15
19
|
# overridden by command line arguments.
|
16
20
|
#
|
17
21
|
# Use 'space' to refresh, 'q' to exit.
|
22
|
+
#
|
18
23
|
class VedeuConfigurationApp
|
19
24
|
|
20
25
|
include Vedeu
|
data/examples/drb_app.rb
CHANGED
@@ -6,6 +6,10 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
6
6
|
require 'vedeu'
|
7
7
|
|
8
8
|
# An example application to demonstrate the DRb server.
|
9
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
10
|
+
#
|
11
|
+
# ./examples/drb_app.rb
|
12
|
+
#
|
9
13
|
class VedeuTestApplication
|
10
14
|
|
11
15
|
# Be aware that running an application with debugging enabled will affect
|
data/examples/focus_app.rb
CHANGED
@@ -7,6 +7,11 @@ require 'vedeu'
|
|
7
7
|
|
8
8
|
# This example application shows how interface focus works.
|
9
9
|
#
|
10
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
11
|
+
#
|
12
|
+
# ./examples/focus_app.rb
|
13
|
+
#
|
14
|
+
#
|
10
15
|
# First, we set up the interfaces, noting that 'copper' should have focus when
|
11
16
|
# the application starts. Also note that 'status' should not show a cursor.
|
12
17
|
#
|
data/examples/geometry_app.rb
CHANGED
@@ -6,6 +6,10 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
6
6
|
require 'vedeu'
|
7
7
|
|
8
8
|
# An example application to demonstrate geometry.
|
9
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
10
|
+
#
|
11
|
+
# ./examples/geometry_app.rb
|
12
|
+
#
|
9
13
|
class VedeuGeometryApp
|
10
14
|
|
11
15
|
include Vedeu
|
data/examples/hello_world.rb
CHANGED
@@ -9,6 +9,11 @@ trap('INT') { exit! }
|
|
9
9
|
require 'vedeu'
|
10
10
|
|
11
11
|
# An example application to demonstrate 'Hello World'.
|
12
|
+
#
|
13
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
14
|
+
#
|
15
|
+
# ./examples/hello_world.rb
|
16
|
+
#
|
12
17
|
class HelloWorldApp
|
13
18
|
|
14
19
|
include Vedeu
|
@@ -7,6 +7,11 @@ require 'vedeu'
|
|
7
7
|
|
8
8
|
# An example application to demonstrate colours, cursor and interface movement,
|
9
9
|
# maximising/unmaximising of interfaces and toggling of cursors and interfaces.
|
10
|
+
#
|
11
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
12
|
+
#
|
13
|
+
# ./examples/material_colours_app.rb
|
14
|
+
#
|
10
15
|
class VedeuMaterialColoursApp
|
11
16
|
|
12
17
|
include Vedeu
|
@@ -35,20 +40,22 @@ class VedeuMaterialColoursApp
|
|
35
40
|
zindex 2
|
36
41
|
end
|
37
42
|
|
43
|
+
# This interface uses the 'parens' style for the DSL, which sometimes helps
|
44
|
+
# Ruby to understand the values you provide.
|
38
45
|
interface 'other_interface' do
|
39
46
|
border 'other_interface' do
|
40
|
-
colour
|
41
|
-
title
|
47
|
+
colour(foreground: '#ffffff', background: :default)
|
48
|
+
title('Wow!')
|
42
49
|
end
|
43
|
-
colour
|
50
|
+
colour(foreground: '#ffffff', background: :default)
|
44
51
|
cursor!
|
45
52
|
geometry 'other_interface' do
|
46
|
-
x
|
47
|
-
xn
|
48
|
-
y
|
49
|
-
yn
|
53
|
+
x(27)
|
54
|
+
xn(47)
|
55
|
+
y(3)
|
56
|
+
yn(13)
|
50
57
|
end
|
51
|
-
zindex
|
58
|
+
zindex(1)
|
52
59
|
end
|
53
60
|
|
54
61
|
keymap('_global_') do
|
data/examples/panel_app.rb
CHANGED
@@ -7,6 +7,11 @@ require 'vedeu'
|
|
7
7
|
|
8
8
|
# An example application to demonstrate colours, cursor and interface movement,
|
9
9
|
# maximising/unmaximising of interfaces and toggling of cursors and interfaces.
|
10
|
+
#
|
11
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
12
|
+
#
|
13
|
+
# ./examples/panel_app.rb
|
14
|
+
#
|
10
15
|
class VedeuPanelApp
|
11
16
|
|
12
17
|
include Vedeu
|
@@ -63,15 +63,15 @@ class VedeuTypedCommands
|
|
63
63
|
geometry('status') do
|
64
64
|
height 1
|
65
65
|
width 40
|
66
|
-
x
|
67
|
-
y
|
66
|
+
x use('output').left
|
67
|
+
y use('output').south(0)
|
68
68
|
end
|
69
69
|
|
70
70
|
geometry 'command' do
|
71
71
|
height 3
|
72
72
|
width 40
|
73
|
-
x
|
74
|
-
y
|
73
|
+
x use('status').left
|
74
|
+
y use('status').south(0)
|
75
75
|
end
|
76
76
|
|
77
77
|
focus_by_name 'command'
|
@@ -58,15 +58,15 @@ class VedeuViewTemplateApp
|
|
58
58
|
geometry 'default' do
|
59
59
|
height 6
|
60
60
|
width 25
|
61
|
-
x
|
62
|
-
y
|
61
|
+
x use('prune').left
|
62
|
+
y use('prune').north(7)
|
63
63
|
end
|
64
64
|
|
65
65
|
geometry 'wrap' do
|
66
66
|
height 6
|
67
67
|
width 25
|
68
|
-
x
|
69
|
-
y
|
68
|
+
x use('prune').left
|
69
|
+
y use('prune').south(1)
|
70
70
|
end
|
71
71
|
|
72
72
|
renders do
|
data/lib/vedeu/application.rb
CHANGED
data/lib/vedeu/bindings.rb
CHANGED
data/lib/vedeu/buffers/buffer.rb
CHANGED
@@ -10,6 +10,8 @@ module Vedeu
|
|
10
10
|
# if available, otherwise from the current 'Front' buffer. When new content
|
11
11
|
# is copied to the 'Front' buffer, the current 'Front' buffer is also copied
|
12
12
|
# to the 'Previous' buffer.
|
13
|
+
#
|
14
|
+
# @api private
|
13
15
|
class Buffer
|
14
16
|
|
15
17
|
include Vedeu::Model
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
data/lib/vedeu/cursor/move.rb
CHANGED
data/lib/vedeu/debug.rb
CHANGED
data/lib/vedeu/dsl/all.rb
CHANGED
data/lib/vedeu/dsl/border.rb
CHANGED
@@ -23,10 +23,13 @@ module Vedeu
|
|
23
23
|
# # ...or standalone; referencing the target interface or view.
|
24
24
|
# Vedeu.border 'some_interface' do
|
25
25
|
# # ...
|
26
|
+
#
|
27
|
+
# @api public
|
26
28
|
class Border
|
27
29
|
|
28
30
|
include Vedeu::DSL
|
29
31
|
include Vedeu::DSL::Presentation
|
32
|
+
include Vedeu::DSL::Use
|
30
33
|
|
31
34
|
# Specify the border of an interface or view with a simple DSL.
|
32
35
|
#
|
data/lib/vedeu/dsl/geometry.rb
CHANGED
data/lib/vedeu/dsl/group.rb
CHANGED
data/lib/vedeu/dsl/interface.rb
CHANGED
@@ -3,6 +3,8 @@ module Vedeu
|
|
3
3
|
module DSL
|
4
4
|
|
5
5
|
# DSL for creating interfaces.
|
6
|
+
#
|
7
|
+
# @api public
|
6
8
|
class Interface
|
7
9
|
|
8
10
|
include Vedeu::Common
|
@@ -23,12 +25,20 @@ module Vedeu
|
|
23
25
|
|
24
26
|
# Allows the setting of a border for the interface.
|
25
27
|
#
|
28
|
+
# @example
|
29
|
+
# interface 'my_interface' do
|
30
|
+
# border do
|
31
|
+
# # ... see Vedeu::DSL::Border for DSL methods for borders.
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
#
|
26
35
|
# @param name [String] The name of the interface; this is already provided
|
27
36
|
# when we define the interface or view, setting it here is just
|
28
37
|
# mirroring functionality of {Vedeu::DSL::Border.border}.
|
29
38
|
# @param block [Proc]
|
30
39
|
# @raise [InvalidSyntax] The required block was not given.
|
31
40
|
# @return [Vedeu::Border]
|
41
|
+
# @see Vedeu::DSL::Border
|
32
42
|
def border(name = nil, &block)
|
33
43
|
fail InvalidSyntax, 'block not given' unless block_given?
|
34
44
|
|
@@ -114,7 +124,9 @@ module Vedeu
|
|
114
124
|
# @example
|
115
125
|
# interface 'my_interface' do
|
116
126
|
# geometry do
|
117
|
-
# # ...
|
127
|
+
# # ... see Vedeu::DSL::Geometry for DSL methods for geometries.
|
128
|
+
# end
|
129
|
+
# end
|
118
130
|
#
|
119
131
|
# @param name [String] The name of the interface; this is already provided
|
120
132
|
# when we define the interface or view, setting it here is just
|
@@ -219,6 +231,15 @@ module Vedeu
|
|
219
231
|
visible(false)
|
220
232
|
end
|
221
233
|
|
234
|
+
# Use a value from another model.
|
235
|
+
#
|
236
|
+
# @param name [String] The name of the interface model you wish to use a
|
237
|
+
# value from.
|
238
|
+
# @return [Vedeu::Interface]
|
239
|
+
def use(name)
|
240
|
+
model.repository.by_name(name)
|
241
|
+
end
|
242
|
+
|
222
243
|
# Set the visibility of the interface.
|
223
244
|
#
|
224
245
|
# @param value [Boolean] Any value other than nil or false will evaluate
|