App-SeismicUnixGui

 view release on metacpan or  search on metacpan

lib/App/SeismicUnixGui/script/L_SU.pl  view on Meta::CPAN

#!/bin/perl
=head1 DOCUMENTATION


=head2 SYNOPSIS 

 PERL PROGRAM NAME: L_SUV0.87.5.pl 
 AUTHOR: 	Juan Lorenzo
 DATE: 		June 22 2017 

 DESCRIPTION 
     

 BASED ON:
 Version 0.1 April 18 2017 SeismicUnixPlTk.pl  
    Added a simple configuration file readable 
	flow
    and writable using Config::Simple (CPAN)

 Version 0.2 
    incorporate more object oriented classes
   
 Update: Simple (ASCII) local configuration 
      file is Project_Variables.config
      
 V 0.2.0 Jan 12 2018: removed all Config::Simple dependencies   
 V 0.3.0 May 14, 2018: refactored into L_SU.pm and L_SU.pl
 0
 Fall 2018
 V 0.3.1 makes Run = Save and Run
 Moves SaveAs to L_SU Menu and removes Save button
 
 V 0.3.2 has 4 flow panels
 
 V 0.3.3 has dragNdrop deactivated to stabilize version
 
 V 0.3.4 has classifies sunix programs using tabbed notebooks Sept. 12, 2018
 
 V0.3.7 removed all ticks from strings in GUIS using control module
     From now on users can write words with gaps and commas and L_SU will accept these
     value and formulate the correct Seismic Unix sytnax.
     
 V 0.3.8 Standardized format with PerlTidy, tidyviewer .perltidyrc Aug., 2019
 
 V 0.3.9 Introduce Moose attributes to record real-time GUI history
 
 V 0.4.5 Include PDL packages to handle interactive modeling and reading fortran-generated
 files
 
  V 0.5.0 new color_listbox class handles occupancy and vacancies among the listboxes March 2021
 
 V0.5.1 delete_whole_flow_button,  April 9, 2021
 
 V0.6.6 September 4, 2021
 
 V0.80.00 September 19, 2022 ready for initial uploading to the CPAN
 
 V0.82.3 April 2023, ready for automatic installation and Earthscope summer program 
 V0.82.4,5 27 April 2023, Improved: "How to install environment variables"

 
=cut

=head2 USE

=head3 NOTES

=head4 Examples

=head3 SEISMIC UNIX NOTES

=head2 CHANGES and their DATES

=cut 

=head2 Notes from bash
 
=cut 

use Moose;
our $VERSION = '0.82.6';

extends 'App::SeismicUnixGui::misc::gui_history' => { -version => 0.0.2 };
use aliased 'App::SeismicUnixGui::misc::gui_history';

use Tk;
use Tk::Pane;
use Tk::NoteBook;
use App::SeismicUnixGui::misc::L_SU '0.1.8';
use aliased 'App::SeismicUnixGui::misc::L_SU';
use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';

lib/App/SeismicUnixGui/script/L_SU.pl  view on Meta::CPAN

	-text                => " ",
	-relief              => 'flat',
	-highlightbackground => $var->{_my_yellow},
	-background          => $var->{_my_yellow},
	-state               => "disabled",
  );
$main_href->{_blank_button_spacer_left} =
  $main_href->{_my_dialog_box_w}->Button(
	-text                => "",
	-relief              => 'flat',
	-highlightbackground => $var->{_my_yellow},
	-background          => $var->{_my_yellow},
	-state               => "disabled",
  );
$main_href->{_blank_button_spacer_right} =
  $main_href->{_my_dialog_box_w}->Button(
	-text                => "",
	-relief              => 'flat',
	-highlightbackground => $var->{_my_yellow},
	-background          => $var->{_my_yellow},
	-state               => "disabled",
  );

=head2 Frame for the left-side menu in main gui

=cut

$side_menu_frame = ( $main_href->{_mw} )->Frame(
	-borderwidth => $var->{_no_borderwidth},
	-background  => $var->{_my_purple},
	-relief      => 'groove'
);

=head2 load images
Button bitmaps and pixmaps
XXX_cartoon image is used to delete
a seismic unix program from the flow

=cut

my $cross_cartoon = ( $main_href->{_mw} )
  ->Pixmap( -file => $global_libs->{_images} . 'cross.xpm', );
my $minus_cartoon = ( $main_href->{_mw} )
  ->Pixmap( -file => $global_libs->{_images} . 'minus.xpm', );
