vedeu 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/bin/vedeu_drb_client +8 -3
- data/bin/vedeu_drb_server +113 -0
- data/bin/vedeu_test +1 -1
- data/docs/events.md +0 -127
- data/examples/borders_app.rb +17 -7
- data/examples/configuration_app.rb +1 -1
- data/examples/cursor_app.rb +4 -2
- data/examples/drb_app.rb +113 -0
- data/examples/focus_app.rb +1 -1
- data/examples/geometry_app.rb +1 -1
- data/examples/hello_world.rb +1 -1
- data/examples/lines_app.rb +1 -1
- data/features/start_stop.feature +1 -1
- data/inch.yml +5 -0
- data/lib/vedeu/all.rb +2 -0
- data/lib/vedeu/api.rb +1 -0
- data/lib/vedeu/application.rb +17 -36
- data/lib/vedeu/bindings.rb +134 -27
- data/lib/vedeu/buffers/display_buffer.rb +1 -4
- data/lib/vedeu/configuration/api.rb +15 -14
- data/lib/vedeu/configuration/cli.rb +17 -16
- data/lib/vedeu/configuration/configuration.rb +3 -1
- data/lib/vedeu/cursor/cursor.rb +6 -8
- data/lib/vedeu/cursor/move_cursor.rb +1 -0
- data/lib/vedeu/cursor/toggle_cursor.rb +1 -0
- data/lib/vedeu/debug.rb +23 -0
- data/lib/vedeu/distributed/all.rb +1 -1
- data/lib/vedeu/distributed/client.rb +55 -13
- data/lib/vedeu/distributed/server.rb +207 -0
- data/lib/vedeu/distributed/subprocess.rb +22 -21
- data/lib/vedeu/distributed/templates/default_application.vedeu +3 -1
- data/lib/vedeu/distributed/test_application.rb +2 -1
- data/lib/vedeu/distributed/uri.rb +1 -0
- data/lib/vedeu/dsl/all.rb +4 -2
- data/lib/vedeu/dsl/components/border.rb +11 -10
- data/lib/vedeu/dsl/components/geometry.rb +1 -0
- data/lib/vedeu/dsl/components/keymap.rb +1 -0
- data/lib/vedeu/dsl/components/menu.rb +1 -0
- data/lib/vedeu/dsl/interface.rb +1 -0
- data/lib/vedeu/dsl/line.rb +3 -1
- data/lib/vedeu/dsl/shared/colour.rb +1 -0
- data/lib/vedeu/dsl/shared/style.rb +1 -0
- data/lib/vedeu/dsl/shared/text.rb +2 -0
- data/lib/vedeu/dsl/shared/use.rb +3 -0
- data/lib/vedeu/dsl/stream.rb +3 -1
- data/lib/vedeu/dsl/view.rb +1 -0
- data/lib/vedeu/events/event.rb +9 -6
- data/lib/vedeu/events/trigger.rb +18 -7
- data/lib/vedeu/exceptions.rb +4 -1
- data/lib/vedeu/input/input.rb +1 -0
- data/lib/vedeu/input/key.rb +0 -1
- data/lib/vedeu/input/keymap.rb +5 -3
- data/lib/vedeu/input/keys.rb +1 -0
- data/lib/vedeu/input/mapper.rb +1 -0
- data/lib/vedeu/launcher.rb +35 -12
- data/lib/vedeu/main_loop.rb +53 -0
- data/lib/vedeu/models/collection.rb +11 -3
- data/lib/vedeu/models/focus.rb +3 -3
- data/lib/vedeu/models/geometry.rb +8 -16
- data/lib/vedeu/models/group.rb +1 -0
- data/lib/vedeu/models/menu.rb +2 -1
- data/lib/vedeu/models/model.rb +7 -1
- data/lib/vedeu/models/view/char.rb +52 -44
- data/lib/vedeu/models/view/chars.rb +1 -0
- data/lib/vedeu/models/view/composition.rb +2 -1
- data/lib/vedeu/models/view/interface.rb +5 -3
- data/lib/vedeu/models/view/interfaces.rb +1 -0
- data/lib/vedeu/models/view/line.rb +2 -1
- data/lib/vedeu/models/view/stream.rb +2 -1
- data/lib/vedeu/models/view/streams.rb +1 -0
- data/lib/vedeu/output/all.rb +4 -0
- data/lib/vedeu/output/border.rb +75 -206
- data/lib/vedeu/output/compositor.rb +1 -0
- data/lib/vedeu/output/html_char.rb +119 -0
- data/lib/vedeu/output/html_renderer.rb +89 -0
- data/lib/vedeu/output/output.rb +48 -44
- data/lib/vedeu/output/position_index.rb +12 -1
- data/lib/vedeu/output/renderer.rb +28 -0
- data/lib/vedeu/output/viewport.rb +14 -14
- data/lib/vedeu/output/virtual_buffer.rb +56 -0
- data/lib/vedeu/output/virtual_terminal.rb +42 -34
- data/lib/vedeu/output/wordwrap.rb +3 -0
- data/lib/vedeu/output/writer.rb +13 -1
- data/lib/vedeu/presentation/background.rb +1 -0
- data/lib/vedeu/presentation/colour.rb +8 -7
- data/lib/vedeu/presentation/foreground.rb +1 -0
- data/lib/vedeu/presentation/presentation.rb +43 -7
- data/lib/vedeu/presentation/translator.rb +12 -0
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/support/bounding_area.rb +2 -0
- data/lib/vedeu/support/coercions.rb +2 -1
- data/lib/vedeu/support/common.rb +1 -0
- data/lib/vedeu/support/console.rb +17 -23
- data/lib/vedeu/support/content_geometry.rb +2 -0
- data/lib/vedeu/support/coordinate.rb +1 -0
- data/lib/vedeu/support/esc.rb +58 -29
- data/lib/vedeu/support/grid.rb +1 -0
- data/lib/vedeu/support/limit.rb +9 -0
- data/lib/vedeu/support/log.rb +31 -9
- data/lib/vedeu/support/node.rb +8 -18
- data/lib/vedeu/support/position.rb +13 -34
- data/lib/vedeu/support/position_validator.rb +3 -0
- data/lib/vedeu/support/read.rb +1 -0
- data/lib/vedeu/support/refresh.rb +3 -2
- data/lib/vedeu/support/terminal.rb +11 -5
- data/lib/vedeu/support/trace.rb +16 -1
- data/lib/vedeu/support/visible.rb +2 -0
- data/lib/vedeu/support/write.rb +1 -0
- data/lib/vedeu/traps.rb +1 -0
- data/lib/vedeu.rb +2 -0
- data/test/integration/distributed_test.rb +10 -8
- data/test/lib/vedeu/api_test.rb +3 -7
- data/test/lib/vedeu/application_test.rb +2 -5
- data/test/lib/vedeu/configuration/api_test.rb +12 -0
- data/test/lib/vedeu/cursor/cursor_test.rb +2 -0
- data/test/lib/vedeu/distributed/client_test.rb +17 -7
- data/test/lib/vedeu/distributed/server_test.rb +56 -0
- data/test/lib/vedeu/distributed/test_application_test.rb +7 -3
- data/test/lib/vedeu/dsl/components/border_test.rb +10 -2
- data/test/lib/vedeu/dsl/interface_test.rb +6 -0
- data/test/lib/vedeu/dsl/line_test.rb +19 -0
- data/test/lib/vedeu/dsl/shared/colour_test.rb +4 -26
- data/test/lib/vedeu/dsl/shared/text_test.rb +8 -1
- data/test/lib/vedeu/dsl/stream_test.rb +13 -1
- data/test/lib/vedeu/input/input_test.rb +1 -1
- data/test/lib/vedeu/input/key_test.rb +3 -16
- data/test/lib/vedeu/launcher_test.rb +11 -1
- data/test/lib/vedeu/main_loop_test.rb +41 -0
- data/test/lib/vedeu/models/geometry_test.rb +15 -34
- data/test/lib/vedeu/models/view/char_test.rb +44 -45
- data/test/lib/vedeu/models/view/interface_test.rb +6 -0
- data/test/lib/vedeu/models/view/line_test.rb +1 -1
- data/test/lib/vedeu/models/view/stream_test.rb +1 -1
- data/test/lib/vedeu/output/border_test.rb +6 -5
- data/test/lib/vedeu/output/compositor_test.rb +2 -20
- data/test/lib/vedeu/output/html_char_test.rb +85 -0
- data/test/lib/vedeu/output/html_renderer_test.rb +37 -0
- data/test/lib/vedeu/output/position_index_test.rb +2 -10
- data/test/lib/vedeu/output/renderer_test.rb +24 -0
- data/test/lib/vedeu/output/virtual_buffer_test.rb +53 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +32 -2
- data/test/lib/vedeu/presentation/background_test.rb +41 -1
- data/test/lib/vedeu/presentation/colour_test.rb +10 -6
- data/test/lib/vedeu/presentation/foreground_test.rb +46 -6
- data/test/lib/vedeu/presentation/presentation_test.rb +44 -1
- data/test/lib/vedeu/presentation/translator_test.rb +34 -0
- data/test/lib/vedeu/repositories/repository_test.rb +1 -1
- data/test/lib/vedeu/support/bounding_area_test.rb +4 -12
- data/test/lib/vedeu/support/console_test.rb +9 -50
- data/test/lib/vedeu/support/esc_test.rb +7 -7
- data/test/lib/vedeu/support/position_test.rb +42 -0
- data/test/lib/vedeu/support/terminal_test.rb +5 -20
- data/test/lib/vedeu/support/write_test.rb +42 -18
- data/test/support/helpers/all.rb +0 -1
- data/test/support/helpers/repository_test_module.rb +1 -0
- data/test/test_helper.rb +5 -2
- data/vedeu.gemspec +7 -5
- metadata +60 -14
- data/lib/vedeu/distributed/application.rb +0 -91
- data/test/lib/vedeu/distributed/application_test.rb +0 -24
- data/test/support/helpers/presentation.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55cc711fc37aa01aeaba23c8ababc6c983801c4
|
4
|
+
data.tar.gz: e86bdcf954386935f4710649322622de5afadb3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f9a8eb02a9b61bdb6f9c0943f016bce77f4747d327d93ea62fc56b024a457af78b4268095ef3141a7085fb500de741ba0dee15c114ccb5715bf819444cc0ec
|
7
|
+
data.tar.gz: cd92b729793a54269549769f3ca235e465297cd6eedf92e752fb1eb72e9a12d1991b55a540466c455684b1fe986e24ab840e28c57b34c92acacaefbde0562b32
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# Vedeu
|
6
6
|
|
7
|
-
Vedeu is my attempt at creating a terminal based application framework without the need for Ncurses. I've tried to make Vedeu as simple and flexible as possible.
|
7
|
+
Vedeu (vee-dee-you; aka VDU) is my attempt at creating a terminal based application framework without the need for Ncurses. I've tried to make Vedeu as simple and flexible as possible.
|
8
8
|
|
9
9
|
|
10
10
|
## Requirements
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@ require 'bundler/gem_tasks'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'cucumber'
|
4
4
|
require 'cucumber/rake/task'
|
5
|
+
require 'inch/rake'
|
5
6
|
|
6
7
|
# Don't run cukes for the time being.
|
7
8
|
# Cucumber::Rake::Task.new(:cucumber) do |t|
|
@@ -16,4 +17,9 @@ Rake::TestTask.new do |t|
|
|
16
17
|
t.verbose = false
|
17
18
|
end
|
18
19
|
|
20
|
+
Inch::Rake::Suggest.new do |suggest|
|
21
|
+
suggest.args << "--pedantic"
|
22
|
+
suggest.args << "--all"
|
23
|
+
end
|
24
|
+
|
19
25
|
task :default => :test
|
data/bin/vedeu_drb_client
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
4
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
+
|
6
|
+
require 'vedeu'
|
7
|
+
|
3
8
|
client = Vedeu::Distributed::Client.new("druby://localhost:21420")
|
4
|
-
client.input('
|
5
|
-
|
6
|
-
client.
|
9
|
+
client.input('l')
|
10
|
+
sleep 1
|
11
|
+
client.shutdown
|
@@ -0,0 +1,113 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib_dir = "/Users/gavinlaking/Source/vedeu/lib/vedeu/distributed/../../../lib"
|
4
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
+
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
class VedeuTestApplication
|
9
|
+
# include Vedeu
|
10
|
+
|
11
|
+
Vedeu.configure do
|
12
|
+
colour_mode 16777216
|
13
|
+
log '/tmp/vedeu_test_helper.log'
|
14
|
+
debug!
|
15
|
+
drb!
|
16
|
+
drb_host 'localhost'
|
17
|
+
drb_port 21420
|
18
|
+
drb_width 80
|
19
|
+
drb_height 25
|
20
|
+
|
21
|
+
# cooked!
|
22
|
+
# raw!
|
23
|
+
|
24
|
+
# run_once!
|
25
|
+
|
26
|
+
# interactive!
|
27
|
+
# standalone!
|
28
|
+
|
29
|
+
# trace!
|
30
|
+
|
31
|
+
# System keys can be redefined
|
32
|
+
# exit_key 'q'
|
33
|
+
# focus_next_key :tab
|
34
|
+
# focus_prev_key :shift_tab
|
35
|
+
# mode_switch_key :escape
|
36
|
+
|
37
|
+
# Not used yet
|
38
|
+
# stdin File.open("/dev/tty", "r")
|
39
|
+
# stdout File.open("/dev/tty", "w")
|
40
|
+
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
41
|
+
end
|
42
|
+
|
43
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
44
|
+
|
45
|
+
Vedeu.border 'test_interface' do
|
46
|
+
# Define colour and style of border
|
47
|
+
colour foreground: '#ffff00', background: '#0000ff'
|
48
|
+
style 'normal'
|
49
|
+
|
50
|
+
# Define visibility of border
|
51
|
+
show_bottom!
|
52
|
+
show_left!
|
53
|
+
show_right!
|
54
|
+
show_top!
|
55
|
+
|
56
|
+
# Define characters used to draw border
|
57
|
+
bottom_right '+'
|
58
|
+
bottom_left '+'
|
59
|
+
horizontal '-'
|
60
|
+
top_right '+'
|
61
|
+
top_left '+'
|
62
|
+
vertical '|'
|
63
|
+
end
|
64
|
+
|
65
|
+
Vedeu.geometry 'test_interface' do
|
66
|
+
# centred!
|
67
|
+
height 6
|
68
|
+
width 26
|
69
|
+
x 4
|
70
|
+
y 4
|
71
|
+
end
|
72
|
+
|
73
|
+
Vedeu.interface 'test_interface' do
|
74
|
+
colour foreground: '#ff0000', background: '#000000'
|
75
|
+
cursor!
|
76
|
+
end
|
77
|
+
|
78
|
+
Vedeu.keymap 'test_interface' do
|
79
|
+
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
80
|
+
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
81
|
+
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
82
|
+
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
83
|
+
end
|
84
|
+
|
85
|
+
Vedeu.menu 'test_interface' do
|
86
|
+
# ...
|
87
|
+
end
|
88
|
+
|
89
|
+
Vedeu.renders do
|
90
|
+
view 'test_interface' do
|
91
|
+
lines do
|
92
|
+
line 'a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1'
|
93
|
+
line 'a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u2v2w2x2y2z2'
|
94
|
+
line 'a3b3c3d3e3f3g3h3i3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3'
|
95
|
+
line 'a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4'
|
96
|
+
line 'a5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5'
|
97
|
+
line 'a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v6w6x6y6z6'
|
98
|
+
line 'a7b7c7d7e7f7g7h7i7j7k7l7m7n7o7p7q7r7s7t7u7v7w7x7y7z7'
|
99
|
+
line 'a8b8c8d8e8f8g8h8i8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.start(argv = ARGV,
|
105
|
+
stdin = STDIN,
|
106
|
+
stdout = STDOUT,
|
107
|
+
stderr = STDERR,
|
108
|
+
kernel = Kernel)
|
109
|
+
Vedeu::Launcher.execute!(argv, stdin, stdout, stderr, kernel)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
VedeuTestApplication.start(ARGV)
|
data/bin/vedeu_test
CHANGED
data/docs/events.md
CHANGED
@@ -15,118 +15,6 @@ class SomeClassInYourApplication
|
|
15
15
|
|
16
16
|
System events generally control the internal state of Vedeu with respects to your application. They are soft-namespaced using underscores.
|
17
17
|
|
18
|
-
### `:_clear_`
|
19
|
-
|
20
|
-
Clears the whole terminal space.
|
21
|
-
|
22
|
-
### `:_cursor_up_`
|
23
|
-
|
24
|
-
Moves the cursor for the focussed interface up one row, but will not exceed the boundary of the interface.
|
25
|
-
|
26
|
-
### `:_cursor_right_`
|
27
|
-
|
28
|
-
Moves the cursor for the focussed interface right one column, but will not exceed the boundary of the interface.
|
29
|
-
|
30
|
-
### `:_cursor_down_`
|
31
|
-
|
32
|
-
Moves the cursor for the focussed interface down one row, but will not exceed the boundary of the interface.
|
33
|
-
|
34
|
-
### `:_cursor_left_`
|
35
|
-
|
36
|
-
Moves the cursor for the focussed interface left one column, but will not exceed the boundary of the interface.
|
37
|
-
|
38
|
-
### `:_cursor_hide_`
|
39
|
-
|
40
|
-
Hides the cursor for the focussed interface.
|
41
|
-
|
42
|
-
### `:_cursor_show_`
|
43
|
-
|
44
|
-
Shows the cursor for the focussed interface.
|
45
|
-
|
46
|
-
### `:_cursor_hide_by_name_`
|
47
|
-
|
48
|
-
Hides the cursor for the named interface.
|
49
|
-
|
50
|
-
### `:_cursor_show_by_name_`
|
51
|
-
|
52
|
-
Shows the cursor for the named interface.
|
53
|
-
|
54
|
-
### `:_cursor_origin_`
|
55
|
-
|
56
|
-
Moves the cursor to the top left position of the focussed interface. If this interface has a border,then this is respected.
|
57
|
-
|
58
|
-
### `:_exit_`
|
59
|
-
|
60
|
-
When triggered, Vedeu will trigger a `:cleanup` event which you can define (to save files, etc) and attempt to exit.
|
61
|
-
|
62
|
-
### `:_focus_by_name_`
|
63
|
-
|
64
|
-
When triggered with an interface name will focus that interface and restore the cursor position and visibility.
|
65
|
-
|
66
|
-
### `:_focus_next_`
|
67
|
-
|
68
|
-
When triggered will focus the next interface and restore the cursor position and visibility.
|
69
|
-
|
70
|
-
### `:_focus_prev_`
|
71
|
-
|
72
|
-
When triggered will focus the previous interface and restore the cursor position and visibility.
|
73
|
-
|
74
|
-
### `:_keypress_`
|
75
|
-
|
76
|
-
Triggering this event will cause the triggering of the `:key` event; which you should define to 'do things'. If the `escape` key is pressed, then `key` is triggered with the argument `:escape`, also an internal event `_mode_switch_` is triggered.
|
77
|
-
|
78
|
-
### `:_log_`
|
79
|
-
|
80
|
-
When triggered with a message will cause Vedeu to log the message if logging is enabled in the configuration.
|
81
|
-
|
82
|
-
### `:_menu_current_`
|
83
|
-
|
84
|
-
Requires target menu name as argument. Returns the current menu item.
|
85
|
-
|
86
|
-
### `:_menu_selected_`
|
87
|
-
|
88
|
-
Requires target menu name as argument. Returns the selected menu item.
|
89
|
-
|
90
|
-
### `:_menu_next_`
|
91
|
-
|
92
|
-
Requires target menu name as argument. Makes the next menu item the current menu item, until it reaches the last item.
|
93
|
-
|
94
|
-
### `:_menu_prev_`
|
95
|
-
|
96
|
-
Requires target menu name as argument. Makes the previous menu item the current menu item, until it reaches the first item.
|
97
|
-
|
98
|
-
### `:_menu_top_`
|
99
|
-
|
100
|
-
Requires target menu name as argument. Makes the first menu item the current menu item.
|
101
|
-
|
102
|
-
### `:_menu_bottom_`
|
103
|
-
|
104
|
-
Requires target menu name as argument. Makes the last menu item the current menu item.
|
105
|
-
|
106
|
-
### `:_menu_select_`
|
107
|
-
|
108
|
-
Requires target menu name as argument. Makes the current menu item also the selected menu item.
|
109
|
-
|
110
|
-
### `:_menu_deselect_`
|
111
|
-
|
112
|
-
Requires target menu name as argument. Deselects all menu items.
|
113
|
-
|
114
|
-
### `:_menu_items_`
|
115
|
-
|
116
|
-
Requires target menu name as argument. Returns all the menu items with respective `current` or `selected` boolean indicators.
|
117
|
-
|
118
|
-
### `:_menu_view_`
|
119
|
-
|
120
|
-
Requires target menu name as argument. Returns a subset of the menu items; starting at the current item to the last item.
|
121
|
-
|
122
|
-
### `:_mode_switch_`
|
123
|
-
|
124
|
-
When triggered (after the user presses `escape`), Vedeu switches from a "raw mode" terminal to a "cooked mode" terminal. The idea here being that the raw mode is for single keypress actions, whilst cooked mode allows the user to enter more elaborate commands- such as commands with arguments.
|
125
|
-
|
126
|
-
### `:_refresh_`
|
127
|
-
|
128
|
-
Triggering this event will cause all interfaces to refresh.
|
129
|
-
|
130
18
|
### `:_refresh_group_(group_name)_`
|
131
19
|
|
132
20
|
Will refresh all interfaces belonging to this group. E.g. `_refresh_group_home_` will refresh all interfaces with the group of `home`.
|
@@ -135,10 +23,6 @@ Will refresh all interfaces belonging to this group. E.g. `_refresh_group_home_`
|
|
135
23
|
|
136
24
|
Will refresh the interface with this name. E.g. `_refresh_widget_` will refresh the interface `widget`.
|
137
25
|
|
138
|
-
### `:_resize_`
|
139
|
-
|
140
|
-
When triggered will cause Vedeu to trigger the `:_clear_` and `:_refresh_` events. Please see those events for their behaviour.
|
141
|
-
|
142
26
|
|
143
27
|
##### Notes:
|
144
28
|
|
@@ -157,17 +41,6 @@ User events allow you to orchestrate behaviour within your application, ie. the
|
|
157
41
|
|
158
42
|
Vedeu pre-defines a few user events, which client applications can listen for, or trigger themselves.
|
159
43
|
|
160
|
-
### `:cleanup`
|
161
|
-
|
162
|
-
Vedeu triggers this event when `:_exit_` is triggered. You can hook into this to perform a special action before the application terminates. Saving the user's work, session or preferences might be popular here.
|
163
|
-
|
164
|
-
### `:_initialize_`
|
165
|
-
|
166
|
-
Vedeu triggers this event when it is ready to enter the main loop. Client
|
167
|
-
applications can listen for this event and perform some action(s), like render
|
168
|
-
the first screen, interface or make a sound. When Vedeu triggers this event,
|
169
|
-
the :_refresh_ event is also triggered automatically.
|
170
|
-
|
171
44
|
### `:_tick_`
|
172
45
|
|
173
46
|
Each time Vedeu completes one cycle in the application loop
|
data/examples/borders_app.rb
CHANGED
@@ -46,7 +46,7 @@ class VedeuBordersApp
|
|
46
46
|
height 3
|
47
47
|
width 7
|
48
48
|
end
|
49
|
-
colour foreground: '#000000', background: '#
|
49
|
+
colour foreground: '#000000', background: '#ff5500'
|
50
50
|
end
|
51
51
|
|
52
52
|
interface 'no_bottom' do
|
@@ -56,7 +56,7 @@ class VedeuBordersApp
|
|
56
56
|
height 3
|
57
57
|
width 7
|
58
58
|
end
|
59
|
-
colour foreground: '#000000', background: '#
|
59
|
+
colour foreground: '#000000', background: '#ff5500'
|
60
60
|
end
|
61
61
|
|
62
62
|
interface 'no_left' do
|
@@ -66,7 +66,7 @@ class VedeuBordersApp
|
|
66
66
|
height 3
|
67
67
|
width 7
|
68
68
|
end
|
69
|
-
colour foreground: '#000000', background: '#
|
69
|
+
colour foreground: '#000000', background: '#ff5500'
|
70
70
|
end
|
71
71
|
|
72
72
|
interface 'no_right' do
|
@@ -76,7 +76,7 @@ class VedeuBordersApp
|
|
76
76
|
height 3
|
77
77
|
width 7
|
78
78
|
end
|
79
|
-
colour foreground: '#000000', background: '#
|
79
|
+
colour foreground: '#000000', background: '#ff5500'
|
80
80
|
end
|
81
81
|
|
82
82
|
interface 'custom_corners' do
|
@@ -166,21 +166,27 @@ class VedeuBordersApp
|
|
166
166
|
|
167
167
|
# Borders can be defined as part of a view (see below), or standalone.
|
168
168
|
border 'no_bottom' do
|
169
|
+
foreground '#ffffff'
|
169
170
|
show_bottom false
|
170
171
|
end
|
171
172
|
border 'no_left' do
|
173
|
+
foreground '#ffffff'
|
172
174
|
show_left false
|
173
175
|
end
|
174
176
|
border 'no_right' do
|
177
|
+
foreground '#ffffff'
|
175
178
|
show_right false
|
176
179
|
end
|
177
180
|
border 'no_top' do
|
181
|
+
foreground '#ffffff'
|
178
182
|
show_top false
|
179
183
|
end
|
180
184
|
|
181
185
|
renders do
|
182
186
|
view('default_border') do
|
183
|
-
border
|
187
|
+
border do
|
188
|
+
foreground '#ffffff'
|
189
|
+
end
|
184
190
|
lines do
|
185
191
|
line 'on'
|
186
192
|
end
|
@@ -234,6 +240,7 @@ class VedeuBordersApp
|
|
234
240
|
end
|
235
241
|
view('only_top') do
|
236
242
|
border do
|
243
|
+
foreground '#ffffff'
|
237
244
|
show_right false
|
238
245
|
show_bottom false
|
239
246
|
show_left false
|
@@ -245,6 +252,7 @@ class VedeuBordersApp
|
|
245
252
|
end
|
246
253
|
view('only_bottom') do
|
247
254
|
border do
|
255
|
+
foreground '#ffffff'
|
248
256
|
show_top false
|
249
257
|
show_right false
|
250
258
|
show_left false
|
@@ -256,6 +264,7 @@ class VedeuBordersApp
|
|
256
264
|
end
|
257
265
|
view('only_left') do
|
258
266
|
border do
|
267
|
+
foreground '#ffffff'
|
259
268
|
show_top false
|
260
269
|
show_bottom false
|
261
270
|
show_right false
|
@@ -267,6 +276,7 @@ class VedeuBordersApp
|
|
267
276
|
end
|
268
277
|
view('only_right') do
|
269
278
|
border do
|
279
|
+
foreground '#ffffff'
|
270
280
|
show_top false
|
271
281
|
show_bottom false
|
272
282
|
show_left false
|
@@ -278,7 +288,7 @@ class VedeuBordersApp
|
|
278
288
|
end
|
279
289
|
view('custom_colour') do
|
280
290
|
border do
|
281
|
-
colour foreground: '#
|
291
|
+
colour foreground: '#ff5500', background: '#0000ff'
|
282
292
|
end
|
283
293
|
lines do
|
284
294
|
line 'color'
|
@@ -295,7 +305,7 @@ class VedeuBordersApp
|
|
295
305
|
end
|
296
306
|
|
297
307
|
def self.start(argv = ARGV)
|
298
|
-
Vedeu::Launcher.
|
308
|
+
Vedeu::Launcher.execute!(argv)
|
299
309
|
end
|
300
310
|
end
|
301
311
|
|
data/examples/cursor_app.rb
CHANGED
@@ -39,7 +39,9 @@ class VedeuCursorApp
|
|
39
39
|
|
40
40
|
renders do
|
41
41
|
view 'main_interface' do
|
42
|
-
border
|
42
|
+
border do
|
43
|
+
colour foreground: '#aadd00', background: '#000000'
|
44
|
+
end
|
43
45
|
lines do
|
44
46
|
streams do
|
45
47
|
text 'A.3456789 '
|
@@ -106,7 +108,7 @@ class VedeuCursorApp
|
|
106
108
|
focus_by_name 'main_interface'
|
107
109
|
|
108
110
|
def self.start(argv = ARGV)
|
109
|
-
Vedeu::Launcher.
|
111
|
+
Vedeu::Launcher.execute!(argv)
|
110
112
|
end
|
111
113
|
end
|
112
114
|
|
data/examples/drb_app.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib_dir = "/Users/gavinlaking/Source/vedeu/lib/vedeu/distributed/../../../lib"
|
4
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
+
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
class VedeuTestApplication
|
9
|
+
# include Vedeu
|
10
|
+
|
11
|
+
Vedeu.configure do
|
12
|
+
colour_mode 16777216
|
13
|
+
log '/tmp/vedeu_test_helper.log'
|
14
|
+
debug!
|
15
|
+
drb!
|
16
|
+
drb_host 'localhost'
|
17
|
+
drb_port 21420
|
18
|
+
drb_width 80
|
19
|
+
drb_height 25
|
20
|
+
|
21
|
+
# cooked!
|
22
|
+
# raw!
|
23
|
+
|
24
|
+
# run_once!
|
25
|
+
|
26
|
+
# interactive!
|
27
|
+
# standalone!
|
28
|
+
|
29
|
+
# trace!
|
30
|
+
|
31
|
+
# System keys can be redefined
|
32
|
+
# exit_key 'q'
|
33
|
+
# focus_next_key :tab
|
34
|
+
# focus_prev_key :shift_tab
|
35
|
+
# mode_switch_key :escape
|
36
|
+
|
37
|
+
# Not used yet
|
38
|
+
# stdin File.open("/dev/tty", "r")
|
39
|
+
# stdout File.open("/dev/tty", "w")
|
40
|
+
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
41
|
+
end
|
42
|
+
|
43
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
44
|
+
|
45
|
+
Vedeu.border 'test_interface' do
|
46
|
+
# Define colour and style of border
|
47
|
+
colour foreground: '#ffff00', background: '#0000ff'
|
48
|
+
style 'normal'
|
49
|
+
|
50
|
+
# Define visibility of border
|
51
|
+
show_bottom!
|
52
|
+
show_left!
|
53
|
+
show_right!
|
54
|
+
show_top!
|
55
|
+
|
56
|
+
# Define characters used to draw border
|
57
|
+
bottom_right '+'
|
58
|
+
bottom_left '+'
|
59
|
+
horizontal '-'
|
60
|
+
top_right '+'
|
61
|
+
top_left '+'
|
62
|
+
vertical '|'
|
63
|
+
end
|
64
|
+
|
65
|
+
Vedeu.geometry 'test_interface' do
|
66
|
+
# centred!
|
67
|
+
height 6
|
68
|
+
width 26
|
69
|
+
x 4
|
70
|
+
y 4
|
71
|
+
end
|
72
|
+
|
73
|
+
Vedeu.interface 'test_interface' do
|
74
|
+
colour foreground: '#ff0000', background: '#000000'
|
75
|
+
cursor!
|
76
|
+
end
|
77
|
+
|
78
|
+
Vedeu.keymap 'test_interface' do
|
79
|
+
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
80
|
+
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
81
|
+
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
82
|
+
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
83
|
+
end
|
84
|
+
|
85
|
+
Vedeu.menu 'test_interface' do
|
86
|
+
# ...
|
87
|
+
end
|
88
|
+
|
89
|
+
Vedeu.renders do
|
90
|
+
view 'test_interface' do
|
91
|
+
lines do
|
92
|
+
line 'a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1'
|
93
|
+
line 'a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u2v2w2x2y2z2'
|
94
|
+
line 'a3b3c3d3e3f3g3h3i3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3'
|
95
|
+
line 'a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4'
|
96
|
+
line 'a5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5'
|
97
|
+
line 'a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v6w6x6y6z6'
|
98
|
+
line 'a7b7c7d7e7f7g7h7i7j7k7l7m7n7o7p7q7r7s7t7u7v7w7x7y7z7'
|
99
|
+
line 'a8b8c8d8e8f8g8h8i8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.start(argv = ARGV,
|
105
|
+
stdin = STDIN,
|
106
|
+
stdout = STDOUT,
|
107
|
+
stderr = STDERR,
|
108
|
+
kernel = Kernel)
|
109
|
+
Vedeu::Launcher.execute!(argv, stdin, stdout, stderr, kernel)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
VedeuTestApplication.start(ARGV)
|
data/examples/focus_app.rb
CHANGED
data/examples/geometry_app.rb
CHANGED
data/examples/hello_world.rb
CHANGED
data/examples/lines_app.rb
CHANGED
data/features/start_stop.feature
CHANGED
data/inch.yml
ADDED
data/lib/vedeu/all.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
# load order is important
|
3
3
|
|
4
|
+
require 'vedeu/debug'
|
4
5
|
require 'vedeu/traps'
|
5
6
|
require 'vedeu/exceptions'
|
6
7
|
|
@@ -26,5 +27,6 @@ require 'vedeu/output/all'
|
|
26
27
|
require 'vedeu/presentation/all'
|
27
28
|
require 'vedeu/support/all'
|
28
29
|
|
30
|
+
require 'vedeu/main_loop'
|
29
31
|
require 'vedeu/application'
|
30
32
|
require 'vedeu/launcher'
|