mrdialog 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. data/ChangeLog.md +68 -23
  3. data/Gemfile +3 -2
  4. data/LICENSE.txt +1 -1
  5. data/README.md +196 -0
  6. data/Rakefile +3 -3
  7. data/VERSION +1 -1
  8. data/lib/mrdialog/mrdialog.rb +261 -178
  9. data/mrdialog.gemspec +124 -0
  10. data/pkg/md5.txt +1 -0
  11. data/samples/buildlist.rb +9 -1
  12. data/samples/calendar.rb +7 -0
  13. data/samples/checklist.rb +17 -4
  14. data/samples/editbox.rb +7 -0
  15. data/samples/extra_button/buildlist.rb +89 -0
  16. data/samples/extra_button/calendar.rb +45 -0
  17. data/samples/extra_button/checklist.rb +84 -0
  18. data/samples/extra_button/form1.rb +101 -0
  19. data/samples/extra_button/fselect.rb +36 -0
  20. data/samples/extra_button/inputbox.rb +48 -0
  21. data/samples/extra_button/menubox.rb +85 -0
  22. data/samples/extra_button/password.rb +44 -0
  23. data/samples/extra_button/radiolist.rb +86 -0
  24. data/samples/extra_button/timebox.rb +43 -0
  25. data/samples/extra_button/treeview.rb +112 -0
  26. data/samples/form1.rb +8 -2
  27. data/samples/form2.rb +7 -0
  28. data/samples/form3.rb +7 -1
  29. data/samples/fselect.rb +7 -0
  30. data/samples/gauge.rb +7 -0
  31. data/samples/infobox.rb +7 -0
  32. data/samples/inputbox.rb +7 -0
  33. data/samples/menubox.rb +7 -0
  34. data/samples/mixedform1.rb +7 -2
  35. data/samples/msgbox.rb +7 -0
  36. data/samples/password.rb +7 -0
  37. data/samples/password2.rb +7 -0
  38. data/samples/passwordform.rb +8 -2
  39. data/samples/pause.rb +7 -0
  40. data/samples/prgbox.rb +7 -0
  41. data/samples/program.rb +7 -0
  42. data/samples/progress.rb +7 -0
  43. data/samples/radiolist.rb +8 -0
  44. data/samples/run_all.rb +52 -0
  45. data/samples/timebox.rb +7 -0
  46. data/samples/treeview.rb +7 -0
  47. data/samples/treeview2.rb +7 -0
  48. data/samples/yesno.rb +7 -0
  49. data/screenshots/README.txt +10 -0
  50. data/screenshots/all.gif +0 -0
  51. data/screenshots/buildlist.png +0 -0
  52. data/screenshots/calendar.png +0 -0
  53. data/screenshots/checklist.png +0 -0
  54. data/screenshots/editbox.png +0 -0
  55. data/screenshots/form1.png +0 -0
  56. data/screenshots/form2.png +0 -0
  57. data/screenshots/form3.png +0 -0
  58. data/screenshots/fselect.png +0 -0
  59. data/screenshots/gauge.png +0 -0
  60. data/screenshots/infobox.png +0 -0
  61. data/screenshots/inputbox.png +0 -0
  62. data/screenshots/menubox.png +0 -0
  63. data/screenshots/mixedform1.png +0 -0
  64. data/screenshots/msgbox.png +0 -0
  65. data/screenshots/password.png +0 -0
  66. data/screenshots/password2.png +0 -0
  67. data/screenshots/passwordform.png +0 -0
  68. data/screenshots/pause.png +0 -0
  69. data/screenshots/prgbox.png +0 -0
  70. data/screenshots/program.png +0 -0
  71. data/screenshots/progress.png +0 -0
  72. data/screenshots/radiolist.png +0 -0
  73. data/screenshots/take_shots.rb +111 -0
  74. data/screenshots/timebox.png +0 -0
  75. data/screenshots/treeview.png +0 -0
  76. data/screenshots/treeview2.png +0 -0
  77. data/screenshots/yesno.png +0 -0
  78. metadata +83 -29
  79. data/Gemfile.lock +0 -82
  80. data/README.rdoc +0 -52
  81. data/pkg/mrdialog-1.0.1.gem +0 -0
