mrdialog 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +12 -1
- data/LICENSE.txt +1 -1
- data/README.md +19 -8
- data/VERSION +1 -1
- data/lib/mrdialog/mrdialog.rb +224 -157
- data/pkg/md5.txt +1 -0
- data/pkg/mrdialog-1.0.3.gem +0 -0
- metadata +5 -4
- data/pkg/mrdialog-1.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2c5f27d587a51acc7503e1b99fdcfdb97af44d3
|
4
|
+
data.tar.gz: e1e584a5d7da7a9647630def35388e3fba207f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35820b6519e3ee6094a4df9299d7879ebea3f140baeb5621221c6d663cf63b7d581a7e113894a7f22b5b4ec24eaef024ad56f52b1f75910322cf913268029739
|
7
|
+
data.tar.gz: fa921f2ebdfb777fafc614af31ca14cd0b2b90e40059fdfbeb8f1b87f14b7f3dc0bc39c72847b83d31b9cf54fe92ecaf9146cd5c1383d121baf63eeaf3945dc5
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 1.0.3
|
2
|
+
* Added accessor `rc_file`. It specifies the DIALOGRC file to use. Default is $HOME/.dialogrc
|
3
|
+
* Added accessor `cancel_label`. It specifies the label to use for the 'Cancel' button.
|
4
|
+
* Added accessor `yes_label`. It specifies the label to use for the 'Yes' button.
|
5
|
+
* Added accessor `no_label`. It specifies the label to use for the 'No' button.
|
6
|
+
* Added accessor `help_button`. It specifies that a help button should be added to the dialog.
|
7
|
+
* Added accessor `help_label`. It specifies the label to use for the 'Help' button.
|
8
|
+
* Added accessor `extra_button`. It specifies that an extra button should be added to the dialog.
|
9
|
+
* Added accessor `extra_label`. It specifies the label to use for the 'Extra' button.
|
10
|
+
* Fully implemented @exit_code. The @exit_code variable wasn't being set on all dialog styles.
|
11
|
+
|
1
12
|
## 1.0.2
|
2
13
|
|
3
14
|
* Added accessor `notags`. It can be used with checklist for example. The default value is false.
|
@@ -6,7 +17,7 @@
|
|
6
17
|
dialog = MRDialog.new()
|
7
18
|
dialog.notags = true
|
8
19
|
```
|
9
|
-
* Added
|
20
|
+
* 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:
|
10
21
|
|
11
22
|
```
|
12
23
|
dialog = MRDialog.new()
|
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
CHANGED
@@ -6,7 +6,7 @@ mrdialog is a pure
|
|
6
6
|
[dialog](http://invisible-island.net/dialog/dialog.html) is
|
7
7
|
a command line tool that can present questions, messages, forms using
|
8
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
|
9
|
+
menuconfig', configured Linux from command line with various configuration
|
10
10
|
managers, you have used 'dialog' like programs.
|
11
11
|
|
12
12
|
However, it is painful to program dialog from shell scripts due to lack of
|
@@ -25,21 +25,19 @@ I did the following:
|
|
25
25
|
* Added features and support for all of the missing widgets.
|
26
26
|
* Fixed the bugs I found.
|
27
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
28
|
|
32
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.
|
33
30
|
|
34
31
|
### Latest Version
|
35
|
-
The latest version is 1.0.
|
32
|
+
The latest version is 1.0.3.
|
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.
|
36
34
|
|
37
35
|
### Screenshots
|
38
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.
|
39
37
|
|
40
38
|
|
41
39
|
### Requirements
|
42
|
-
The [dialog](http://invisible-island.net/dialog/dialog.html) program must be installed.
|
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```
|
43
41
|
|
44
42
|
I tested with ```dialog Version: 1.2-20130928```
|
45
43
|
|
@@ -67,7 +65,7 @@ Example:
|
|
67
65
|
|
68
66
|
|
69
67
|
### How to use the API
|
70
|
-
For now, please look at the apps in [samples](samples/) directory to see how the API works.
|
68
|
+
For now, please look at the apps in [samples](samples/) directory to see how the API works.
|
71
69
|
|
72
70
|
require 'mrdialog'
|
73
71
|
dialog = MRDialog.new
|
@@ -83,7 +81,15 @@ The various properties of the dialog (shadow, title etc.) can be set by calling
|
|
83
81
|
|clear|```dialog.clear = true```|Clears the widget screen, keeping only the screen_color background.|false|
|
84
82
|
|insecure|```dialog.insecure = true```|Makes the password widget friendlier but less secure, by echoing asterisks for each character.|false|
|
85
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|
|
86
|
-
|
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|
|
87
93
|
|
88
94
|
#### Widgets
|
89
95
|
The following dialog widgets are supported:
|
@@ -165,6 +171,11 @@ Please look at [treeview.rb](samples/treeview.rb) for an example.
|
|
165
171
|
Please look at [yesno.rb](samples/yesno.rb) for an example.
|
166
172
|
|
167
173
|
### For Developers
|
174
|
+
Install bundler first:
|
175
|
+
|
176
|
+
$ gem install bundler
|
177
|
+
$ bundle install
|
178
|
+
|
168
179
|
- To build: ```$ rake build```
|
169
180
|
|
170
181
|
Will create the gem inside the pkg directory
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/lib/mrdialog/mrdialog.rb
CHANGED
@@ -39,6 +39,9 @@ class MRDialog
|
|
39
39
|
# All accessors are boolean unless otherwise noted.
|
40
40
|
#
|
41
41
|
|
42
|
+
# Specify the rc file to use for dialog. Default is $HOME/.dialogrc
|
43
|
+
attr_accessor :rc_file
|
44
|
+
|
42
45
|
#
|
43
46
|
# This gives you some control over the box dimensions when
|
44
47
|
# using auto sizing (specifying 0 for height and width).
|
@@ -146,6 +149,27 @@ class MRDialog
|
|
146
149
|
# Override the label used for "OK" buttons
|
147
150
|
attr_accessor :ok_label
|
148
151
|
|
152
|
+
# Override the label used for "Cancel" buttons
|
153
|
+
attr_accessor :cancel_label
|
154
|
+
|
155
|
+
# Override the label used for "Yes" buttons
|
156
|
+
attr_accessor :yes_label
|
157
|
+
|
158
|
+
# Override the label used for "No" buttons
|
159
|
+
attr_accessor :no_label
|
160
|
+
|
161
|
+
# Add a "Help" button
|
162
|
+
attr_accessor :help_button
|
163
|
+
|
164
|
+
# Override the label used for the "Help" button
|
165
|
+
attr_accessor :help_label
|
166
|
+
|
167
|
+
# Add an "Extra" button
|
168
|
+
attr_accessor :extra_button
|
169
|
+
|
170
|
+
# Override the label used for the "Extra" button
|
171
|
+
attr_accessor :extra_label
|
172
|
+
|
149
173
|
# clear screen
|
150
174
|
attr_accessor :clear
|
151
175
|
|
@@ -729,6 +753,7 @@ class MRDialog
|
|
729
753
|
day.to_i.to_s + " " + month.to_i.to_s + " " + year.to_i.to_s +
|
730
754
|
" 2> " + tmp.path
|
731
755
|
success = system(command)
|
756
|
+
@exit_code = $?.exitstatus
|
732
757
|
if success
|
733
758
|
date = Date::civil(*tmp.readline.split('/').collect {|i| i.to_i}.reverse)
|
734
759
|
tmp.close!
|
@@ -773,7 +798,8 @@ class MRDialog
|
|
773
798
|
tmp.path
|
774
799
|
log_debug "Command:\n#{command}"
|
775
800
|
success = system(command)
|
776
|
-
|
801
|
+
@exit_code = $?.exitstatus
|
802
|
+
selected_array = []
|
777
803
|
if success
|
778
804
|
selected_string = tmp.readline
|
779
805
|
tmp.close!
|
@@ -814,27 +840,28 @@ class MRDialog
|
|
814
840
|
# value in the text-entry window and exit.
|
815
841
|
|
816
842
|
def fselect(path, height=0, width=0)
|
817
|
-
|
843
|
+
tmp = Tempfile.new('tmp')
|
818
844
|
|
819
|
-
|
820
|
-
|
845
|
+
command = option_string() + "--fselect \"" + path.to_s +
|
846
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
|
847
|
+
|
848
|
+
command += "2> " + tmp.path
|
849
|
+
|
850
|
+
success = system(command)
|
851
|
+
@exit_code = $?.exitstatus
|
821
852
|
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
else
|
835
|
-
tmp.close!
|
836
|
-
return success
|
837
|
-
end
|
853
|
+
if success
|
854
|
+
begin
|
855
|
+
selected_string = tmp.readline
|
856
|
+
rescue EOFError
|
857
|
+
selected_string = ""
|
858
|
+
end
|
859
|
+
tmp.close!
|
860
|
+
return selected_string
|
861
|
+
else
|
862
|
+
tmp.close!
|
863
|
+
return success
|
864
|
+
end
|
838
865
|
end
|
839
866
|
|
840
867
|
|
@@ -852,48 +879,49 @@ class MRDialog
|
|
852
879
|
command = option_string() + "--infobox \"" + text.to_s +
|
853
880
|
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
|
854
881
|
success = system(command)
|
882
|
+
@exit_code = $?.exitstatus
|
855
883
|
return success
|
856
884
|
end
|
857
885
|
|
858
|
-
|
859
|
-
|
860
|
-
|
886
|
+
# A radiolist box is similar to a menu box. The only difference
|
887
|
+
# is that you can indicate which entry is currently selected, by
|
888
|
+
# setting its status to true.
|
889
|
+
def radiolist(text, items, height=0, width=0, listheight=0)
|
861
890
|
|
862
|
-
|
891
|
+
tmp = Tempfile.new('tmp')
|
863
892
|
|
864
|
-
|
893
|
+
itemlist = String.new
|
865
894
|
|
866
|
-
|
895
|
+
for item in items
|
896
|
+
if item[2]
|
897
|
+
item[2] = "on"
|
898
|
+
else
|
899
|
+
item[2] = "off"
|
900
|
+
end
|
901
|
+
itemlist += "\"" + item[0].to_s + "\" \"" + item[1].to_s +
|
902
|
+
"\" " + item[2] + " "
|
867
903
|
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
item[2] = "off"
|
873
|
-
end
|
874
|
-
itemlist += "\"" + item[0].to_s + "\" \"" + item[1].to_s +
|
875
|
-
"\" " + item[2] + " "
|
904
|
+
if @itemhelp
|
905
|
+
itemlist += "\"" + item[3].to_s + "\" "
|
906
|
+
end
|
907
|
+
end
|
876
908
|
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
909
|
+
command = option_string() + "--radiolist \"" + text.to_s +
|
910
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s +
|
911
|
+
" " + listheight.to_i.to_s + " " + itemlist + "2> " +
|
912
|
+
tmp.path
|
913
|
+
log_debug("Command:\n#{command}")
|
914
|
+
success = system(command)
|
915
|
+
@exit_code = $?.exitstatus
|
881
916
|
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
success = system(command)
|
888
|
-
|
889
|
-
if success
|
890
|
-
selected_string = tmp.readline
|
891
|
-
tmp.close!
|
892
|
-
return selected_string
|
893
|
-
else
|
917
|
+
if success
|
918
|
+
selected_string = tmp.readline
|
919
|
+
tmp.close!
|
920
|
+
return selected_string
|
921
|
+
else
|
894
922
|
tmp.close!
|
895
|
-
|
896
|
-
|
923
|
+
return success
|
924
|
+
end
|
897
925
|
|
898
926
|
end
|
899
927
|
|
@@ -912,43 +940,44 @@ class MRDialog
|
|
912
940
|
# Returns a string containing the tag of the chosen menu entry.
|
913
941
|
|
914
942
|
def menu(text="Text Goes Here", items=nil, height=0, width=0, listheight=0)
|
915
|
-
|
943
|
+
tmp = Tempfile.new('tmp')
|
916
944
|
|
917
|
-
|
945
|
+
itemlist = String.new
|
918
946
|
|
919
|
-
|
920
|
-
|
947
|
+
for item in items
|
948
|
+
itemlist += "\"" + item[0].to_s + "\" \"" + item[1].to_s + "\" "
|
921
949
|
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
950
|
+
if @itemhelp
|
951
|
+
itemlist += "\"" + item[2].to_s + "\" "
|
952
|
+
end
|
953
|
+
end
|
926
954
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
955
|
+
command = option_string() + "--menu \"" + text.to_s +
|
956
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s +
|
957
|
+
" " + listheight.to_i.to_s + " " + itemlist + "2> " +
|
958
|
+
tmp.path
|
959
|
+
|
960
|
+
log_debug("Command:\n#{command}")
|
961
|
+
success = system(command)
|
962
|
+
@exit_code = $?.exitstatus
|
963
|
+
|
964
|
+
if success
|
965
|
+
selected_string = tmp.readline
|
966
|
+
tmp.close!
|
967
|
+
return selected_string
|
968
|
+
else
|
969
|
+
tmp.close!
|
970
|
+
return success
|
971
|
+
end
|
943
972
|
|
944
973
|
end
|
945
974
|
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
975
|
+
# A message box is very similar to a yes/no box. The only dif-
|
976
|
+
# ference between a message box and a yes/no box is that a mes-
|
977
|
+
# sage box has only a single OK button. You can use this dialog
|
978
|
+
# box to display any message you like. After reading the mes-
|
979
|
+
# sage, the user can press the ENTER key so that dialog will exit
|
980
|
+
# and the calling shell script can continue its operation.
|
952
981
|
|
953
982
|
def msgbox(text="Text Goes Here", height=0, width=0)
|
954
983
|
command = option_string() + "--msgbox \"" + text.to_s +
|
@@ -956,44 +985,46 @@ class MRDialog
|
|
956
985
|
|
957
986
|
log_debug "Command\n#{command}"
|
958
987
|
success = system(command)
|
988
|
+
@exit_code = $?.exitstatus
|
959
989
|
return success
|
960
990
|
end
|
961
991
|
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
992
|
+
# A password box is similar to an input box, except that the text
|
993
|
+
# the user enters is not displayed. This is useful when prompt-
|
994
|
+
# ing for passwords or other sensitive information. Be aware
|
995
|
+
# that if anything is passed in "init", it will be visible in the
|
996
|
+
# system's process table to casual snoopers. Also, it is very
|
997
|
+
# confusing to the user to provide them with a default password
|
998
|
+
# they cannot see. For these reasons, using "init" is highly
|
999
|
+
# discouraged.
|
970
1000
|
|
971
1001
|
def passwordbox(text="Please enter some text", height=0, width=0, init="")
|
972
|
-
|
973
|
-
|
974
|
-
|
1002
|
+
tmp = Tempfile.new('tmp')
|
1003
|
+
command = option_string() + "--passwordbox \"" + text.to_s +
|
1004
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
|
975
1005
|
|
976
|
-
|
977
|
-
|
978
|
-
|
1006
|
+
unless init.empty?
|
1007
|
+
command += init.to_s + " "
|
1008
|
+
end
|
979
1009
|
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
tmp.close!
|
991
|
-
return selected_string
|
992
|
-
else
|
993
|
-
tmp.close!
|
994
|
-
return success
|
1010
|
+
command += "2> " + tmp.path
|
1011
|
+
log_debug(command)
|
1012
|
+
success = system(command)
|
1013
|
+
@exit_code = $?.exitstatus
|
1014
|
+
|
1015
|
+
if success
|
1016
|
+
begin
|
1017
|
+
selected_string = tmp.readline
|
1018
|
+
rescue EOFError
|
1019
|
+
selected_string = ""
|
995
1020
|
end
|
996
|
-
|
1021
|
+
tmp.close!
|
1022
|
+
return selected_string
|
1023
|
+
else
|
1024
|
+
tmp.close!
|
1025
|
+
return success
|
1026
|
+
end
|
1027
|
+
end
|
997
1028
|
|
998
1029
|
# The textbox method handles three similar dialog functions, textbox,
|
999
1030
|
# tailbox, and tailboxbg. They are activated by setting type to
|
@@ -1037,37 +1068,39 @@ class MRDialog
|
|
1037
1068
|
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
|
1038
1069
|
|
1039
1070
|
success = system(command)
|
1071
|
+
@exit_code = $?.exitstatus
|
1040
1072
|
|
1041
1073
|
return success
|
1042
1074
|
end
|
1043
1075
|
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1076
|
+
# A dialog is displayed which allows you to select hour, minute
|
1077
|
+
# and second. If the values for hour, minute or second are miss-
|
1078
|
+
# ing or negative, the current date's corresponding values are
|
1079
|
+
# used. You can increment or decrement any of those using the
|
1080
|
+
# left-, up-, right- and down-arrows. Use tab or backtab to move
|
1081
|
+
# between windows.
|
1082
|
+
#
|
1083
|
+
# On exit, a Time object is returned.
|
1052
1084
|
|
1053
1085
|
##- def timebox(file, type="text", height=0, width=0, time=Time.now)
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1086
|
+
def timebox(text, height=0, width=0, time=Time.now)
|
1087
|
+
tmp = Tempfile.new('tmp')
|
1088
|
+
|
1089
|
+
command = option_string() + "--timebox \"" + text.to_s +
|
1090
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " " +
|
1091
|
+
time.hour.to_s + " " + time.min.to_s + " " +
|
1092
|
+
time.sec.to_s + " 2> " + tmp.path
|
1093
|
+
log_debug("Command:\n#{command}")
|
1094
|
+
success = system(command)
|
1095
|
+
@exit_code = $?.exitstatus
|
1096
|
+
if success
|
1097
|
+
time = Time.parse(tmp.readline)
|
1098
|
+
tmp.close!
|
1099
|
+
return time
|
1100
|
+
else
|
1101
|
+
tmp.close!
|
1102
|
+
return success
|
1103
|
+
end
|
1071
1104
|
|
1072
1105
|
end
|
1073
1106
|
|
@@ -1084,7 +1117,7 @@ class MRDialog
|
|
1084
1117
|
tmp = Tempfile.new('tmp')
|
1085
1118
|
|
1086
1119
|
command = option_string() + "--inputbox \"" + text.to_s +
|
1087
|
-
|
1120
|
+
"\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
|
1088
1121
|
|
1089
1122
|
unless init.empty?
|
1090
1123
|
command += init.to_s + " "
|
@@ -1093,32 +1126,33 @@ class MRDialog
|
|
1093
1126
|
command += "2> " + tmp.path
|
1094
1127
|
|
1095
1128
|
log_debug(command)
|
1096
|
-
|
1129
|
+
success = system(command)
|
1130
|
+
@exit_code = $?.exitstatus
|
1097
1131
|
|
1098
|
-
|
1132
|
+
if success
|
1099
1133
|
begin
|
1100
|
-
|
1134
|
+
selected_string = tmp.readline
|
1101
1135
|
rescue EOFError
|
1102
1136
|
selected_string = ""
|
1103
1137
|
end
|
1104
1138
|
tmp.close!
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1139
|
+
return selected_string
|
1140
|
+
else
|
1141
|
+
tmp.close!
|
1142
|
+
return success
|
1143
|
+
end
|
1110
1144
|
end
|
1111
1145
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1146
|
+
# A yes/no dialog box of size height rows by width columns will
|
1147
|
+
# be displayed. The string specified by text is displayed inside
|
1148
|
+
# the dialog box. If this string is too long to fit in one line,
|
1149
|
+
# it will be automatically divided into multiple lines at appro-
|
1150
|
+
# priate places. The text string can also contain the sub-string
|
1151
|
+
# "\n" or newline characters '\n' to control line breaking
|
1152
|
+
# explicitly. This dialog box is useful for asking questions
|
1153
|
+
# that require the user to answer either yes or no. The dialog
|
1154
|
+
# box has a Yes button and a No button, in which the user can
|
1155
|
+
# switch between by pressing the TAB key.
|
1122
1156
|
|
1123
1157
|
# changing --inputbox to --yesno
|
1124
1158
|
# muquit@muquit.com Apr-01-2014
|
@@ -1144,6 +1178,7 @@ class MRDialog
|
|
1144
1178
|
|
1145
1179
|
log_debug("Command:\n#{command}")
|
1146
1180
|
success = system(command)
|
1181
|
+
@exit_code = $?.exitstatus
|
1147
1182
|
return success
|
1148
1183
|
end
|
1149
1184
|
|
@@ -1166,10 +1201,14 @@ class MRDialog
|
|
1166
1201
|
end
|
1167
1202
|
end
|
1168
1203
|
raise "'dialog' executable not found in path" unless exe_loc
|
1204
|
+
|
1205
|
+
# if an rc file was specified, set DIALOGRC to that file
|
1206
|
+
ENV["DIALOGRC"] = @rc_file if @rc_file
|
1207
|
+
|
1169
1208
|
ostring = exe_loc + " "
|
1170
1209
|
|
1171
1210
|
if @aspect
|
1172
|
-
ostring += "--aspect " + aspect + " "
|
1211
|
+
ostring += "--aspect " + @aspect + " "
|
1173
1212
|
end
|
1174
1213
|
|
1175
1214
|
if @beep
|
@@ -1241,6 +1280,34 @@ class MRDialog
|
|
1241
1280
|
ostring += "--ok-label #{@ok_label} "
|
1242
1281
|
end
|
1243
1282
|
|
1283
|
+
if @cancel_label
|
1284
|
+
ostring += "--cancel-label #{@cancel_label} "
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
if @yes_label
|
1288
|
+
ostring += "--yes-label #{@yes_label} "
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
if @no_label
|
1292
|
+
ostring += "--no-label #{@no_label} "
|
1293
|
+
end
|
1294
|
+
|
1295
|
+
if @extra_button
|
1296
|
+
ostring += "--extra-button "
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
if @extra_label
|
1300
|
+
ostring += "--extra-label #{@extra_label} "
|
1301
|
+
end
|
1302
|
+
|
1303
|
+
if @help_button
|
1304
|
+
ostring += "--help-button "
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
if @help_label
|
1308
|
+
ostring += "--help-label #{@help_label} "
|
1309
|
+
end
|
1310
|
+
|
1244
1311
|
if @separator
|
1245
1312
|
ostring += "--separator \"#{@separator}\" "
|
1246
1313
|
end
|
data/pkg/md5.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2e4238d8e121adb4b646a299e63d333f mrdialog-1.0.3.gem
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleks Clark
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
@@ -104,7 +104,8 @@ files:
|
|
104
104
|
- VERSION
|
105
105
|
- lib/mrdialog.rb
|
106
106
|
- lib/mrdialog/mrdialog.rb
|
107
|
-
- pkg/
|
107
|
+
- pkg/md5.txt
|
108
|
+
- pkg/mrdialog-1.0.3.gem
|
108
109
|
- samples/buildlist.rb
|
109
110
|
- samples/calendar.rb
|
110
111
|
- samples/checklist.rb
|
@@ -184,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
185
|
version: '0'
|
185
186
|
requirements: []
|
186
187
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.4.8
|
188
189
|
signing_key:
|
189
190
|
specification_version: 4
|
190
191
|
summary: A ruby gem for ncurses dialog program, based on the gem rdialog
|
data/pkg/mrdialog-1.0.1.gem
DELETED
Binary file
|