dialog 0.1.1 → 0.1.2
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.
- data/lib/dialog.rb +1 -0
- data/lib/form.rb +5 -5
- data/lib/mixedform.rb +51 -0
- metadata +3 -2
data/lib/dialog.rb
CHANGED
data/lib/form.rb
CHANGED
@@ -7,12 +7,12 @@ module Dialog
|
|
7
7
|
# Corresponds to the --form box option. Use the field method to
|
8
8
|
# define form fields
|
9
9
|
#
|
10
|
-
# Example
|
10
|
+
# Example
|
11
11
|
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
12
|
+
# frm = Form.new do |f|
|
13
|
+
# f.text "Pick your poi.., er, vitamins"
|
14
|
+
# f.field "Fruit", 1, 1, "Strawberry", 1, 12
|
15
|
+
# f.field "Veggie", 2, 1, "Eggplant", 2, 12, 30, 50
|
16
16
|
# end
|
17
17
|
#
|
18
18
|
# Box option syntax:
|
data/lib/mixedform.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'base'
|
2
|
+
|
3
|
+
module Dialog
|
4
|
+
|
5
|
+
# Displays a mixed form
|
6
|
+
#
|
7
|
+
# Corresponds to the --mixedform box option. Use the field method or
|
8
|
+
# one of the specialized helper methods like password to define form
|
9
|
+
# fields.
|
10
|
+
#
|
11
|
+
# Example
|
12
|
+
#
|
13
|
+
# steps = MixedForm.new do |m|
|
14
|
+
# m.text "Authentication"
|
15
|
+
# m.field "User", 1, 1, "", 1, 10, 40, 38, 0
|
16
|
+
# m.password "Password", 2, 1, "", 2, 10, 40, 38
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# Box option syntax:
|
20
|
+
# --mixedform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>...
|
21
|
+
#
|
22
|
+
class MixedForm < Form
|
23
|
+
|
24
|
+
# Adds a field to the form
|
25
|
+
def field(label, ly, lx, item, iy, ix, flen=30, ilen=0, itype=0)
|
26
|
+
@fields << [label, ly, lx, item, iy, ix, flen, ilen, itype]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Adds an input field to the form
|
30
|
+
def input(label, ly, lx, item, iy, ix, flen=30, ilen=0)
|
31
|
+
field(label, ly, lx, item, iy, ix, flen, ilen, 0)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Adds a password field to the form
|
35
|
+
def password(label, ly, lx, item, iy, ix, flen=30, ilen=0)
|
36
|
+
field(label, ly, lx, item, iy, ix, flen, ilen, 1)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Adds a readonly field to the form
|
40
|
+
def readonly(label, ly, lx, item, iy, ix, flen=30, ilen=0)
|
41
|
+
field(label, ly, lx, item, iy, ix, flen, ilen, 2)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Adds a disabled field to the form
|
45
|
+
def disabled(label, ly, lx, item, iy, ix, flen=30, ilen=0)
|
46
|
+
field(label, ly, lx, item, iy, ix, flen, ilen, 3)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: dialog
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2008-03-
|
6
|
+
version: 0.1.2
|
7
|
+
date: 2008-03-29 00:00:00 +01:00
|
8
8
|
summary: Library for building ncurses-based dialogs by interfacing with dialog(1).
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/inputbox.rb
|
45
45
|
- lib/dialog.rb
|
46
46
|
- lib/infobox.rb
|
47
|
+
- lib/mixedform.rb
|
47
48
|
- lib/tailboxbg.rb
|
48
49
|
- lib/menu.rb
|
49
50
|
- lib/checklist.rb
|