my $flow_item_up_arrow = ( $main_href->{_mw} )
  ->Bitmap( -file => $global_libs->{_images} . 'file_item_up_arrow.xbm', );
my $flow_item_down_arrow = ( $main_href->{_mw} )
  ->Bitmap( -file => $global_libs->{_images} . 'file_item_down_arrow.xbm', );

=head2  top menu frame

Contains:
(1) top menus
for superflows
and (2) icons for (a) wiping plots 
 
MB3 goes to superflow bindings 

=cut

$main_href->{_superflow_select} = $top_menu_frame->Menubutton(
	-text               => 'Tools',
	-font               => $arial_16,
	-height             => $var->{_1_character},
	-width              => $var->{_6_characters},
	-padx               => $var->{_five_pixels},
	-background         => $var->{_my_yellow},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat'
);

my $top_menu_bar =
  ( $main_href->{_superflow_select} )->Menu( -font => $arial_16 );

$top_menu_bar->bind(
	'<ButtonRelease-3>' => [ \&_L_SU_superflow_bindings, 'get_help' ], );

=head2 Top menu frame icon
wipe background plots
enable from the start

=cut 

$main_href->{_wipe_plots_button} = $top_menu_frame->Button(
	-image              => $cross_cartoon,
	-height             => $var->{_18_pixels},
	-border             => 0,
	-padx               => 8,
	-width              => $var->{_18_pixels},
	-background         => $var->{_my_light_grey},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat',
	-state              => 'active',
);

=head2 Top title reminders for Selected flow and Superflow names


=cut 

my $top_menu_frame_spacer_left = $top_menu_frame->Label(
	-text               => "\t\t\t\t",
	-font               => $arial_16,
	-height             => $var->{_one_character},
	-border             => $var->{_no_pixel},
	-anchor             => 'center',
	-width              => 0,
	-padx               => 0,
	-height             => $var->{_1_character},
	-width              => $var->{_thirty_characters},
	-padx               => $var->{_five_pixels},
	-background         => $var->{_my_purple},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat'
);

$main_href->{_flowNsuperflow_name_w} = $top_menu_frame->Label(
	-text               => 'Flow Name',
	-anchor             => 'center',
	-font               => $arial_italic_large,
	-height             => $var->{_one_character},
	-border             => $var->{_no_pixel},
	-padx               => 0,
	-height             => $var->{_1_character},
	-width              => $var->{_37_characters},
	-padx               => $var->{_five_pixels},
	-background         => $var->{_my_yellow},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat',
	-state              => 'disabled',
);

my $top_menu_frame_spacer_right = $top_menu_frame->Label(
	-text               => "\t\t\t\t",
	-font               => $arial_16,
	-height             => $var->{_one_character},
	-border             => $var->{_no_pixel},
	-anchor             => 'center',
	-width              => 0,
	-padx               => 0,
	-height             => $var->{_1_character},
	-width              => $var->{_thirty_characters},
	-padx               => $var->{_five_pixels},
	-background         => $var->{_my_purple},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat'
);

=head2 Top menu frame right side

Advice for installation of software

=cut	

$main_href->{_help_menubutton} = $top_menu_frame->Menubutton(
	-text               => 'Help',
	-font               => $arial_16,
	-width              => $var->{_6_characters},
	-height             => $var->{_1_character},
	-background         => $var->{_my_yellow},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
	-relief             => 'flat',
);

my $side_menu_bar_right =
  ( $main_href->{_help_menubutton} )->Menu( -font => $arial_16 );

( $main_href->{_help_menubutton} )->configure( -menu => $side_menu_bar_right );

my @Help_option;
$Help_option[0] = $help_menubutton_type->{_About};
$Help_option[1] = $help_menubutton_type->{_InstallationGuide};
$Help_option[2] = $help_menubutton_type->{_Tutorial};

# Help is always enabled and from the start
$main_href->{_install_menubutton} =
  ( $main_href->{_help_menubutton} )->command(
	-label     => @$alias_help_menubutton_label[0],
	-underline => 0,
	-command   => [ \&_L_SU, 'help_menubutton', \$Help_option[0] ],
	-font      => $arial_16,
  );
$main_href->{_install_menubutton} =
  ( $main_href->{_help_menubutton} )->command(
	-label     => @$alias_help_menubutton_label[1],
	-underline => 0,
	-command   => [ \&_L_SU, 'help_menubutton', \$Help_option[1] ],
	-font      => $arial_16,
  );