@@ -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/form1.rb CHANGED
@@ -6,8 +6,13 @@ require 'pp'
6
6
 
7
7
  begin
8
8
  ME = File.basename($0)
9
- # uid=1000(muquit) gid=1000(muquit)
10
- # groups=1000(muquit),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),107(lpadmin),125(sambashare)
9
+ if ENV['CHANGE_TITLE']
10
+ if ME =~ /(.+)\.rb$/
11
+ base = $1
12
+ puts "\033]0;mrdialog - #{base}\007"
13
+ end
14
+ end
15
+
11
16
  user = ''
12
17
  uid = ''
13
18
  gid = ''
@@ -74,6 +79,7 @@ EOF
74
79
  data.ilen = 0
75
80
  items.push(data.to_a)
76
81
 
82
+ dialog.title = "FORM"
77
83
  result_hash = dialog.form(text, items, 20, 50, 0)
78
84
  if result_hash
79
85
  puts "Resulting data:"
data/samples/form2.rb CHANGED
@@ -9,6 +9,12 @@ require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join
9
9
 
10
10
  class TestForm2
11
11
  ME = File.basename($0)
12
+ if ENV['CHANGE_TITLE']
13
+ if ME =~ /(.+)\.rb$/
14
+ base = $1
15
+ puts "\033]0;mrdialog - #{base}\007"
16
+ end
17
+ end
12
18
  def initialize
13
19
  @hsh = {}
14
20
  end
@@ -135,6 +141,7 @@ EOF
135
141
  data.ilen = 0
136
142
  items.push(data.to_a)
137
143
 
144
+ dialog.title = "FORM"
138
145
  @hsh = dialog.form(text, items, 20, 60, 0)
139
146
  exit_code = dialog.exit_code
140
147
  @hsh.each do |key, val|
data/samples/form3.rb CHANGED
@@ -7,9 +7,15 @@ require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join
7
7
  require 'pp'
8
8
 
9
9
  class TestForm
10
- ME = File.basename($0)
10
+ ME = File.basename($0)
11
11
  HIDDEN = 1
12
12
  READ_ONLY = 2
13
+ if ENV['CHANGE_TITLE']
14
+ if ME =~ /(.+)\.rb$/
15
+ base = $1
16
+ puts "\033]0;mrdialog - #{base}\007"
17
+ end
18
+ end
13
19
  def initialize
14
20
  @a = []
15
21
  @h = {}
data/samples/fselect.rb CHANGED
@@ -6,6 +6,13 @@ require 'pp'
6
6
 
7
7
  begin
8
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
+
9
16
  text = <<EOF
10
17
  Please set the time...
11
18
  EOF
data/samples/gauge.rb CHANGED
@@ -7,6 +7,13 @@ require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join
7
7
 
8
8
  class TestGauge
9
9
  ME = File.basename($0)
10
+ if ENV['CHANGE_TITLE']
11
+ if ME =~ /(.+)\.rb$/
12
+ base = $1
13
+ puts "\033]0;mrdialog - #{base}\007"
14
+ end
15
+ end
16
+
10
17
  def initialize
11
18
  end
12
19
 
data/samples/infobox.rb CHANGED
@@ -6,6 +6,13 @@ require 'pp'
6
6
 
7
7
  class TestInfobox
8
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
+
9
16
  def initialize
10
17
  end
11
18
 
data/samples/inputbox.rb CHANGED
@@ -6,6 +6,13 @@ require 'pp'
6
6
 
7
7
  begin
8
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
+
9
16
  text = <<EOF
10
17
  Hi, this is an input dialog box. You can use
11
18
  this to ask questions that require the user
data/samples/menubox.rb CHANGED
@@ -4,6 +4,13 @@
4
4
  require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join('/')
5
5
  begin
6
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
+
7
14
  dialog = MRDialog.new
8
15
  dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
9
16
  dialog.clear = true
@@ -6,8 +6,12 @@ require 'pp'
6
6
 
7
7
  begin
8
8
  ME = File.basename($0)
