Magellan Linux

Diff of /trunk/installer-simple/functions/common-dialogs.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2394 by niro, Tue Jan 7 12:58:09 2014 UTC revision 2452 by niro, Tue Jan 7 15:03:12 2014 UTC
# Line 31  messagebox() Line 31  messagebox()
31    
32   [[ -z ${OK_LABEL} ]] && OK_LABEL="Next"   [[ -z ${OK_LABEL} ]] && OK_LABEL="Next"
33    
34     echo "DEBUG: paused" >&2; read
35   dialog \   dialog \
36   --colors \   --colors \
37   --title "${header}" \   --title "${header}" \
# Line 39  messagebox() Line 40  messagebox()
40   --msgbox "${text}" "${height}" "${width}"   --msgbox "${text}" "${height}" "${width}"
41  }  }
42    
43    infobox()
44    {
45     local header
46     local text
47     local height
48     local width
49    
50     # very basic getops
51     local OPTIND opt
52     while getopts ":h:y:x:" opt
53     do
54     case ${opt} in
55     h) header="${OPTARG}" ;;
56     y) height="${OPTARG}" ;;
57     x) width="${OPTARG}" ;;
58     esac
59     done
60     shift $((OPTIND-1))
61     text="$@"
62    
63     #[[ -z ${header} ]] && die "no header given"
64     [[ -z ${text} ]] && die "no text given"
65     [[ -z ${height} ]] && height=3
66     [[ -z ${width} ]] && width=70
67    
68     echo "DEBUG: paused" >&2; read
69     dialog \
70     --colors \
71     --title "${header}" \
72     --backtitle "${TITLE}" \
73     --infobox "${text}" "${height}" "${width}"
74    }
75    
76  inputbox()  inputbox()
77  {  {
78   local header   local header
# Line 64  inputbox() Line 98  inputbox()
98   [[ -z ${height} ]] && height=0   [[ -z ${height} ]] && height=0
99   [[ -z ${width} ]] && width=0   [[ -z ${width} ]] && width=0
100    
101     echo "DEBUG: paused" >&2; read
102   dialog \   dialog \
103   --stdout \   --stdout \
104   --colors \   --colors \
# Line 97  passwordbox() Line 132  passwordbox()
132   [[ -z ${height} ]] && height=0   [[ -z ${height} ]] && height=0
133   [[ -z ${width} ]] && width=0   [[ -z ${width} ]] && width=0
134    
135     echo "DEBUG: paused" >&2; read
136   dialog \   dialog \
137   --stdout \   --stdout \
138   --colors \   --colors \
# Line 106  passwordbox() Line 142  passwordbox()
142   --passwordbox "${text}" "${height}" "${width}"   --passwordbox "${text}" "${height}" "${width}"
143  }  }
144    
145    menubox()
146    {
147     local header
148     local text
149     local height
150     local width
151     local items
152     local index
153     local dialog_opts
154    
155     # very basic getops
156     local OPTIND opt
157     while getopts ":h:y:x:i:n" opt
158     do
159     case ${opt} in
160     n) dialog_opts+=" --no-cancel" ;;
161     h) header="${OPTARG}" ;;
162     y) height="${OPTARG}" ;;
163     x) width="${OPTARG}" ;;
164     esac
165     done
166     shift $((OPTIND-1))
167     text="$1"
168     shift
169     items=( "$@" )
170     index="${#items[*]}"
171    
172     #[[ -z ${header} ]] && header="empty header: add -h yourheader"
173     [[ -z ${text} ]] && die "no text given"
174     [[ -z ${height} ]] && height=0
175     [[ -z ${width} ]] && width=70
176    
177     [[ -z ${OK_LABEL} ]] && OK_LABEL="Next"
178     [[ -z ${CANCEL_LABEL} ]] && CANCEL_LABEL="Back"
179    
180     echo "DEBUG: paused" >&2; read
181     eval dialog \
182     --stdout \
183     --colors \
184     --title "'${header}'" \
185     --backtitle "'${TITLE}'" \
186     --ok-label "'${OK_LABEL}'" \
187     --cancel-label "'${CANCEL_LABEL}'" \
188     "${dialog_opts}" \
189     --menu "'${text}'" "${height}" "${width}" "${index}" \
190     $(for ((i=0;i<index;i++)); do echo "'${items[${i}]%%:*}'";echo "'${items[${i}]#*:}'"; done)
191    }
192    
193  gaugebox()  gaugebox()
194  {  {
195   local header   local header
# Line 131  gaugebox() Line 215  gaugebox()
215   [[ -z ${height} ]] && height=0   [[ -z ${height} ]] && height=0
216   [[ -z ${width} ]] && width=70   [[ -z ${width} ]] && width=70
217    
218     echo "DEBUG: paused" >&2; read
219   dialog \   dialog \
220   --colors \   --colors \
221   --title "${header}" \   --title "${header}" \
# Line 163  yesnobox() Line 248  yesnobox()
248   [[ -z ${height} ]] && height=0   [[ -z ${height} ]] && height=0
249   [[ -z ${width} ]] && width=0   [[ -z ${width} ]] && width=0
250    
251     echo "DEBUG: paused" >&2; read
252   dialog \   dialog \
253   --colors \   --colors \
254   --title "${header}" \   --title "${header}" \
# Line 170  yesnobox() Line 256  yesnobox()
256   --defaultno \   --defaultno \
257   --yesno "${text}" "${height}" "${width}"   --yesno "${text}" "${height}" "${width}"
258  }  }
   
 welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; }  
 finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; }  

Legend:
Removed from v.2394  
changed lines
  Added in v.2452