line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UI::Dialog::Backend::XDialog; |
2
|
|
|
|
|
|
|
############################################################################### |
3
|
|
|
|
|
|
|
# Copyright (C) 2004-2016 Kevin C. Krinke |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
6
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
7
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
8
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
11
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
16
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
17
|
|
|
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
3
|
|
|
3
|
|
12894
|
use 5.006; |
|
3
|
|
|
|
|
7
|
|
20
|
3
|
|
|
3
|
|
11
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
49
|
|
21
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
63
|
|
22
|
3
|
|
|
3
|
|
9
|
use Carp; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
143
|
|
23
|
3
|
|
|
3
|
|
735
|
use FileHandle; |
|
3
|
|
|
|
|
8768
|
|
|
3
|
|
|
|
|
13
|
|
24
|
3
|
|
|
3
|
|
745
|
use File::Basename; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
173
|
|
25
|
3
|
|
|
3
|
|
12
|
use Cwd qw( abs_path ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
109
|
|
26
|
3
|
|
|
3
|
|
410
|
use String::ShellQuote; |
|
3
|
|
|
|
|
564
|
|
|
3
|
|
|
|
|
123
|
|
27
|
3
|
|
|
3
|
|
376
|
use UI::Dialog::Backend; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
76
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
BEGIN { |
30
|
3
|
|
|
3
|
|
11
|
use vars qw( $VERSION @ISA ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
129
|
|
31
|
3
|
|
|
3
|
|
19
|
@ISA = qw( UI::Dialog::Backend ); |
32
|
3
|
|
|
|
|
17624
|
$VERSION = '1.21'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
36
|
|
|
|
|
|
|
#: Constructor Method |
37
|
|
|
|
|
|
|
#: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
1
|
|
|
1
|
1
|
592
|
my $proto = shift(); |
41
|
1
|
|
33
|
|
|
6
|
my $class = ref($proto) || $proto; |
42
|
1
|
50
|
|
|
|
5
|
my $cfg = ((ref($_[0]) eq "HASH") ? $_[0] : (@_) ? { @_ } : {}); |
|
|
50
|
|
|
|
|
|
43
|
1
|
|
|
|
|
2
|
my $self = {}; |
44
|
1
|
|
|
|
|
1
|
bless($self, $class); |
45
|
1
|
|
|
|
|
7
|
$self->{'_state'} = {}; |
46
|
1
|
|
|
|
|
2
|
$self->{'_opts'} = {}; |
47
|
1
|
50
|
|
|
|
4
|
$self->{'test_mode'} = ($cfg->{'test_mode'}) ? 1 : 0; |
48
|
1
|
|
|
|
|
2
|
$self->{'test_mode_result'} = ''; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#: Dynamic path discovery... |
51
|
1
|
|
|
|
|
1
|
my $CFG_PATH = $cfg->{'PATH'}; |
52
|
1
|
50
|
|
|
|
4
|
if ($CFG_PATH) { |
|
|
50
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
0
|
if (ref($CFG_PATH) eq "ARRAY") { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = $CFG_PATH; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
elsif ($CFG_PATH =~ m!:!) { |
57
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif (-d $CFG_PATH) { |
60
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = [ $CFG_PATH ]; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif ($ENV{'PATH'}) { |
64
|
1
|
|
|
|
|
7
|
$self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = ''; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'debug'} = $cfg->{'debug'} || undef(); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$self->{'_opts'}->{'XDIALOG_HIGH_DIALOG_COMPAT'} = 1 |
75
|
1
|
50
|
|
|
|
2
|
unless not $cfg->{'XDIALOG_HIGH_DIALOG_COMPAT'}; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'callbacks'} = $cfg->{'callbacks'} || undef(); |
78
|
|
|
|
|
|
|
# --wmclass |
79
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'wmclass'} = $cfg->{'wmclass'} || undef(); |
80
|
|
|
|
|
|
|
# --rc-file |
81
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'rcfile'} = $cfg->{'rcfile'} || undef(); |
82
|
|
|
|
|
|
|
# --backtitle |
83
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'backtitle'} = $cfg->{'backtitle'} || undef(); |
84
|
|
|
|
|
|
|
# --title |
85
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'title'} = $cfg->{'title'} || undef(); |
86
|
|
|
|
|
|
|
# --allow-close | --no-close |
87
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'allowclose'} = $cfg->{'allowclose'} || 0; |
88
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'noclose'} = $cfg->{'noclose'} || 0; |
89
|
|
|
|
|
|
|
# --screen-center | --under-mouse | --auto-placement |
90
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'screencenter'} = $cfg->{'screencenter'} || 0; |
91
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'undermouse'} = $cfg->{'undermouse'} || 0; |
92
|
1
|
|
50
|
|
|
8
|
$self->{'_opts'}->{'autoplacement'} = $cfg->{'autoplacement'} || 0; |
93
|
|
|
|
|
|
|
# --center | --right | --left | --fill |
94
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'center'} = $cfg->{'center'} || 0; |
95
|
1
|
|
50
|
|
|
7
|
$self->{'_opts'}->{'right'} = $cfg->{'right'} || 0; |
96
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'left'} = $cfg->{'left'} || 0; |
97
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'fill'} = $cfg->{'fill'} || 0; |
98
|
|
|
|
|
|
|
# --no-wrap | --wrap |
99
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'nowrap'} = $cfg->{'nowrap'} || 0; |
100
|
1
|
|
50
|
|
|
7
|
$self->{'_opts'}->{'wrap'} = $cfg->{'wrap'} || 0; |
101
|
|
|
|
|
|
|
# --cr-wrap | --no-cr-wrap |
102
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'crwrap'} = $cfg->{'crwrap'} || 0; |
103
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'nocrwrap'} = $cfg->{'nocrwrap'} || 0; |
104
|
|
|
|
|
|
|
# --buttons-style default|icon|text |
105
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'buttonsstyle'} = $cfg->{'buttonsstyle'} || 'default'; |
106
|
|
|
|
|
|
|
# --fixed-font (tailbox, textbox, and editbox) |
107
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'fixedfont'} = $cfg->{'fixedfont'} || 0; |
108
|
|
|
|
|
|
|
# --editable (combobox) |
109
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'editable'} = $cfg->{'editable'} || 0; |
110
|
|
|
|
|
|
|
# --time-stamp | --date-stamp (logbox) |
111
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'timestamp'} = $cfg->{'timestamp'} || 0; |
112
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'datestamp'} = $cfg->{'datestamp'} || 0; |
113
|
|
|
|
|
|
|
# --reverse (logbox) |
114
|
1
|
|
50
|
|
|
8
|
$self->{'_opts'}->{'reverse'} = $cfg->{'reverse'} || 0; |
115
|
|
|
|
|
|
|
# --keep-colors (logbox) |
116
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'keepcolors'} = $cfg->{'keepcolours'} || $cfg->{'keepcolors'} || 0; |
117
|
|
|
|
|
|
|
# --interval (input(s) boxes, combo box, range(s) boxes, spin(s) boxes, list boxes, menu box, treeview, calendar, timebox) |
118
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'interval'} = $cfg->{'interval'} || 0; |
119
|
|
|
|
|
|
|
# --no-tags (menubox, checklist and radiolist) |
120
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'notags'} = $cfg->{'notags'} || 0; |
121
|
|
|
|
|
|
|
# --item-help (menubox, checklist, radiolist, buildlist and treeview) |
122
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'itemhelp'} = $cfg->{'itemhelp'} || 0; |
123
|
|
|
|
|
|
|
# --default-item (menubox) |
124
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'defaultitem'} = $cfg->{'defaultitem'} || undef(); |
125
|
|
|
|
|
|
|
# --icon (textbox, editbox, tailbox, logbox, fselect and dselect) |
126
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'icon'} = $cfg->{'icon'} || undef(); |
127
|
|
|
|
|
|
|
# --no-ok (tailbox and logbox) |
128
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'nook'} = $cfg->{'nook'} || 0; |
129
|
|
|
|
|
|
|
# --no-cancel (infobox, gauge and progress) |
130
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'nocancel'} = $cfg->{'nocancel'} || 0; |
131
|
|
|
|
|
|
|
# --no-buttons (textbox, tailbox, logbox, infobox fselect and dselect) |
132
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'nobuttons'} = $cfg->{'nobuttons'} || 0; |
133
|
|
|
|
|
|
|
# --default-no !(wizard) |
134
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'defaultno'} = $cfg->{'defaultno'} || 0; |
135
|
|
|
|
|
|
|
# --wizard !(msgbox, infobox, gauge and progress) |
136
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'wizard'} = $cfg->{'wizard'} || 0; |
137
|
|
|
|
|
|
|
# --help (infobox, gauge and progress) |
138
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'help'} = $cfg->{'help'} || undef(); |
139
|
|
|
|
|
|
|
# --print (textbox, editbox and tailbox) |
140
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'print'} = $cfg->{'print'} || undef(); |
141
|
|
|
|
|
|
|
# --check |
142
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'check'} = $cfg->{'check'} || undef(); |
143
|
|
|
|
|
|
|
# --ok-label |
144
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'oklabel'} = $cfg->{'oklabel'} || undef(); |
145
|
|
|
|
|
|
|
# --cancel-label |
146
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'cancellabel'} = $cfg->{'cancellabel'} || undef(); |
147
|
|
|
|
|
|
|
# --beep | --beep-after (all) |
148
|
1
|
|
50
|
|
|
9
|
$self->{'_opts'}->{'beepbin'} = $cfg->{'beepbin'} || $self->_find_bin('beep') || '/usr/bin/beep'; |
149
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'beepbefore'} = $cfg->{'beepbefore'} || 0; |
150
|
1
|
|
50
|
|
|
7
|
$self->{'_opts'}->{'beepafter'} = $cfg->{'beepafter'} || 0; |
151
|
|
|
|
|
|
|
# --begin (all) |
152
|
1
|
|
50
|
|
|
11
|
$self->{'_opts'}->{'begin'} = $cfg->{'begin'} || undef(); #: 'begin' => [$y,$x] |
153
|
|
|
|
|
|
|
# --ignore-eof (infobox and gauge) |
154
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'ignoreeof'} = $cfg->{'ignoreeof'} || 0; |
155
|
|
|
|
|
|
|
# --smooth (tailbox and logbox) |
156
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'smooth'} = $cfg->{'smooth'} || 0; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
#: \/we handle these internally\/ |
159
|
|
|
|
|
|
|
# --stderr | --stdout |
160
|
|
|
|
|
|
|
# --separator | --separate-output |
161
|
|
|
|
|
|
|
#: ^^we handle these internally^^ |
162
|
|
|
|
|
|
|
|
163
|
1
|
|
33
|
|
|
6
|
$self->{'_opts'}->{'bin'} ||= $self->_find_bin('Xdialog'); |
164
|
1
|
50
|
|
|
|
6
|
unless (-x $self->{'_opts'}->{'bin'}) { |
165
|
1
|
|
|
|
|
164
|
croak("the Xdialog binary could not be found."); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
#: to determin upper limits use: |
169
|
|
|
|
|
|
|
# --print-maxsize |
170
|
|
|
|
|
|
|
#: STDOUT| MaxSize: \d+(width), \d+(height) |
171
|
0
|
|
|
|
|
|
my $command = $self->{'_opts'}->{'bin'}." --print-maxsize"; |
172
|
0
|
|
|
|
|
|
my $raw = `$command 2>&1`; |
173
|
0
|
|
|
|
|
|
my ($w,$h) = (0,0); |
174
|
0
|
0
|
|
|
|
|
if ($raw =~ m!^\s*MaxSize\:\s+(\d+?),\s+(\d+?)\s*$!) { |
175
|
0
|
|
|
|
|
|
($w,$h) = ($1,$2); |
176
|
|
|
|
|
|
|
} |
177
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'width'} = $cfg->{'width'} || $w; |
178
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'height'} = $cfg->{'height'} || $h; |
179
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'listheight'} = $cfg->{'listheight'} || $cfg->{'menuheight'} || 5; |
180
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; |
183
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; |
184
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; |
185
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'timeout'} = $cfg->{'timeout'} || 0; |
186
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'wait'} = $cfg->{'wait'} || 0; |
187
|
|
|
|
|
|
|
|
188
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'trust-input'} = $cfg->{'trust-input'} || 0; |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
return($self); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
197
|
|
|
|
|
|
|
#: Private Methods |
198
|
|
|
|
|
|
|
#: |
199
|
|
|
|
|
|
|
my $SIG_CODE = {'PROGRESS'=>{},'GAUGE'=>{}}; |
200
|
|
|
|
|
|
|
sub _del_progress { |
201
|
0
|
|
|
0
|
|
|
my $CODE = $SIG_CODE->{'PROGRESS'}->{$$}; |
202
|
0
|
0
|
|
|
|
|
unless (not ref($CODE)) { |
203
|
0
|
|
|
|
|
|
delete($CODE->{'_PROGRESS'}); |
204
|
0
|
|
|
|
|
|
$CODE->rv('1'); |
205
|
0
|
|
|
|
|
|
$CODE->rs('null'); |
206
|
0
|
|
|
|
|
|
$CODE->ra('null'); |
207
|
0
|
|
|
|
|
|
$SIG_CODE->{$$} = ""; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
sub _del_gauge { |
211
|
0
|
|
|
0
|
|
|
my $CODE = $SIG_CODE->{'GAUGE'}->{$$}; |
212
|
0
|
0
|
|
|
|
|
unless (not ref($CODE)) { |
213
|
0
|
|
|
|
|
|
delete($CODE->{'_GAUGE'}); |
214
|
0
|
|
|
|
|
|
$CODE->rv('1'); |
215
|
0
|
|
|
|
|
|
$CODE->rs('null'); |
216
|
0
|
|
|
|
|
|
$CODE->ra('null'); |
217
|
0
|
|
|
|
|
|
$SIG_CODE->{$$} = ""; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub append_format_base { |
222
|
0
|
|
|
0
|
0
|
|
my ($self,$args,$fmt) = @_; |
223
|
|
|
|
|
|
|
$fmt = 'XDIALOG_HIGH_DIALOG_COMPAT="1" ' . $fmt |
224
|
0
|
0
|
|
|
|
|
if $args->{'XDIALOG_HIGH_DIALOG_COMPAT'}; |
225
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"editable","--editable"); |
226
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"center","--center"); |
227
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"right","--right"); |
228
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"left","--left"); |
229
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"fill","--fill"); |
230
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"wrap","--wrap"); |
231
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"crwrap","--crwrap"); |
232
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"nocrwrap","--nocrwrap"); |
233
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"reverse","--reverse"); |
234
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"wizard","--wizard"); |
235
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"smooth","--smooth"); |
236
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,'backtitle','--backtitle {{backtitle}}'); |
237
|
0
|
|
0
|
|
|
|
$args->{'no-wrap'} ||= $args->{'nowrap'} || 0; |
|
|
|
0
|
|
|
|
|
238
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-wrap","--no-wrap"); |
239
|
0
|
|
0
|
|
|
|
$args->{'allow-close'} ||= $args->{'allowclose'} || 0; |
|
|
|
0
|
|
|
|
|
240
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"allow-close","--allow-close"); |
241
|
0
|
|
0
|
|
|
|
$args->{'no-close'} ||= $args->{'noclose'} || 0; |
|
|
|
0
|
|
|
|
|
242
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-close","--no-close"); |
243
|
0
|
|
0
|
|
|
|
$args->{'screen-center'} ||= $args->{'screencenter'} || 0; |
|
|
|
0
|
|
|
|
|
244
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"screen-center","--screen-center"); |
245
|
0
|
|
0
|
|
|
|
$args->{'under-mouse'} ||= $args->{'undermouse'} || 0; |
|
|
|
0
|
|
|
|
|
246
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"under-mouse","--under-mouse"); |
247
|
0
|
|
0
|
|
|
|
$args->{'auto-placement'} ||= $args->{'autoplacement'} || 0; |
|
|
|
0
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"auto-placement","--auto-placement"); |
249
|
0
|
|
0
|
|
|
|
$args->{'fixed-font'} ||= $args->{'fixedfont'} || 0; |
|
|
|
0
|
|
|
|
|
250
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"fixed-font","--fixed-font"); |
251
|
0
|
|
0
|
|
|
|
$args->{'time-stamp'} ||= $args->{'timestamp'} || 0; |
|
|
|
0
|
|
|
|
|
252
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"time-stamp","--time-stamp"); |
253
|
0
|
|
0
|
|
|
|
$args->{'date-stamp'} ||= $args->{'datestamp'} || 0; |
|
|
|
0
|
|
|
|
|
254
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"date-stamp","--date-stamp"); |
255
|
|
|
|
|
|
|
$args->{'keep-colors'} ||= $args->{'keep-colours'} |
256
|
0
|
|
0
|
|
|
|
|| $args->{'keepcolors'} || $args->{'keepcolours'}; |
|
|
|
0
|
|
|
|
|
257
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"keep-colors","--keep-colors"); |
258
|
0
|
|
0
|
|
|
|
$args->{'no-tags'} ||= $args->{'notags'} || 0; |
|
|
|
0
|
|
|
|
|
259
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-tags","--no-tags"); |
260
|
0
|
|
0
|
|
|
|
$args->{'item-help'} ||= $args->{'itemhelp'} || 0; |
|
|
|
0
|
|
|
|
|
261
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"item-help","--item-help"); |
262
|
0
|
|
0
|
|
|
|
$args->{'no-ok'} ||= $args->{'nook'} || 0; |
|
|
|
0
|
|
|
|
|
263
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-ok","--no-ok"); |
264
|
0
|
|
0
|
|
|
|
$args->{'no-cancel'} ||= $args->{'nocancel'} || 0; |
|
|
|
0
|
|
|
|
|
265
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-cancel","--no-cancel"); |
266
|
0
|
|
0
|
|
|
|
$args->{'no-buttons'} ||= $args->{'nobuttons'} || 0; |
|
|
|
0
|
|
|
|
|
267
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"no-buttons","--no-buttons"); |
268
|
0
|
|
0
|
|
|
|
$args->{'default-no'} ||= $args->{'defaultno'} || 0; |
|
|
|
0
|
|
|
|
|
269
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"default-no","--default-no"); |
270
|
0
|
|
0
|
|
|
|
$args->{'ignore-eof'} ||= $args->{'ignoreeof'} || 0; |
|
|
|
0
|
|
|
|
|
271
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"ignore-eof","--ignore-eof"); |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"wmclass","--wmclass {{wmclass}}"); |
274
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"interval","--interval {{interval}}"); |
275
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"icon","--icon {{icon}}"); |
276
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"help","--help {{help}}"); |
277
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"print","--print {{print}}"); |
278
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,"check",'--check {{check}}'); |
279
|
|
|
|
|
|
|
|
280
|
0
|
|
0
|
|
|
|
$args->{'rc-file'} ||= $args->{'rcfile'} || 0; |
|
|
|
0
|
|
|
|
|
281
|
|
|
|
|
|
|
$fmt = $self->append_format_check |
282
|
|
|
|
|
|
|
( $args, $fmt, "rc-file", |
283
|
0
|
|
|
|
|
|
'--rc-file '.shell_quote($args->{'rc-file'}) |
284
|
|
|
|
|
|
|
); |
285
|
|
|
|
|
|
|
|
286
|
0
|
|
0
|
|
|
|
$args->{'button-style'} ||= $args->{'buttonsstyle'} || 0; |
|
|
|
0
|
|
|
|
|
287
|
|
|
|
|
|
|
$fmt = $self->append_format_check |
288
|
|
|
|
|
|
|
( $args, $fmt, "button-style", |
289
|
0
|
|
|
|
|
|
'--button-style '.shell_quote($args->{'button-style'}) |
290
|
|
|
|
|
|
|
); |
291
|
|
|
|
|
|
|
|
292
|
0
|
|
0
|
|
|
|
$args->{'default-item'} ||= $args->{'defaultitem'} || 0; |
|
|
|
0
|
|
|
|
|
293
|
|
|
|
|
|
|
$fmt = $self->append_format_check |
294
|
|
|
|
|
|
|
( $args, $fmt, "default-item", |
295
|
0
|
|
|
|
|
|
'--default-item '.shell_quote($args->{'default-item'}) |
296
|
|
|
|
|
|
|
); |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
0
|
|
|
|
$args->{'ok-label'} ||= $args->{'oklabel'} || 0; |
|
|
|
0
|
|
|
|
|
299
|
|
|
|
|
|
|
$fmt = $self->append_format_check |
300
|
|
|
|
|
|
|
( $args, $fmt, "ok-label", |
301
|
0
|
|
|
|
|
|
'--ok-label '.shell_quote($args->{'ok-label'}) |
302
|
|
|
|
|
|
|
); |
303
|
|
|
|
|
|
|
|
304
|
0
|
|
0
|
|
|
|
$args->{'cancel-label'} ||= $args->{'cancellabel'} || 0; |
|
|
|
0
|
|
|
|
|
305
|
|
|
|
|
|
|
$fmt = $self->append_format_check |
306
|
|
|
|
|
|
|
( $args, $fmt, "cancel-label", |
307
|
0
|
|
|
|
|
|
'--cancel-label '.shell_quote($args->{'cancel-label'}) |
308
|
|
|
|
|
|
|
); |
309
|
|
|
|
|
|
|
|
310
|
0
|
0
|
|
|
|
|
if (exists $args->{'begin'}) { |
311
|
0
|
|
|
|
|
|
my $begin = $args->{'begin'}; |
312
|
0
|
0
|
|
|
|
|
if (ref($begin) eq "ARRAY") { |
313
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--begin '.$begin->[0].' '.$begin->[1]); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
0
|
|
|
|
|
|
return $fmt; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
321
|
|
|
|
|
|
|
#: State Methods (override inherited) |
322
|
|
|
|
|
|
|
#: |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
#: report on the state of the last widget. |
325
|
|
|
|
|
|
|
sub state { |
326
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
327
|
0
|
|
0
|
|
|
|
my $rv = $self->rv() || 0; |
328
|
0
|
|
0
|
|
|
|
$self->_debug((join(" | ",(caller())))." > state() > is: ".($rv||'NULL'),2); |
329
|
0
|
0
|
0
|
|
|
|
if ($rv == 1 or $rv == 129) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
return("CANCEL"); |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
elsif ($rv == 2) { |
333
|
0
|
|
|
|
|
|
return("HELP"); |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
elsif ($rv == 3) { |
336
|
0
|
|
|
|
|
|
return("PREVIOUS"); |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
elsif ($rv == 254) { |
339
|
0
|
|
|
|
|
|
return("ERROR"); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
elsif ($rv == 255) { |
342
|
0
|
|
|
|
|
|
return("ESC"); |
343
|
|
|
|
|
|
|
} |
344
|
|
|
|
|
|
|
elsif (not $rv or $rv =~ /^null$/i) { |
345
|
0
|
|
|
|
|
|
return("OK"); |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
else { |
348
|
0
|
|
|
|
|
|
return("UNKNOWN(".$rv.")"); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
354
|
|
|
|
|
|
|
#: Public Methods |
355
|
|
|
|
|
|
|
#: |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
# --combobox ... |
358
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
359
|
|
|
|
|
|
|
#: display a dropdown list that's editable |
360
|
|
|
|
|
|
|
sub combobox { |
361
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
362
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
363
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
364
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
365
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
} |
367
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
370
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
371
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --combobox {{text}} {{height}} {{width}} {{list}}'); |
372
|
|
|
|
|
|
|
my $command = $self->prepare_command |
373
|
|
|
|
|
|
|
( $args, $fmt, |
374
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
375
|
|
|
|
|
|
|
); |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
378
|
0
|
|
|
|
|
|
$self->_post($args); |
379
|
0
|
0
|
|
|
|
|
return($rv ? $selected : 0); |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
# --rangebox [] |
384
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
385
|
|
|
|
|
|
|
#: display a slider bar with a preset range. |
386
|
|
|
|
|
|
|
sub rangebox { |
387
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
388
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
389
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
390
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
391
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
} |
393
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
396
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
397
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--rangebox {{text}} {{height}} {{width}} {{min}} {{max}} {{def}}'); |
398
|
|
|
|
|
|
|
my $command = $self->prepare_command |
399
|
|
|
|
|
|
|
( $args, $fmt, |
400
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
401
|
|
|
|
|
|
|
min => $self->make_kvl($args,($args->{'min'}||'0')), |
402
|
|
|
|
|
|
|
max => $self->make_kvl($args,($args->{'max'}||'100')), |
403
|
0
|
|
0
|
|
|
|
def => $self->make_kvl($args,($args->{'def'}||'0')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
404
|
|
|
|
|
|
|
); |
405
|
|
|
|
|
|
|
|
406
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
407
|
0
|
|
|
|
|
|
$self->_post($args); |
408
|
0
|
0
|
|
|
|
|
return($rv ? $selected : 0); |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
# --2rangesbox |
412
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
413
|
|
|
|
|
|
|
#: display two slider bars with preset ranges and labels |
414
|
|
|
|
|
|
|
sub rangesbox2 { |
415
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
416
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
417
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
418
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
419
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
} |
421
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
422
|
|
|
|
|
|
|
|
423
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
424
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
425
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --2rangesbox {{text}} {{height}} {{width}}'); |
426
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{label1}} {{min1}} {{max1}} {{def1}}'); |
427
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{label2}} {{min2}} {{max2}} {{def2}}'); |
428
|
|
|
|
|
|
|
my $command = $self->prepare_command |
429
|
|
|
|
|
|
|
( $args, $fmt, |
430
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
431
|
|
|
|
|
|
|
label1 => $self->make_kvl($args,($args->{'label1'}||'')), |
432
|
|
|
|
|
|
|
min1 => $self->make_kvl($args,($args->{'min1'}||'0')), |
433
|
|
|
|
|
|
|
max1 => $self->make_kvl($args,($args->{'max1'}||'100')), |
434
|
|
|
|
|
|
|
def1 => $self->make_kvl($args,($args->{'def1'}||'0')), |
435
|
|
|
|
|
|
|
label2 => $self->make_kvl($args,($args->{'label2'}||'')), |
436
|
|
|
|
|
|
|
min2 => $self->make_kvl($args,($args->{'min2'}||'0')), |
437
|
|
|
|
|
|
|
max2 => $self->make_kvl($args,($args->{'max2'}||'100')), |
438
|
0
|
|
0
|
|
|
|
def2 => $self->make_kvl($args,($args->{'def2'}||'0')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
439
|
|
|
|
|
|
|
); |
440
|
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
442
|
0
|
|
|
|
|
|
$self->_post($args); |
443
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
444
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
# --3rangesbox |
448
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
449
|
|
|
|
|
|
|
#: display three slider bars with preset ranges and labels |
450
|
|
|
|
|
|
|
sub rangesbox3 { |
451
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
452
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
453
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
454
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
455
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
} |
457
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
458
|
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
460
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
461
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --3rangesbox {{text}} {{height}} {{width}}'); |
462
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{label1}} {{min1}} {{max1}} {{def1}}'); |
463
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{label2}} {{min2}} {{max2}} {{def2}}'); |
464
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{label3}} {{min3}} {{max3}} {{def3}}'); |
465
|
|
|
|
|
|
|
my $command = $self->prepare_command |
466
|
|
|
|
|
|
|
( $args, $fmt, |
467
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
468
|
|
|
|
|
|
|
label1 => $self->make_kvl($args,($args->{'label1'}||'')), |
469
|
|
|
|
|
|
|
min1 => $self->make_kvl($args,($args->{'min1'}||'0')), |
470
|
|
|
|
|
|
|
max1 => $self->make_kvl($args,($args->{'max1'}||'100')), |
471
|
|
|
|
|
|
|
def1 => $self->make_kvl($args,($args->{'def1'}||'0')), |
472
|
|
|
|
|
|
|
label2 => $self->make_kvl($args,($args->{'label2'}||'')), |
473
|
|
|
|
|
|
|
min2 => $self->make_kvl($args,($args->{'min2'}||'0')), |
474
|
|
|
|
|
|
|
max2 => $self->make_kvl($args,($args->{'max2'}||'100')), |
475
|
|
|
|
|
|
|
def2 => $self->make_kvl($args,($args->{'def2'}||'0')), |
476
|
|
|
|
|
|
|
label3 => $self->make_kvl($args,($args->{'label3'}||'')), |
477
|
|
|
|
|
|
|
min3 => $self->make_kvl($args,($args->{'min3'}||'0')), |
478
|
|
|
|
|
|
|
max3 => $self->make_kvl($args,($args->{'max3'}||'100')), |
479
|
0
|
|
0
|
|
|
|
def3 => $self->make_kvl($args,($args->{'def3'}||'0')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
480
|
|
|
|
|
|
|
); |
481
|
|
|
|
|
|
|
|
482
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
483
|
0
|
|
|
|
|
|
$self->_post($args); |
484
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
485
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
# --spinbox |
489
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
490
|
|
|
|
|
|
|
#: display a spin box (a number with up/down buttons) with preset ranges |
491
|
|
|
|
|
|
|
sub spinbox { |
492
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
493
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
494
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
495
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
496
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
} |
498
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
499
|
|
|
|
|
|
|
|
500
|
0
|
|
0
|
|
|
|
$self->{'min'} ||= $self->{'min1'}; |
501
|
0
|
|
0
|
|
|
|
$self->{'max'} ||= $self->{'max1'}; |
502
|
0
|
|
0
|
|
|
|
$self->{'def'} ||= $self->{'def1'}; |
503
|
0
|
|
0
|
|
|
|
$self->{'label'} ||= $self->{'label1'}; |
504
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
505
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
506
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --spinbox {{text}} {{height}} {{width}}'); |
507
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min}} {{max}} {{def}} {{label}}'); |
508
|
|
|
|
|
|
|
my $command = $self->prepare_command |
509
|
|
|
|
|
|
|
( $args, $fmt, |
510
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
511
|
|
|
|
|
|
|
min => $self->make_kvl($args,($args->{'min'}||'0')), |
512
|
|
|
|
|
|
|
max => $self->make_kvl($args,($args->{'max'}||'100')), |
513
|
|
|
|
|
|
|
def => $self->make_kvl($args,($args->{'def'}||'0')), |
514
|
0
|
|
0
|
|
|
|
label => $self->make_kvl($args,($args->{'label'}||'')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
515
|
|
|
|
|
|
|
); |
516
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
518
|
0
|
|
|
|
|
|
$self->_post($args); |
519
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
# --2spinsbox |
523
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
524
|
|
|
|
|
|
|
#: display two spin boxes with preset ranges and labels |
525
|
|
|
|
|
|
|
sub spinsbox2 { |
526
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
527
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
528
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
529
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
530
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
} |
532
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
533
|
|
|
|
|
|
|
|
534
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
535
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
536
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --2spinsbox {{text}} {{height}} {{width}}'); |
537
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min1}} {{max1}} {{def1}} {{label1}}'); |
538
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min2}} {{max2}} {{def2}} {{label2}}'); |
539
|
|
|
|
|
|
|
my $command = $self->prepare_command |
540
|
|
|
|
|
|
|
( $args, $fmt, |
541
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
542
|
|
|
|
|
|
|
label1 => $self->make_kvl($args,($args->{'label1'}||'')), |
543
|
|
|
|
|
|
|
min1 => $self->make_kvl($args,($args->{'min1'}||'0')), |
544
|
|
|
|
|
|
|
max1 => $self->make_kvl($args,($args->{'max1'}||'100')), |
545
|
|
|
|
|
|
|
def1 => $self->make_kvl($args,($args->{'def1'}||'0')), |
546
|
|
|
|
|
|
|
label2 => $self->make_kvl($args,($args->{'label2'}||'')), |
547
|
|
|
|
|
|
|
min2 => $self->make_kvl($args,($args->{'min2'}||'0')), |
548
|
|
|
|
|
|
|
max2 => $self->make_kvl($args,($args->{'max2'}||'100')), |
549
|
0
|
|
0
|
|
|
|
def2 => $self->make_kvl($args,($args->{'def2'}||'0')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
550
|
|
|
|
|
|
|
); |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
553
|
0
|
|
|
|
|
|
$self->_post($args); |
554
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
555
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
556
|
|
|
|
|
|
|
} |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
# --3spinsbox |
559
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
560
|
|
|
|
|
|
|
#: display three spin boxes with preset ranges and labels |
561
|
|
|
|
|
|
|
sub spinsbox3 { |
562
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
563
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
564
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
565
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
566
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
} |
568
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
569
|
|
|
|
|
|
|
|
570
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
571
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
572
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --3spinsbox {{text}} {{height}} {{width}}'); |
573
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min1}} {{max1}} {{def1}} {{label1}}'); |
574
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min2}} {{max2}} {{def2}} {{label2}}'); |
575
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{min3}} {{max3}} {{def3}} {{label3}}'); |
576
|
|
|
|
|
|
|
my $command = $self->prepare_command |
577
|
|
|
|
|
|
|
( $args, $fmt, |
578
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
579
|
|
|
|
|
|
|
label1 => $self->make_kvl($args,($args->{'label1'}||'')), |
580
|
|
|
|
|
|
|
min1 => $self->make_kvl($args,($args->{'min1'}||'0')), |
581
|
|
|
|
|
|
|
max1 => $self->make_kvl($args,($args->{'max1'}||'100')), |
582
|
|
|
|
|
|
|
def1 => $self->make_kvl($args,($args->{'def1'}||'0')), |
583
|
|
|
|
|
|
|
label2 => $self->make_kvl($args,($args->{'label2'}||'')), |
584
|
|
|
|
|
|
|
min2 => $self->make_kvl($args,($args->{'min2'}||'0')), |
585
|
|
|
|
|
|
|
max2 => $self->make_kvl($args,($args->{'max2'}||'100')), |
586
|
|
|
|
|
|
|
def2 => $self->make_kvl($args,($args->{'def2'}||'0')), |
587
|
|
|
|
|
|
|
label3 => $self->make_kvl($args,($args->{'label3'}||'')), |
588
|
|
|
|
|
|
|
min3 => $self->make_kvl($args,($args->{'min3'}||'0')), |
589
|
|
|
|
|
|
|
max3 => $self->make_kvl($args,($args->{'max3'}||'100')), |
590
|
0
|
|
0
|
|
|
|
def3 => $self->make_kvl($args,($args->{'def3'}||'0')), |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
591
|
|
|
|
|
|
|
); |
592
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
594
|
0
|
|
|
|
|
|
$self->_post($args); |
595
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
596
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
597
|
|
|
|
|
|
|
} |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
# --buildlist {}... |
600
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
601
|
|
|
|
|
|
|
#: display a two paned box by which the user can organize a list of items |
602
|
|
|
|
|
|
|
sub buildlist { |
603
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
604
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
605
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
606
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
607
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
} |
609
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
610
|
|
|
|
|
|
|
|
611
|
0
|
|
0
|
|
|
|
$self->{'buildlist'} ||= 'buildlist'; |
612
|
0
|
|
0
|
|
|
|
$self->{'listheight'} ||= $self->{'menuheight'}; |
613
|
|
|
|
|
|
|
|
614
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
615
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
616
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --'.$self->{'buildlist'}); |
617
|
0
|
|
|
|
|
|
$fmt = $self->append_format('{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
618
|
|
|
|
|
|
|
my $command = $self->prepare_command |
619
|
|
|
|
|
|
|
( $args, $fmt, |
620
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
621
|
|
|
|
|
|
|
); |
622
|
|
|
|
|
|
|
|
623
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
624
|
0
|
|
|
|
|
|
$self->_post($args); |
625
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
626
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# --treeview {}... |
630
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
631
|
|
|
|
|
|
|
#: display a tree view of items |
632
|
|
|
|
|
|
|
sub treeview { |
633
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
634
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
635
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
636
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
637
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
} |
639
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
640
|
|
|
|
|
|
|
|
641
|
0
|
|
0
|
|
|
|
$self->{'treeview'} ||= 'treeview'; |
642
|
0
|
|
0
|
|
|
|
$self->{'listheight'} ||= $self->{'menuheight'}; |
643
|
|
|
|
|
|
|
|
644
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
645
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
646
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --'.$self->{'treeview'}); |
647
|
0
|
|
|
|
|
|
$fmt = $self->append_format('{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
648
|
|
|
|
|
|
|
my $command = $self->prepare_command |
649
|
|
|
|
|
|
|
( $args, $fmt, |
650
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
651
|
|
|
|
|
|
|
); |
652
|
|
|
|
|
|
|
|
653
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
654
|
0
|
|
|
|
|
|
$self->_post($args); |
655
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
# --calendar |
659
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
660
|
|
|
|
|
|
|
#: display a calendar with a preset date |
661
|
|
|
|
|
|
|
sub calendar { |
662
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
663
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
664
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
665
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
666
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
} |
668
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
669
|
0
|
|
0
|
|
|
|
$args->{'day'} ||= '1'; |
670
|
0
|
|
0
|
|
|
|
$args->{'month'} ||= '1'; |
671
|
0
|
|
0
|
|
|
|
$args->{'year'} ||= '1970'; |
672
|
|
|
|
|
|
|
|
673
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
674
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
675
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --calendar {{text}} {{height}} {{width}} {{day}} {{month}} {{year}}'); |
676
|
|
|
|
|
|
|
my $command = $self->prepare_command |
677
|
|
|
|
|
|
|
( $args, $fmt, |
678
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
679
|
|
|
|
|
|
|
); |
680
|
|
|
|
|
|
|
|
681
|
0
|
|
|
|
|
|
my ($rv,$date) = $self->command_string($command); |
682
|
0
|
0
|
|
|
|
|
if ($rv == 0) { |
683
|
0
|
|
|
|
|
|
$self->ra(split(m!/!,$date)); |
684
|
|
|
|
|
|
|
} |
685
|
0
|
|
|
|
|
|
$self->_post($args); |
686
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $date : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
687
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0,0,0)); |
688
|
|
|
|
|
|
|
} |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
# --timebox |
691
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
692
|
|
|
|
|
|
|
#: display a time box |
693
|
|
|
|
|
|
|
sub timebox { |
694
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
695
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
696
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
697
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
698
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
} |
700
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
701
|
|
|
|
|
|
|
|
702
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
703
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
704
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --timebox {{text}} {{height}} {{width}} {{hour}} {{minute}} {{second}}'); |
705
|
|
|
|
|
|
|
my $command = $self->prepare_command |
706
|
|
|
|
|
|
|
( $args, $fmt, |
707
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
708
|
|
|
|
|
|
|
); |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
|
my ($rv,$time) = $self->command_string($command); |
711
|
0
|
0
|
|
|
|
|
if ($rv == 0) { |
712
|
0
|
|
|
|
|
|
$self->ra(split(m!\:!,$time)); |
713
|
|
|
|
|
|
|
} |
714
|
0
|
|
|
|
|
|
$self->_post($args); |
715
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $time : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
716
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0,0,0)); |
717
|
|
|
|
|
|
|
} |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
# --yesno |
720
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
721
|
|
|
|
|
|
|
#: Ask a binary question (Yes/No) |
722
|
|
|
|
|
|
|
sub yesno { |
723
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
724
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
725
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
726
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
727
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
} |
729
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
730
|
|
|
|
|
|
|
|
731
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
732
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
733
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--yesno {{text}} {{height}} {{width}}'); |
734
|
|
|
|
|
|
|
my $command = $self->prepare_command |
735
|
|
|
|
|
|
|
( $args, $fmt, |
736
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
737
|
|
|
|
|
|
|
); |
738
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
|
my $rv = $self->command_state($command); |
740
|
0
|
0
|
0
|
|
|
|
if ($rv && $rv >= 1) { |
741
|
0
|
|
|
|
|
|
$self->ra("NO"); |
742
|
0
|
|
|
|
|
|
$self->rs("NO"); |
743
|
|
|
|
|
|
|
} else { |
744
|
0
|
|
|
|
|
|
$self->ra("YES"); |
745
|
0
|
|
|
|
|
|
$self->rs("YES"); |
746
|
|
|
|
|
|
|
} |
747
|
0
|
|
|
|
|
|
$self->_post($args); |
748
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
749
|
|
|
|
|
|
|
} |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
# --inputbox [] |
752
|
|
|
|
|
|
|
# --2inputsbox |
753
|
|
|
|
|
|
|
# --3inputsbox |
754
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
755
|
|
|
|
|
|
|
#: Text entry |
756
|
|
|
|
|
|
|
sub inputbox { |
757
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
758
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
759
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
760
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
761
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
} |
763
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
764
|
0
|
|
0
|
|
|
|
my $num_fields = $args->{'inputs'} || $args->{'password'} || 1; |
765
|
|
|
|
|
|
|
|
766
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
767
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
768
|
0
|
0
|
|
|
|
|
if ($num_fields > 1) { |
769
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output'); |
770
|
|
|
|
|
|
|
} |
771
|
0
|
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,'password','--password'); |
772
|
0
|
0
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,'password','--password') |
773
|
|
|
|
|
|
|
if $num_fields > 1; |
774
|
0
|
0
|
|
|
|
|
$fmt = $self->append_format_check($args,$fmt,'password','--password') |
775
|
|
|
|
|
|
|
if $num_fields > 2; |
776
|
|
|
|
|
|
|
|
777
|
0
|
|
|
|
|
|
my $opbox = '--inputbox'; |
778
|
0
|
0
|
|
|
|
|
$opbox = '--2inputsbox' if $num_fields == 2; |
779
|
0
|
0
|
|
|
|
|
$opbox = '--3inputsbox' if $num_fields == 3; |
780
|
|
|
|
|
|
|
|
781
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,$opbox.' {{text}} {{height}} {{width}}'); |
782
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'entry'}||$args->{'init'})) |
783
|
|
|
|
|
|
|
if $num_fields == 1; |
784
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'label1'}||'')) |
785
|
|
|
|
|
|
|
if $num_fields > 1; |
786
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'input1'}||'')) |
787
|
|
|
|
|
|
|
if $num_fields > 1; |
788
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'label2'}||'')) |
789
|
|
|
|
|
|
|
if $num_fields >= 2; |
790
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'input2'}||'')) |
791
|
|
|
|
|
|
|
if $num_fields >= 2; |
792
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'label3'}||'')) |
793
|
|
|
|
|
|
|
if $num_fields >= 3; |
794
|
0
|
0
|
0
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'input3'}||'')) |
795
|
|
|
|
|
|
|
if $num_fields >= 3; |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
my $command = $self->prepare_command |
798
|
|
|
|
|
|
|
( $args, $fmt, |
799
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
800
|
|
|
|
|
|
|
); |
801
|
|
|
|
|
|
|
|
802
|
0
|
|
|
|
|
|
my ($rv,$text); |
803
|
0
|
0
|
|
|
|
|
if ($num_fields == 1) { |
804
|
0
|
|
|
|
|
|
($rv,$text) = $self->command_string($command); |
805
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $text : 0); |
806
|
|
|
|
|
|
|
} |
807
|
0
|
|
|
|
|
|
($rv,$text) = $self->command_array($command); |
808
|
0
|
|
|
|
|
|
$self->_post($args); |
809
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $text : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
810
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
811
|
|
|
|
|
|
|
} |
812
|
|
|
|
|
|
|
sub inputsbox2 { |
813
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
814
|
0
|
|
0
|
|
|
|
return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'inputs',2)); |
815
|
|
|
|
|
|
|
} |
816
|
|
|
|
|
|
|
sub inputsbox3 { |
817
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
818
|
0
|
|
0
|
|
|
|
return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'inputs',3)); |
819
|
|
|
|
|
|
|
} |
820
|
|
|
|
|
|
|
sub password { |
821
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
822
|
0
|
|
0
|
|
|
|
return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'password',1,'inputs',1)); |
823
|
|
|
|
|
|
|
} |
824
|
|
|
|
|
|
|
sub passwords2 { |
825
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
826
|
0
|
|
0
|
|
|
|
return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'password',1,'inputs',2)); |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
sub passwords3 { |
829
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
830
|
0
|
|
0
|
|
|
|
return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'password',1,'inputs',3)); |
831
|
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
# --msgbox |
834
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
835
|
|
|
|
|
|
|
#: Text box |
836
|
|
|
|
|
|
|
sub msgbox { |
837
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
838
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
839
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
840
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
841
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
} |
843
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
844
|
|
|
|
|
|
|
|
845
|
0
|
|
0
|
|
|
|
$args->{'msgbox'} ||= 'msgbox'; |
846
|
|
|
|
|
|
|
|
847
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
848
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
849
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--'.$args->{'msgbox'}); |
850
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}}'); |
851
|
0
|
0
|
0
|
|
|
|
my $wait = ($args->{'wait'} ? $args->{'wait'}*1000 : ($args->{'timeout'}||'5000')); |
852
|
|
|
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($wait)) |
853
|
0
|
0
|
|
|
|
|
if $args->{'msgbox'} eq 'infobox'; |
854
|
|
|
|
|
|
|
my $command = $self->prepare_command |
855
|
|
|
|
|
|
|
( $args, $fmt, |
856
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
857
|
|
|
|
|
|
|
); |
858
|
|
|
|
|
|
|
|
859
|
0
|
|
|
|
|
|
my $rv = $self->command_state($command); |
860
|
0
|
|
|
|
|
|
$self->_post($args); |
861
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
862
|
|
|
|
|
|
|
} |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
# --infobox [] |
865
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
866
|
|
|
|
|
|
|
#: same as msgbox but destroy's itself with timeout... |
867
|
|
|
|
|
|
|
sub infobox { |
868
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
869
|
0
|
|
0
|
|
|
|
return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'msgbox','infobox')); |
870
|
|
|
|
|
|
|
} |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
# --editbox |
873
|
|
|
|
|
|
|
# --tailbox |
874
|
|
|
|
|
|
|
# --logbox |
875
|
|
|
|
|
|
|
# --textbox |
876
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
877
|
|
|
|
|
|
|
#: File box |
878
|
|
|
|
|
|
|
sub textbox { |
879
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
880
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
881
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
882
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
883
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
} |
885
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
886
|
|
|
|
|
|
|
|
887
|
0
|
|
0
|
|
|
|
$args->{'textbox'} ||= 'textbox'; |
888
|
0
|
|
0
|
|
|
|
$args->{'filename'} ||= $args->{'path'}; |
889
|
|
|
|
|
|
|
|
890
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
891
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
892
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--'.$args->{'textbox'}); |
893
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{filename}} {{height}} {{width}}'); |
894
|
|
|
|
|
|
|
my $command = $self->prepare_command |
895
|
|
|
|
|
|
|
( $args, $fmt, |
896
|
0
|
|
|
|
|
|
filename => $self->make_kvl($args,$args->{'filename'}), |
897
|
|
|
|
|
|
|
); |
898
|
|
|
|
|
|
|
|
899
|
0
|
|
|
|
|
|
my ($rv,$text) = $self->command_string($command); |
900
|
0
|
|
|
|
|
|
$self->_post($args); |
901
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $text : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
902
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
903
|
|
|
|
|
|
|
} |
904
|
|
|
|
|
|
|
sub editbox { |
905
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
906
|
0
|
|
0
|
|
|
|
return($self->textbox('caller',((caller(1))[3]||'main'),@_,'textbox','editbox')); |
907
|
|
|
|
|
|
|
} |
908
|
|
|
|
|
|
|
sub logbox { |
909
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
910
|
0
|
|
0
|
|
|
|
return($self->textbox('caller',((caller(1))[3]||'main'),@_,'textbox','logbox')); |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
sub tailbox { |
913
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
914
|
0
|
|
0
|
|
|
|
return($self->textbox('caller',((caller(1))[3]||'main'),@_,'textbox','tailbox')); |
915
|
|
|
|
|
|
|
} |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
# --menubox |
918
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
919
|
|
|
|
|
|
|
#: Lists |
920
|
|
|
|
|
|
|
sub menu { |
921
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
922
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
923
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
924
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
925
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
} |
927
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
928
|
|
|
|
|
|
|
|
929
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
930
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
931
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --menu'); |
932
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
933
|
|
|
|
|
|
|
my $command = $self->prepare_command |
934
|
|
|
|
|
|
|
( $args, $fmt, |
935
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
936
|
|
|
|
|
|
|
); |
937
|
|
|
|
|
|
|
|
938
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
939
|
0
|
|
|
|
|
|
$self->_post($args); |
940
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
941
|
|
|
|
|
|
|
} |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
# --checklist {}... |
944
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
945
|
|
|
|
|
|
|
#: multiple selection list via checkbox widgets |
946
|
|
|
|
|
|
|
sub checklist { |
947
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
948
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
949
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
950
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
951
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
} |
953
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
954
|
|
|
|
|
|
|
|
955
|
0
|
|
0
|
|
|
|
$self->{'checklist'} ||= 'checklist'; |
956
|
|
|
|
|
|
|
|
957
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
958
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
959
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --'.$self->{'checklist'}); |
960
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
961
|
|
|
|
|
|
|
my $command = $self->prepare_command |
962
|
|
|
|
|
|
|
( $args, $fmt, |
963
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
964
|
|
|
|
|
|
|
); |
965
|
|
|
|
|
|
|
|
966
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
967
|
0
|
|
|
|
|
|
$self->_post($args); |
968
|
0
|
0
|
0
|
|
|
|
return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray; |
|
|
0
|
|
|
|
|
|
969
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $self->ra() : (0)); |
970
|
|
|
|
|
|
|
} |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
# --radiolist {}... |
973
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
974
|
|
|
|
|
|
|
#: display a list via the radiolist widget |
975
|
|
|
|
|
|
|
sub radiolist { |
976
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
977
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
978
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
979
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
980
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
} |
982
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
983
|
|
|
|
|
|
|
|
984
|
0
|
|
0
|
|
|
|
$self->{'radiolist'} ||= 'radiolist'; |
985
|
|
|
|
|
|
|
|
986
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
987
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
988
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output --'.$self->{'radiolist'}); |
989
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
990
|
|
|
|
|
|
|
my $command = $self->prepare_command |
991
|
|
|
|
|
|
|
( $args, $fmt, |
992
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
993
|
|
|
|
|
|
|
); |
994
|
|
|
|
|
|
|
|
995
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
996
|
0
|
|
|
|
|
|
$self->_post($args); |
997
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
998
|
|
|
|
|
|
|
} |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
# --fselect |
1001
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1002
|
|
|
|
|
|
|
#: file select |
1003
|
|
|
|
|
|
|
sub fselect { |
1004
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
1005
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
1006
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
1007
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
1008
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
} |
1010
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
1011
|
0
|
|
0
|
|
|
|
$args->{'path'} ||= abs_path(); |
1012
|
|
|
|
|
|
|
|
1013
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
1014
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
1015
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--fselect'); |
1016
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}'); |
1017
|
|
|
|
|
|
|
my $command = $self->prepare_command |
1018
|
|
|
|
|
|
|
( $args, $fmt, |
1019
|
0
|
|
|
|
|
|
path => $self->make_kvl($args,$args->{'path'}), |
1020
|
|
|
|
|
|
|
); |
1021
|
|
|
|
|
|
|
|
1022
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
1023
|
0
|
|
|
|
|
|
$self->_post($args); |
1024
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
1025
|
|
|
|
|
|
|
} |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
# --dselect |
1028
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1029
|
|
|
|
|
|
|
#: directory selector |
1030
|
|
|
|
|
|
|
sub dselect { |
1031
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
1032
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
1033
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
1034
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
1035
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
} |
1037
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
1038
|
0
|
|
0
|
|
|
|
$args->{'path'} ||= abs_path(); |
1039
|
|
|
|
|
|
|
|
1040
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
1041
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
1042
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--dselect'); |
1043
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}'); |
1044
|
|
|
|
|
|
|
my $command = $self->prepare_command |
1045
|
|
|
|
|
|
|
( $args, $fmt, |
1046
|
0
|
|
|
|
|
|
path => $self->make_kvl($args,$args->{'path'}), |
1047
|
|
|
|
|
|
|
); |
1048
|
|
|
|
|
|
|
|
1049
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
1050
|
0
|
|
|
|
|
|
$self->_post($args); |
1051
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
1052
|
|
|
|
|
|
|
} |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
# --gauge [] |
1055
|
|
|
|
|
|
|
# --progress [ [[-]]] |
1056
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1057
|
|
|
|
|
|
|
#: progress meter |
1058
|
|
|
|
|
|
|
sub progress_start { |
1059
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
1060
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
1061
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
1062
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
1063
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
} |
1065
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
1066
|
|
|
|
|
|
|
|
1067
|
0
|
|
0
|
|
|
|
$self->{'_PROGRESS'} ||= {}; |
1068
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'ARGS'} = $args; |
1069
|
|
|
|
|
|
|
|
1070
|
0
|
0
|
|
|
|
|
if (defined $self->{'_PROGRESS'}->{'FH'}) { |
1071
|
0
|
|
|
|
|
|
$self->rv(129); |
1072
|
0
|
|
|
|
|
|
$self->_post($args); |
1073
|
0
|
|
|
|
|
|
return(0); |
1074
|
|
|
|
|
|
|
} |
1075
|
|
|
|
|
|
|
|
1076
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
1077
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
1078
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--progress'); |
1079
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}}'); |
1080
|
|
|
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'maxdots'}||'')) |
1081
|
0
|
0
|
0
|
|
|
|
if $args->{'maxdots'} or $args->{'msglen'}; |
|
|
|
0
|
|
|
|
|
1082
|
|
|
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'msglen'}||'')) |
1083
|
0
|
0
|
0
|
|
|
|
if $args->{'msglen'}; |
1084
|
|
|
|
|
|
|
my $command = $self->prepare_command |
1085
|
|
|
|
|
|
|
( $args, $fmt, |
1086
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
1087
|
|
|
|
|
|
|
); |
1088
|
|
|
|
|
|
|
|
1089
|
0
|
|
0
|
|
|
|
$self->{'_PROGRESS'}->{'PERCENT'} = ($args->{'percentage'} || '0'); |
1090
|
|
|
|
|
|
|
|
1091
|
0
|
|
|
|
|
|
$self->_debug("command: ".$command,2); |
1092
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'FH'} = new FileHandle; |
1093
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'FH'}->open("| $command"); |
1094
|
0
|
|
|
|
|
|
my $rv = $? >> 8; |
1095
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'FH'}->autoflush(1); |
1096
|
0
|
|
0
|
|
|
|
$self->rv($rv||'null'); |
1097
|
0
|
|
|
|
|
|
$self->ra('null'); |
1098
|
0
|
|
|
|
|
|
$self->rs('null'); |
1099
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
1100
|
|
|
|
|
|
|
} |
1101
|
|
|
|
|
|
|
sub gauge_start { |
1102
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
1103
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
1104
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
1105
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
1106
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
0
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
} |
1108
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
1109
|
|
|
|
|
|
|
|
1110
|
0
|
|
0
|
|
|
|
$self->{'_GAUGE'} ||= {}; |
1111
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'ARGS'} = $args; |
1112
|
|
|
|
|
|
|
|
1113
|
0
|
0
|
|
|
|
|
if (defined $self->{'_GAUGE'}->{'FH'}) { |
1114
|
0
|
|
|
|
|
|
$self->rv(129); |
1115
|
0
|
|
|
|
|
|
$self->_post($args); |
1116
|
0
|
|
|
|
|
|
return(0); |
1117
|
|
|
|
|
|
|
} |
1118
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
1119
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
1120
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--progress'); |
1121
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{percentage}}'); |
1122
|
|
|
|
|
|
|
$fmt = $self->append_format($fmt,shell_quote($args->{'msglen'}||'')) |
1123
|
0
|
0
|
0
|
|
|
|
if $args->{'msglen'}; |
1124
|
|
|
|
|
|
|
my $command = $self->prepare_command |
1125
|
|
|
|
|
|
|
( $args, $fmt, |
1126
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
1127
|
0
|
|
0
|
|
|
|
percentage => $self->make_kvl($args,($args->{'percentage'}||'0')), |
1128
|
|
|
|
|
|
|
); |
1129
|
|
|
|
|
|
|
|
1130
|
0
|
|
0
|
|
|
|
$self->{'_GAUGE'}->{'PERCENT'} = ($args->{'percentage'} || '0'); |
1131
|
|
|
|
|
|
|
|
1132
|
0
|
|
|
|
|
|
$self->_debug("command: ".$command,2); |
1133
|
|
|
|
|
|
|
|
1134
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'FH'} = new FileHandle; |
1135
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'FH'}->open("| $command"); |
1136
|
0
|
|
|
|
|
|
my $rv = $? >> 8; |
1137
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'FH'}->autoflush(1); |
1138
|
0
|
|
0
|
|
|
|
$self->rv($rv||'null'); |
1139
|
0
|
|
|
|
|
|
$self->ra('null'); |
1140
|
0
|
|
|
|
|
|
$self->rs('null'); |
1141
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
sub progress_inc { |
1144
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1145
|
0
|
|
0
|
|
|
|
my $incr = $_[1] || 1; |
1146
|
|
|
|
|
|
|
|
1147
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_PROGRESS'}->{'FH'}; |
1148
|
|
|
|
|
|
|
|
1149
|
0
|
|
|
|
|
|
my $fh = $self->{'_PROGRESS'}->{'FH'}; |
1150
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'PERCENT'} += $incr; |
1151
|
0
|
|
|
|
|
|
$SIG_CODE->{'PROGRESS'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_progress; |
|
0
|
|
|
|
|
|
|
1152
|
0
|
|
|
|
|
|
print $fh $self->{'_PROGRESS'}->{'PERCENT'}."\n"; |
1153
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_PROGRESS'}->{'FH'}) ? 1 : 0)); |
1154
|
|
|
|
|
|
|
} |
1155
|
|
|
|
|
|
|
sub gauge_inc { |
1156
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1157
|
0
|
|
0
|
|
|
|
my $incr = $_[1] || 1; |
1158
|
|
|
|
|
|
|
|
1159
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_GAUGE'}->{'FH'}; |
1160
|
|
|
|
|
|
|
|
1161
|
0
|
|
|
|
|
|
my $fh = $self->{'_GAUGE'}->{'FH'}; |
1162
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'PERCENT'} += $incr; |
1163
|
0
|
|
|
|
|
|
$SIG_CODE->{'GAUGE'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge; |
|
0
|
|
|
|
|
|
|
1164
|
0
|
|
|
|
|
|
print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n"; |
1165
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0)); |
1166
|
|
|
|
|
|
|
} |
1167
|
|
|
|
|
|
|
sub progress_dec { |
1168
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1169
|
0
|
|
0
|
|
|
|
my $decr = $_[1] || 1; |
1170
|
|
|
|
|
|
|
|
1171
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_PROGRESS'}->{'FH'}; |
1172
|
|
|
|
|
|
|
|
1173
|
0
|
|
|
|
|
|
my $fh = $self->{'_PROGRESS'}->{'FH'}; |
1174
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'PERCENT'} -= $decr; |
1175
|
0
|
|
|
|
|
|
$SIG_CODE->{'PROGRESS'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_progress; |
|
0
|
|
|
|
|
|
|
1176
|
0
|
|
|
|
|
|
print $fh $self->{'_PROGRESS'}->{'PERCENT'}."\n"; |
1177
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_PROGRESS'}->{'FH'}) ? 1 : 0)); |
1178
|
|
|
|
|
|
|
} |
1179
|
|
|
|
|
|
|
sub gauge_dec { |
1180
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1181
|
0
|
|
0
|
|
|
|
my $decr = $_[1] || 1; |
1182
|
|
|
|
|
|
|
|
1183
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_GAUGE'}->{'FH'}; |
1184
|
|
|
|
|
|
|
|
1185
|
0
|
|
|
|
|
|
my $fh = $self->{'_GAUGE'}->{'FH'}; |
1186
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'PERCENT'} -= $decr; |
1187
|
0
|
|
|
|
|
|
$SIG_CODE->{'GAUGE'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge; |
|
0
|
|
|
|
|
|
|
1188
|
0
|
|
|
|
|
|
print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n"; |
1189
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0)); |
1190
|
|
|
|
|
|
|
} |
1191
|
|
|
|
|
|
|
sub progress_set { |
1192
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1193
|
0
|
|
0
|
|
|
|
my $perc = $_[1] || $self->{'_PROGRESS'}->{'PERCENT'} || 1; |
1194
|
|
|
|
|
|
|
|
1195
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_PROGRESS'}->{'FH'}; |
1196
|
|
|
|
|
|
|
|
1197
|
0
|
|
|
|
|
|
my $fh = $self->{'_PROGRESS'}->{'FH'}; |
1198
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'PERCENT'} = $perc; |
1199
|
0
|
|
|
|
|
|
$SIG_CODE->{'PROGRESS'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_progress; |
|
0
|
|
|
|
|
|
|
1200
|
0
|
|
|
|
|
|
print $fh $self->{'_PROGRESS'}->{'PERCENT'}."\n"; |
1201
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_PROGRESS'}->{'FH'}) ? 1 : 0)); |
1202
|
|
|
|
|
|
|
} |
1203
|
|
|
|
|
|
|
sub gauge_set { |
1204
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1205
|
0
|
|
0
|
|
|
|
my $perc = $_[1] || $self->{'_GAUGE'}->{'PERCENT'} || 1; |
1206
|
|
|
|
|
|
|
|
1207
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_GAUGE'}->{'FH'}; |
1208
|
|
|
|
|
|
|
|
1209
|
0
|
|
|
|
|
|
my $fh = $self->{'_GAUGE'}->{'FH'}; |
1210
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'PERCENT'} = $perc; |
1211
|
0
|
|
|
|
|
|
$SIG_CODE->{'GAUGE'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge; |
|
0
|
|
|
|
|
|
|
1212
|
0
|
|
|
|
|
|
print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n"; |
1213
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0)); |
1214
|
|
|
|
|
|
|
} |
1215
|
|
|
|
|
|
|
sub gauge_text { |
1216
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1217
|
0
|
|
0
|
|
|
|
my $mesg = $_[1] || return(0); |
1218
|
|
|
|
|
|
|
|
1219
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_GAUGE'}->{'FH'}; |
1220
|
|
|
|
|
|
|
|
1221
|
0
|
|
|
|
|
|
my $fh = $self->{'_GAUGE'}->{'FH'}; |
1222
|
0
|
|
|
|
|
|
$SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge; |
|
0
|
|
|
|
|
|
|
1223
|
0
|
|
|
|
|
|
print $fh "\nXXX\n\n".$mesg."\n\nXXX\n\n".$self->{'_GAUGE'}->{'PERCENT'}."\n"; |
1224
|
0
|
0
|
|
|
|
|
return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0)); |
1225
|
|
|
|
|
|
|
} |
1226
|
|
|
|
|
|
|
sub progress_stop { |
1227
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1228
|
|
|
|
|
|
|
|
1229
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_PROGRESS'}->{'FH'}; |
1230
|
|
|
|
|
|
|
|
1231
|
0
|
|
|
|
|
|
my $args = $self->{'_PROGRESS'}->{'ARGS'}; |
1232
|
0
|
|
|
|
|
|
my $fh = $self->{'_PROGRESS'}->{'FH'}; |
1233
|
0
|
|
|
|
|
|
$SIG_CODE->{'PROGRESS'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_progress; |
|
0
|
|
|
|
|
|
|
1234
|
0
|
|
|
|
|
|
$self->{'_PROGRESS'}->{'FH'}->close(); |
1235
|
0
|
|
|
|
|
|
delete($self->{'_PROGRESS'}->{'FH'}); |
1236
|
0
|
|
|
|
|
|
delete($self->{'_PROGRESS'}->{'PERCENT'}); |
1237
|
0
|
|
|
|
|
|
delete($self->{'_PROGRESS'}->{'ARGS'}); |
1238
|
0
|
|
|
|
|
|
delete($self->{'_PROGRESS'}); |
1239
|
0
|
|
|
|
|
|
$self->rv('null'); |
1240
|
0
|
|
|
|
|
|
$self->rs('null'); |
1241
|
0
|
|
|
|
|
|
$self->ra('null'); |
1242
|
0
|
|
|
|
|
|
$self->_post($args); |
1243
|
0
|
|
|
|
|
|
return(1); |
1244
|
|
|
|
|
|
|
} |
1245
|
|
|
|
|
|
|
sub gauge_stop { |
1246
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
1247
|
|
|
|
|
|
|
|
1248
|
0
|
0
|
|
|
|
|
return(0) unless defined $self->{'_GAUGE'}->{'FH'}; |
1249
|
|
|
|
|
|
|
|
1250
|
0
|
|
|
|
|
|
my $args = $self->{'_GAUGE'}->{'ARGS'}; |
1251
|
0
|
|
|
|
|
|
my $fh = $self->{'_GAUGE'}->{'FH'}; |
1252
|
0
|
|
|
|
|
|
$SIG_CODE->{'GAUGE'}->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge; |
|
0
|
|
|
|
|
|
|
1253
|
0
|
|
|
|
|
|
$self->{'_GAUGE'}->{'FH'}->close(); |
1254
|
0
|
|
|
|
|
|
delete($self->{'_GAUGE'}->{'FH'}); |
1255
|
0
|
|
|
|
|
|
delete($self->{'_GAUGE'}->{'PERCENT'}); |
1256
|
0
|
|
|
|
|
|
delete($self->{'_GAUGE'}->{'ARGS'}); |
1257
|
0
|
|
|
|
|
|
delete($self->{'_GAUGE'}); |
1258
|
0
|
|
|
|
|
|
$self->rv('null'); |
1259
|
0
|
|
|
|
|
|
$self->rs('null'); |
1260
|
0
|
|
|
|
|
|
$self->ra('null'); |
1261
|
0
|
|
|
|
|
|
$self->_post($args); |
1262
|
0
|
|
|
|
|
|
return(1); |
1263
|
|
|
|
|
|
|
} |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
1; |