9
- # uid=1000(muquit) gid=1000(muquit)
10
- # groups=1000(muquit),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),107(lpadmin),125(sambashare)
9
+ if ENV['CHANGE_TITLE']
10
+ if ME =~ /(.+)\.rb$/
11
+ base = $1
12
+ puts "\033]0;mrdialog - #{base}\007"
13
+ end
14
+ end
11
15
  user = ''
12
16
  uid = ''
13
17
  gid = ''
@@ -100,6 +104,7 @@ EOF
100
104
 
101
105
  dialog.title = "mixedform"
102
106
  dialog.insecure = true
107
+ dialog.title = "MIXEDFORM"
103
108
  height = 20
104
109
  width = 70
105
110
  result_hash = dialog.mixedform(text, items, height, width, 0)
data/samples/msgbox.rb CHANGED
@@ -6,6 +6,13 @@ require 'pp'
6
6
 
7
7
  class TestMsgbox
8
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
+
9
16
  def initialize
10
17
  end
11
18
 
data/samples/password.rb CHANGED
@@ -5,6 +5,13 @@ require 'pp'
5
5
 
6
6
  begin
7
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
+
8
15
  text = <<EOF
9
16
  Hi, this is an password dialog box. You can use
10
17
  this to ask questions that require the user
data/samples/password2.rb CHANGED
@@ -10,6 +10,13 @@ require 'pp'
10
10
 
11
11
  begin
12
12
  ME = File.basename($0)
13
+ if ENV['CHANGE_TITLE']
14
+ if ME =~ /(.+)\.rb$/
15
+ base = $1
16
+ puts "\033]0;mrdialog - #{base}\007"
17
+ end
18
+ end
19
+
13
20
  text = <<EOF
14
21
  Hi, this is an password dialog box. You can use
15
22
  this to ask questions that require the user
@@ -6,8 +6,13 @@ require 'pp'
6
6
 
7
7
  begin
8
8
  ME = File.basename($0)
9
- # uid=1000(muquit) gid=1000(muquit)
10
- # groups=1000(muquit),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),107(lpadmin),125(sambashare)
9
+ if ENV['CHANGE_TITLE']
10
+ if ME =~ /(.+)\.rb$/
11
+ base = $1
12
+ puts "\033]0;mrdialog - #{base}\007"
13
+ end
14
+ end
15
+
11
16
  user = ''
12
17
  uid = ''
13
18
  gid = ''
@@ -75,6 +80,7 @@ EOF
75
80
  items.push(data.to_a)
76
81
 
77
82
  dialog.insecure = true
83
+ dialog.title = "PASSWORDFORM"
78
84
  result_hash = dialog.passwordform(text, items, 20, 50, 0)
79
85
  if result_hash
80
86
  puts "Resulting data:"
data/samples/pause.rb CHANGED
@@ -6,6 +6,13 @@ require 'pp'
6
6
 
7
7
  class PauseBox
8
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
+
9
16
  def initialize
10
17
  end
11
18
 
data/samples/prgbox.rb CHANGED
@@ -6,7 +6,14 @@ require 'pp'
6
6
 
7
7
  class TestPrgBox1
8
8
  ME = File.basename($0)
9
+
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
10
17
  end
11
18
 
12
19
  def doit
data/samples/program.rb CHANGED
@@ -6,6 +6,13 @@
6
6
  require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join('/')
7
7
  begin
8
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
+
9
16
  text = "Hi, this is a gauge widget"
10
17
 
11
18
  height = 20
data/samples/progress.rb CHANGED
@@ -6,6 +6,13 @@
6
6
  require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join('/')
7
7
  begin
8
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
+
9
16
  text = "Hi, this is a gauge widget"
10
17
 
11
18
  height = 20
data/samples/radiolist.rb CHANGED
@@ -6,7 +6,14 @@ require 'pp'
6
6
 
7
7
  class TestRadiolist
8
8
  ME = File.basename($0)
9
+
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
10
17
  end
11
18
 
12
19
  def doit
@@ -50,6 +57,7 @@ EOF
50
57
  data.select = false
51
58
  items.push(data.to_a)
52
59
 
60
+ dialog.title = "RADIOLIST"
53
61
  selected_item = dialog.radiolist(text, items)
54
62
  exit_code = dialog.exit_code
55
63
  case exit_code