lib/App/SeismicUnixGui/misc/wipe.pm untested

filter: Statementstmt 0.0% 0 / 98 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 131 CC 8 SCAR 16.3
CC
8
Cov
0%
all_check_buttons
6.0
range
6.0
set_range
6.0
CRAP 5.1
1 package App::SeismicUnixGui::misc::wipe;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: wipe
8 AUTHOR: Juan Lorenzo
9 DATE: July 3 2017
10  
11 DESCRIPTION:
12 Version:0.1
13 Package used for scrubbing gui
14
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4
20  
21 Examples
22  
23 =head4 CHANGES and their DATES
24  
25  
26 =cut
27  
28 use Moose;
29 our $VERSION = '0.0.1';
30 use Tk;
31 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
32 my $get = L_SU_global_constants->new();
33 my $var = $get->var();
34 my $param = $get->param();
35  
36 # TODO mystery memory leak between check_buttons_settings_aref and values_w[$i]
37  
38 =head2 anonymous reference to common variable
39  
40 In $param->{_length},
41 length = max_index + 1 (see L_SU_global constants)
42  
43 =cut
44  
45 my $entries = {
46 _last => '',
47 _length => '',
48 _first_idx => '',
49 _labels_w_aref => '',
50 _values_w_aref => '',
51 _check_buttons_w_aref => '',
52 _max_length => $param->{_length},
53  
54 };
55  
56 =head2 sub all_check_buttons
57  
58 print("self is $self\n");
59 print("\nprevious final entry $entries->{_prev_final_entry_num}\n");
60 print("$i on or off: red \n");
61 print("wipe: ref butt are @$ref_button refvar is @$ref_variable\n\n");
62 print("\nmax entry $all\n");
63 print(" 1. count is $i\n");
64 print(" 2. count is $i\n");
65 print("all is $all\n");
66 print("wipe: ref butt are @$ref_button[$i]\n
67 refvar is @$ref_variable[$i]\n\n");
68 print(" 1. count is $i\n");
69
70 =cut
71  
72 sub all_check_buttons {
73  
74 my ($self) = @_;
75 my ( $first_idx, $length, $i );
76 my (@check_buttons_w);
77 $first_idx = $entries->{_first_idx};
78 $length = $entries->{_max_length};
79  
80 if ( $entries->{_check_buttons_w_aref} ) {
81  
82 # print("wipe, check_buttons, cleaning up to index:$length \n");
83 @check_buttons_w = @{ $entries->{_check_buttons_w_aref} };
84  
85 for ( $i = $first_idx ; $i < $length ; $i++ ) {
86  
87 $check_buttons_w[$i]->configure(
88 -background => $var->{_my_white},
89 -activebackground => $var->{_my_white},
90 -variable => \$var->{_off},
91 );
92 }
93 }
94 else {
95 # print("wipe, check_buttons, missing parameters \n");
96 }
97  
98 }
99  
100 =head2 sub neutral_range
101  
102 for neutral color
103  
104 =cut
105  
106 sub neutral_range {
107 my ( $self, $ref_hash ) = @_;
108 $entries->{_first_idx} = $ref_hash->{_first_idx};
109 $entries->{_length} = $entries->{_max_length};
110 $entries->{_labels_w_aref} = $ref_hash->{_labels_w_aref};
111 $entries->{_values_w_aref} = $ref_hash->{_values_w_aref};
112 $entries->{_check_buttons_w_aref} = $ref_hash->{_check_buttons_w_aref};
113  
114 # $temp = $ref_hash->{_check_buttons_settings_aref};
115 # $entries->{_check_buttons_settings_aref} = $ref_hash->{_check_buttons_settings_aref};
116 # print("wipe,neutral_range,length of previous selected sueprflow = $entries->{_length}\n");
117 # print("wipe,neutral_range,check_buttons_settings_aref=--@{$entries->{_check_buttons_settings_aref}}--\n");
118 # @{$entries->{_check_buttons_settings_aref}}[0]='aaa';
119 }
120  
121 =head2 sub range
122  
123 for colored flows
124  
125 =cut
126  
127 sub range {
128 my ( $self, $ref_hash ) = @_;
129  
130 if ( length $ref_hash ) {
131  
132 $entries->{_first_idx} = $ref_hash->{_first_idx};
133 $entries->{_length} = $entries->{_max_length};
134 $entries->{_labels_w_aref} = $ref_hash->{_labels_w_aref};
135 $entries->{_values_w_aref} = $ref_hash->{_values_w_aref};
136 $entries->{_check_buttons_w_aref} = $ref_hash->{_check_buttons_w_aref};
137 }
138 else {
139 print("wipe,range, missing hash reference\n");
140 }
141  
142 return ();
143  
144 }
145  
146 =head2 sub set_range
147  
148  
149 =cut
150  
151 sub set_range {
152 my ( $self, $range ) = @_;
153  
154 if ( length $range ) {
155  
156 $entries->{_length} = $range;
157  
158 }
159 else {
160 print("wipe,range,length to wipe is missing\n");
161 }
162  
163 }
164  
165 =head2 sub set_all
166  
167  
168 =cut
169  
170 sub set_all {
171 my ( $self, $ref_hash ) = @_;
172  
173 if ( length $ref_hash ) {
174  
175 $entries->{_first_idx} = $ref_hash->{_first_idx};
176 $entries->{_length} = $entries->{_max_length};
177 $entries->{_labels_w_aref} = $ref_hash->{_labels_w_aref};
178 $entries->{_values_w_aref} = $ref_hash->{_values_w_aref};
179 $entries->{_check_buttons_w_aref} = $ref_hash->{_check_buttons_w_aref};
180 }
181 else {
182 print("wipe,range, missing hash reference\n");
183 }
184 return ();
185
186 }
187  
188 =head2 sub labels
189  
190 print("self is $self labels are $ref_labels_w\n\n");
191 print("delete labels $i ");
192  
193 =cut
194  
195 sub labels {
196 my ($self) = @_;
197 my ( $first_idx, $length, $i );
198 my (@labels_w);
199  
200 $first_idx = $entries->{_first_idx};
201 $length = $entries->{_length};
202  
203 if ( length $entries->{_labels_w_aref} ) {
204  
205 @labels_w = @{ $entries->{_labels_w_aref} };
206  
207 for ( $i = $first_idx ; $i < $length ; $i++ ) {
208  
209 $labels_w[$i]->configure( -text => '', );
210 }
211  
212 }
213 else {
214 # print("wipe,values, missing entries->{_labels_w_aref}\n");
215 }
216  
217 return ();
218 }
219  
220 =head2 sub values
221  
222 print("self is $self values are $ref_values_w\n\n");
223 print("wipe final: $entries->{_final_entry_num}\n");
224 print(" prev final: $entries->{_prev_final_entry_num}\n");
225 print(" first: $entries->{_first_entry_num}\n");
226 print("wipe max $entries->{_max_entry_num}\n");
227 print("max final entry num $all\n\n");
228 $LSU->{_ref_labels_w} = $create->labelsc(\@blank_choices,
229 \$parameter_names_frame);
230
231
232 solve mystery memory leak
233 $entries->{_check_buttons_settings_aref} = $temp;
234 print("wipe,neutral_range,length of previous selected sueprflow = $entries->{_length}\n");
235 print("wipe,neutral_range,check_buttons_settings_aref=--@{$entries->{_check_buttons_settings_aref}}--\n");
236  
237 print("wipe,values, _values_w_aref: @{$entries->{_values_w_aref}} \n");
238 print("wipe,values, first_idx: $first_idx, length: $length, _values_w_aref: @{$entries->{_values_w_aref}} \n");
239
240 =cut
241  
242 sub values {
243 my ($self) = @_;
244 my ( $first_idx, $length, $i );
245 my (@values_w);
246 $first_idx = $entries->{_first_idx};
247 $length = $entries->{_length};
248  
249 if ( length $entries->{_values_w_aref} ) {
250  
251 @values_w = @{ $entries->{_values_w_aref} };
252  
253 for ( $i = $first_idx ; $i < $length ; $i++ ) {
254  
255 $values_w[$i]->delete( 0, 'end' );
256 # print("wipe,values,idx=$i,length=$length}--\n");
257 }
258 }
259 else {
260 print("warning: wipe,values, missing entries->{_values_w_aref}\n");
261 print(
262 "wipe,values, first_idx: $first_idx, length: $length, _values_w_aref: $entries->{_values_w_aref} \n"
263 );
264 }
265 return ();
266 }
267  
268 =head2 sub check_buttons
269  
270 print("self is $self\n");
271 print("\nprevious final entry $entries->{_prev_final_entry_num}\n");
272 print("$i on or off: red \n");
273 print("wipe: ref butt are @$ref_button refvar is @$ref_variable\n\n");
274 print("\nmax entry $all\n");
275 print(" 1. count is $i\n");
276 print(" 2. count is $i\n");
277 print("all is $all\n");
278 print("wipe: ref butt are @$ref_button[$i]\n
279 refvar is @$ref_variable[$i]\n\n");
280 print(" 1. count is $i\n");
281
282 =cut
283  
284 sub check_buttons {
285  
286 my ($self) = @_;
287 my ( $first_idx, $length, $i );
288 my (@check_buttons_w);
289 $first_idx = $entries->{_first_idx};
290 $length = $entries->{_length};
291  
292 if ( length $entries->{_check_buttons_w_aref} ) {
293  
294 #print("wipe, check_buttons, cleaning up to index:$length \n");
295 @check_buttons_w = @{ $entries->{_check_buttons_w_aref} };
296  
297 for ( $i = $first_idx ; $i < $length ; $i++ ) {
298  
299 $check_buttons_w[$i]->configure(
300 -background => $var->{_white},
301 -activebackground => $var->{_white},
302 -variable => \$var->{_off},
303 );
304 }
305 }
306 else {
307 # print("wipe, check_buttons, missing parameters \n");
308 }
309  
310 }
311 1;