mrdialog 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog.md +68 -23
- data/Gemfile +3 -2
- data/LICENSE.txt +1 -1
- data/README.md +196 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/mrdialog/mrdialog.rb +261 -178
- data/mrdialog.gemspec +124 -0
- data/pkg/md5.txt +1 -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/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/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 +83 -29
- data/Gemfile.lock +0 -82
- data/README.rdoc +0 -52
- data/pkg/mrdialog-1.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4abf284e5f7c5aa297345dbd4506bce9997aae61093f05cb4dab1190f0c40346
|
4
|
+
data.tar.gz: f667bcca5f8556c139a4ee4d38e210df6f6c9163e3dfab588dfecfa8fa4766e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f79b47813388ebcf37ae95d3cb3373b792cd6e929c3f83a53fa6818a39fb6909e5096c9b493c89de8ae7f4b9233a4442b0844dd2db067bc7a3f885f88f7a3ffc
|
7
|
+
data.tar.gz: 89ac7a47299c65fc5fef30fbfd6acaba29e9f80ae20b0fc8d57ce8a65e57cec177f3adfdc6168406882cefe1970a9e776abc04b90ff16fb398b557bfd5decdfe
|
data/ChangeLog.md
CHANGED
@@ -1,8 +1,52 @@
|
|
1
|
+
## 1.0.4
|
2
|
+
* Previously only the OK/Yes button read input from forms, menus and lists.
|
3
|
+
If an extra button is used, it was treated the same as the Cancel/No
|
4
|
+
button, and no output from the form/menu/list was returned to the caller.
|
5
|
+
|
6
|
+
This PR changes the various user input dialogs to treat the Extra button
|
7
|
+
the same way as the OK/Yes button, and to return the dialog's input to the
|
8
|
+
caller.
|
9
|
+
|
10
|
+
Thanks to https://github.com/OtherJohnGray for pull request.
|
11
|
+
|
12
|
+
(Jun-22-2022)
|
13
|
+
|
14
|
+
|
15
|
+
## 1.0.3
|
16
|
+
* Added accessor `rc_file`. It specifies the DIALOGRC file to use. Default is $HOME/.dialogrc
|
17
|
+
* Added accessor `cancel_label`. It specifies the label to use for the 'Cancel' button.
|
18
|
+
* Added accessor `yes_label`. It specifies the label to use for the 'Yes' button.
|
19
|
+
* Added accessor `no_label`. It specifies the label to use for the 'No' button.
|
20
|
+
* Added accessor `help_button`. It specifies that a help button should be added to the dialog.
|
21
|
+
* Added accessor `help_label`. It specifies the label to use for the 'Help' button.
|
22
|
+
* Added accessor `extra_button`. It specifies that an extra button should be added to the dialog.
|
23
|
+
* Added accessor `extra_label`. It specifies the label to use for the 'Extra' button.
|
24
|
+
* Fully implemented @exit_code. The @exit_code variable wasn't being set on all dialog styles.
|
25
|
+
|
26
|
+
## 1.0.2
|
27
|
+
|
28
|
+
* Added accessor `notags`. It can be used with checklist for example. The default value is false.
|
29
|
+
|
30
|
+
```
|
31
|
+
dialog = MRDialog.new()
|
32
|
+
dialog.notags = true
|
33
|
+
```
|
34
|
+
* Added accessor `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:
|
35
|
+
|
36
|
+
```
|
37
|
+
dialog = MRDialog.new()
|
38
|
+
dialog.dialog_options = "--no-tags"
|
39
|
+
```
|
40
|
+
This ia exactly same as `dialog.notags = true`
|
41
|
+
|
42
|
+
(Apr-16-2016 )
|
43
|
+
|
1
44
|
## 1.0.1
|
2
45
|
|
3
|
-
*
|
46
|
+
* Juwelier support for making the gem.
|
47
|
+
|
48
|
+
Implemented methods for:
|
4
49
|
|
5
|
-
* Implemented methods for:
|
6
50
|
* 'buildlist' (--buildlist)
|
7
51
|
* 'editbox' (--editbox)
|
8
52
|
* 'form' (--form)
|
@@ -21,27 +65,28 @@
|
|
21
65
|
dialog_ok, dialog_cancel, dialog_help, dialog_extra,
|
22
66
|
dialog_item_help, dialog_esc
|
23
67
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
68
|
+
Implemented examples for:
|
69
|
+
|
70
|
+
* buildlist
|
71
|
+
* calendar
|
72
|
+
* checklist
|
73
|
+
* editbox
|
74
|
+
* form
|
75
|
+
* fselect
|
76
|
+
* gauge
|
77
|
+
* infobox
|
78
|
+
* inputbox
|
79
|
+
* menu
|
80
|
+
* msgbox
|
81
|
+
* passwordbox
|
82
|
+
* pause
|
83
|
+
* prgbox
|
84
|
+
* progressbox
|
85
|
+
* programbox
|
86
|
+
* radiolist
|
87
|
+
* timebox
|
88
|
+
* treeview
|
89
|
+
* yesno
|
45
90
|
|
46
91
|
Note: The examples use Struct class, making the examples clean and
|
47
92
|
easy to understand.
|
data/Gemfile
CHANGED
@@ -8,7 +8,8 @@ source "http://rubygems.org"
|
|
8
8
|
group :development do
|
9
9
|
gem "shoulda", ">= 0"
|
10
10
|
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler", "
|
12
|
-
gem "
|
11
|
+
gem "bundler", ">= 2.0"
|
12
|
+
gem "juwelier", "~> 2.1.0"
|
13
13
|
gem "simplecov", ">= 0"
|
14
|
+
gem "test-unit"
|
14
15
|
end
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) Aleks Clarks, http://rdialog.rubyforge.org/
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2016, 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,196 @@
|
|
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
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
### Latest Version
|
32
|
+
The latest version is 1.0.4.
|
33
|
+
Please look at the [ChangeLog.md](ChangeLog.md) file for details. Please look at he [screenshots](screenshots/) to see how the widgets look like.
|
34
|
+
|
35
|
+
### Screenshots
|
36
|
+
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.
|
37
|
+
|
38
|
+
|
39
|
+
### Requirements
|
40
|
+
The [dialog](http://invisible-island.net/dialog/dialog.html) program must be installed. Note: the dialog program that is available in ubuntu is little old. Check the dialog version by typing ```dialog --version```
|
41
|
+
|
42
|
+
I tested with ```dialog Version: 1.2-20130928```
|
43
|
+
|
44
|
+
dialog HOME: http://invisible-island.net/dialog/dialog.html.
|
45
|
+
|
46
|
+
### To install
|
47
|
+
|
48
|
+
```# gem install mrdialog```
|
49
|
+
or
|
50
|
+
```$ sudo gem install mrdialog```
|
51
|
+
### To uninstall
|
52
|
+
```# gem uninstall mrdialog``` or ```$ sudo gem uninstall mrdialog```
|
53
|
+
|
54
|
+
### Run the sample apps
|
55
|
+
Find out where the mrdialog gem is installed. Example:
|
56
|
+
|
57
|
+
$ gem which mrdialog
|
58
|
+
/Library/Ruby/Gems/2.0.0/gems/mrdialog-1.0.1/lib/mrdialog.rb
|
59
|
+
|
60
|
+
```cd``` to the ```samples``` directory and run the apps.
|
61
|
+
Example:
|
62
|
+
|
63
|
+
$ cd /Library/Ruby/Gems/2.0.0/gems/mrdialog-1.0.1/samples
|
64
|
+
$ ./msgbox.rb
|
65
|
+
|
66
|
+
|
67
|
+
### How to use the API
|
68
|
+
For now, please look at the apps in [samples](samples/) directory to see how the API works.
|
69
|
+
|
70
|
+
require 'mrdialog'
|
71
|
+
dialog = MRDialog.new
|
72
|
+
|
73
|
+
#### Properties
|
74
|
+
The various properties of the dialog (shadow, title etc.) can be set by calling the appropriate setters. The supported propertes are shown below:
|
75
|
+
|
76
|
+
|Property|Example|Description|Default|
|
77
|
+
|--------|-------|-----------|-------|
|
78
|
+
|shadow|```dialog.shadow = false``` | Draw a shadow to the right and bottom of each dialog box.| true|
|
79
|
+
|title|```dialog.title = 'foo'```|Specifies a title string to be displayed at the top of the dialog box|N/A|
|
80
|
+
|logger|```dialog.logger = Logger.new("dialog.log")```|Debug messages will be logged to the specified ruby Logger|N/A|
|
81
|
+
|clear|```dialog.clear = true```|Clears the widget screen, keeping only the screen_color background.|false|
|
82
|
+
|insecure|```dialog.insecure = true```|Makes the password widget friendlier but less secure, by echoing asterisks for each character.|false|
|
83
|
+
|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|
|
84
|
+
|rc_file|```dialog.rc_file = "/path/to/rc/file"``` | Use the specified rc file.| "$HOME/.dialogrc"|
|
85
|
+
|yes_label|```dialog.yes_label = "Sure"``` | Use the specified label on the "Yes" button.| "Yes"|
|
86
|
+
|no_label|```dialog.no_label = "Nope"``` | Use the specified label on the "No" button.| "No"|
|
87
|
+
|cancel_label|```dialog.cancel_label = "Forget"``` | Use the specified label on the "Cancel" button.| "Cancel"|
|
88
|
+
|help_button|```dialog.help_button = true``` | Include a "Help" button on the dialog.| false|
|
89
|
+
|help_label|```dialog.help_label = "What?"``` | Use the specified label on the "Help" button.| "Help"|
|
90
|
+
|extra_button|```dialog.extra_button = true``` | Include an "Extra" button on the dialog.| false|
|
91
|
+
|extra_label|```dialog.extra_label = "More"``` | Use the specified label on the "Extra" button.| "Extra"|
|
92
|
+
|dialog_options|`dialog.dialog_options="any valid dialog option"` e.g. `dialog.dialog_options="--no-tags"` for checklist|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|N/A|
|
93
|
+
|
94
|
+
#### Widgets
|
95
|
+
The following dialog widgets are supported:
|
96
|
+
|
97
|
+
* buildlist
|
98
|
+
* calendar
|
99
|
+
* checklist
|
100
|
+
* editbox
|
101
|
+
* form
|
102
|
+
* fselect
|
103
|
+
* gauge
|
104
|
+
* infobox
|
105
|
+
* inputbox
|
106
|
+
* menu
|
107
|
+
* msgbox
|
108
|
+
* passwordbox
|
109
|
+
* passwordform
|
110
|
+
* pause
|
111
|
+
* prgbox
|
112
|
+
* progressbox
|
113
|
+
* programbox
|
114
|
+
* radiolist
|
115
|
+
* timebox
|
116
|
+
* treeview
|
117
|
+
* yesno
|
118
|
+
|
119
|
+
##### buildlist
|
120
|
+
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
|
121
|
+
select or unselect an item.
|
122
|
+
|
123
|
+
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.
|
124
|
+
|
125
|
+
returns an array of selected tags
|
126
|
+
|
127
|
+
result_array = dialog.buildlist(text="Text Goes Here", items, height=0, width=0, listheight=0)
|
128
|
+
|
129
|
+
#### calendar
|
130
|
+
Please look at [calendar.rb](samples/calendar.rb) for an example.
|
131
|
+
#### checklist
|
132
|
+
Please look at [checklist.rb](samples/checklist.rb) for an example.
|
133
|
+
#### editbox
|
134
|
+
Please look at [editbox.rb](samples/editbox.rb) for an example.
|
135
|
+
#### form
|
136
|
+
Please look at
|
137
|
+
[form1.rb](samples/form1.rb), [form2.rb](samples/form2.rb), [form3.rb](samples/form3.rb)
|
138
|
+
for examples.
|
139
|
+
#### fselect
|
140
|
+
Please look at [fselect.rb](samples/fselect.rb) for an example.
|
141
|
+
#### gauge
|
142
|
+
Please look at [gauge.rb](samples/gauge.rb) for an example.
|
143
|
+
#### infobox
|
144
|
+
Please look at [infobox.rb](samples/infobox.rb) for an example.
|
145
|
+
#### inputbox
|
146
|
+
Please look at [inputbox.rb](samples/inputbox.rb) for an example.
|
147
|
+
#### menu
|
148
|
+
Please look at [menubox.rb](samples/menubox.rb) for an example.
|
149
|
+
#### msgbox
|
150
|
+
Please look at [msgbox.rb](samples/msgbox.rb) for an example.
|
151
|
+
#### passwordbox
|
152
|
+
Please look at [password.rb](samples/password.rb), [password2.rb](samples/password2.rb)
|
153
|
+
for examples.
|
154
|
+
#### passwordform
|
155
|
+
Please look at [passwordform.rb](samples/passwordform.rb) for an example.
|
156
|
+
#### pause
|
157
|
+
Please look at [pause.rb](samples/pause.rb) for an example.
|
158
|
+
#### prgbox
|
159
|
+
Please look at [prgbox.rb](samples/prgbox.rb) for an example.
|
160
|
+
#### progressbox
|
161
|
+
Please look at [progressbox.rb](samples/progressbox.rb) for an example.
|
162
|
+
#### programbox
|
163
|
+
Please look at [programbox.rb](samples/programbox.rb) for an example.
|
164
|
+
#### radiolist
|
165
|
+
Please look at [radiolist.rb](samples/radiolist.rb) for an example.
|
166
|
+
#### timebox
|
167
|
+
Please look at [timebox.rb](samples/timebox.rb) for an example.
|
168
|
+
#### treeview
|
169
|
+
Please look at [treeview.rb](samples/treeview.rb) for an example.
|
170
|
+
#### yesno
|
171
|
+
Please look at [yesno.rb](samples/yesno.rb) for an example.
|
172
|
+
|
173
|
+
### For Developers
|
174
|
+
Note: Pre-built mrdialog-1.0.4.gem is in the pkg directory
|
175
|
+
|
176
|
+
If you need to build the gem yourself:
|
177
|
+
|
178
|
+
Install bundler first:
|
179
|
+
|
180
|
+
$ gem install bundler
|
181
|
+
$ bundle install
|
182
|
+
|
183
|
+
- To build: ```$ rake build```
|
184
|
+
|
185
|
+
Will create the gem inside the pkg directory
|
186
|
+
|
187
|
+
- To install the built gem: ```$ sudo gem install --local pkg/mrdialog-1.0.4.gem```
|
188
|
+
|
189
|
+
- To install using rake: ```$ sudo rake install```
|
190
|
+
|
191
|
+
- To install the gem to a specific directory: ```$ GEM_HOME=/tmp gem install --local pkg/mrdialog-1.0.4.gem```
|
192
|
+
|
193
|
+
The gem will be installed in /tmp/gems directory
|
194
|
+
|
195
|
+
### Copyright
|
196
|
+
Lincense is MIT. Please look at the [LICENSE.txt](LICENSE.txt) file for details.
|
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
-
require '
|
15
|
-
|
14
|
+
require 'juwelier'
|
15
|
+
Juwelier::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "mrdialog"
|
18
18
|
gem.homepage = "http://github.com/muquit/mrdialog"
|
@@ -34,7 +34,7 @@ Jeweler::Tasks.new do |gem|
|
|
34
34
|
gem.files.include 'ChangeLog.md'
|
35
35
|
# dependencies defined in Gemfile
|
36
36
|
end
|
37
|
-
|
37
|
+
Juwelier::RubygemsDotOrgTasks.new
|
38
38
|
|
39
39
|
require 'rake/testtask'
|
40
40
|
Rake::TestTask.new(:test) do |test|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|