mrdialog 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +42 -22
- data/LICENSE.txt +1 -1
- data/README.md +181 -0
- data/VERSION +1 -1
- data/lib/mrdialog/mrdialog.rb +18 -1
- data/pkg/mrdialog-1.0.1.gem +0 -0
- data/samples/buildlist.rb +9 -1
- data/samples/calendar.rb +7 -0
- data/samples/checklist.rb +17 -4
- data/samples/editbox.rb +7 -0
- data/samples/form1.rb +8 -2
- data/samples/form2.rb +7 -0
- data/samples/form3.rb +7 -1
- data/samples/fselect.rb +7 -0
- data/samples/gauge.rb +7 -0
- data/samples/infobox.rb +7 -0
- data/samples/inputbox.rb +7 -0
- data/samples/menubox.rb +7 -0
- data/samples/mixedform1.rb +7 -2
- data/samples/msgbox.rb +7 -0
- data/samples/password.rb +7 -0
- data/samples/password2.rb +7 -0
- data/samples/passwordform.rb +8 -2
- data/samples/pause.rb +7 -0
- data/samples/prgbox.rb +7 -0
- data/samples/program.rb +7 -0
- data/samples/progress.rb +7 -0
- data/samples/radiolist.rb +8 -0
- data/samples/run_all.rb +52 -0
- data/samples/timebox.rb +7 -0
- data/samples/treeview.rb +7 -0
- data/samples/treeview2.rb +7 -0
- data/samples/yesno.rb +7 -0
- data/screenshots/README.txt +10 -0
- data/screenshots/all.gif +0 -0
- data/screenshots/buildlist.png +0 -0
- data/screenshots/calendar.png +0 -0
- data/screenshots/checklist.png +0 -0
- data/screenshots/editbox.png +0 -0
- data/screenshots/form1.png +0 -0
- data/screenshots/form2.png +0 -0
- data/screenshots/form3.png +0 -0
- data/screenshots/fselect.png +0 -0
- data/screenshots/gauge.png +0 -0
- data/screenshots/infobox.png +0 -0
- data/screenshots/inputbox.png +0 -0
- data/screenshots/menubox.png +0 -0
- data/screenshots/mixedform1.png +0 -0
- data/screenshots/msgbox.png +0 -0
- data/screenshots/password.png +0 -0
- data/screenshots/password2.png +0 -0
- data/screenshots/passwordform.png +0 -0
- data/screenshots/pause.png +0 -0
- data/screenshots/prgbox.png +0 -0
- data/screenshots/program.png +0 -0
- data/screenshots/progress.png +0 -0
- data/screenshots/radiolist.png +0 -0
- data/screenshots/take_shots.rb +111 -0
- data/screenshots/timebox.png +0 -0
- data/screenshots/treeview.png +0 -0
- data/screenshots/treeview2.png +0 -0
- data/screenshots/yesno.png +0 -0
- metadata +48 -18
- data/README.rdoc +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2788351bad6662f93bed6be806fda9d5ff752ef
|
4
|
+
data.tar.gz: 2e580a2f427e441cfee6478b7fbf7f52cc691ae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d033481974440dc36978a2ae3db69f0f1e37057c5eb5dd8bc7ef1ebc90af7004b72364a71f950bd6f50f487d59d5deb27122952c7646f3c3ed1620d84d26e762
|
7
|
+
data.tar.gz: a2453d6a80bace7d54defe1dc5e06568857715be1bf38c182fcb8c0f2d8f4847fb915e18f3d4081f25b8e00cfd9f92b8ea608b9f360899e426fd957921a55f49
|
data/ChangeLog.md
CHANGED
@@ -1,8 +1,27 @@
|
|
1
|
+
## 1.0.2
|
2
|
+
|
3
|
+
* Added accessor `notags`. It can be used with checklist for example. The default value is false.
|
4
|
+
|
5
|
+
```
|
6
|
+
dialog = MRDialog.new()
|
7
|
+
dialog.notags = true
|
8
|
+
```
|
9
|
+
* Added accesor `dialog_options`. It can be used to pass any valid dialog option. `man dialog` and look at the **OPTIONS** section. It is the caller's responsibily to specify correct options, no validation will be done. Example:
|
10
|
+
|
11
|
+
```
|
12
|
+
dialog = MRDialog.new()
|
13
|
+
dialog.dialog_options = "--no-tags"
|
14
|
+
```
|
15
|
+
This ia exactly same as `dialog.notags = true`
|
16
|
+
|
17
|
+
(Apr-16-2016 )
|
18
|
+
|
1
19
|
## 1.0.1
|
2
20
|
|
3
21
|
* Jeweler support for making the gem.
|
4
22
|
|
5
|
-
|
23
|
+
Implemented methods for:
|
24
|
+
|
6
25
|
* 'buildlist' (--buildlist)
|
7
26
|
* 'editbox' (--editbox)
|
8
27
|
* 'form' (--form)
|
@@ -21,27 +40,28 @@
|
|
21
40
|
dialog_ok, dialog_cancel, dialog_help, dialog_extra,
|
22
41
|
dialog_item_help, dialog_esc
|
23
42
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
Implemented examples for:
|
44
|
+
|
45
|
+
* buildlist
|
46
|
+
* calendar
|
47
|
+
* checklist
|
48
|
+
* editbox
|
49
|
+
* form
|
50
|
+
* fselect
|
51
|
+
* gauge
|
52
|
+
* infobox
|
53
|
+
* inputbox
|
54
|
+
* menu
|
55
|
+
* msgbox
|
56
|
+
* passwordbox
|
57
|
+
* pause
|
58
|
+
* prgbox
|
59
|
+
* progressbox
|
60
|
+
* programbox
|
61
|
+
* radiolist
|
62
|
+
* timebox
|
63
|
+
* treeview
|
64
|
+
* yesno
|
45
65
|
|
46
66
|
Note: The examples use Struct class, making the examples clean and
|
47
67
|
easy to understand.
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) Aleks Clarks, http://rdialog.rubyforge.org/
|
2
|
-
Copyright (c) 2014, Muhammad Muquit, http://
|
2
|
+
Copyright (c) 2014, Muhammad Muquit, http://www.muquit.com/
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
data/README.md
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
### MRDialog
|
2
|
+
|
3
|
+
mrdialog is a pure
|
4
|
+
[ruby](https://www.ruby-lang.org/) library for the ncurses
|
5
|
+
[dialog](http://invisible-island.net/dialog/dialog.html) program.
|
6
|
+
[dialog](http://invisible-island.net/dialog/dialog.html) is
|
7
|
+
a command line tool that can present questions, messages, forms using
|
8
|
+
dialog boxes from a shell script. If you compiled linux kernel and typed 'make
|
9
|
+
menuconfig, configured Linux from command line with various configuration
|
10
|
+
managers, you have used 'dialog' like programs.
|
11
|
+
|
12
|
+
However, it is painful to program dialog from shell scripts due to lack of
|
13
|
+
data structure. You constantly have to watch if the correct number of
|
14
|
+
items are specified, if the arguments are in correct order for example. It is
|
15
|
+
a lot of fun to program dialog from an object oriented scripting language like
|
16
|
+
[ruby](https://www.ruby-lang.org/). Compare the sample shell scripts of dialog program with
|
17
|
+
the sample ruby scripts of mrdialog in the [samples](samples/) directory, I think you will
|
18
|
+
agree.
|
19
|
+
|
20
|
+
MRDialog is based on the rdialog ruby gem http://rdialog.rubyforge.org/ by
|
21
|
+
Aleks Clark.
|
22
|
+
|
23
|
+
I did the following:
|
24
|
+
|
25
|
+
* Added features and support for all of the missing widgets.
|
26
|
+
* Fixed the bugs I found.
|
27
|
+
* Implemented the examples for all the widgets.
|
28
|
+
* I am in the process of documenting the APIs here.
|
29
|
+
|
30
|
+
Please look at the [ChangeLog.md](ChangeLog.md) file for details. Please look at he [screenshots](screenshots/) to see how the widgets look like.
|
31
|
+
|
32
|
+
If you have bug reports, questions, requests or suggestions, please enter it in the [Issues](https://github.com/muquit/mrdialog/issues) with an appropriate label.
|
33
|
+
|
34
|
+
### Latest Version
|
35
|
+
The latest version is 1.0.2.
|
36
|
+
|
37
|
+
### Screenshots
|
38
|
+
Please look at the [screenshots](screenshots/) directory. There are individual screenshots for each of the widgets. Also the animated GIF file [all.gif](screenshots/all.gif) contains screenshot of all the widgets.
|
39
|
+
|
40
|
+
|
41
|
+
### Requirements
|
42
|
+
The [dialog](http://invisible-island.net/dialog/dialog.html) program must be installed. d Note: the dialog program that is available in ubuntu is little old. Check the dialog version by typing ```dialog --version```
|
43
|
+
|
44
|
+
I tested with ```dialog Version: 1.2-20130928```
|
45
|
+
|
46
|
+
dialog HOME: http://invisible-island.net/dialog/dialog.html.
|
47
|
+
|
48
|
+
### To install
|
49
|
+
|
50
|
+
```# gem install mrdialog```
|
51
|
+
or
|
52
|
+
```$ sudo gem install mrdialog```
|
53
|
+
### To uninstall
|
54
|
+
```# gem uninstall mrdialog``` or ```$ sudo gem uninstall mrdialog```
|
55
|
+
|
56
|
+
### Run the sample apps
|
57
|
+
Find out where the mrdialog gem is installed. Example:
|
58
|
+
|
59
|
+
$ gem which mrdialog
|
60
|
+
/Library/Ruby/Gems/2.0.0/gems/mrdialog-1.0.1/lib/mrdialog.rb
|
61
|
+
|
62
|
+
```cd``` to the ```samples``` directory and run the apps.
|
63
|
+
Example:
|
64
|
+
|
65
|
+
$ cd /Library/Ruby/Gems/2.0.0/gems/mrdialog-1.0.1/samples
|
66
|
+
$ ./msgbox.rb
|
67
|
+
|
68
|
+
|
69
|
+
### How to use the API
|
70
|
+
For now, please look at the apps in [samples](samples/) directory to see how the API works. I will document the APIs here as time permits.
|
71
|
+
|
72
|
+
require 'mrdialog'
|
73
|
+
dialog = MRDialog.new
|
74
|
+
|
75
|
+
#### Properties
|
76
|
+
The various properties of the dialog (shadow, title etc.) can be set by calling the appropriate setters. The supported propertes are shown below:
|
77
|
+
|
78
|
+
|Property|Example|Description|Default|
|
79
|
+
|--------|-------|-----------|-------|
|
80
|
+
|shadow|```dialog.shadow = false``` | Draw a shadow to the right and bottom of each dialog box.| true|
|
81
|
+
|title|```dialog.title = 'foo'```|Specifies a title string to be displayed at the top of the dialog box|N/A|
|
82
|
+
|logger|```dialog.logger = Logger.new("dialog.log")```|Debug messages will be logged to the specified ruby Logger|N/A|
|
83
|
+
|clear|```dialog.clear = true```|Clears the widget screen, keeping only the screen_color background.|false|
|
84
|
+
|insecure|```dialog.insecure = true```|Makes the password widget friendlier but less secure, by echoing asterisks for each character.|false|
|
85
|
+
|ascii_lines|```dialog.ascii_lines = true```|Rather than draw graphics lines around boxes, draw ASCII "+" and "-" in the same place. See also "--no-lines".|false|
|
86
|
+
|...|...|...|...|
|
87
|
+
|
88
|
+
#### Widgets
|
89
|
+
The following dialog widgets are supported:
|
90
|
+
|
91
|
+
* buildlist
|
92
|
+
* calendar
|
93
|
+
* checklist
|
94
|
+
* editbox
|
95
|
+
* form
|
96
|
+
* fselect
|
97
|
+
* gauge
|
98
|
+
* infobox
|
99
|
+
* inputbox
|
100
|
+
* menu
|
101
|
+
* msgbox
|
102
|
+
* passwordbox
|
103
|
+
* passwordform
|
104
|
+
* pause
|
105
|
+
* prgbox
|
106
|
+
* progressbox
|
107
|
+
* programbox
|
108
|
+
* radiolist
|
109
|
+
* timebox
|
110
|
+
* treeview
|
111
|
+
* yesno
|
112
|
+
|
113
|
+
##### buildlist
|
114
|
+
A buildlist dialog displays two lists, side-by-side. The list on the left shows unselected items. The list on the right shows selected items. As items are selected or unselected, they move between the lists. The SPACE bar is used to
|
115
|
+
select or unselect an item.
|
116
|
+
|
117
|
+
Use a carriage return or the "OK" button to accept the current value in the selected-window and exit. The results are written using the order displayed in the selected-window. The caller is responsible to create the items properly. Please look at [buildlist.rb](samples/buildlist.rb) for an example.
|
118
|
+
|
119
|
+
returns an array of selected tags
|
120
|
+
|
121
|
+
result_array = dialog.buildlist(text="Text Goes Here", items, height=0, width=0, listheight=0)
|
122
|
+
|
123
|
+
#### calendar
|
124
|
+
Please look at [calendar.rb](samples/calendar.rb) for an example.
|
125
|
+
#### checklist
|
126
|
+
Please look at [checklist.rb](samples/checklist.rb) for an example.
|
127
|
+
#### editbox
|
128
|
+
Please look at [editbox.rb](samples/editbox.rb) for an example.
|
129
|
+
#### form
|
130
|
+
Please look at
|
131
|
+
[form1.rb](samples/form1.rb), [form2.rb](samples/form2.rb), [form3.rb](samples/form3.rb)
|
132
|
+
for examples.
|
133
|
+
#### fselect
|
134
|
+
Please look at [fselect.rb](samples/fselect.rb) for an example.
|
135
|
+
#### gauge
|
136
|
+
Please look at [gauge.rb](samples/gauge.rb) for an example.
|
137
|
+
#### infobox
|
138
|
+
Please look at [infobox.rb](samples/infobox.rb) for an example.
|
139
|
+
#### inputbox
|
140
|
+
Please look at [inputbox.rb](samples/inputbox.rb) for an example.
|
141
|
+
#### menu
|
142
|
+
Please look at [menubox.rb](samples/menubox.rb) for an example.
|
143
|
+
#### msgbox
|
144
|
+
Please look at [msgbox.rb](samples/msgbox.rb) for an example.
|
145
|
+
#### passwordbox
|
146
|
+
Please look at [password.rb](samples/password.rb), [password2.rb](samples/password2.rb)
|
147
|
+
for examples.
|
148
|
+
#### passwordform
|
149
|
+
Please look at [passwordform.rb](samples/passwordform.rb) for an example.
|
150
|
+
#### pause
|
151
|
+
Please look at [pause.rb](samples/pause.rb) for an example.
|
152
|
+
#### prgbox
|
153
|
+
Please look at [prgbox.rb](samples/prgbox.rb) for an example.
|
154
|
+
#### progressbox
|
155
|
+
Please look at [progressbox.rb](samples/progressbox.rb) for an example.
|
156
|
+
#### programbox
|
157
|
+
Please look at [programbox.rb](samples/programbox.rb) for an example.
|
158
|
+
#### radiolist
|
159
|
+
Please look at [radiolist.rb](samples/radiolist.rb) for an example.
|
160
|
+
#### timebox
|
161
|
+
Please look at [timebox.rb](samples/timebox.rb) for an example.
|
162
|
+
#### treeview
|
163
|
+
Please look at [treeview.rb](samples/treeview.rb) for an example.
|
164
|
+
#### yesno
|
165
|
+
Please look at [yesno.rb](samples/yesno.rb) for an example.
|
166
|
+
|
167
|
+
### For Developers
|
168
|
+
- To build: ```$ rake build```
|
169
|
+
|
170
|
+
Will create the gem inside the pkg directory
|
171
|
+
|
172
|
+
- To install the built gem: ```$ sudo gem install --local pkg/mrdialog-1.0.2.gem```
|
173
|
+
|
174
|
+
- To install using rake: ```$ sudo rake install```
|
175
|
+
|
176
|
+
- To install the gem to a specific directory: ```$ GEM_HOME=/tmp gem install --local pkg/mrdialog-1.0.2.gem```
|
177
|
+
|
178
|
+
The gem will be installed in /tmp/gems directory
|
179
|
+
|
180
|
+
### Copyright
|
181
|
+
Lincense is MIT. Please look at the [LICENSE.txt](LICENSE.txt) file for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/mrdialog/mrdialog.rb
CHANGED
@@ -94,6 +94,9 @@ class MRDialog
|
|
94
94
|
#
|
95
95
|
attr_accessor :shadow
|
96
96
|
|
97
|
+
# MMM
|
98
|
+
attr_accessor :notags
|
99
|
+
|
97
100
|
#
|
98
101
|
# Sleep (delay) for the given integer of seconds after processing
|
99
102
|
# a dialog box.
|
@@ -129,9 +132,12 @@ class MRDialog
|
|
129
132
|
attr_accessor :dialog_ok
|
130
133
|
attr_accessor :dialog_cancel
|
131
134
|
attr_accessor :dialog_help
|
132
|
-
attr_accessor :dialog_extra
|
133
135
|
attr_accessor :dialog_item_help
|
134
136
|
attr_accessor :dialog_esc
|
137
|
+
attr_accessor :dialog_extra
|
138
|
+
|
139
|
+
# pass dialog's option exactly
|
140
|
+
attr_accessor :dialog_options
|
135
141
|
|
136
142
|
#
|
137
143
|
# ruby logger
|
@@ -166,6 +172,7 @@ class MRDialog
|
|
166
172
|
# muquit@muquit.com mod starts--
|
167
173
|
$stdout.sync = true
|
168
174
|
$stderr.sync = true
|
175
|
+
# @tags = true
|
169
176
|
@dialog_ok = DIALOG_OK
|
170
177
|
@dialog_cancel = DIALOG_CANCEL
|
171
178
|
@dialog_help = DIALOG_HELP
|
@@ -1189,6 +1196,16 @@ class MRDialog
|
|
1189
1196
|
end
|
1190
1197
|
end
|
1191
1198
|
|
1199
|
+
unless @notags == nil
|
1200
|
+
if @notags == true
|
1201
|
+
ostring += "--no-tags "
|
1202
|
+
end
|
1203
|
+
end
|
1204
|
+
|
1205
|
+
if @dialog_options
|
1206
|
+
ostring += " #{@dialog_options} "
|
1207
|
+
end
|
1208
|
+
|
1192
1209
|
if @sleep
|
1193
1210
|
ostring += "--sleep " + @sleep.to_s + " "
|
1194
1211
|
end
|
data/pkg/mrdialog-1.0.1.gem
CHANGED
Binary file
|
data/samples/buildlist.rb
CHANGED
@@ -5,6 +5,12 @@ 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
|
8
14
|
text = <<EOF
|
9
15
|
This example is taken from dialog/samples/menulist
|
10
16
|
shell script.
|
@@ -12,7 +18,7 @@ shell script.
|
|
12
18
|
Hi, this is a buildlist dialog. The list on the left
|
13
19
|
shows the unselected items. The list on the right shows
|
14
20
|
the selected items. Use SPACE bar to select/unselect
|
15
|
-
items.
|
21
|
+
items. Shadow is set to false.
|
16
22
|
|
17
23
|
EOF
|
18
24
|
items = []
|
@@ -56,6 +62,8 @@ EOF
|
|
56
62
|
|
57
63
|
dialog = MRDialog.new
|
58
64
|
dialog.clear = true
|
65
|
+
dialog.shadow = false
|
66
|
+
dialog.title = "BUILDLIST"
|
59
67
|
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
60
68
|
|
61
69
|
height = 0
|
data/samples/calendar.rb
CHANGED
data/samples/checklist.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
|
This example is taken from dialog/samples/radiolist
|
10
17
|
shell script.
|
@@ -15,7 +22,8 @@ off. If there are more items than can fit on the
|
|
15
22
|
screen, the list will be scrolled. You can use the
|
16
23
|
UP/DOWN arrow keys, the first letter of the choice as a
|
17
24
|
hot key, or the number keys 1-9 to choose an option.
|
18
|
-
Press SPACE to toggle an option on/off.
|
25
|
+
Press SPACE to toggle an option on/off. Set the option
|
26
|
+
notags to true if you don't want to diaplay the tags.
|
19
27
|
|
20
28
|
Which of the following are fruits?
|
21
29
|
|
@@ -48,16 +56,21 @@ EOF
|
|
48
56
|
items.push(data.to_a)
|
49
57
|
|
50
58
|
dialog = MRDialog.new
|
59
|
+
# dialog.notags = false
|
60
|
+
# dialog.dialog_options = "--no-tags"
|
51
61
|
dialog.clear = true
|
62
|
+
dialog.title = "CHECKLIST"
|
52
63
|
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
53
64
|
|
54
65
|
selected_items = dialog.checklist(text, items)
|
55
66
|
exit_code = dialog.exit_code
|
56
67
|
puts selected_items.class
|
57
68
|
puts "Exit code: #{exit_code}"
|
58
|
-
|
59
|
-
|
60
|
-
|
69
|
+
if selected_items
|
70
|
+
puts "Selected Items:"
|
71
|
+
selected_items.each do |item|
|
72
|
+
puts " '#{item}'"
|
73
|
+
end
|
61
74
|
end
|
62
75
|
|
63
76
|
rescue => e
|
data/samples/editbox.rb
CHANGED
@@ -6,6 +6,12 @@ require 'tempfile'
|
|
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
|
9
15
|
|
10
16
|
tmp = Tempfile.new('editbox')
|
11
17
|
tmp.puts <<-EOF
|
@@ -45,6 +51,7 @@ EOF
|
|
45
51
|
dialog = MRDialog.new
|
46
52
|
dialog.clear = true
|
47
53
|
dialog.shadow = false
|
54
|
+
dialog.title = "EDITBOX"
|
48
55
|
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
|
49
56
|
|
50
57
|
output = dialog.editbox(tmp.path, height, width)
|
data/samples/form1.rb
CHANGED
@@ -6,8 +6,13 @@ require 'pp'
|
|
6
6
|
|
7
7
|
begin
|
8
8
|
ME = File.basename($0)
|
9
|
-
|
10
|
-
|
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
|
-
|
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
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
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
|
data/samples/mixedform1.rb
CHANGED
@@ -6,8 +6,12 @@ require 'pp'
|
|
6
6
|
|
7
7
|
begin
|
8
8
|
ME = File.basename($0)
|
9
|
-
|
10
|
-
|
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
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
|
data/samples/passwordform.rb
CHANGED
@@ -6,8 +6,13 @@ require 'pp'
|
|
6
6
|
|
7
7
|
begin
|
8
8
|
ME = File.basename($0)
|
9
|
-
|
10
|
-
|
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:"
|