mrdialog 1.0.3 → 1.0.4
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 +5 -5
- data/ChangeLog.md +15 -1
- data/Gemfile +3 -2
- data/README.md +7 -3
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/mrdialog/mrdialog.rb +35 -36
- data/mrdialog.gemspec +124 -0
- data/pkg/md5.txt +1 -1
- data/samples/extra_button/buildlist.rb +89 -0
- data/samples/extra_button/calendar.rb +45 -0
- data/samples/extra_button/checklist.rb +84 -0
- data/samples/extra_button/form1.rb +101 -0
- data/samples/extra_button/fselect.rb +36 -0
- data/samples/extra_button/inputbox.rb +48 -0
- data/samples/extra_button/menubox.rb +85 -0
- data/samples/extra_button/password.rb +44 -0
- data/samples/extra_button/radiolist.rb +86 -0
- data/samples/extra_button/timebox.rb +43 -0
- data/samples/extra_button/treeview.rb +112 -0
- data/samples/run_all.rb +1 -1
- metadata +39 -16
- data/Gemfile.lock +0 -82
- data/pkg/mrdialog-1.0.3.gem +0 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
begin
|
8
|
+
ME = File.basename($0)
|
9
|
+
if ENV['CHANGE_TITLE']
|
10
|
+
if ME =~ /(.+)\.rb$/
|
11
|
+
base = $1
|
12
|
+
puts "\033]0;mrdialog - #{base}\007"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
user = ''
|
17
|
+
uid = ''
|
18
|
+
gid = ''
|
19
|
+
home = ENV["HOME"]
|
20
|
+
|
21
|
+
id = `id`.chomp
|
22
|
+
if id =~ /^uid=(\d+)\((.+)\)\sgid=(\d+)\(.*$/
|
23
|
+
uid = $1
|
24
|
+
user = $2
|
25
|
+
gid = $3
|
26
|
+
end
|
27
|
+
|
28
|
+
dialog = MRDialog.new
|
29
|
+
dialog.clear = true
|
30
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
31
|
+
|
32
|
+
text = <<EOF
|
33
|
+
Here is a possible piece of a configuration program.
|
34
|
+
EOF
|
35
|
+
items = []
|
36
|
+
form_data = Struct.new(:label, :ly, :lx, :item, :iy, :ix, :flen, :ilen)
|
37
|
+
|
38
|
+
data = form_data.new
|
39
|
+
data.label = "Username:"
|
40
|
+
data.ly = 1
|
41
|
+
data.lx = 1
|
42
|
+
data.item = user
|
43
|
+
data.iy = 1
|
44
|
+
data.ix = 10
|
45
|
+
data.flen = user.length + 10
|
46
|
+
data.ilen = 0
|
47
|
+
items.push(data.to_a)
|
48
|
+
|
49
|
+
data = form_data.new
|
50
|
+
data.label = "UID:"
|
51
|
+
data.ly = 2
|
52
|
+
data.lx = 1
|
53
|
+
data.item = uid.to_s
|
54
|
+
data.iy = 2
|
55
|
+
data.ix = 10
|
56
|
+
data.flen = uid.length + 10
|
57
|
+
data.ilen = 0
|
58
|
+
items.push(data.to_a)
|
59
|
+
|
60
|
+
data = form_data.new
|
61
|
+
data.label = "GID:"
|
62
|
+
data.ly = 3
|
63
|
+
data.lx = 1
|
64
|
+
data.item = gid.to_s
|
65
|
+
data.iy =3
|
66
|
+
data.ix = 10
|
67
|
+
data.flen = gid.length + 2
|
68
|
+
data.ilen = 0
|
69
|
+
items.push(data.to_a)
|
70
|
+
|
71
|
+
data = form_data.new
|
72
|
+
data.label = "HOME:"
|
73
|
+
data.ly = 4
|
74
|
+
data.lx = 1
|
75
|
+
data.item = home
|
76
|
+
data.iy = 4
|
77
|
+
data.ix = 10
|
78
|
+
data.flen = home.length + 40
|
79
|
+
data.ilen = 0
|
80
|
+
items.push(data.to_a)
|
81
|
+
|
82
|
+
dialog.title = "FORM"
|
83
|
+
dialog.extra_button = true
|
84
|
+
dialog.ok_label = "Save"
|
85
|
+
dialog.extra_label = "Submit"
|
86
|
+
dialog.cancel_label = "Quit"
|
87
|
+
|
88
|
+
result_hash = dialog.form(text, items, 20, 50, 0)
|
89
|
+
if result_hash
|
90
|
+
puts "Resulting data:"
|
91
|
+
result_hash.each do |key, val|
|
92
|
+
puts " #{key} = #{val}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
rescue => e
|
98
|
+
puts "#{$!}"
|
99
|
+
t = e.backtrace.join("\n\t")
|
100
|
+
puts "Error: #{t}"
|
101
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
begin
|
8
|
+
ME = File.basename($0)
|
9
|
+
if ENV['CHANGE_TITLE']
|
10
|
+
if ME =~ /(.+)\.rb$/
|
11
|
+
base = $1
|
12
|
+
puts "\033]0;mrdialog - #{base}\007"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
dialog = MRDialog.new
|
17
|
+
dialog.clear = true
|
18
|
+
dialog.title = "Please choose a file"
|
19
|
+
dialog.extra_button = true
|
20
|
+
dialog.ok_label = "Copy"
|
21
|
+
dialog.extra_label = "Delete"
|
22
|
+
dialog.cancel_label = "Quit"
|
23
|
+
|
24
|
+
h = 14
|
25
|
+
w = 48
|
26
|
+
file_path = ENV["HOME"] + "/"
|
27
|
+
file = dialog.fselect(file_path, h, w)
|
28
|
+
|
29
|
+
puts "Exit code: #{dialog.exit_code}"
|
30
|
+
puts "Result is: #{file}"
|
31
|
+
|
32
|
+
rescue => e
|
33
|
+
puts "#{$!}"
|
34
|
+
t = e.backtrace.join("\n\t")
|
35
|
+
puts "Error: #{t}"
|
36
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
begin
|
8
|
+
ME = File.basename($0)
|
9
|
+
if ENV['CHANGE_TITLE']
|
10
|
+
if ME =~ /(.+)\.rb$/
|
11
|
+
base = $1
|
12
|
+
puts "\033]0;mrdialog - #{base}\007"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
text = <<EOF
|
17
|
+
Hi, this is an input dialog box. You can use
|
18
|
+
this to ask questions that require the user
|
19
|
+
to input a string as the answer. You can
|
20
|
+
input strings of length longer than the
|
21
|
+
width of the input box, in that case, the
|
22
|
+
input field will be automatically scrolled.
|
23
|
+
You can use BACKSPACE to correct errors.
|
24
|
+
Try entering your name below:
|
25
|
+
|
26
|
+
EOF
|
27
|
+
dialog = MRDialog.new
|
28
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
29
|
+
dialog.clear = true
|
30
|
+
dialog.title = "INPUT BOX"
|
31
|
+
dialog.extra_button = true
|
32
|
+
dialog.ok_label = "Send"
|
33
|
+
dialog.extra_label = "Save"
|
34
|
+
dialog.cancel_label = "Quit"
|
35
|
+
|
36
|
+
height = 16
|
37
|
+
width = 51
|
38
|
+
init = "blah"
|
39
|
+
result = dialog.inputbox(text, height, width, init)
|
40
|
+
|
41
|
+
puts "Exit Code: #{dialog.exit_code}"
|
42
|
+
puts "Result is: #{result}"
|
43
|
+
|
44
|
+
rescue => e
|
45
|
+
puts "#{$!}"
|
46
|
+
t = e.backtrace.join("\n\t")
|
47
|
+
puts "Error: #{t}"
|
48
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
begin
|
6
|
+
ME = File.basename($0)
|
7
|
+
if ENV['CHANGE_TITLE']
|
8
|
+
if ME =~ /(.+)\.rb$/
|
9
|
+
base = $1
|
10
|
+
puts "\033]0;mrdialog - #{base}\007"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
dialog = MRDialog.new
|
15
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
16
|
+
dialog.clear = true
|
17
|
+
dialog.title = "MENU BOX"
|
18
|
+
dialog.extra_button = true
|
19
|
+
dialog.ok_label = "Send"
|
20
|
+
dialog.extra_label = "Save"
|
21
|
+
dialog.cancel_label = "Quit"
|
22
|
+
|
23
|
+
|
24
|
+
text = <<EOF
|
25
|
+
This example is taken from dialog/samples/menubox1
|
26
|
+
|
27
|
+
Hi, this is a menu box. You can use this to
|
28
|
+
present a list of choices for the user to
|
29
|
+
choose. If there are more items than can fit
|
30
|
+
on the screen, the menu will be scrolled.
|
31
|
+
You can use the UP/DOWN arrow keys, the first
|
32
|
+
letter of the choice as a hot key, or the
|
33
|
+
number keys 1-9 to choose an option.
|
34
|
+
Try it now!
|
35
|
+
|
36
|
+
Choose the OS you like:
|
37
|
+
|
38
|
+
EOF
|
39
|
+
items = []
|
40
|
+
menu_data = Struct.new(:tag, :item)
|
41
|
+
data = menu_data.new
|
42
|
+
data.tag = "Linux"
|
43
|
+
data.item = "The Great Unix Clone for 386/486"
|
44
|
+
items.push(data.to_a)
|
45
|
+
|
46
|
+
data = menu_data.new
|
47
|
+
data.tag = "NetBSD"
|
48
|
+
data.item = "Another free Unix Clone for 386/486"
|
49
|
+
items.push(data.to_a)
|
50
|
+
|
51
|
+
data = menu_data.new
|
52
|
+
data.tag = "OS/2"
|
53
|
+
data.item = "IBM OS/2"
|
54
|
+
items.push(data.to_a)
|
55
|
+
|
56
|
+
data = menu_data.new
|
57
|
+
data.tag = "WIN NT"
|
58
|
+
data.item = "Microsoft Windows NT"
|
59
|
+
items.push(data.to_a)
|
60
|
+
|
61
|
+
data = menu_data.new
|
62
|
+
data.tag = "PCDOS"
|
63
|
+
data.item = "IBM PC DOS"
|
64
|
+
items.push(data.to_a)
|
65
|
+
|
66
|
+
data = menu_data.new
|
67
|
+
data.tag = "MSDOS"
|
68
|
+
data.item = "Microsoft DOS"
|
69
|
+
items.push(data.to_a)
|
70
|
+
|
71
|
+
|
72
|
+
height = 0
|
73
|
+
width = 0
|
74
|
+
menu_height = 4
|
75
|
+
|
76
|
+
selected_item = dialog.menu(text, items, height, width, menu_height)
|
77
|
+
|
78
|
+
puts "Exit Code: #{dialog.exit_code}"
|
79
|
+
puts "Selected item: #{selected_item}"
|
80
|
+
|
81
|
+
rescue => e
|
82
|
+
puts "#{$!}"
|
83
|
+
t = e.backtrace.join("\n\t")
|
84
|
+
puts "Error: #{t}"
|
85
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# muquit@muquit.com Apr-01-2014
|
3
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
begin
|
7
|
+
ME = File.basename($0)
|
8
|
+
if ENV['CHANGE_TITLE']
|
9
|
+
if ME =~ /(.+)\.rb$/
|
10
|
+
base = $1
|
11
|
+
puts "\033]0;mrdialog - #{base}\007"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
text = <<EOF
|
16
|
+
Hi, this is an password dialog box. You can use
|
17
|
+
this to ask questions that require the user
|
18
|
+
to input a string as the answer. You can
|
19
|
+
input strings of length longer than the
|
20
|
+
width of the input box, in that case, the
|
21
|
+
input field will be automatically scrolled.
|
22
|
+
You can use BACKSPACE to correct errors.
|
23
|
+
Try entering your name below:
|
24
|
+
|
25
|
+
EOF
|
26
|
+
dialog = MRDialog.new
|
27
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
28
|
+
dialog.clear = true
|
29
|
+
dialog.title = "Password box"
|
30
|
+
dialog.extra_button = true
|
31
|
+
dialog.ok_label = "Login"
|
32
|
+
dialog.extra_label = "Reset"
|
33
|
+
dialog.cancel_label = "Quit"
|
34
|
+
|
35
|
+
result = dialog.passwordbox(text)
|
36
|
+
|
37
|
+
puts "Exit Code: #{dialog.exit_code}"
|
38
|
+
puts "Result is: #{result}"
|
39
|
+
|
40
|
+
rescue => e
|
41
|
+
puts "#{$!}"
|
42
|
+
t = e.backtrace.join("\n\t")
|
43
|
+
puts "Error: #{t}"
|
44
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
class TestRadiolist
|
8
|
+
ME = File.basename($0)
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
if ENV['CHANGE_TITLE']
|
12
|
+
if ME =~ /(.+)\.rb$/
|
13
|
+
base = $1
|
14
|
+
puts "\033]0;mrdialog - #{base}\007"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def doit
|
20
|
+
dialog = MRDialog.new
|
21
|
+
dialog.clear = true
|
22
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
23
|
+
|
24
|
+
text = <<EOF
|
25
|
+
This example is taken from dialog/samples/radiolist
|
26
|
+
shell script.
|
27
|
+
|
28
|
+
Hi, this is a radiolist box. You can use this to
|
29
|
+
present a list of choices which can be turned on or
|
30
|
+
off. If there are more items than can fit on the
|
31
|
+
screen, the list will be scrolled. You can use the
|
32
|
+
UP/DOWN arrow keys, the first letter of the choice as a
|
33
|
+
hot key, or the number keys 1-9 to choose an option.
|
34
|
+
Press SPACE to toggle an option on/off.
|
35
|
+
|
36
|
+
Which of the following are fruits?
|
37
|
+
|
38
|
+
EOF
|
39
|
+
items = []
|
40
|
+
radiolist_data = Struct.new(:tag, :item, :select)
|
41
|
+
|
42
|
+
data = radiolist_data.new
|
43
|
+
data.tag = "Apple"
|
44
|
+
data.item = "It's an applie"
|
45
|
+
data.select = false
|
46
|
+
items.push(data.to_a)
|
47
|
+
|
48
|
+
data = radiolist_data.new
|
49
|
+
data.tag = "Dog"
|
50
|
+
data.item = "No it's not my dog"
|
51
|
+
data.select = true
|
52
|
+
items.push(data.to_a)
|
53
|
+
|
54
|
+
data = radiolist_data.new
|
55
|
+
data.tag = "Orange"
|
56
|
+
data.item = "Yeah! it is juicy"
|
57
|
+
data.select = false
|
58
|
+
items.push(data.to_a)
|
59
|
+
|
60
|
+
dialog.title = "RADIOLIST"
|
61
|
+
dialog.extra_button = true
|
62
|
+
dialog.ok_label = "Edit"
|
63
|
+
dialog.extra_label = "Delete"
|
64
|
+
dialog.cancel_label = "Quit"
|
65
|
+
|
66
|
+
selected_item = dialog.radiolist(text, items)
|
67
|
+
exit_code = dialog.exit_code
|
68
|
+
case exit_code
|
69
|
+
when dialog.dialog_ok
|
70
|
+
puts "OK Pressed"
|
71
|
+
when dialog.dialog_extra
|
72
|
+
puts "Extra Pressed"
|
73
|
+
when dialog.dialog_cancel
|
74
|
+
puts "Cancel Pressed"
|
75
|
+
when dialog.dialog_esc
|
76
|
+
puts "Escape Pressed"
|
77
|
+
end
|
78
|
+
|
79
|
+
puts "Selected item: #{selected_item}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
if __FILE__ == $0
|
84
|
+
TestRadiolist.new.doit
|
85
|
+
end
|
86
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-01-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
begin
|
8
|
+
ME = File.basename($0)
|
9
|
+
if ENV['CHANGE_TITLE']
|
10
|
+
if ME =~ /(.+)\.rb$/
|
11
|
+
base = $1
|
12
|
+
puts "\033]0;mrdialog - #{base}\007"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
text = <<EOF
|
17
|
+
Please set the time...
|
18
|
+
EOF
|
19
|
+
|
20
|
+
h = 0
|
21
|
+
w = 0
|
22
|
+
t = Time.new
|
23
|
+
|
24
|
+
dialog = MRDialog.new
|
25
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
26
|
+
dialog.clear = true
|
27
|
+
dialog.title = "TIEMBOX"
|
28
|
+
dialog.extra_button = true
|
29
|
+
dialog.ok_label = "Event"
|
30
|
+
dialog.extra_label = "Alert"
|
31
|
+
dialog.cancel_label = "Quit"
|
32
|
+
|
33
|
+
# return Time
|
34
|
+
time = dialog.timebox(text, h, w, t)
|
35
|
+
|
36
|
+
puts "Exit Code: #{dialog.exit_code}"
|
37
|
+
puts "time: #{time}"
|
38
|
+
|
39
|
+
rescue => e
|
40
|
+
puts "#{$!}"
|
41
|
+
t = e.backtrace.join("\n\t")
|
42
|
+
puts "Error: #{t}"
|
43
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# muquit@muquit.com Apr-20-2014
|
4
|
+
require [File.expand_path(File.dirname(__FILE__)), '../..', 'lib', 'mrdialog'].join('/')
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
begin
|
8
|
+
ME = File.basename($0)
|
9
|
+
if ENV['CHANGE_TITLE']
|
10
|
+
if ME =~ /(.+)\.rb$/
|
11
|
+
base = $1
|
12
|
+
puts "\033]0;mrdialog - #{base}\007"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
text = <<-EOF
|
17
|
+
This example is taken from dialog/samples/treeview1
|
18
|
+
shell script.
|
19
|
+
|
20
|
+
EOF
|
21
|
+
items = []
|
22
|
+
Struct.new("TreeviewData", :tag, :item, :status, :depth)
|
23
|
+
data = Struct::TreeviewData.new
|
24
|
+
|
25
|
+
data.tag = "tag1"
|
26
|
+
data.item = "Item number 1"
|
27
|
+
data.status = false
|
28
|
+
data.depth = 0
|
29
|
+
items.push(data.to_a)
|
30
|
+
|
31
|
+
data = Struct::TreeviewData.new
|
32
|
+
data.tag = "tag2"
|
33
|
+
data.item = "Item number 2"
|
34
|
+
data.status = false
|
35
|
+
data.depth = 1
|
36
|
+
items.push(data.to_a)
|
37
|
+
|
38
|
+
data = Struct::TreeviewData.new
|
39
|
+
data.tag = "tag3"
|
40
|
+
data.item = "Item number 3"
|
41
|
+
data.status = true
|
42
|
+
data.depth = 2
|
43
|
+
items.push(data.to_a)
|
44
|
+
|
45
|
+
data = Struct::TreeviewData.new
|
46
|
+
data.tag = "tag4"
|
47
|
+
data.item = "Item number 4"
|
48
|
+
data.status = false
|
49
|
+
data.depth = 1
|
50
|
+
items.push(data.to_a)
|
51
|
+
|
52
|
+
data = Struct::TreeviewData.new
|
53
|
+
data.tag = "tag5"
|
54
|
+
data.item = "Item number 5"
|
55
|
+
data.status = false
|
56
|
+
data.depth = 2
|
57
|
+
items.push(data.to_a)
|
58
|
+
|
59
|
+
data = Struct::TreeviewData.new
|
60
|
+
data.tag = "tag6"
|
61
|
+
data.item = "Item number 6"
|
62
|
+
data.status = false
|
63
|
+
data.depth = 3
|
64
|
+
items.push(data.to_a)
|
65
|
+
|
66
|
+
data = Struct::TreeviewData.new
|
67
|
+
data.tag = "tag7"
|
68
|
+
data.item = "Item number 7"
|
69
|
+
data.status = false
|
70
|
+
data.depth = 3
|
71
|
+
items.push(data.to_a)
|
72
|
+
|
73
|
+
data = Struct::TreeviewData.new
|
74
|
+
data.tag = "tag8"
|
75
|
+
data.item = "Item number 8"
|
76
|
+
data.status = false
|
77
|
+
data.depth = 4
|
78
|
+
items.push(data.to_a)
|
79
|
+
|
80
|
+
data = Struct::TreeviewData.new
|
81
|
+
data.tag = "tag9"
|
82
|
+
data.item = "Item number 9"
|
83
|
+
data.status = false
|
84
|
+
data.depth = 1
|
85
|
+
items.push(data.to_a)
|
86
|
+
|
87
|
+
dialog = MRDialog.new
|
88
|
+
dialog.clear = true
|
89
|
+
dialog.title = "TREEVIEW"
|
90
|
+
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
91
|
+
dialog.extra_button = true
|
92
|
+
dialog.ok_label = "Edit"
|
93
|
+
dialog.extra_label = "Delete"
|
94
|
+
dialog.cancel_label = "Quit"
|
95
|
+
|
96
|
+
|
97
|
+
height = 0
|
98
|
+
width = 0
|
99
|
+
listheight = 0
|
100
|
+
|
101
|
+
selected_tag = dialog.treeview(text, items, height, width, listheight)
|
102
|
+
exit_code = dialog.exit_code
|
103
|
+
puts "Exit code: #{exit_code}"
|
104
|
+
if exit_code != 1
|
105
|
+
puts "Selected tag: #{selected_tag}"
|
106
|
+
end
|
107
|
+
|
108
|
+
rescue => e
|
109
|
+
puts "#{$!}"
|
110
|
+
t = e.backtrace.join("\n\t")
|
111
|
+
puts "Error: #{t}"
|
112
|
+
end
|
data/samples/run_all.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrdialog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleks Clark
|
8
8
|
- Muhammad Muquit
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
@@ -43,30 +43,30 @@ dependencies:
|
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '2.0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '2.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: juwelier
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 2.0
|
62
|
+
version: 2.1.0
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.0
|
69
|
+
version: 2.1.0
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: simplecov
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +81,20 @@ dependencies:
|
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: test-unit
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
84
98
|
description: "A ruby gem for ncurses dialog program.\n This gem is based on rdialog
|
85
99
|
(http://rdialog.rubyforge.org/) by\n Aleks Clark. I added support for missing
|
86
100
|
widgets, fixed \n bugs and wrote the sample apps. I am \n also renaming
|
@@ -97,19 +111,29 @@ files:
|
|
97
111
|
- ".document"
|
98
112
|
- ChangeLog.md
|
99
113
|
- Gemfile
|
100
|
-
- Gemfile.lock
|
101
114
|
- LICENSE.txt
|
102
115
|
- README.md
|
103
116
|
- Rakefile
|
104
117
|
- VERSION
|
105
118
|
- lib/mrdialog.rb
|
106
119
|
- lib/mrdialog/mrdialog.rb
|
120
|
+
- mrdialog.gemspec
|
107
121
|
- pkg/md5.txt
|
108
|
-
- pkg/mrdialog-1.0.3.gem
|
109
122
|
- samples/buildlist.rb
|
110
123
|
- samples/calendar.rb
|
111
124
|
- samples/checklist.rb
|
112
125
|
- samples/editbox.rb
|
126
|
+
- samples/extra_button/buildlist.rb
|
127
|
+
- samples/extra_button/calendar.rb
|
128
|
+
- samples/extra_button/checklist.rb
|
129
|
+
- samples/extra_button/form1.rb
|
130
|
+
- samples/extra_button/fselect.rb
|
131
|
+
- samples/extra_button/inputbox.rb
|
132
|
+
- samples/extra_button/menubox.rb
|
133
|
+
- samples/extra_button/password.rb
|
134
|
+
- samples/extra_button/radiolist.rb
|
135
|
+
- samples/extra_button/timebox.rb
|
136
|
+
- samples/extra_button/treeview.rb
|
113
137
|
- samples/form1.rb
|
114
138
|
- samples/form2.rb
|
115
139
|
- samples/form3.rb
|
@@ -169,7 +193,7 @@ homepage: http://github.com/muquit/mrdialog
|
|
169
193
|
licenses:
|
170
194
|
- MIT
|
171
195
|
metadata: {}
|
172
|
-
post_install_message:
|
196
|
+
post_install_message:
|
173
197
|
rdoc_options: []
|
174
198
|
require_paths:
|
175
199
|
- lib
|
@@ -184,9 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
208
|
- !ruby/object:Gem::Version
|
185
209
|
version: '0'
|
186
210
|
requirements: []
|
187
|
-
|
188
|
-
|
189
|
-
signing_key:
|
211
|
+
rubygems_version: 3.2.3
|
212
|
+
signing_key:
|
190
213
|
specification_version: 4
|
191
214
|
summary: A ruby gem for ncurses dialog program, based on the gem rdialog
|
192
215
|
test_files: []
|