| 1 | package App::SeismicUnixGui::misc::iFile; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | Perl package: iFile.pm | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | DATE: Nov 3 2017 | ||
| 10 | |||
| 11 | DESCRIPTION: | ||
| 12 | V 0.1 | ||
| 13 | |||
| 14 | USED FOR: | ||
| 15 | |||
| 16 | interactive file and path manipulation | ||
| 17 | |||
| 18 | BASED ON: | ||
| 19 | |||
| 20 | CHANGES: Nov 14 2018 now works on user-built | ||
| 21 | as well as pre-built superflows | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | use Moose; | ||
| 26 | our $VERSION = '0.0.1'; | ||
| 27 | |||
| 28 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 29 | use aliased 'App::SeismicUnixGui::misc::L_SU_path'; | ||
| 30 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 31 | |||
| 32 | =head2 Instantiation | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | my $L_SU_global_constants = L_SU_global_constants->new(); | ||
| 37 | my $L_SU_path = L_SU_path->new(); | ||
| 38 | my $global_libs = $L_SU_global_constants->global_libs(); | ||
| 39 | my $alias_superflow_config_names_aref = | ||
| 40 | $L_SU_global_constants->alias_superflow_config_names_aref(); | ||
| 41 | my $alias_superflow_spec_names_h = | ||
| 42 | $L_SU_global_constants->alias_superflow_spec_names_h(); | ||
| 43 | my $superflow_config_names_aref = | ||
| 44 | $L_SU_global_constants->superflow_config_names_aref(); | ||
| 45 | |||
| 46 | my $default_path = $global_libs->{_default_path}; | ||
| 47 | my $var = $L_SU_global_constants->var(); | ||
| 48 | my $base_file_name = $var->{_base_file_name}; | ||
| 49 | |||
| 50 | =head2 Declare local variables | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | my $on = $var->{_on}; | ||
| 55 | my $off = $var->{_off}; | ||
| 56 | my $nu = $var->{_nu}; | ||
| 57 | my $true = $var->{_on}; | ||
| 58 | my $false = $var->{_off}; | ||
| 59 | my $flow_type_href = $L_SU_global_constants->flow_type_href(); | ||
| 60 | my $file_dialog_type_h = $L_SU_global_constants->file_dialog_type_href(); | ||
| 61 | my $empty_string = $var->{_empty_string}; | ||
| 62 | |||
| 63 | =head2 private hash | ||
| 64 | |||
| 65 | 15 keys and values | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | my $iFile = { | ||
| 70 | _dialog_type => '', | ||
| 71 | _entry_button_label => '', | ||
| 72 | _is_flow_listbox_grey_w => '', | ||
| 73 | _is_flow_listbox_pink_w => '', | ||
| 74 | _is_flow_listbox_green_w => '', | ||
| 75 | _is_flow_listbox_blue_w => '', | ||
| 76 | _is_flow_listbox_color_w => '', | ||
| 77 | _is_superflow_select_button => '', | ||
| 78 | _last_parameter_index_touched_color => '', | ||
| 79 | _last_flow_listbox_touched_w => '', | ||
| 80 | _last_flow_index_touched => '', | ||
| 81 | _parameter_value_index => '', | ||
| 82 | _prog_name => '', | ||
| 83 | _prog_name_sref => '', | ||
| 84 | _values_aref => '', | ||
| 85 | |||
| 86 | }; | ||
| 87 | |||
| 88 | =head2 _get_DATA_DIR_IN | ||
| 89 | |||
| 90 | works for both user-built and pre-built superflows | ||
| 91 | JML Nov-14-2018 | ||
| 92 | Allows mutiple file formats (bin,su,txt) within a single program: 6.4.21 | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | sub _get_DATA_DIR_IN { | ||
| 97 | my ($self) = @_; | ||
| 98 | |||
| 99 | my $Project = Project_config->new(); | ||
| 100 | |||
| 101 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 102 | my $DATA_SEISMIC_SEGB = $Project->DATA_SEISMIC_SEGB(); | ||
| 103 | my $DATA_SEISMIC_SEGD = $Project->DATA_SEISMIC_SEGD(); | ||
| 104 | my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY(); | ||
| 105 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 106 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 107 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 108 | my $prog_name; | ||
| 109 | my $result; | ||
| 110 | |||
| 111 | # correct the superflow alias for _spec_name | ||
| 112 | # N.B. that a hyphen is not needed inside the value of $prog_name | ||
| 113 | if ( $iFile->{_flow_type} eq $flow_type_href->{_pre_built_superflow} ) { | ||
| 114 | |||
| 115 | my $alias_prog_name = _get_prog_name(); | ||
| 116 | $prog_name = $alias_superflow_spec_names_h->{$alias_prog_name}; | ||
| 117 | |||
| 118 | # print("iFile,_get_DATA_DIR_IN, my unaliased program = $prog_name\n"); | ||
| 119 | |||
| 120 | } | ||
| 121 | elsif ( $iFile->{_flow_type} eq $flow_type_href->{_user_built} ) { | ||
| 122 | |||
| 123 | $prog_name = _get_prog_name(); | ||
| 124 | |||
| 125 | } | ||
| 126 | else { | ||
| 127 | print("iFile, unexpected flow type \n"); | ||
| 128 | } | ||
| 129 | |||
| 130 | if ( length $prog_name | ||
| 131 | && length( $iFile->{_parameter_value_index} ) ) | ||
| 132 | { | ||
| 133 | |||
| 134 | $L_SU_path->set_program_name($prog_name); | ||
| 135 | my $pathNmodule_spec_w_slash_pm = | ||
| 136 | $L_SU_path->get_pathNmodule_spec_w_slash_pm(); | ||
| 137 | my $pathNmodule_spec_w_colon = | ||
| 138 | $L_SU_path->get_pathNmodule_spec_w_colon(); | ||
| 139 | |||
| 140 | require $pathNmodule_spec_w_slash_pm; | ||
| 141 | |||
| 142 | # INSTANTIATE | ||
| 143 | my $package = $pathNmodule_spec_w_colon->new(); | ||
| 144 | |||
| 145 | # collect specifications of input and output directories | ||
| 146 | # from a "program_spec".pm module | ||
| 147 | my $specs_h = $package->variables(); | ||
| 148 | my $DATA_PATH_IN = $specs_h->{_DATA_DIR_IN}; | ||
| 149 | |||
| 150 | $package->prefix_aref(); | ||
| 151 | my @prefix = @{ $package->get_prefix_aref() }; | ||
| 152 | my $index = $iFile->{_parameter_value_index}; | ||
| 153 | |||
| 154 | if ( length $DATA_PATH_IN | ||
| 155 | and ( length $index ) ) | ||
| 156 | { | ||
| 157 | |||
| 158 | if ( $prefix[$index] ne $empty_string ) { | ||
| 159 | |||
| 160 | # Case 1.A: Many possible defined prefixes | ||
| 161 | # print("iFile, _get_DATA_DIR_IN, Case 1.A: Many possible defined prefixes\n"); | ||
| 162 | |||
| 163 | # Case 1.A: Many possible defined prefixes | ||
| 164 | # print("iFile, _get_DATA_DIR_IN, Case 1.A: Many possible defined prefixes\n"); | ||
| 165 | |||
| 166 | if ( $prefix[$index] eq ( '$DATA_SEISMIC_SU' . ".'/'." ) ) { | ||
| 167 | |||
| 168 | $result = $DATA_SEISMIC_SU; | ||
| 169 | |||
| 170 | } | ||
| 171 | elsif ( $prefix[$index] eq ( '$DATA_SEISMIC_BIN' . ".'/'." ) ) { | ||
| 172 | |||
| 173 | $result = $DATA_SEISMIC_BIN; | ||
| 174 | |||
| 175 | # print("iFile, _get_DATA_DIR_IN,for BIN; prefix[$index] =$prefix[$index]\n"); | ||
| 176 | |||
| 177 | } | ||
| 178 | elsif ( $prefix[$index] eq ( '$DATA_SEISMIC_SEGB' . ".'/'." ) ) | ||
| 179 | { | ||
| 180 | |||
| 181 | $result = $DATA_SEISMIC_SEGB; | ||
| 182 | |||
| 183 | # print("iFile, _get_DATA_DIR_IN,for SEGB; prefix[$index] =$prefix[$index]\n"); | ||
| 184 | |||
| 185 | } | ||
| 186 | elsif ( $prefix[$index] eq ( '$DATA_SEISMIC_SEGD' . ".'/'." ) ) | ||
| 187 | { | ||
| 188 | |||
| 189 | $result = $DATA_SEISMIC_SEGD; | ||
| 190 | |||
| 191 | # print("iFile, _get_DATA_DIR_IN,for SEGD; prefix[$index] =$prefix[$index]\n"); | ||
| 192 | |||
| 193 | } | ||
| 194 | elsif ( $prefix[$index] eq ( '$DATA_SEISMIC_SEGY' . ".'/'." ) ) | ||
| 195 | { | ||
| 196 | |||
| 197 | $result = $DATA_SEISMIC_SEGY; | ||
| 198 | |||
| 199 | # print("iFile, _get_DATA_DIR_IN,for SEGY; prefix[$index] =$prefix[$index]\n"); | ||
| 200 | |||
| 201 | } | ||
| 202 | elsif ( $prefix[$index] eq ( '$DATA_SEISMIC_TXT' . ".'/'." ) ) { | ||
| 203 | |||
| 204 | # print("iFile, _get_DATA_DIR_IN for TXT; prefix[$index] =$prefix[$index]\n"); | ||
| 205 | $result = $DATA_SEISMIC_TXT; | ||
| 206 | |||
| 207 | } | ||
| 208 | elsif ( $prefix[$index] eq '$PL_SEISMIC/' ) { | ||
| 209 | |||
| 210 | print( | ||
| 211 | "iFile, _get_DATA_DIR_IN for PL_SEISMIC; prefix[$index] =$prefix[$index]\n" | ||
| 212 | ); | ||
| 213 | |||
| 214 | $result = $PL_SEISMIC; | ||
| 215 | |||
| 216 | } | ||
| 217 | else { | ||
| 218 | print("iFile, _get_DATA_DIR_IN, unexpected result \n"); | ||
| 219 | |||
| 220 | # print("iFile, _get_DATA_DIR_IN, DATA_PATH_IN= $DATA_PATH_IN \n"); | ||
| 221 | # print("2. iFile, _get_DATA_DIR_IN,prefix[$index] ='$prefix[$index]'\n"); | ||
| 222 | # print( "3. iFile, _get_DATA_DIR_IN, 'DATA_SEISMIC_BIN' ='$DATA_SEISMIC_BIN' . " . '/' . "\n" ); | ||
| 223 | # print( "4. iFile, _get_DATA_DIR_IN, 'DATA_SEISMIC_TXT' ='$DATA_SEISMIC_TXT' . " . '/' . "\n" ); | ||
| 224 | } | ||
| 225 | |||
| 226 | } | ||
| 227 | elsif ( $prefix[$index] eq $empty_string ) { | ||
| 228 | |||
| 229 | # Case 2. | ||
| 230 | # No defined prefix | ||
| 231 | # Skips ancillary prefix definitions and only | ||
| 232 | # uses the first key value of _DATA_DIR_IN | ||
| 233 | $result = $DATA_PATH_IN; | ||
| 234 | |||
| 235 | } | ||
| 236 | else { | ||
| 237 | print("iFile, _get_DATA_DIR_IN, unexpected \n"); | ||
| 238 | } | ||
| 239 | |||
| 240 | } | ||
| 241 | else { | ||
| 242 | print("iFile, _get_DATA_DIR_IN, mising values \n"); | ||
| 243 | |||
| 244 | # print("iFile, $DATA_PATH_IN=$DATA_PATH_IN \n"); | ||
| 245 | # print("iFile, index=$index\n"); | ||
| 246 | } | ||
| 247 | |||
| 248 | } | ||
| 249 | else { | ||
| 250 | print("iFile,_get_DATA_DIR_IN, missing prog_name=$prog_name, OR \n"); | ||
| 251 | print( | ||
| 252 | "iFile,_get_DATA_DIR_IN, missing iFile->{_parameter_value_index}=$iFile->{_parameter_value_index}\n" | ||
| 253 | ); | ||
| 254 | } | ||
| 255 | |||
| 256 | # print("iFile,get_Data_path, DATA_DIR_IN = $result\n"); | ||
| 257 | return ($result); | ||
| 258 | } | ||
| 259 | |||
| 260 | =head2 _get_DATA_DIR_OUT | ||
| 261 | |||
| 262 | =cut | ||
| 263 | |||
| 264 | sub _get_DATA_DIR_OUT { | ||
| 265 | my ($self) = @_; | ||
| 266 | my $DATA_PATH_OUT; | ||
| 267 | |||
| 268 | my $prog_name = _get_prog_name(); | ||
| 269 | |||
| 270 | # print("iFile,get_Data_path, my program = $prog_name\n"); | ||
| 271 | |||
| 272 | if ($prog_name) { | ||
| 273 | |||
| 274 | $L_SU_path->set_program_name($prog_name); | ||
| 275 | my $pathNmodule_spec_w_slash_pm = | ||
| 276 | $L_SU_path->get_pathNmodule_spec_w_slash_pm(); | ||
| 277 | my $pathNmodule_spec_w_colon = | ||
| 278 | $L_SU_path->get_pathNmodule_spec_w_colon(); | ||
| 279 | |||
| 280 | require $pathNmodule_spec_w_slash_pm; | ||
| 281 | |||
| 282 | # INSTANTIATE | ||
| 283 | my $package = $pathNmodule_spec_w_colon->new(); | ||
| 284 | |||
| 285 | # # use Module::Refresh; # reload updated module | ||
| 286 | # # my $refresher = Module::Refresh->new; | ||
| 287 | # # | ||
| 288 | # # my $manage_files_by2 = manage_files_by2->new(); | ||
| 289 | # # | ||
| 290 | # # $manage_files_by2->set_program_name($prog_name); | ||
| 291 | # # my $pathNmodule_pm = $manage_files_by2->get_pathNmodule_pm(); | ||
| 292 | # # my $pathNmodule_spec = $manage_files_by2->get_pathNmodule_spec(); | ||
| 293 | # # | ||
| 294 | # # # print("1. _get_suffix_aref, prog_name: $program_name$pathNmodule_pm \n"); | ||
| 295 | # # | ||
| 296 | # # require $pathNmodule_pm; | ||
| 297 | # # | ||
| 298 | # # #$refresher->refresh_module("$module_spec_pm"); | ||
| 299 | # # | ||
| 300 | # # # INSTANTIATE | ||
| 301 | # # my $package = $pathNmodule_spec->new(); | ||
| 302 | # | ||
| 303 | # # my $module_spec = $prog_name . '_spec'; | ||
| 304 | # # my $module_spec_pm = $module_spec . '.pm'; | ||
| 305 | # # | ||
| 306 | # # $L_SU_global_constants->set_file_name($module_spec_pm); | ||
| 307 | # # my $path = $L_SU_global_constants->get_path4spec_file(); | ||
| 308 | # # my $pathNmodule_pm = $path . '/' . $module_spec_pm; | ||
| 309 | # # | ||
| 310 | # # require $pathNmodule_pm; | ||
| 311 | # # | ||
| 312 | # # # $refresher->refresh_module("$module_spec_pm"); | ||
| 313 | # # my $package = $module_spec->new; | ||
| 314 | |||
| 315 | # collect specifications of input and output directories | ||
| 316 | # fromt a program_spec.pm module | ||
| 317 | my $specs_h = $package->variables(); | ||
| 318 | $DATA_PATH_OUT = $specs_h->{_DATA_DIR_OUT}; | ||
| 319 | |||
| 320 | # print("iFile,get_Data_path, DATA_PATH_OUT = $DATA_PATH_OUT\n"); | ||
| 321 | return ($DATA_PATH_OUT); | ||
| 322 | |||
| 323 | } | ||
| 324 | else { | ||
| 325 | print("iFile,_get_DATA_DIR_OUT, missing prog_name\n"); | ||
| 326 | return (); | ||
| 327 | } | ||
| 328 | } | ||
| 329 | |||
| 330 | =head2 sub get_Open_perl_flow_path | ||
| 331 | |||
| 332 | =cut | ||
| 333 | |||
| 334 | sub get_Open_perl_flow_path { | ||
| 335 | |||
| 336 | my ($self) = @_; | ||
| 337 | |||
| 338 | my $Project = Project_config->new(); | ||
| 339 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 340 | |||
| 341 | $iFile->{_path} = $PL_SEISMIC; | ||
| 342 | |||
| 343 | my $path = $iFile->{_path}; | ||
| 344 | |||
| 345 | return ($path); | ||
| 346 | } | ||
| 347 | |||
| 348 | =head2 sub get_Open_path | ||
| 349 | |||
| 350 | =cut | ||
| 351 | |||
| 352 | sub get_Open_path { | ||
| 353 | |||
| 354 | my ($self) = @_; | ||
| 355 | |||
| 356 | my $Project = Project_config->new(); | ||
| 357 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 358 | |||
| 359 | $iFile->{_path} = $PL_SEISMIC; | ||
| 360 | |||
| 361 | my $path = $iFile->{_path}; | ||
| 362 | return ($path); | ||
| 363 | } | ||
| 364 | |||
| 365 | =head2 sub get_SaveAs_path | ||
| 366 | |||
| 367 | =cut | ||
| 368 | |||
| 369 | sub get_SaveAs_path { | ||
| 370 | |||
| 371 | my ($self) = @_; | ||
| 372 | |||
| 373 | my $Project = Project_config->new(); | ||
| 374 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 375 | |||
| 376 | $iFile->{_path} = $PL_SEISMIC; | ||
| 377 | |||
| 378 | my $path = $iFile->{_path}; | ||
| 379 | return ($path); | ||
| 380 | } | ||
| 381 | |||
| 382 | =head2 sub get_Data_path | ||
| 383 | |||
| 384 | get DATA path from SPEC file | ||
| 385 | corresponding to the program name | ||
| 386 | make sure to remove unneeded ticks in strings | ||
| 387 | |||
| 388 | used in user-built flows | ||
| 389 | for very specific programs (data_in, suop2) | ||
| 390 | |||
| 391 | and for pre-built user flows in the general case | ||
| 392 | |||
| 393 | TODO: separate the determination of data paths for user-built flows | ||
| 394 | and pre-built flows | ||
| 395 | |||
| 396 | =cut | ||
| 397 | |||
| 398 | sub get_Data_path { | ||
| 399 | |||
| 400 | my ($self) = @_; | ||
| 401 | |||
| 402 | my $entry_label = $iFile->{_entry_button_label}; | ||
| 403 | my $dialog_type = $iFile->{_dialog_type}; | ||
| 404 | |||
| 405 | # print("iFile, get_Data_path, parameter label or name = $entry_label\n"); | ||
| 406 | # print( | ||
| 407 | # "iFile, Data_File,get_Data_path, base_file_name = $base_file_name\n"); | ||
| 408 | # print("iFile,get_Data_path,flow_type =$iFile->{_flow_type}\n"); | ||
| 409 | |||
| 410 | my $Project = Project_config->new(); | ||
| 411 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 412 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 413 | my $HOME = $Project->HOME(); | ||
| 414 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 415 | my $DATA_SEISMIC_SEGB = $Project->DATA_SEISMIC_SEGB(); | ||
| 416 | my $DATA_SEISMIC_SEGD = $Project->DATA_SEISMIC_SEGD(); | ||
| 417 | my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY(); | ||
| 418 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 419 | my $DATA_SEISMIC_WELL_SYNSEIS = $Project->DATA_SEISMIC_WELL_SYNSEIS(); | ||
| 420 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 421 | my $Data_PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 422 | my $Data_SEISMIC_TXT = $DATA_SEISMIC_TXT; | ||
| 423 | |||
| 424 | if ( $iFile->{_flow_type} eq $flow_type_href->{_user_built} ) { | ||
| 425 | |||
| 426 | if ( $entry_label eq $base_file_name ) { | ||
| 427 | |||
| 428 | # CASE 1 user-built flows | ||
| 429 | # CASE 1A first label/name is base_file_name | ||
| 430 | # print("CASE 1 iFile,get_Data_path,flow_type = $iFile->{_flow_type}\n"); | ||
| 431 | # FOR A VERY SPECIFIC CASE (TODO: move all cases to the _spec files) | ||
| 432 | |||
| 433 | my $suffix_type = @{ $iFile->{_values_aref} }[1]; | ||
| 434 | |||
| 435 | # print("CASE 1 iFile,get_Data_path,suffix_type = $suffix_type\n"); | ||
| 436 | |||
| 437 | if ( $suffix_type eq 'su' or $suffix_type eq "'su'" ) { | ||
| 438 | |||
| 439 | # CASE 1A.1 | ||
| 440 | # second (index=1) | ||
| 441 | # second label/name = 'type' && value = 'su' | ||
| 442 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 443 | # print("CASE 1A.1 iFile,get_Data_path=$DATA_SEISMIC_SU\n"); | ||
| 444 | $iFile->{_path} = $DATA_SEISMIC_SU; | ||
| 445 | |||
| 446 | } | ||
| 447 | elsif ($suffix_type eq 'segb' | ||
| 448 | or $suffix_type eq "'segb'" | ||
| 449 | or $suffix_type eq 'SEGB' | ||
| 450 | or $suffix_type eq "'SEGB'" | ||
| 451 | or $suffix_type eq 'sgb' | ||
| 452 | or $suffix_type eq "'sgb'" | ||
| 453 | or $suffix_type eq 'SGB' | ||
| 454 | or $suffix_type eq "'SGB'" ) | ||
| 455 | { | ||
| 456 | |||
| 457 | # CASE 1A.2 | ||
| 458 | # and second (index=1) 'segy\b' | ||
| 459 | # if second label/name = 'type' && value = 'segb' | ||
| 460 | |||
| 461 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 462 | # print("CASE 1A.2 iFile,get_Data_path,$DATA_SEISMIC_SEGB\n"); | ||
| 463 | $iFile->{_path} = $DATA_SEISMIC_SEGB; | ||
| 464 | |||
| 465 | } | ||
| 466 | elsif ($suffix_type eq 'segd' | ||
| 467 | or $suffix_type eq "'segd'" | ||
| 468 | or $suffix_type eq 'SEGD' | ||
| 469 | or $suffix_type eq "'SEGD'" | ||
| 470 | or $suffix_type eq 'sgd' | ||
| 471 | or $suffix_type eq "'sgd'" | ||
| 472 | or $suffix_type eq 'SGD' | ||
| 473 | or $suffix_type eq "'SGD'" ) | ||
| 474 | { | ||
| 475 | |||
| 476 | # CASE 1A.2 | ||
| 477 | # and second (index=1) 'segy\d' | ||
| 478 | # if second label/name = 'type' && value = 'segd' | ||
| 479 | |||
| 480 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 481 | # print("CASE 1A.2 iFile,get_Data_path,$DATA_SEISMIC_SEGD\n"); | ||
| 482 | $iFile->{_path} = $DATA_SEISMIC_SEGD; | ||
| 483 | |||
| 484 | } | ||
| 485 | elsif ($suffix_type eq 'segy' | ||
| 486 | or $suffix_type eq "'segy'" | ||
| 487 | or $suffix_type eq 'SEGY' | ||
| 488 | or $suffix_type eq "'SEGY'" | ||
| 489 | or $suffix_type eq 'sgy' | ||
| 490 | or $suffix_type eq "'sgy'" | ||
| 491 | or $suffix_type eq 'SGY' | ||
| 492 | or $suffix_type eq "'SGY'" ) | ||
| 493 | { | ||
| 494 | |||
| 495 | # CASE 1A.3 | ||
| 496 | # and second (index=1) 'segy' | ||
| 497 | # if second label/name = 'type' && value = 'segy' | ||
| 498 | |||
| 499 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 500 | # print("CASE 1A.3 iFile,get_Data_path,$DATA_SEISMIC_SEGY\n"); | ||
| 501 | $iFile->{_path} = $DATA_SEISMIC_SEGY; | ||
| 502 | |||
| 503 | } | ||
| 504 | elsif ($suffix_type eq 'txt' | ||
| 505 | or $suffix_type eq 'TXT' | ||
| 506 | or $suffix_type eq "'txt'" | ||
| 507 | or $suffix_type eq "'TXT'" | ||
| 508 | or $suffix_type eq 'text' | ||
| 509 | or $suffix_type eq 'TEXT' | ||
| 510 | or $suffix_type eq "'text'" | ||
| 511 | or $suffix_type eq "'TEXT'" | ||
| 512 | or $suffix_type eq 'ascii' | ||
| 513 | or $suffix_type eq 'ASCII' | ||
| 514 | or $suffix_type eq "'ascii'" | ||
| 515 | or $suffix_type eq "'ASCII'" ) | ||
| 516 | { | ||
| 517 | |||
| 518 | # CASE 1A.4 | ||
| 519 | # and second (index=1) text | ||
| 520 | # if second label/name = 'type' && value is text | ||
| 521 | |||
| 522 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 523 | # print("CASE 1A.4. iFile,get_Data_path,$DATA_SEISMIC_TXT\n"); | ||
| 524 | $iFile->{_path} = $DATA_SEISMIC_TXT; | ||
| 525 | |||
| 526 | } | ||
| 527 | elsif ($suffix_type eq 'bin' | ||
| 528 | or $suffix_type eq 'BIN' | ||
| 529 | or $suffix_type eq "'bin'" | ||
| 530 | or $suffix_type eq "'BIN'" ) | ||
| 531 | { | ||
| 532 | |||
| 533 | # CASE 1A.5 | ||
| 534 | # and second (index=1) entry value = binary data | ||
| 535 | # if second label/name = 'type' && value = bin | ||
| 536 | |||
| 537 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 538 | # print("CASE 1A.5 iFile,get_Data_path,$DATA_SEISMIC_BIN\n"); | ||
| 539 | $iFile->{_path} = $DATA_SEISMIC_BIN; | ||
| 540 | |||
| 541 | } | ||
| 542 | elsif ($suffix_type eq 'ps' | ||
| 543 | or $suffix_type eq 'PS' | ||
| 544 | or $suffix_type eq "'ps'" | ||
| 545 | or $suffix_type eq "'PS'" ) | ||
| 546 | { | ||
| 547 | |||
| 548 | # CASE 1A.6 | ||
| 549 | # and second (index=1) entry value = postscript file | ||
| 550 | # if second label/name = 'type' && value = ps | ||
| 551 | |||
| 552 | # print("iFile,get_path,entry_button_label= $entry_label\n"); | ||
| 553 | # print("CASE 1A.6 iFile,get_Data_path,$DATA_SEISMIC_BIN\n"); | ||
| 554 | $iFile->{_path} = $PS_SEISMIC; | ||
| 555 | |||
| 556 | } | ||
| 557 | elsif ( $suffix_type eq $empty_string ) { | ||
| 558 | |||
| 559 | # CASE 1A.7 | ||
| 560 | $iFile->{_path} = $PL_SEISMIC; | ||
| 561 | |||
| 562 | #print("iFile,get_path,path=$iFile->{_path}\n"); | ||
| 563 | |||
| 564 | } | ||
| 565 | else { | ||
| 566 | $iFile->{_path} = $default_path; | ||
| 567 | |||
| 568 | # CASE 1A.8 unrecognized data type | ||
| 569 | print( | ||
| 570 | "CASE 1A.8 iFile,get_Data_path, unrecognized data type ... TB Added\n" | ||
| 571 | ); | ||
| 572 | } | ||
| 573 | |||
| 574 | } | ||
| 575 | |||
| 576 | # elsif ($entry_label eq 'file1' | ||
| 577 | # or $entry_label eq 'file2' ) | ||
| 578 | # { | ||
| 579 | # | ||
| 580 | # # FOR ANOTHER VERY SPECIFIC CASE | ||
| 581 | # # TODO remove?? becuase it is updated by prefix values inthe *_spec file? | ||
| 582 | # # CASE 1B.1 : suop2 | ||
| 583 | # # first label/name = 'file1' | ||
| 584 | # # second label/name = 'file2' | ||
| 585 | # $iFile->{_path} = $DATA_SEISMIC_SU; | ||
| 586 | # | ||
| 587 | # # print("CASE 1B.1 : iFile,get_path,path=$iFile->{_path}\n"); | ||
| 588 | # | ||
| 589 | # } | ||
| 590 | elsif ( $entry_label ne $empty_string | ||
| 591 | and $iFile->{_dialog_type} eq | ||
| 592 | $file_dialog_type_h->{_Data_PL_SEISMIC} ) | ||
| 593 | { | ||
| 594 | |||
| 595 | # case 1B.2A | ||
| 596 | # print("case 1B.2A iFile,get_Data_path, dialog_type=$iFile->{_dialog_type} \n"); | ||
| 597 | $iFile->{_path} = $Data_PL_SEISMIC; | ||
| 598 | |||
| 599 | } | ||
| 600 | elsif ( length $entry_label | ||
| 601 | and $iFile->{_dialog_type} eq | ||
| 602 | $file_dialog_type_h->{_Data_SEISMIC_TXT} ) | ||
| 603 | { | ||
| 604 | |||
| 605 | # case 1B.2B | ||
| 606 | # print("case 1B.2B iFile,get_Data_path, dialog_type=$iFile->{_dialog_type} \n"); | ||
| 607 | $iFile->{_path} = $Data_SEISMIC_TXT; | ||
| 608 | |||
| 609 | } | ||
| 610 | |||
| 611 | elsif ( $entry_label ne $empty_string ) { | ||
| 612 | |||
| 613 | # CASE 1B.3 | ||
| 614 | # which are pre-defined within the relevant spec files | ||
| 615 | # by DATA_DIR_IN and DATA_DIR_OUT | ||
| 616 | |||
| 617 | $iFile->{_path} = _get_DATA_DIR_IN; | ||
| 618 | |||
| 619 | # print("CASE 1B.3 iFile,get_Data_path, DATA_DIR_IN= $iFile->{_path}\n"); | ||
| 620 | |||
| 621 | } | ||
| 622 | elsif ( $entry_label eq $empty_string ) { | ||
| 623 | |||
| 624 | # unlikely | ||
| 625 | # CASE 1B.4 | ||
| 626 | # print("CASE1B.4 1iFile,get_Data_path, entry_label is empty \n"); | ||
| 627 | # print("iFile,get_Data_path, PL_SEISMIC is new chosen path \n"); | ||
| 628 | $iFile->{_path} = $PL_SEISMIC; | ||
| 629 | |||
| 630 | } | ||
| 631 | else { | ||
| 632 | |||
| 633 | # CASE 1B.5 | ||
| 634 | $iFile->{_path} = $default_path; | ||
| 635 | |||
| 636 | # print("CASE1B.5 iFile,get_Data_path, entry_label is empty \n"); | ||
| 637 | # print("iFile,get_path,path=$iFile->{_path}\n"); | ||
| 638 | # print("iFile, get_Data_path, entry label is neither base_file_name (i.e. without suffix) nor fileX \n"); | ||
| 639 | } | ||
| 640 | |||
| 641 | } | ||
| 642 | elsif ( $iFile->{_flow_type} eq $flow_type_href->{_pre_built_superflow} ) { | ||
| 643 | |||
| 644 | # CASE 2: for superflows | ||
| 645 | |||
| 646 | if ( $entry_label eq $base_file_name ) { | ||
| 647 | |||
| 648 | # CASE 2A.1: | ||
| 649 | # first label/name = 'base_file_name | ||
| 650 | # and second label/name = 'type', | ||
| 651 | # and second (index=1) entry value = 'su', 'segy' etc. | ||
| 652 | # print("iFile,CCASE 2A.1: iFile,get_Data_path, $DATA_SEISMIC_SU\n"); | ||
| 653 | $iFile->{_path} = _get_DATA_DIR_IN(); | ||
| 654 | |||
| 655 | } | ||
| 656 | elsif ( $entry_label ne $empty_string | ||
| 657 | and $iFile->{_dialog_type} eq | ||
| 658 | $file_dialog_type_h->{_Data_PL_SEISMIC} ) | ||
| 659 | { | ||
| 660 | |||
| 661 | # case 2A.2 | ||
| 662 | # print( | ||
| 663 | #"iFile,Ccase 2A.2 iFile,get_Data_path, dialog_type=$iFile->{_dialog_type} \n" | ||
| 664 | # ); | ||
| 665 | $iFile->{_path} = $Data_PL_SEISMIC; | ||
| 666 | |||
| 667 | } | ||
| 668 | elsif ( $entry_label ne $empty_string | ||
| 669 | and $iFile->{_dialog_type} eq | ||
| 670 | $file_dialog_type_h->{_Data_SEISMIC_TXT} ) | ||
| 671 | { | ||
| 672 | |||
| 673 | # CASE 2A.3 | ||
| 674 | $iFile->{_path} = $Data_SEISMIC_TXT; | ||
| 675 | # print( | ||
| 676 | #"iFile,Ccase 2A.3 iFile,get_Data_path, dialog_type=$iFile->{_dialog_type} \n" | ||
| 677 | # ); | ||
| 678 | } | ||
| 679 | elsif ( $entry_label ne $empty_string | ||
| 680 | and $iFile->{_dialog_type} eq $file_dialog_type_h->{_Home} ) | ||
| 681 | { | ||
| 682 | |||
| 683 | # CASE 2A.4 | ||
| 684 | # print("iFile,CASE 2A.4 File, get_Data_path, Home path chosen \n"); | ||
| 685 | $iFile->{_path} = $HOME; | ||
| 686 | |||
| 687 | } | ||
| 688 | else { | ||
| 689 | |||
| 690 | # CASE 2A.5 | ||
| 691 | $iFile->{_path} = $default_path; | ||
| 692 | |||
| 693 | # print("iFile, get_Data_path, superflow entry label is unexpected \n"); | ||
| 694 | # print( | ||
| 695 | #"case 2A.5 iFile,get_Data_path, iFile->_path = $Data_SEISMIC_TXT\n" | ||
| 696 | # ); | ||
| 697 | |||
| 698 | # print("CASE 2A.5, iFile,get_path,path=$iFile->{_path}\n"); | ||
| 699 | } | ||
| 700 | |||
| 701 | } | ||
| 702 | else { | ||
| 703 | |||
| 704 | # CASE 3: all other cases | ||
| 705 | $iFile->{_path} = $default_path; | ||
| 706 | |||
| 707 | print("CASE 3: iFile,get_Data_path, unsuitable flow type \n"); | ||
| 708 | |||
| 709 | # print("CASE 3: iFile,get_path,path=$iFile->{_path}\n"); | ||
| 710 | } | ||
| 711 | |||
| 712 | my $result = $iFile->{_path}; | ||
| 713 | |||
| 714 | # print("2. iFile,get_Data_path,result=$iFile->{_path}\n"); | ||
| 715 | return ($result); | ||
| 716 | } | ||
| 717 | |||
| 718 | =head2 sub get_Path | ||
| 719 | |||
| 720 | get DATA path from SPEC file | ||
| 721 | corresponding to the program name | ||
| 722 | make sure to remove unneeded ticks in strings | ||
| 723 | Only used by _pre_built_superflow_open_path | ||
| 724 | |||
| 725 | prepend appropriately the path to the | ||
| 726 | final path in the parameter value | ||
| 727 | e.g. Z becomes /home/gom/ProjectHome/site/spare_directory/etc..../Z | ||
| 728 | you can do this by using | ||
| 729 | the current index | ||
| 730 | current program name | ||
| 731 | the current value of the parameter | ||
| 732 | the previous indices | ||
| 733 | the values or the previous parameters | ||
| 734 | |||
| 735 | =cut | ||
| 736 | |||
| 737 | sub get_Path { | ||
| 738 | |||
| 739 | my ($self) = @_; | ||
| 740 | |||
| 741 | my $result; | ||
| 742 | my $Path; | ||
| 743 | |||
| 744 | if ( $iFile->{_flow_type} ne $empty_string ) { | ||
| 745 | |||
| 746 | my $Project = Project_config->new(); | ||
| 747 | my $program_name = _get_prog_name(); | ||
| 748 | |||
| 749 | # print("iFile,get_Path,flow_type: $iFile->{_flow_type}\n"); | ||
| 750 | |||
| 751 | if ( $iFile->{_flow_type} eq $flow_type_href->{_user_built} ) { | ||
| 752 | |||
| 753 | #CASE 1B | ||
| 754 | # first get values from the Project | ||
| 755 | my $PROJECT_HOME = $Project->PROJECT_HOME(); | ||
| 756 | |||
| 757 | # print("iFile,get_Path for $program_name PROJECT_HOME=$PROJECT_HOME\n"); | ||
| 758 | |||
| 759 | my $entry_label = $iFile->{_entry_button_label}; | ||
| 760 | my $index = $iFile->{_parameter_value_index}; | ||
| 761 | my @values = @{ $iFile->{_values_aref} }; | ||
| 762 | |||
| 763 | my $forPROJECT_HOME = $PROJECT_HOME; | ||
| 764 | my $forSITE = $forPROJECT_HOME . '/seismics/pl/'; | ||
| 765 | |||
| 766 | # make base path | ||
| 767 | # print("5.iFile,get_Path, forSITE: $forSITE \n"); | ||
| 768 | # print("6.iFile,get_Path,for program_name: $program_name \n"); | ||
| 769 | $Path = $forSITE; | ||
| 770 | |||
| 771 | } | ||
| 772 | elsif ( $flow_type_href->{_pre_built_superflow} ) { | ||
| 773 | |||
| 774 | if ( | ||
| 775 | $program_name eq 'Project' | ||
| 776 | |||
| 777 | # CASE 1A | ||
| 778 | and defined $iFile->{_values_aref} | ||
| 779 | && defined $iFile->{_parameter_value_index} | ||
| 780 | && defined $iFile->{_prog_name_sref} | ||
| 781 | && $iFile->{_values_aref} ne $empty_string | ||
| 782 | && $iFile->{_parameter_value_index} ne $empty_string | ||
| 783 | && $iFile->{_prog_name_sref} ne $empty_string | ||
| 784 | ) | ||
| 785 | |||
| 786 | { | ||
| 787 | # print("1.iFile,get_Path, _values_aref: @{$iFile->{_values_aref}}[0]\n"); | ||
| 788 | |||
| 789 | my $entry_label = $iFile->{_entry_button_label}; | ||
| 790 | my $index = $iFile->{_parameter_value_index}; | ||
| 791 | my @values = @{ $iFile->{_values_aref} }; | ||
| 792 | |||
| 793 | # print("iFile,get_Path,parameter label or name =---$entry_label---\n"); | ||
| 794 | # print("1.iFile,get_Path, _values_aref: @{$iFile->{_values_aref}}\n"); | ||
| 795 | # for(my $i=0; $i <8; $i++) { | ||
| 796 | # print ("iFile, get_Path, values[$i] = $values[$i]\n"); | ||
| 797 | # } | ||
| 798 | |||
| 799 | my $forHOME = $values[0]; | ||
| 800 | my $forPROJECT_HOME = $values[0]; | ||
| 801 | my $forSITE = $values[1] | ||
| 802 | . '/seismics/pl/' | ||
| 803 | ; # seismics/pl chosen out of convenience; could be gmt/pl | ||
| 804 | my $forSPARE_DIR = $forSITE . $values[2] . '/'; | ||
| 805 | my $forDATE = $forSPARE_DIR . $values[3] . '/'; | ||
| 806 | my $forCOMPONENT = $forDATE . $values[4] . '/'; | ||
| 807 | my $forLINE = $forCOMPONENT . $values[5] . '/'; | ||
| 808 | my $forSUBUSER = | ||
| 809 | $forLINE . $values[6]; # assumes each previous one is correct | ||
| 810 | |||
| 811 | if ( $index == 0 ) { | ||
| 812 | $Path = $forHOME; | ||
| 813 | |||
| 814 | } | ||
| 815 | elsif ( $index == 1 ) { | ||
| 816 | $Path = $forPROJECT_HOME; | ||
| 817 | |||
| 818 | } | ||
| 819 | elsif ( $index == 2 ) { | ||
| 820 | $Path = $forSITE; | ||
| 821 | |||
| 822 | } | ||
| 823 | elsif ( $index == 3 ) { | ||
| 824 | $Path = $forSPARE_DIR; | ||
| 825 | |||
| 826 | } | ||
| 827 | elsif ( $index == 4 ) { | ||
| 828 | $Path = $forDATE; | ||
| 829 | |||
| 830 | } | ||
| 831 | elsif ( $index == 5 ) { | ||
| 832 | $Path = $forCOMPONENT; | ||
| 833 | |||
| 834 | } | ||
| 835 | elsif ( $index == 6 ) { | ||
| 836 | $Path = $forLINE; | ||
| 837 | |||
| 838 | } | ||
| 839 | elsif ( $index == 7 ) { | ||
| 840 | $Path = $forSUBUSER; | ||
| 841 | |||
| 842 | } | ||
| 843 | else { | ||
| 844 | print("2.iFile,get_Path, unexpected index \n"); | ||
| 845 | $Path = $empty_string; | ||
| 846 | } | ||
| 847 | |||
| 848 | } | ||
| 849 | elsif ( $program_name eq 'Sucat' ) { | ||
| 850 | |||
| 851 | # CASE 1 B first get values from the Project | ||
| 852 | my $PROJECT_HOME = $Project->PROJECT_HOME(); | ||
| 853 | |||
| 854 | # print("iFile,get_Path for $program_name PROJECT_HOME=$PROJECT_HOME\n"); | ||
| 855 | |||
| 856 | my $entry_label = $iFile->{_entry_button_label}; | ||
| 857 | my $index = $iFile->{_parameter_value_index}; | ||
| 858 | my @values = @{ $iFile->{_values_aref} }; | ||
| 859 | |||
| 860 | my $forPROJECT_HOME = $PROJECT_HOME; | ||
| 861 | my $forSITE = $forPROJECT_HOME . '/seismics/pl/'; | ||
| 862 | |||
| 863 | # make base path p | ||
| 864 | # print("5.iFile,get_Path, forSITE: $forSITE \n"); | ||
| 865 | # print("6.iFile,get_Path,for program_name: $program_name \n"); | ||
| 866 | |||
| 867 | $Path = $forSITE; | ||
| 868 | |||
| 869 | } | ||
| 870 | else { | ||
| 871 | print( | ||
| 872 | "iFile,get_Path, missing values,program name or parameter index\n" | ||
| 873 | ); | ||
| 874 | return (); | ||
| 875 | $Path = $empty_string; | ||
| 876 | } | ||
| 877 | } | ||
| 878 | } | ||
| 879 | else { | ||
| 880 | print("iFile,get_Path, missing file type \n"); | ||
| 881 | $Path = $empty_string; | ||
| 882 | } # end of flow types | ||
| 883 | |||
| 884 | $iFile->{_path} = $Path; | ||
| 885 | $result = $iFile->{_path}; | ||
| 886 | |||
| 887 | # print("7. iFile,get_Path,path=$iFile->{_path}\n"); | ||
| 888 | return ($result); | ||
| 889 | } | ||
| 890 | |||
| 891 | =head2 sub get_prog_name_href | ||
| 892 | |||
| 893 | |||
| 894 | =cut | ||
| 895 | |||
| 896 | sub get_prog_name_href { | ||
| 897 | |||
| 898 | my ( $self, $hash_ref ) = @_; | ||
| 899 | my ($program_name); | ||
| 900 | if ($hash_ref) { | ||
| 901 | my ( $ans, $first_name, $suffix, $length ); | ||
| 902 | my @names = @$alias_superflow_config_names_aref; | ||
| 903 | $length = scalar(@names); | ||
| 904 | $first_name = $hash_ref->{_selected_first_name}; | ||
| 905 | |||
| 906 | # print("iFile,get_prog_name_href,first_name=$first_name\n"); | ||
| 907 | |||
| 908 | for ( my $i = 0 ; $i < $length ; $i++ ) { | ||
| 909 | if ( $names[$i] eq $first_name ) { | ||
| 910 | $ans = $i; | ||
| 911 | } | ||
| 912 | } | ||
| 913 | $program_name = $names[$ans]; | ||
| 914 | |||
| 915 | # print("iFile,get_prog_name,superflow name = $names[$ans]\n"); | ||
| 916 | } | ||
| 917 | return ($program_name); | ||
| 918 | } | ||
| 919 | |||
| 920 | =head2 sub get_prog_name_s | ||
| 921 | |||
| 922 | match the names of configuration files using aliases, | ||
| 923 | which have hyphens, e.g. Project_Variables | ||
| 924 | |||
| 925 | However, program names may be different: e.g. ProjectVariables | ||
| 926 | |||
| 927 | |||
| 928 | =cut | ||
| 929 | |||
| 930 | sub get_prog_name_s { | ||
| 931 | |||
| 932 | my ( $self, $scalar ) = @_; | ||
| 933 | my ( $alias_program_name, $program_name ); | ||
| 934 | if ($scalar) { | ||
| 935 | my ( $ans, $first_name, $length ); | ||
| 936 | $first_name = $scalar; | ||
| 937 | my @alias_names = @$alias_superflow_config_names_aref; | ||
| 938 | my @names = @$superflow_config_names_aref; | ||
| 939 | $length = scalar(@names); | ||
| 940 | |||
| 941 | # print("iFile,get_prog_name_s,first_name=$first_name\n"); | ||
| 942 | |||
| 943 | for ( my $i = 0 ; $i < $length ; $i++ ) { | ||
| 944 | if ( $alias_names[$i] eq $first_name ) { | ||
| 945 | $ans = $i; | ||
| 946 | $program_name = $names[$ans]; | ||
| 947 | } | ||
| 948 | } | ||
| 949 | if ($program_name) { | ||
| 950 | |||
| 951 | # print("iFile,get_prog_name_s,superflow name = $program_name\n"); | ||
| 952 | } | ||
| 953 | else { | ||
| 954 | print("iFile,get_prog_name_s,superflow name = NO MATCH\n"); | ||
| 955 | } | ||
| 956 | } | ||
| 957 | return ($program_name); | ||
| 958 | } | ||
| 959 | |||
| 960 | =head2 sub _get_prog_name | ||
| 961 | |||
| 962 | give scalar reference to program name | ||
| 963 | |||
| 964 | =cut | ||
| 965 | |||
| 966 | sub _get_prog_name { | ||
| 967 | |||
| 968 | my ($self) = @_; | ||
| 969 | |||
| 970 | if ( defined $iFile->{_prog_name_sref} | ||
| 971 | && $iFile->{_prog_name_sref} ne $empty_string ) | ||
| 972 | { | ||
| 973 | |||
| 974 | # print("iFile,set_prog_name_sref,-- if assumed a scalar ref: ${$iFile->{_prog_name_sref}}\n"); | ||
| 975 | |||
| 976 | my $program_name = ${ $iFile->{_prog_name_sref} }; | ||
| 977 | return ($program_name); | ||
| 978 | |||
| 979 | } | ||
| 980 | else { | ||
| 981 | print("iFile,set_prog_name_sref, no prog name is available to read\n"); | ||
| 982 | return (); | ||
| 983 | } | ||
| 984 | } | ||
| 985 | |||
| 986 | =head2 sub _set4getpath | ||
| 987 | |||
| 988 | =cut | ||
| 989 | |||
| 990 | sub _set4get_path { | ||
| 991 | |||
| 992 | my ($self) = @_; | ||
| 993 | my $conditions; | ||
| 994 | |||
| 995 | return ($conditions); | ||
| 996 | } | ||
| 997 | |||
| 998 | =head2 sub set_dialog_type | ||
| 999 | |||
| 1000 | =cut | ||
| 1001 | |||
| 1002 | sub set_dialog_type { | ||
| 1003 | |||
| 1004 | my ( $self, $dialog_type ) = @_; | ||
| 1005 | if ( $dialog_type ne $empty_string ) { | ||
| 1006 | |||
| 1007 | $iFile->{_dialog_type} = $dialog_type; | ||
| 1008 | |||
| 1009 | # print("iFile, set_dialog_type, dialog_type=$iFile->{_dialog_type} \n"); | ||
| 1010 | |||
| 1011 | } | ||
| 1012 | else { | ||
| 1013 | print("iFile, set_dialog_type, missing dialog_type\n"); | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | return (); | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | =head2 sub set_dialog_type | ||
| 1020 | |||
| 1021 | =cut | ||
| 1022 | |||
| 1023 | sub set_dialog_type_h { | ||
| 1024 | |||
| 1025 | my ( $self, $href ) = @_; | ||
| 1026 | if ( $href ne $empty_string ) { | ||
| 1027 | |||
| 1028 | $iFile->{_dialog_type} = $href->{_dialog_type}; | ||
| 1029 | |||
| 1030 | # print("iFile, set_dialog_type, dialog_type=$iFile->{_dialog_type} \n"); | ||
| 1031 | |||
| 1032 | } | ||
| 1033 | else { | ||
| 1034 | print("iFile, set_dialog_type, missing dialog_type\n"); | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | return (); | ||
| 1038 | } | ||
| 1039 | |||
| 1040 | =head2 sub set_entry | ||
| 1041 | |||
| 1042 | force entry point from gui to be an Entry widget | ||
| 1043 | |||
| 1044 | =cut | ||
| 1045 | |||
| 1046 | sub set_entry { | ||
| 1047 | |||
| 1048 | my ( $self, $hash_ref ) = @_; | ||
| 1049 | |||
| 1050 | if ( defined $hash_ref ) { | ||
| 1051 | |||
| 1052 | # print("iFile,set_entry, entry_button label=$hash_ref->{_entry_button_label}___\n"); | ||
| 1053 | |||
| 1054 | if ( $hash_ref->{_entry_button_label} ne $empty_string ) { | ||
| 1055 | |||
| 1056 | $iFile->{_entry_button_label} = $hash_ref->{_entry_button_label}; | ||
| 1057 | |||
| 1058 | } | ||
| 1059 | else { | ||
| 1060 | print("iFile,set_entry, unexpected hash_ref\n"); | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | } | ||
| 1064 | |||
| 1065 | return (); | ||
| 1066 | } | ||
| 1067 | |||
| 1068 | =head2 sub set_flow_type_h | ||
| 1069 | |||
| 1070 | user_built_flow | ||
| 1071 | or | ||
| 1072 | pre_built_superflow | ||
| 1073 | |||
| 1074 | =cut | ||
| 1075 | |||
| 1076 | sub set_flow_type_h { | ||
| 1077 | |||
| 1078 | my ( $self, $how_built ) = @_; | ||
| 1079 | |||
| 1080 | if ( defined $how_built ) { | ||
| 1081 | |||
| 1082 | $iFile->{_flow_type} = $how_built->{_flow_type}; | ||
| 1083 | |||
| 1084 | # print("iFile, set_flow_type_h : $iFile->{_flow_type}\n"); | ||
| 1085 | |||
| 1086 | } | ||
| 1087 | else { | ||
| 1088 | print("iFile, set_flow_type_h , missing how_built\n"); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | return (); | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | =head2 sub set_parameter_value_index | ||
| 1095 | |||
| 1096 | Index of selected parameter | ||
| 1097 | |||
| 1098 | =cut | ||
| 1099 | |||
| 1100 | sub set_parameter_value_index { | ||
| 1101 | |||
| 1102 | my ( $self, $hash_ref ) = @_; | ||
| 1103 | |||
| 1104 | if ( defined $hash_ref ) { | ||
| 1105 | |||
| 1106 | # print("iFile,set_parameter_value_index, index=$hash_ref->{_parameter_value_index}----\n"); | ||
| 1107 | |||
| 1108 | if ( $hash_ref->{_parameter_value_index} ne $empty_string ) { | ||
| 1109 | |||
| 1110 | $iFile->{_parameter_value_index} = | ||
| 1111 | $hash_ref->{_parameter_value_index}; | ||
| 1112 | |||
| 1113 | } | ||
| 1114 | else { | ||
| 1115 | print("iFile,set_parameter_value_index, unexpected hash_ref\n"); | ||
| 1116 | } | ||
| 1117 | } | ||
| 1118 | my $result = $iFile->{_parameter_value_index}; | ||
| 1119 | return ($result); | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | =head2 sub set_prog_name_sref | ||
| 1123 | |||
| 1124 | give scalar reference to program name | ||
| 1125 | |||
| 1126 | =cut | ||
| 1127 | |||
| 1128 | sub set_prog_name_sref { | ||
| 1129 | |||
| 1130 | my ( $self, $hash_ref ) = @_; | ||
| 1131 | if ( $hash_ref->{_prog_name_sref} ) { | ||
| 1132 | |||
| 1133 | # print("iFile,set_prog_name_sref,raw: $hash_ref->{_prog_name_sref}\n"); | ||
| 1134 | # print("iFile,set_prog_name_sref,-- if assumed a scalar ref: ${$hash_ref->{_prog_name_sref}}\n"); | ||
| 1135 | $iFile->{_prog_name_sref} = $hash_ref->{_prog_name_sref}; | ||
| 1136 | |||
| 1137 | } | ||
| 1138 | else { | ||
| 1139 | print("iFile,set_prog_name_sref, no prog name given\n"); | ||
| 1140 | } | ||
| 1141 | return (); | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | =head2 sub set_values_aref | ||
| 1145 | Introduce array or parameter values | ||
| 1146 | |||
| 1147 | =cut | ||
| 1148 | |||
| 1149 | sub set_values_aref { | ||
| 1150 | |||
| 1151 | my ( $self, $hash_ref ) = @_; | ||
| 1152 | if ( $hash_ref->{_values_aref} ) { | ||
| 1153 | |||
| 1154 | # print("iFile,set_values_aref,raw: @{$hash_ref->{_values_aref}}[0],@{$hash_ref->{_values_aref}}[1]\n"); | ||
| 1155 | $iFile->{_values_aref} = $hash_ref->{_values_aref}; | ||
| 1156 | |||
| 1157 | } | ||
| 1158 | else { | ||
| 1159 | print("iFile,set_values_aref, missing values_aref \n"); | ||
| 1160 | } | ||
| 1161 | return (); | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | 1; |