$main_href->{_install_menubutton} =
  ( $main_href->{_help_menubutton} )->command(
	-label     => @$alias_help_menubutton_label[2],
	-underline => 0,
	-command   => [ \&_L_SU, 'help_menubutton', \$Help_option[2] ],
	-font      => $arial_16,
  );
=pod
    $args[0] = $superflow_names->{_ProjectVariables}; (OLD)
	print("main, _Project: $args[0]\n");
	print("main,sflows:$sflows\n");
	print("main,$length_sflows\n");
	
=cut

=head2 give user superflow names

=cut

@args = @$superflow_names_gui_aref;
my $length_sflows = ( scalar @args ) - 1;    # last member is "temp"

( $main_href->{_superflow_select} )->configure( -menu => $top_menu_bar );

for ( my $sflows = 0 ; $sflows < $length_sflows ; $sflows++ ) {
	$main_href->{_superflow_select}->command(
		-label     => $args[$sflows],
		-underline => 0,
		-font      => $arial_16,
		-command   =>
		  [ \&_L_SU_superflows, 'pre_built_superflows', \$args[$sflows] ],
	);
}

=pod tied button widgets
to a tool_array
for easier management
bind MB3 to get_help
my @who;
my $this=0;

$who[$this] = $top_menu_bar->focusCurrent;
print(" who is @who\n");
my $a =$top_menu_bar->bind();
print(" bind is @$a\n");
my $class = ref $top_menu_bar;
print "Button \\$top_menu_bar is an instance of class '$class'.\n" .
      "This class has bindings for these events:\n\n";
print join("\n", $top_menu_bar->bind($class) ), "\n";

=cut

=head2 side menu frame

 contains side menus
 1. for files

=cut

$main_href->{_file_menubutton} = $side_menu_frame->Menubutton(
	-text               => 'Flow',
	-font               => $arial_16,
	-height             => $var->{_1_character},
	-relief             => 'flat',
	-background         => $var->{_my_yellow},
	-foreground         => $var->{_my_black},
	-disabledforeground => $var->{_my_dark_grey},
	-activeforeground   => $var->{_my_white},
	-activebackground   => $var->{_my_dark_grey},
);

my $side_menu_bar_left =
  ( $main_href->{_file_menubutton} )->Menu( -font => $arial_16 );

( $main_href->{_file_menubutton} )->configure( -menu => $side_menu_bar_left );

#	( $main_href->{_file_menubutton} )->separator;
my @File_option;

$File_option[0] = $file_dialog_type->{_Open};
$File_option[1] = $file_dialog_type->{_SaveAs};
$File_option[2] = $file_dialog_type->{_Delete};

# Open is the only button enabled from the start
# Its purpose is to open a user-built perl flow
( $main_href->{_file_menubutton} )->separator;
$main_href->{_Open_menubutton} = ( $main_href->{_file_menubutton} )->command(
	-label     => @$alias_FileDialog_button_label[0],
	-underline => 0,
	-command   => [ \&_L_SU, 'FileDialog_button', \$File_option[0] ],
	-font      => $arial_16,
);

( $main_href->{_file_menubutton} )->separator;
$main_href->{_SaveAs_menubutton} = ( $main_href->{_file_menubutton} )->command(
	-label     => @$alias_FileDialog_button_label[1],
	-underline => 0,
	-command   => [ \&_L_SU, 'FileDialog_button', \$File_option[1] ],
	-font      => $arial_16
);

( $main_href->{_file_menubutton} )->separator;
$main_href->{_Delete_menubutton} = ( $main_href->{_file_menubutton} )->command(
	-label     => @$alias_FileDialog_button_label[2],
	-underline => 0,
	-command   => [ \&_L_SU, 'FileDialog_button', \$File_option[2] ],
	-font      => $arial_16
);

$top_titles_frame = ( $main_href->{_mw} )->Frame(
	-borderwidth => $var->{_one_pixel_borderwidth},
	-background  => $var->{_light_gray},
	-relief      => 'groove'
);

$main_href->{_parameter_menu_frame} = ( $main_href->{_mw} )->Frame(
	-borderwidth => $var->{_one_pixel_borderwidth},
	-background  => $var->{_light_gray},
	-relief      => 'groove'
);

$parameter_titles_frame = ( $main_href->{_mw} )->Frame(
	-borderwidth => $var->{_one_pixel_borderwidth},
	-background  => $var->{_light_gray},
	-relief      => 'groove'
);

=head2  side menu frame

contains side menus
 2. for action 

=cut



( run in 1.940 second using v1.01-cache-2.11-cpan-5b529ec07f3 )