Difference between revisions of "Amulet pl src"
From AMule Project FAQ
(→aMulet.pl source: add lang) |
|||
| Line 9: | Line 9: | ||
# http://www.gnu.org/copyleft/gpl.html | # http://www.gnu.org/copyleft/gpl.html | ||
# | # | ||
| − | |||
| − | |||
use strict; | use strict; | ||
my $binaMuled = 'amuled -f'; | my $binaMuled = 'amuled -f'; | ||
| − | my $apppid = "$ENV{HOME}/.tx2z.pid"; | + | my $apppid = "$ENV{HOME}/.tx2z.pid"; # imagination |
| − | my $logMode = " | + | my $logMode = "debug"; # debug warning msg |
my $verbose = 1; # true false | my $verbose = 1; # true false | ||
| + | |||
| + | use vars qw( %lang_en %lang_es ); | ||
| + | &initLang; | ||
| + | |||
| + | my %lang = %lang_en; | ||
if (!defined($ENV{'DISPLAY'})){ | if (!defined($ENV{'DISPLAY'})){ | ||
| − | print &appRel . "\ | + | print &appRel . "\n\n$lang{not_X11_msg}\n\n"; |
exit -1; | exit -1; | ||
} | } | ||
| Line 27: | Line 30: | ||
if ($@) { | if ($@) { | ||
print &appRel; | print &appRel; | ||
| − | print "\n | + | print "\n\n$lang{not_TrayIcon_msg}\n"; |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
exit -1; | exit -1; | ||
} | } | ||
| Line 55: | Line 54: | ||
# Comprobaciones iniciales. Cargar configuración. | # Comprobaciones iniciales. Cargar configuración. | ||
if (!&inicializar){ | if (!&inicializar){ | ||
| − | logsys ("msg", &appRel . | + | logsys ("msg", &appRel . $lang{interrupted_initialization}); |
| − | unlink $apppid or die | + | unlink $apppid or die $lang{bad_blockage_file}; |
exit -1; | exit -1; | ||
} | } | ||
| − | logsys ("msg", &appRel . | + | logsys ("msg", &appRel . $lang{initiated}); |
# Formas Gtk2 | # Formas Gtk2 | ||
| − | my $menu = Gtk2::Menu->new(); | + | my $menu = Gtk2::Menu->new(); |
| − | my $menu_opciones = Gtk2::MenuItem->new( | + | my $menu_opciones = Gtk2::MenuItem->new($lang{options}); |
my $menu_aLinkCreator = Gtk2::MenuItem->new("aLinkCreator"); | my $menu_aLinkCreator = Gtk2::MenuItem->new("aLinkCreator"); | ||
| − | my $menu_wxCas = Gtk2::MenuItem->new("wxCas"); | + | my $menu_wxCas = Gtk2::MenuItem->new("wxCas"); |
| − | my $menu_aMuleGui = Gtk2::MenuItem->new("aMuleGui"); | + | my $menu_aMuleGui = Gtk2::MenuItem->new("aMuleGui"); |
| − | my $menu_verLog = Gtk2::MenuItem->new( | + | my $menu_verLog = Gtk2::MenuItem->new($lang{logfile}); |
| − | my $menuSalir = Gtk2::MenuItem->new( | + | my $menuSalir = Gtk2::MenuItem->new($lang{quit}); |
my $pic; | my $pic; | ||
| + | |||
eval {$pic = Gtk2::Gdk::Pixbuf->new_from_file ($config->{'iconPath'});}; | eval {$pic = Gtk2::Gdk::Pixbuf->new_from_file ($config->{'iconPath'});}; | ||
if ($@){ | if ($@){ | ||
my @aMulet_xpm = ('18 24 17 1', ' c None', '. c #312A28', '+ c #524842', | my @aMulet_xpm = ('18 24 17 1', ' c None', '. c #312A28', '+ c #524842', | ||
| − | + | '@ c #D42238', '# c #835128', '$ c #985A20', '% c #6A6B6A', | |
| − | + | '& c #AA7B50', '* c #EC5867', '= c #BF7B3F', '- c #C9792F', | |
| − | + | '; c #898989', '> c #E39854', ', c #CB9D83', '" c #A9AAAA', | |
| − | + | ') c #CDCBC9', '! c #F4F5F3', ' ', | |
| − | + | ' $ ', ' !> ', ' #! )$$ ', | |
| − | + | ' ## #-$ ', ' )##$ -,# ', ' .+##)$,) ', | |
| − | + | ' ...$,!" ', ' ".$=-$" ', ' ;==-!= ', | |
| − | + | ' " >! " ', ' ; !& ; ', ' " !)))" ', | |
| − | + | ' """"""! ', ' %!.""""); ', ' ;))";;;"%;;) ', | |
| − | + | ' ">-)";;;;"->"" ', ' )-=$,;;%@,->$) ', ' ;%--#=>>**+%%; ', | |
| − | + | ' +....&=>>>>#!))! ', '%"-=##$>>>>=&$--;;', '+)-=##&=>>>=#=->)+', | |
| − | + | '%;;=$+.+>>++$->,;%', ' " . '); | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
$pic = Gtk2::Gdk::Pixbuf->new_from_xpm_data (@aMulet_xpm); | $pic = Gtk2::Gdk::Pixbuf->new_from_xpm_data (@aMulet_xpm); | ||
| − | logsys ("warning", | + | logsys ("warning", $lang{icon_load_Error} . $config->{'iconPath'}); |
| − | logsys ("msg", | + | logsys ("msg", $lang{icon_load}); |
} | } | ||
| + | |||
my $img= Gtk2::Image->new_from_pixbuf($pic->scale_simple(18, 24, "tiles")); | my $img= Gtk2::Image->new_from_pixbuf($pic->scale_simple(18, 24, "tiles")); | ||
my $tray= Gtk2::TrayIcon->new("trayicon"); | my $tray= Gtk2::TrayIcon->new("trayicon"); | ||
| Line 126: | Line 113: | ||
# Tratamiento de señales | # Tratamiento de señales | ||
| − | logsys ("debug", | + | logsys ("debug", $lang{signs_assignment}); |
$tray->signal_connect ('button-press-event' => \&ClickOnIcon); | $tray->signal_connect ('button-press-event' => \&ClickOnIcon); | ||
$menu_opciones->signal_connect('activate' => \&opcionesGui); | $menu_opciones->signal_connect('activate' => \&opcionesGui); | ||
| Line 137: | Line 124: | ||
# show sobre los witgets para que sean visibles | # show sobre los witgets para que sean visibles | ||
| − | logsys ("debug", | + | logsys ("debug", $lang{witgets_show}); |
$menu->show_all; | $menu->show_all; | ||
$tray->show_all; | $tray->show_all; | ||
&popUpsAct; | &popUpsAct; | ||
# iniciando bucle de mensajes | # iniciando bucle de mensajes | ||
| − | logsys ("debug", | + | logsys ("debug", $lang{init_msg_loop}); |
Gtk2->main; | Gtk2->main; | ||
# Fin. Aquí termina el flujo. | # Fin. Aquí termina el flujo. | ||
| Line 151: | Line 138: | ||
# statusText Establece el texto del toolTip | # statusText Establece el texto del toolTip | ||
sub statusText{ | sub statusText{ | ||
| − | my $tmpStr = &appRel . | + | my $tmpStr = &appRel . $lang{right_click_show}; |
if ($config->{'signOn'}){ | if ($config->{'signOn'}){ | ||
&onlineInfo; | &onlineInfo; | ||
# my $tmpStr; | # my $tmpStr; | ||
if ($config->{'ConectStatus'}){ | if ($config->{'ConectStatus'}){ | ||
| − | if ($config->{'typeId'}eq"H"){$tmpStr = | + | if ($config->{'typeId'}eq"H"){$tmpStr = $lang{Hid}} |
| − | elsif ($config->{'typeId'}eq"L"){$tmpStr = | + | elsif ($config->{'typeId'}eq"L"){$tmpStr = $lang{Lid}} |
| − | else {$tmpStr = | + | else {$tmpStr = $lang{Conecting}} |
| − | $tmpStr .= | + | $tmpStr .= $lang{down} . $config->{'downSpeed'}; |
$tmpStr .= " kb/s Up:" . $config->{'upSpeed'} ." Kb/s "; | $tmpStr .= " kb/s Up:" . $config->{'upSpeed'} ." Kb/s "; | ||
| − | if ($config->{'kadStatus'}==2) {$tmpStr .= | + | if ($config->{'kadStatus'}==2) {$tmpStr .= $lang{k_ok}; |
| − | } elsif ($config->{'kadStatus'}==1) {$tmpStr .= | + | } elsif ($config->{'kadStatus'}==1) {$tmpStr .= $lang{k_fire}; |
| − | } else {$tmpStr .= | + | } else {$tmpStr .= $lang{k_down}}; |
| − | } else {$tmpStr = &appRel . | + | } else {$tmpStr = &appRel . $lang{aMd_off}} |
| − | + | ||
} | } | ||
$trayTooltip->set_tip($tray, $tmpStr); | $trayTooltip->set_tip($tray, $tmpStr); | ||
| Line 219: | Line 205: | ||
my $pid = wait; | my $pid = wait; | ||
return unless $config->{$pid}; # El system() realiza un fork() también. | return unless $config->{$pid}; # El system() realiza un fork() también. | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{just_end} . $config->{$pid} . |
" [" . $config->{$config->{$pid} . 'Pid'} . "]"); | " [" . $config->{$config->{$pid} . 'Pid'} . "]"); | ||
undef $config->{$config->{$pid} . 'Pid'}; | undef $config->{$config->{$pid} . 'Pid'}; | ||
| Line 228: | Line 214: | ||
sub finalizar { | sub finalizar { | ||
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = \&finalizar; | $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = \&finalizar; | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{ending}); |
#Finalizar el bucle de mensajes | #Finalizar el bucle de mensajes | ||
Gtk2->main_quit; | Gtk2->main_quit; | ||
#Comprobar que no quede ninguna aplicación hijo en funcionamiento | #Comprobar que no quede ninguna aplicación hijo en funcionamiento | ||
#y si existe eliminarlas antes de finalizar no vayan a quedar zombies. | #y si existe eliminarlas antes de finalizar no vayan a quedar zombies. | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{endChilds}); |
# Ahora la señal de retorno del hijo la trataremos aquí. | # Ahora la señal de retorno del hijo la trataremos aquí. | ||
$SIG{CHLD} = 'DEFAULT'; | $SIG{CHLD} = 'DEFAULT'; | ||
foreach my $app (@appList) { | foreach my $app (@appList) { | ||
if (defined $config->{$app . "Pid"}){ | if (defined $config->{$app . "Pid"}){ | ||
| − | logsys ("msg", "[$app] | + | logsys ("msg", "[$app] $lang{end_run_chld}"); |
kill ('SIGTERM', $config->{$app . "Pid"}); | kill ('SIGTERM', $config->{$app . "Pid"}); | ||
waitpid($config->{$app . "Pid"}, 0); | waitpid($config->{$app . "Pid"}, 0); | ||
} | } | ||
} | } | ||
| − | logsys ("msg", | + | |
| + | logsys ("msg", $lang{hasntChld} . &appRel . $lang{inSys}); | ||
#TODO Si archivo de bloqueo es usado para log volcar a otro sitio. | #TODO Si archivo de bloqueo es usado para log volcar a otro sitio. | ||
| − | logsys ("warning", "TODO: | + | logsys ("warning", "TODO: $lang{to_do_1}"); |
| − | logsys ("msg", | + | logsys ("msg", $lang{appEnd}); |
logsys ("msg", "bye ;-)\n\n".&appRel."\n"); | logsys ("msg", "bye ;-)\n\n".&appRel."\n"); | ||
# borrar archivo de bloqueo | # borrar archivo de bloqueo | ||
| − | unlink $apppid or die " | + | unlink $apppid or die "$lang{bad_blockage_file} $apppid"; |
} | } | ||
| Line 270: | Line 257: | ||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time); | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time); | ||
$year += 1900; $mon ++; | $year += 1900; $mon ++; | ||
| − | + | # $tmpStr="[" . uc($mode) . "] " . sprintf("%02d",$mday) . "-" . | |
| − | + | # sprintf("%02d",$mon) . "-$year " . sprintf("%02d",$hour) . ":" . | |
| − | + | # sprintf("%02d",$min) . ":" . sprintf("%02d",$sec) . " $text\n"; | |
| + | $tmpStr="[" . uc($mode) . "] " . sprintf("%02d",$mday) . "-"; | ||
| + | $tmpStr.= sprintf("%02d",$mon) . "-$year " . sprintf("%02d",$hour) . ":" if $logMode ne "debug"; | ||
| + | $tmpStr.= sprintf("%02d",$min) . ":" . sprintf("%02d",$sec) . " $text\n"; | ||
print LOG $tmpStr; print $tmpStr if $verbose; | print LOG $tmpStr; print $tmpStr if $verbose; | ||
} | } | ||
| Line 295: | Line 285: | ||
$config->{ $refApp . 'Pid'} = fork() | $config->{ $refApp . 'Pid'} = fork() | ||
unless ($config->{ $refApp . 'Pid'}); # Crea un proceso hijo | unless ($config->{ $refApp . 'Pid'}); # Crea un proceso hijo | ||
| − | die " | + | die "$lang{fork_error} $!" if !defined($config->{$refApp . 'Pid'}); |
if ( $config->{$refApp . 'Pid'} == 0) { # Si se trata del proceso hijo | if ( $config->{$refApp . 'Pid'} == 0) { # Si se trata del proceso hijo | ||
| − | logsys ("msg", " | + | logsys ("msg", "$lang{child_begin} [$refApp]"); |
if ($config->{$refApp . 'Ok'}) { | if ($config->{$refApp . 'Ok'}) { | ||
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT'; | $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT'; | ||
| − | logsys ("warning", " | + | logsys ("warning", "$lang{stdout_redirect} $refApp $lang{a} $apppid"); |
open STDOUT, ">>$apppid"; | open STDOUT, ">>$apppid"; | ||
exec ($config->{$refApp . 'App'}) || | exec ($config->{$refApp . 'App'}) || | ||
| − | die " | + | die "$lang{exec_fail} $refApp"; |
} else {exit -1} | } else {exit -1} | ||
} else { # Circuito del proceso padre | } else { # Circuito del proceso padre | ||
| − | logsys ("msg", " | + | logsys ("msg", "$lang{father_loop}$refApp pid:" |
. $config->{$refApp . 'Pid'} . "]"); | . $config->{$refApp . 'Pid'} . "]"); | ||
# Asigno una clave en la configuración con el valor de la pid con el padre | # Asigno una clave en la configuración con el valor de la pid con el padre | ||
| Line 312: | Line 302: | ||
unless $config->{$config->{$refApp . 'Pid'}}; | unless $config->{$config->{$refApp . 'Pid'}}; | ||
# a ejecutar por el proceso padre | # a ejecutar por el proceso padre | ||
| − | + | logsys ("debug", "TODO: $lang{to_do_2}"); | |
| − | + | ||
} | } | ||
} | } | ||
| Line 323: | Line 312: | ||
$fileRun = $0 unless $fileRun; | $fileRun = $0 unless $fileRun; | ||
$fileRun = "aMulet.pl [$1]" if $fileRun ne 'aMulet.pl'; | $fileRun = "aMulet.pl [$1]" if $fileRun ne 'aMulet.pl'; | ||
| − | return $fileRun . " v.1. | + | return $fileRun . " v.1.3 alpha"; |
} | } | ||
| Line 358: | Line 347: | ||
} | } | ||
if ($appVerify){ | if ($appVerify){ | ||
| − | $tmpStr = "<b>" .appRel . "</b> | + | $tmpStr = "<b>" . appRel . "</b> $lang{itsRun}\n\n"; |
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT'; | $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT'; | ||
&showMessage( 'error', flushChars($tmpStr), 'ok'); | &showMessage( 'error', flushChars($tmpStr), 'ok'); | ||
| Line 366: | Line 355: | ||
# Iniciar Bloqueo | # Iniciar Bloqueo | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{blockInit}); |
if (open LOG, ">$apppid"){print LOG "$$\n"} | if (open LOG, ">$apppid"){print LOG "$$\n"} | ||
# Cargar la configuración | # Cargar la configuración | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{loadConf}); |
&loadConfig; | &loadConfig; | ||
readSignatureConf; | readSignatureConf; | ||
| Line 375: | Line 364: | ||
# Comprobar el estado del aMule como servicio | # Comprobar el estado del aMule como servicio | ||
if ($config->{'aMuledOn'}){ | if ($config->{'aMuledOn'}){ | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{isaMuled}); |
if (open(PROCESOS,"ps -A |")){ | if (open(PROCESOS,"ps -A |")){ | ||
while (<PROCESOS>){ | while (<PROCESOS>){ | ||
| Line 383: | Line 372: | ||
} | } | ||
if (!$runDaemon) { $runDaemon = 1; | if (!$runDaemon) { $runDaemon = 1; | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{noaMuled}); |
if (open(AMULED,"$binaMuled |")){ | if (open(AMULED,"$binaMuled |")){ | ||
my $aMuleRun; | my $aMuleRun; | ||
while (<AMULED>){ | while (<AMULED>){ | ||
logsys ("msg", $_); | logsys ("msg", $_); | ||
| − | logsys ("msg", " | + | logsys ("msg", "$lang{lock_chg} [$binaMuled] $lang{yourself}") if $_ =~ /binary requires/; |
undef $runDaemon if $_ =~ /binary requires/; | undef $runDaemon if $_ =~ /binary requires/; | ||
$aMuleRun = 1 if $_ =~ /Raising current running instance/; | $aMuleRun = 1 if $_ =~ /Raising current running instance/; | ||
| Line 395: | Line 384: | ||
if ($aMuleRun){ | if ($aMuleRun){ | ||
logsys ("msg", "*"x56 ); | logsys ("msg", "*"x56 ); | ||
| − | logsys ("msg", "*"x5 ." | + | logsys ("msg", "*"x5 ." $lang{aMrun} " ."*"x6 ); |
logsys ("msg", "*"x56 ); | logsys ("msg", "*"x56 ); | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{tiTools} ); |
logsys ("msg", "*"x56 ); | logsys ("msg", "*"x56 ); | ||
| − | logsys ("msg", "* | + | logsys ("msg", "* $lang{alfsay}" ); |
logsys ("msg", "*"x56 ); | logsys ("msg", "*"x56 ); | ||
undef $runDaemon; | undef $runDaemon; | ||
}; | }; | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{aMuledInit}) if $runDaemon; |
} else { | } else { | ||
undef $runDaemon; | undef $runDaemon; | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{aMuledNoRun}); |
| − | logsys ("msg", | + | logsys ("msg", $lang{jump_step}); |
| − | $tmpStr = "<u><b> | + | $tmpStr = "<u><b>$lang{aMuledNoRun}</b></u>.\n\n"; |
| − | $tmpStr .= " | + | $tmpStr .= "$lang{check_no_run}\n\n"; |
| − | $tmpStr .= | + | $tmpStr .= $lang{aMnoHere}; |
| − | $tmpStr .= "\n\ | + | $tmpStr .= "\n\n$lang{noaMGui}" unless $config->{'aMuleGuiOk'}; |
| − | $tmpStr .= "\ | + | $tmpStr .= "\n$lang{whereaMGUI}" unless $config->{'aMuleGuiOk'}; |
my $confirmacion= &showMessage( 'question', flushChars($tmpStr), 'yes-no'); | my $confirmacion= &showMessage( 'question', flushChars($tmpStr), 'yes-no'); | ||
if ($confirmacion eq 'yes'){ | if ($confirmacion eq 'yes'){ | ||
| Line 420: | Line 409: | ||
}; | }; | ||
} | } | ||
| − | } else {logsys ("msg", | + | } else {logsys ("msg", $lang{aMuledIs});} |
} else { | } else { | ||
$runDaemon = 1; | $runDaemon = 1; | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{noRunInit}); |
| − | logsys ("msg", | + | logsys ("msg", $lang{noRunInit2}); |
} | } | ||
| Line 430: | Line 419: | ||
# Esto no afectará al retorno de esta función. | # Esto no afectará al retorno de esta función. | ||
if ($runDaemon){ | if ($runDaemon){ | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{click_veryfy}); |
if (!$config->{$config->{'appOnClick'} . 'Ok'}){ | if (!$config->{$config->{'appOnClick'} . 'Ok'}){ | ||
| − | $tmpStr = " | + | $tmpStr = "$lang{writeItInConf}\n"; |
| − | $tmpStr .= " | + | $tmpStr .= "$lang{of_app} <b>$config->{'appOnClick'}</b> $lang{another}\n"; |
| − | $tmpStr .= | + | $tmpStr .= $lang{appAnsw}; |
&showMessage( 'warning', flushChars($tmpStr), 'ok'); | &showMessage( 'warning', flushChars($tmpStr), 'ok'); | ||
&opcionesGui; | &opcionesGui; | ||
} | } | ||
| + | logsys ("debug", "TODO: $lang{to_do_3}"); | ||
} # TODO: Intentar mostrarlo como modal y esperar respuesta. | } # TODO: Intentar mostrarlo como modal y esperar respuesta. | ||
return $runDaemon; | return $runDaemon; | ||
| Line 446: | Line 436: | ||
logsys ("debug", "sub: visorTexto start"); | logsys ("debug", "sub: visorTexto start"); | ||
my ($widget, $event) = @_; | my ($widget, $event) = @_; | ||
| − | logsys ("debug", | + | logsys ("debug", $lang{menu_off}); |
$widget->set_sensitive(0); | $widget->set_sensitive(0); | ||
my $visorTextWin = Gtk2::Window->new("toplevel"); | my $visorTextWin = Gtk2::Window->new("toplevel"); | ||
| Line 456: | Line 446: | ||
my $LineaLog; | my $LineaLog; | ||
| − | $visorTextWin->set_title( | + | $visorTextWin->set_title($lang{texView}); |
$visorTextWin->set_position('center'); | $visorTextWin->set_position('center'); | ||
$visorTextWin->set_default_size(640, 300); | $visorTextWin->set_default_size(640, 300); | ||
| Line 475: | Line 465: | ||
$ok->signal_connect("clicked", sub { $visorTextWin->destroy; } ); | $ok->signal_connect("clicked", sub { $visorTextWin->destroy; } ); | ||
$visorTextWin->signal_connect('destroy' => sub { $widget->set_sensitive(1); }); | $visorTextWin->signal_connect('destroy' => sub { $widget->set_sensitive(1); }); | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{Shw_log_win}); |
$visorTextWin->show_all; | $visorTextWin->show_all; | ||
} | } | ||
| Line 494: | Line 484: | ||
&onlineInfo if $config->{'signOn'}; | &onlineInfo if $config->{'signOn'}; | ||
if ($config->{'signOn'} && $config->{'ConectStatus'}==1){ | if ($config->{'signOn'} && $config->{'ConectStatus'}==1){ | ||
| − | $tmpStr = "\n\n<b>" . $config->{'nickName'} . "</b> | + | $tmpStr = "\n\n<b>" . $config->{'nickName'} . "</b> $lang{with} <b>aMule</b> [<i>"; |
$tmpStr .= $config->{'aMuleVer'} . "</i>]\n"; | $tmpStr .= $config->{'aMuleVer'} . "</i>]\n"; | ||
| − | $tmpStr .= " | + | $tmpStr .= "$lang{connPort} <b>" . $config->{'portServ'}; |
| − | $tmpStr .= "</b> | + | $tmpStr .= "</b> $lang{of} <b>" . $config->{'nameServ'} . "</b>\n$lang{with} <b>ID "; |
| − | $tmpStr .= $config->{'typeId'}eq"H"?" | + | $tmpStr .= $config->{'typeId'}eq"H"?"$lang{hi}</b>":"$lang{low}</b>"; |
| − | $tmpStr .= " | + | $tmpStr .= " $lang{ande} <b>$lang{nk} "; |
| − | if ($config->{'kadStatus'}==2) {$tmpStr .= " | + | if ($config->{'kadStatus'}==2) {$tmpStr .= "$lang{okcon}</b>\n"; |
| − | } elsif ($config->{'kadStatus'}==1) {$tmpStr .= " | + | } elsif ($config->{'kadStatus'}==1) {$tmpStr .= "$lang{infire}</b>\n"; |
| − | } else {$tmpStr .= " | + | } else {$tmpStr .= "$lang{disconnec}</b>\n"}; |
| − | $tmpStr .= | + | $tmpStr .= $lang{ittake}; |
| − | my $tmpStr2 = $config->{'TimeRun'} % 60 . | + | my $tmpStr2 = $config->{'TimeRun'} % 60 . $lang{sec}; |
my $tiempo = sprintf("%d",$config->{'TimeRun'} / 60); | my $tiempo = sprintf("%d",$config->{'TimeRun'} / 60); | ||
| − | $tmpStr2 = $tiempo % 60 . " | + | $tmpStr2 = $tiempo % 60 . " $lang{min} $tmpStr2" if $tiempo; |
$tiempo = sprintf("%d",$tiempo / 60) if $tiempo; | $tiempo = sprintf("%d",$tiempo / 60) if $tiempo; | ||
| − | $tmpStr2 = $tiempo % 24 . " | + | $tmpStr2 = $tiempo % 24 . "$lang{hours} $tmpStr2" if $tiempo; |
$tiempo = sprintf("%d",$tiempo / 24) if $tiempo; | $tiempo = sprintf("%d",$tiempo / 24) if $tiempo; | ||
| − | $tmpStr2 = $tiempo . " | + | $tmpStr2 = $tiempo . " $lang{days} $tmpStr2" if $tiempo; |
| − | $tmpStr .= $tmpStr2 . " | + | $tmpStr .= $tmpStr2 . " $lang{connected}\n"; |
| − | $tmpStr .= " | + | $tmpStr .= "$lang{inthistime}<b>"; |
$tmpStr .= sprintf("%.2f",$config->{'SessionDown'}/1048576) . " Mb</b>\n"; | $tmpStr .= sprintf("%.2f",$config->{'SessionDown'}/1048576) . " Mb</b>\n"; | ||
| − | $tmpStr .= | + | $tmpStr .= $lang{downTotal}; |
$tmpStr .= sprintf("%.2f",$config->{'totalDown'}/1048576) . " Mb\n"; | $tmpStr .= sprintf("%.2f",$config->{'totalDown'}/1048576) . " Mb\n"; | ||
| − | $tmpStr .= " | + | $tmpStr .= "$lang{sharealso} <b>" . $config->{'filesShared'} . "</b> $lang{sesionFiles}\n"; |
| − | $tmpStr .= " | + | $tmpStr .= "$lang{upload} <b>" . sprintf("%.2f",$config->{'SessionUp'}/1048576); |
| − | $tmpStr .= " Mb</b> | + | $tmpStr .= " Mb</b> $lang{obtaining}\n$lang{atotal} " . sprintf("%.2f",$config->{'totalUp'}/1048576); |
| − | $tmpStr .= " Mb | + | $tmpStr .= " Mb $lang{totalup},\n$lang{hasRight} "; |
| − | $tmpStr .= $config->{'colaCli'} . | + | $tmpStr .= $config->{'colaCli'} . $lang{cli}; |
} | } | ||
return flushChars($tmpStr); | return flushChars($tmpStr); | ||
| Line 528: | Line 518: | ||
sub opcionesGui { | sub opcionesGui { | ||
my ($widget, $event) = @_; | my ($widget, $event) = @_; | ||
| − | logsys ("debug", | + | logsys ("debug", $lang{callOff}); |
$widget->set_sensitive(0) if defined $widget; | $widget->set_sensitive(0) if defined $widget; | ||
my $guiOpciones = Gtk2::Window->new; | my $guiOpciones = Gtk2::Window->new; | ||
| Line 537: | Line 527: | ||
my $select_alc = Gtk2::RadioButton->new_with_label(@grupo, 'aLinkCreator'); | my $select_alc = Gtk2::RadioButton->new_with_label(@grupo, 'aLinkCreator'); | ||
my $select_wxcas = Gtk2::RadioButton->new_with_label(@grupo, 'wxCas'); | my $select_wxcas = Gtk2::RadioButton->new_with_label(@grupo, 'wxCas'); | ||
| − | my $check_aMuled_on = new Gtk2::CheckButton->new(flushChars( | + | my $check_aMuled_on = new Gtk2::CheckButton->new(flushChars($lang{runAsServer})); |
my $vBoxTabRutas = Gtk2::VBox->new; | my $vBoxTabRutas = Gtk2::VBox->new; | ||
my $vBoxTabAbout = Gtk2::VBox->new; | my $vBoxTabAbout = Gtk2::VBox->new; | ||
| Line 547: | Line 537: | ||
my $hseparator2 = Gtk2::HSeparator->new; | my $hseparator2 = Gtk2::HSeparator->new; | ||
my $hseparator3 = Gtk2::HSeparator->new; | my $hseparator3 = Gtk2::HSeparator->new; | ||
| − | my $labelTabRutas = Gtk2::Label->new( | + | my $labelTabRutas = Gtk2::Label->new($lang{general}); |
| − | my $labelTabAbout = Gtk2::Label->new( | + | my $labelTabAbout = Gtk2::Label->new($lang{about}); |
| − | my $labelTabRut1 = Gtk2::Label->new( | + | my $labelTabRut1 = Gtk2::Label->new($lang{aboutAmuled}); |
| − | my $labelTabRut2 = Gtk2::Label->new( | + | my $labelTabRut2 = Gtk2::Label->new($lang{AHD}); |
| − | my $labelTabRut3 = Gtk2::Label->new( | + | my $labelTabRut3 = Gtk2::Label->new($lang{appPaht}); |
my $labelTabRut4 = Gtk2::Label->new('aMuleGui: '); | my $labelTabRut4 = Gtk2::Label->new('aMuleGui: '); | ||
my $labelTabRut5 = Gtk2::Label->new('wxCas: '); | my $labelTabRut5 = Gtk2::Label->new('wxCas: '); | ||
my $labelTabRut6 = Gtk2::Label->new('aLinkCreator: '); | my $labelTabRut6 = Gtk2::Label->new('aLinkCreator: '); | ||
| − | my $labelTabRut7 = Gtk2::Label->new(flushChars( | + | my $labelTabRut7 = Gtk2::Label->new(flushChars($lang{iconShow})); |
| − | my $labelTabRut8 = Gtk2::Label->new( | + | my $labelTabRut8 = Gtk2::Label->new($lang{icon}); |
| − | my $labelTabRut9 = Gtk2::Label->new(flushChars( | + | my $labelTabRut9 = Gtk2::Label->new(flushChars($lang{whatapp})); |
my $labelAbout1 = Gtk2::Label->new('aMulet.pl'); | my $labelAbout1 = Gtk2::Label->new('aMulet.pl'); | ||
| − | my $labelAbout2 = Gtk2::Label->new( | + | my $labelAbout2 = Gtk2::Label->new($lang{oneHawk}); |
| − | my $labelAbout3 = Gtk2::Label->new( | + | my $labelAbout3 = Gtk2::Label->new($lang{oneIdea}); |
| − | my $labelAbout4 = Gtk2::Label->new( | + | my $labelAbout4 = Gtk2::Label->new($lang{licence}); |
my $labelAbout5 = Gtk2::Label->new('http://www.gnu.org/copyleft/gpl.html'); | my $labelAbout5 = Gtk2::Label->new('http://www.gnu.org/copyleft/gpl.html'); | ||
my $labelAbout6 = Gtk2::Label->new; | my $labelAbout6 = Gtk2::Label->new; | ||
| Line 575: | Line 565: | ||
my $btnRutas3 = Gtk2::Button->new('...'); | my $btnRutas3 = Gtk2::Button->new('...'); | ||
my $btnRutas4 = Gtk2::Button->new('...'); | my $btnRutas4 = Gtk2::Button->new('...'); | ||
| − | my $btnRutas5 = Gtk2::Button->new( | + | my $btnRutas5 = Gtk2::Button->new($lang{selec}); |
my $tableTabRutas = Gtk2::Table->new(3, 3, 0 ); | my $tableTabRutas = Gtk2::Table->new(3, 3, 0 ); | ||
| Line 641: | Line 631: | ||
#TODO: Intentar conseguir una UrlLabel, fácil con gnome-open (pero y si no existe gnome?) | #TODO: Intentar conseguir una UrlLabel, fácil con gnome-open (pero y si no existe gnome?) | ||
#http://forum.amule.org/thread.php?threadid=9751 | #http://forum.amule.org/thread.php?threadid=9751 | ||
| − | $labelAbout3->set_markup( | + | $labelAbout3->set_markup("<span>$lang{ideaOf} <b>tx2z</b> $lang{in} http://forum.amule.org</span>"); |
#Añado un mini resumen de la información disponible en amulesig.dat | #Añado un mini resumen de la información disponible en amulesig.dat | ||
$labelAbout6->set_markup(infoOnLine); | $labelAbout6->set_markup(infoOnLine); | ||
| Line 651: | Line 641: | ||
# Propiedades de la ventana principal | # Propiedades de la ventana principal | ||
| − | $guiOpciones->set_title( | + | $guiOpciones->set_title($lang{options}); |
$guiOpciones->set_position('center'); | $guiOpciones->set_position('center'); | ||
#TODO: Intentar que actuase como una ventana modal, como el showMessage | #TODO: Intentar que actuase como una ventana modal, como el showMessage | ||
# y el punto de la llamada esperase la respuesta ok-cancel | # y el punto de la llamada esperase la respuesta ok-cancel | ||
| − | logsys ("msg", | + | logsys ("msg", $lang{shoOpsWin}); |
logsys ("warning", "*"x36) unless $widget; | logsys ("warning", "*"x36) unless $widget; | ||
| − | logsys ("warning", "TODO: | + | logsys ("warning", "TODO: $lang{beModal}") unless $widget; |
logsys ("warning", "*"x36) unless $widget; | logsys ("warning", "*"x36) unless $widget; | ||
| Line 700: | Line 690: | ||
$tmpStr1 = 'aMuleGui' if $select_aMuleGui->get_active; | $tmpStr1 = 'aMuleGui' if $select_aMuleGui->get_active; | ||
| − | $tmpStr .= $edit_home_aMule->get_text . ": | + | $tmpStr .= $edit_home_aMule->get_text . ": $lang{isntDir}\n" |
if !(-d $edit_home_aMule->get_text); | if !(-d $edit_home_aMule->get_text); | ||
| − | $tmpStr .= $edit_aMuleGui_path->get_text . ": <b> | + | $tmpStr .= $edit_aMuleGui_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n" |
if !(-x $edit_aMuleGui_path->get_text); | if !(-x $edit_aMuleGui_path->get_text); | ||
| − | $tmpStr .= $edit_wxcas_path->get_text . ": <b> | + | $tmpStr .= $edit_wxcas_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n" |
if !(-x $edit_wxcas_path->get_text); | if !(-x $edit_wxcas_path->get_text); | ||
| − | $tmpStr .= $edit_alc_path->get_text . ": <b> | + | $tmpStr .= $edit_alc_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n" |
if !(-x $edit_alc_path->get_text); | if !(-x $edit_alc_path->get_text); | ||
| − | $tmpStr .= $edit_icon_path->get_text . ": <b> | + | $tmpStr .= $edit_icon_path->get_text . ": <b>$lang{dontExist}</b>\n" |
if !(-e $edit_icon_path->get_text); | if !(-e $edit_icon_path->get_text); | ||
if (defined $tmpStr){ | if (defined $tmpStr){ | ||
| − | $tmpStr = "<b> | + | $tmpStr = "<b>$lang{detectAny}</b>\n\n$tmpStr\n\n" . flushChars($lang{wantContinue}); |
my $confirmacion= &showMessage( 'question', $tmpStr, 'yes-no'); | my $confirmacion= &showMessage( 'question', $tmpStr, 'yes-no'); | ||
return if ($confirmacion eq 'no'); | return if ($confirmacion eq 'no'); | ||
| Line 725: | Line 715: | ||
$config->{'wxCasApp'} = $edit_wxcas_path->get_text; | $config->{'wxCasApp'} = $edit_wxcas_path->get_text; | ||
$config->{'aLinkCreatorApp'} = $edit_alc_path->get_text; | $config->{'aLinkCreatorApp'} = $edit_alc_path->get_text; | ||
| − | &showMessage( 'info', flushChars( | + | &showMessage( 'info', flushChars($lang{iconWhenRestart}), 'ok') |
if $config->{'iconPath'} ne $edit_icon_path->get_text; | if $config->{'iconPath'} ne $edit_icon_path->get_text; | ||
$config->{'iconPath'} = $edit_icon_path->get_text; | $config->{'iconPath'} = $edit_icon_path->get_text; | ||
| Line 738: | Line 728: | ||
$guiOpciones->signal_connect('destroy' => sub {$widget->set_sensitive(1) if defined $widget;}); | $guiOpciones->signal_connect('destroy' => sub {$widget->set_sensitive(1) if defined $widget;}); | ||
$btnRutas1->signal_connect('clicked' => sub { dialogOpen($edit_home_aMule, | $btnRutas1->signal_connect('clicked' => sub { dialogOpen($edit_home_aMule, | ||
| − | + | $lang{selHomaMu}, 'select-folder'); }); | |
$btnRutas2->signal_connect('clicked' => sub { dialogOpen($edit_aMuleGui_path, | $btnRutas2->signal_connect('clicked' => sub { dialogOpen($edit_aMuleGui_path, | ||
| − | flushChars( | + | flushChars($lang{selaMguiApp}), 'open'); }); |
$btnRutas3->signal_connect('clicked' => sub { dialogOpen($edit_wxcas_path, | $btnRutas3->signal_connect('clicked' => sub { dialogOpen($edit_wxcas_path, | ||
| − | flushChars( | + | flushChars($lang{selwxCasApp}), 'open'); }); |
$btnRutas4->signal_connect('clicked' => sub { dialogOpen($edit_alc_path, | $btnRutas4->signal_connect('clicked' => sub { dialogOpen($edit_alc_path, | ||
| − | flushChars( | + | flushChars($lang{selALCapp}), 'open'); }); |
$btnRutas5->signal_connect('clicked' => sub { dialogOpen($edit_icon_path, | $btnRutas5->signal_connect('clicked' => sub { dialogOpen($edit_icon_path, | ||
| − | flushChars( | + | flushChars($lang{selIcon}), 'open'); }); |
} | } | ||
| Line 786: | Line 776: | ||
} | } | ||
close CONFIGFILE; | close CONFIGFILE; | ||
| − | }else {logSys("warning", | + | }else {logSys("warning", $lang{noConfWrite});} |
}; | }; | ||
| Line 826: | Line 816: | ||
$chooserDialog->destroy; | $chooserDialog->destroy; | ||
return; | return; | ||
| + | } | ||
| + | |||
| + | # Translations | ||
| + | sub initLang { | ||
| + | %lang_en = ( | ||
| + | not_X11_msg => "ATTENTION: This script needs to be executed under the X Window", | ||
| + | not_TrayIcon_msg => "ATTENTION: This script needs Gtk2::TrayIcon module\n" . | ||
| + | "\tYou can install it through CPAN in the following way:\n\n" . | ||
| + | "\t~ \$ perl -MCPAN -e \'install Gtk2::TrayIcon\'\n\nbye", | ||
| + | interrupted_initialization => " ha abortado el arranque.", | ||
| + | bad_blockage_file => "I can't eliminate the blockade file", | ||
| + | initiated => " Initiate", | ||
| + | icon_load_Error => "Icon load error: ", | ||
| + | options => "options", | ||
| + | logfile => "aMule log", | ||
| + | quit => "Exit", | ||
| + | icon_load => "Itself proceeds to load the internal icon.", | ||
| + | signs_assignment => "Signs assignment", | ||
| + | witgets_show => "Visualizing witgets", | ||
| + | init_msg_loop => "Initiating messages loop", | ||
| + | just_end => "It has just concluded: ", | ||
| + | right_click_show => " - Right click to show options", | ||
| + | Hid => "[Hight ID]", | ||
| + | Lid => "[Low ID]", | ||
| + | Conecting => "[Connecting]", | ||
| + | dowSpeed => "downSpeed", | ||
| + | upSpeed => "upSpeed", | ||
| + | k_ok => "[kad ok]", | ||
| + | k_fire => "[kad firewalled]", | ||
| + | k_down => "[kad off]", | ||
| + | aMd_off => " [aMuled Not Conected]", | ||
| + | down => " Down:", | ||
| + | ending => "Concluding ...", | ||
| + | endChilds => "Concluding possible children", | ||
| + | end_run_chld => "it's in progress. Concluding him... ", | ||
| + | hasntChld => "There aren't child process of ", | ||
| + | to_do_1 => "Overt log files to final log file [if config]", | ||
| + | to_do_2 => "It send setFocus to the application", | ||
| + | to_do_3 => "try to show it as modal and wait the answer.", | ||
| + | inSys => " in the system", | ||
| + | appEnd => "Execution end", | ||
| + | child_begin => "child process beginning with", | ||
| + | fork_error => "error when making fork:", | ||
| + | stdout_redirect => "STDOUT redirect for", | ||
| + | a => "to", | ||
| + | exec_fail => "ATTENTION: It failed the execution of", | ||
| + | father_loop => "Process father circuit [son =>", | ||
| + | itsRun => "it\'s already running!", | ||
| + | blockInit => "block file init", | ||
| + | loadConf => "Loading the configuration", | ||
| + | isaMuled => "Beginning the amuled existence verification", | ||
| + | noaMuled => "It isn\'t detected. Beginning amuled ...", | ||
| + | lock_chg => "ATTENTION: You changes the order ", | ||
| + | yourself => "under your responsibility ", | ||
| + | aMrun => "It has been detected that aMule is running ", | ||
| + | tiTools => "aMulet.pl was designed thinking of the remote tools", | ||
| + | alfsay => "It would WORK, but I don't see the necessity of it. STOP!!", | ||
| + | aMuledInit => "The amuled has been started.", | ||
| + | aMuledNoRun => "It hasn\'t been possible to execute the amuled! ", | ||
| + | check_no_run => "Do I disable the option of pulling up the amuled in the configuration? ", | ||
| + | aMnoHere => "Disable this option if the aMuled is residing in another machine of your net.", | ||
| + | noaMGui => "I haven\'t detected the aMuleGui.", | ||
| + | whereaMGUI => "It will indicate where is this located in the configuration", | ||
| + | aMuledIs => "aMuled has been detected:)) ", | ||
| + | noRunInit => "ATTENTION won't be detected neither it will pull up the aMuled", | ||
| + | noRunInit2 => " It can modify this in the configuration", | ||
| + | click_veryfy => "Verifying the application that icon click responds.", | ||
| + | writeItInConf => "You should indicate in the configuration where are the executable one", | ||
| + | of_app => "of the application", | ||
| + | another => "or to choose one another", | ||
| + | jump_step => "You can indicate in the configuration file that jumps this step", | ||
| + | appAnsw => "application that icon click responds", | ||
| + | menu_off => "Disabling menu call", | ||
| + | texView => "Text viewer", | ||
| + | Shw_log_win => "Showing log win", | ||
| + | with => "with", | ||
| + | connPort => "it\'s connected to port", | ||
| + | hi => "high", | ||
| + | low => "low", | ||
| + | ande => "and the", | ||
| + | nk => "kad net", | ||
| + | okcon => "connected OK", | ||
| + | infire => "in firewalled", | ||
| + | disconnec => "disconnected", | ||
| + | ittake => "it takes ", | ||
| + | sec => " seconds", | ||
| + | min => "minutes and", | ||
| + | hours => " hours", | ||
| + | days => "days", | ||
| + | of => "of", | ||
| + | connected => "connected", | ||
| + | inthistime => "and in this time it has discharged: ", | ||
| + | downTotal => "with that has a total discharged of ", | ||
| + | sharealso => "also shares", | ||
| + | sesionFiles => "files and in this session", | ||
| + | obtaining => "obtaining a", | ||
| + | upload => "they has ascended", | ||
| + | atotal => "total of", | ||
| + | totalup => "ascended to the Net", | ||
| + | hasRight => "in line it has right now", | ||
| + | cli => "clients", | ||
| + | callOff => "Disabling the call in the menu", | ||
| + | runAsServer => "Run aMule like service at the beginning (if don't run).", | ||
| + | general => "General", | ||
| + | about => "About", | ||
| + | aboutAmuled => "About aMuled Service", | ||
| + | AHD => "aMule Home Dir", | ||
| + | appPaht => "Applications path", | ||
| + | iconShow => "Icon that will be shown in the task bar", | ||
| + | icon => "Icon:", | ||
| + | whatapp => "What application will be launcher when icon click?", | ||
| + | oneHawk => "by AnimAlf - AnimAlf\@users.sourceforge.net", | ||
| + | oneIdea => "a tx2z idea in http://forum.amule.org,", | ||
| + | ideaOf => "An idea of", | ||
| + | in => "in", | ||
| + | options => "aMulet.pl options", | ||
| + | shoOpsWin => "Showing options widget", | ||
| + | beModal => "Mush be modal as showMessage", | ||
| + | licence => "Distributed under GPL license", | ||
| + | selec => "Select", | ||
| + | itisnt => "or it doesn\'t exist", | ||
| + | isntDir => "It isn\'t a directory", | ||
| + | isntExe => "It isn\'t an executable one", | ||
| + | dontExist => "It doesn\'t seem that it exists", | ||
| + | detectAny => "The following things has been detected:", | ||
| + | wantContinue => "Do you want continue anyway?", | ||
| + | iconWhenRestart => "Icon will change when you restarts the application.", | ||
| + | selHomaMu => "Select the aMule home directory", | ||
| + | selaMguiApp => "Select the aMuleGui application", | ||
| + | selwxCasApp => "Select the wxCas application", | ||
| + | selALCapp => "Select the aLinCreator application", | ||
| + | selIcon => "Select the icon that will use aMulet", | ||
| + | noConfWrite => "One cann\'t write in the configuration file!" | ||
| + | ); | ||
| + | |||
| + | %lang_es = ( | ||
| + | not_X11_msg => "ATENCIÓN: Este script necesita ser ejecutado bajo las X Window", | ||
| + | not_TrayIcon_msg => "ATENCIÓN: Este script necesita el módulo Gtk2::TrayIcon\n" . | ||
| + | "\tPuede instalarlo a través de CPAN del siguiente modo:\n\n" . | ||
| + | "\t~ \$ perl -MCPAN -e \'install Gtk2::TrayIcon\'\n\nbye", | ||
| + | interrupted_initialization => " ha abortado el arranque.", | ||
| + | bad_blockage_file => "No puedo eliminar el archivo de bloqueo", | ||
| + | initiated => " iniciado", | ||
| + | icon_load_Error => "Error al cargar el icono: ", | ||
| + | options => "opciones", | ||
| + | logfile => "log del aMule", | ||
| + | quit => "Salir", | ||
| + | icon_load => "Se procede a cargar el icono interno.", | ||
| + | signs_assignment => "Asignación de señales", | ||
| + | witgets_show => "Visualizando los witgets", | ||
| + | init_msg_loop => "Inicio del bucle de mensajes", | ||
| + | just_end => "Acaba de finalizar: ", | ||
| + | right_click_show => " - Click derecho para opciones", | ||
| + | Hid => "[ID alta]", | ||
| + | Lid => "[ID baja]", | ||
| + | Conecting => "[Conectando]", | ||
| + | dowSpeed => "downSpeed", | ||
| + | upSpeed => "upSpeed", | ||
| + | k_ok => "[kad ok]", | ||
| + | k_fire => "[kad firewalled]", | ||
| + | k_down => "[kad off]", | ||
| + | aMd_off => " [aMuled No Conectado]", | ||
| + | down => " Bajada:", | ||
| + | ending => "Finalizando ...", | ||
| + | endChilds => "Finalizando posibles hijos", | ||
| + | end_run_chld => "está en marcha. Finalizándolo ...", | ||
| + | hasntChld => "No quedan procesos hijo de ", | ||
| + | to_do_1 => "volcar archivo log a log final [si se le ordena]", | ||
| + | to_do_2 => "Enviar setFocus a la aplicación", | ||
| + | to_do_3 => "Intentar mostrarlo como modal y esperar respuesta.", | ||
| + | inSys => " en el sistema", | ||
| + | appEnd => "Terminada la ejecución", | ||
| + | child_begin => "child process beginning with", | ||
| + | fork_error => "error al hacer fork:", | ||
| + | stdout_redirect => "Redirección de STDOUT para", | ||
| + | a => "a", | ||
| + | exec_fail => "ATENCIÓN: Falló la ejecución de", | ||
| + | father_loop => "Circuito del proceso padre [hijo=>", | ||
| + | itsRun => "ya está funcionando!", | ||
| + | blockInit => "Iniciando archivo de bloqueo", | ||
| + | loadConf => "Cargando la configuración", | ||
| + | isaMuled => "Iniciando la verificación de la existencia de amuled", | ||
| + | noaMuled => "No se detecta. Iniciando amuled ...", | ||
| + | lock_chg => "ATENCIÓN: Cambie la orden", | ||
| + | yourself => "bajo su responsabilidad", | ||
| + | aMrun => "Se ha detectado que el aMule está en marcha ", | ||
| + | tiTools => "aMulet.pl se diseñó pensando en las herramientas remotas", | ||
| + | alfsay => "FUNCIONARÍA, pero no veo la necesidad de ello. STOP!!", | ||
| + | aMuledInit => "El amuled ha sido puesto en marcha.", | ||
| + | aMuledNoRun => "No se ha podido ejecutar el amuled!", | ||
| + | check_no_run => "¿Desactivo la opción de arrancar el amuled en la configuración?", | ||
| + | aMnoHere => "Desactive esta opción si el aMuled está residente en otra máquina de su red.", | ||
| + | noaMGui => "No he detectado el aMuleGui.", | ||
| + | whereaMGUI => "Deberá indicar donde está situado éste en la configuración", | ||
| + | aMuledIs => "El aMuled ha sido detectado :))", | ||
| + | noRunInit => "ATENCIÓN No se detectará ni arrancará el aMuled", | ||
| + | noRunInit2 => " Se puede modificar esto en la configuración", | ||
| + | click_veryfy => "Verificando la aplicación que responde al click del icono.", | ||
| + | writeItInConf => "Debe indicar en la configuración dónde residen el ejecutable", | ||
| + | of_app => "de la aplicación", | ||
| + | another => "o escoger otra", | ||
| + | jump_step => "Se puede indicar en la configuración que se salte este paso", | ||
| + | appAnsw => "aplicación que responda al click en el icono", | ||
| + | menu_off => "Deshabilitando la llamada en el menú", | ||
| + | texView => "Visor de Texto", | ||
| + | Shw_log_win => "Mostrando la ventana de logs", | ||
| + | with => "con", | ||
| + | connPort => "está conectado al puerto", | ||
| + | hi => "alta", | ||
| + | low => "baja", | ||
| + | ande => "y la", | ||
| + | nk => "red kad", | ||
| + | okcon => "bien conectada", | ||
| + | infire => "en firewalled", | ||
| + | disconnec => "desconectada", | ||
| + | ittake => "lleva ", | ||
| + | sec => " segundos", | ||
| + | min => "minutos y", | ||
| + | hours => " horas", | ||
| + | days => "dias", | ||
| + | of => "de", | ||
| + | connected => "conectado", | ||
| + | inthistime => "y en este tiempo ha descargado: ", | ||
| + | downTotal => "con lo que tiene un total descagado de ", | ||
| + | sharealso => "Además comparte", | ||
| + | sesionFiles => "archivos y en esta sesión", | ||
| + | obtaining => "obteniendo un", | ||
| + | upload => "se han subido", | ||
| + | atotal => "total de", | ||
| + | totalup => "subidos a la Red", | ||
| + | hasRight => "en cola tiene ahora mismo", | ||
| + | cli => "clientes", | ||
| + | callOff => "Deshabilitando la llamada en el menú", | ||
| + | runAsServer => "Arrancar aMule como servicio al principio (si no lo está)", | ||
| + | general => "General", | ||
| + | about => "About", | ||
| + | aboutAmuled => "Relacionado con el Servicio amuled", | ||
| + | AHD => "aMule Home Dir", | ||
| + | appPaht => "Ruta a las aplicaciones", | ||
| + | iconShow => "Icono que se mostrará en la barra", | ||
| + | icon => "Icono:", | ||
| + | whatapp => "¿Qué aplicación arrancará tras hacer click en el icono?", | ||
| + | oneHawk => "by AnimAlf - AnimAlf\@users.sourceforge.net", | ||
| + | oneIdea => "una idea de tx2z en http://forum.amule.org", | ||
| + | ideaOf => "Una idea de", | ||
| + | in => "en", | ||
| + | options => "Opciones aMulet.pl", | ||
| + | shoOpsWin => "Mostrando la ventana de opciones", | ||
| + | beModal => "Que sea modal tipo showMessage", | ||
| + | licence => "Distribuido bajo la licencia GPL", | ||
| + | selec => "Selecciona", | ||
| + | itisnt => "o no existe", | ||
| + | isntDir => "No es un directorio", | ||
| + | isntExe => "No es un ejecutable", | ||
| + | dontExist => "No parece que exista", | ||
| + | detectAny => "Se ha detectado lo siguiente:", | ||
| + | wantContinue => "¿Desea continuar de todos modos?", | ||
| + | iconWhenRestart => "El icono cambiará cuando reinicie la aplicación.", | ||
| + | selHomaMu => "Seleccione el directorio home de aMule", | ||
| + | selaMguiApp => "Seleccione la aplicación aMuleGui", | ||
| + | selwxCasApp => "Seleccione la aplicación wxCas", | ||
| + | selALCapp => "Seleccione la aplicación aLinCreator", | ||
| + | selIcon => "Seleccione el icono que utilizará aMulet", | ||
| + | noConfWrite => "No se puede escribir en el archivo de configuración!" | ||
| + | ); | ||
} | } | ||
</nowiki></pre> | </nowiki></pre> | ||
Latest revision as of 11:26, 20 February 2008
aMulet.pl source
#!/usr/bin/perl -w
#
# file aMulet.pl
# Copyright by AnimAlf
#
# This lines are under the GNU General Public License.
# http://www.gnu.org/copyleft/gpl.html
#
use strict;
my $binaMuled = 'amuled -f';
my $apppid = "$ENV{HOME}/.tx2z.pid"; # imagination
my $logMode = "debug"; # debug warning msg
my $verbose = 1; # true false
use vars qw( %lang_en %lang_es );
&initLang;
my %lang = %lang_en;
if (!defined($ENV{'DISPLAY'})){
print &appRel . "\n\n$lang{not_X11_msg}\n\n";
exit -1;
}
eval "use Gtk2::TrayIcon;";
if ($@) {
print &appRel;
print "\n\n$lang{not_TrayIcon_msg}\n";
exit -1;
}
my $modUniCode;
eval "use Unicode::MapUTF8 qw(from_utf8);";
$modUniCode = !$@;
my $config = {};
my @appList = ( 'aMuleGui', 'wxCas', 'aLinkCreator');
# Los procesos hijo envían esta señal al padre cuando terminan y ésta
# debe ser atendida, si no se quedan zombies hasta que termine el padre.
$SIG{CHLD} = \&finalHijo;
# Si se recibe cualquier señal que pueda provocar la interrupción del
# normal funcionamiento, entonces nos encargamos de finalizar correctamente.
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = \&finalizar;
# Iniciando Gtk2
Gtk2->init;
# Comprobaciones iniciales. Cargar configuración.
if (!&inicializar){
logsys ("msg", &appRel . $lang{interrupted_initialization});
unlink $apppid or die $lang{bad_blockage_file};
exit -1;
}
logsys ("msg", &appRel . $lang{initiated});
# Formas Gtk2
my $menu = Gtk2::Menu->new();
my $menu_opciones = Gtk2::MenuItem->new($lang{options});
my $menu_aLinkCreator = Gtk2::MenuItem->new("aLinkCreator");
my $menu_wxCas = Gtk2::MenuItem->new("wxCas");
my $menu_aMuleGui = Gtk2::MenuItem->new("aMuleGui");
my $menu_verLog = Gtk2::MenuItem->new($lang{logfile});
my $menuSalir = Gtk2::MenuItem->new($lang{quit});
my $pic;
eval {$pic = Gtk2::Gdk::Pixbuf->new_from_file ($config->{'iconPath'});};
if ($@){
my @aMulet_xpm = ('18 24 17 1', ' c None', '. c #312A28', '+ c #524842',
'@ c #D42238', '# c #835128', '$ c #985A20', '% c #6A6B6A',
'& c #AA7B50', '* c #EC5867', '= c #BF7B3F', '- c #C9792F',
'; c #898989', '> c #E39854', ', c #CB9D83', '" c #A9AAAA',
') c #CDCBC9', '! c #F4F5F3', ' ',
' $ ', ' !> ', ' #! )$$ ',
' ## #-$ ', ' )##$ -,# ', ' .+##)$,) ',
' ...$,!" ', ' ".$=-$" ', ' ;==-!= ',
' " >! " ', ' ; !& ; ', ' " !)))" ',
' """"""! ', ' %!.""""); ', ' ;))";;;"%;;) ',
' ">-)";;;;"->"" ', ' )-=$,;;%@,->$) ', ' ;%--#=>>**+%%; ',
' +....&=>>>>#!))! ', '%"-=##$>>>>=&$--;;', '+)-=##&=>>>=#=->)+',
'%;;=$+.+>>++$->,;%', ' " . ');
$pic = Gtk2::Gdk::Pixbuf->new_from_xpm_data (@aMulet_xpm);
logsys ("warning", $lang{icon_load_Error} . $config->{'iconPath'});
logsys ("msg", $lang{icon_load});
}
my $img= Gtk2::Image->new_from_pixbuf($pic->scale_simple(18, 24, "tiles"));
my $tray= Gtk2::TrayIcon->new("trayicon");
my $paraEvent = Gtk2::EventBox->new;
my $trayTooltip = Gtk2::Tooltips->new;
my $SeparadorMenu1 = Gtk2::SeparatorMenuItem->new;
my $SeparadorMenu2 = Gtk2::SeparatorMenuItem->new;
my $SeparadorMenu3 = Gtk2::SeparatorMenuItem->new;
$menu->append($menu_verLog);
$menu->append($SeparadorMenu1);
$menu->append($menu_opciones);
$menu->append($SeparadorMenu2);
$menu->append($menu_aLinkCreator);
$menu->append($menu_wxCas);
$menu->append($menu_aMuleGui);
$menu->append($SeparadorMenu3);
$menu->append($menuSalir);
$paraEvent->add($img);
$tray->add($paraEvent);
&statusText;
# Tratamiento de señales
logsys ("debug", $lang{signs_assignment});
$tray->signal_connect ('button-press-event' => \&ClickOnIcon);
$menu_opciones->signal_connect('activate' => \&opcionesGui);
$menu_verLog->signal_connect('activate' => \&visorTexto);
$menu_aLinkCreator->signal_connect('activate' => sub {&extAppStatus('aLinkCreator')});
$menu_wxCas->signal_connect('activate' => sub {&extAppStatus('wxCas')});
$menu_aMuleGui->signal_connect('activate' => sub {&extAppStatus('aMuleGui')});
$menuSalir->signal_connect('activate' => \&finalizar);
Glib::Timeout->add($config->{'signOnTime'}*1000, \&statusText) if $config->{'signOn'};
# show sobre los witgets para que sean visibles
logsys ("debug", $lang{witgets_show});
$menu->show_all;
$tray->show_all;
&popUpsAct;
# iniciando bucle de mensajes
logsys ("debug", $lang{init_msg_loop});
Gtk2->main;
# Fin. Aquí termina el flujo.
#############
# Funciones #
#############
# statusText Establece el texto del toolTip
sub statusText{
my $tmpStr = &appRel . $lang{right_click_show};
if ($config->{'signOn'}){
&onlineInfo;
# my $tmpStr;
if ($config->{'ConectStatus'}){
if ($config->{'typeId'}eq"H"){$tmpStr = $lang{Hid}}
elsif ($config->{'typeId'}eq"L"){$tmpStr = $lang{Lid}}
else {$tmpStr = $lang{Conecting}}
$tmpStr .= $lang{down} . $config->{'downSpeed'};
$tmpStr .= " kb/s Up:" . $config->{'upSpeed'} ." Kb/s ";
if ($config->{'kadStatus'}==2) {$tmpStr .= $lang{k_ok};
} elsif ($config->{'kadStatus'}==1) {$tmpStr .= $lang{k_fire};
} else {$tmpStr .= $lang{k_down}};
} else {$tmpStr = &appRel . $lang{aMd_off}}
}
$trayTooltip->set_tip($tray, $tmpStr);
$tray->send_message($config->{'signOnTime'}*1000, "[AnimAlf dice] No entiendo");
}
# signatureOn Comprueba OnlineSignature en amule.conf
sub readSignatureConf {
$config->{'signOn'} = 0;
$config->{'signOnTime'} = 0;
if (-f $config->{'aMuleDir'} . "/amule.conf"){
if ( open( CONFIGFILE, $config->{'aMuleDir'} . "/amule.conf" ) ) {
while (<CONFIGFILE>) {
if ( $_ =~ /^OnlineSignature=(.+)/ ) { $config->{'signOn'} = $1 }
if ( $_ =~ /^OnlineSignatureUpdate=(.+)/ ) { $config->{'signOnTime'} = $1 }
}
close CONFIGFILE;
}
}
}
# onlineInfo Recoge la información de amulesig.dat
sub onlineInfo {
if ( open( SIGNFILE, $config->{'aMuleDir'} . "/amulesig.dat" ) ) {
my @signFile;
while (<SIGNFILE>) {
$_ =~ /(.+)\n$/; push (@signFile, $1)
}
close SIGNFILE;
$config->{'ConectStatus'} = $signFile[0];
$config->{'nameServ'} = $signFile[1];
$config->{'ipServ'} = $signFile[2];
$config->{'portServ'} = $signFile[3];
$config->{'typeId'} = $signFile[4];
$config->{'kadStatus'} = $signFile[5];
$config->{'downSpeed'} = $signFile[6];
$config->{'upSpeed'} = $signFile[7];
$config->{'colaCli'} = $signFile[8];
$config->{'filesShared'} = $signFile[9];
$config->{'nickName'} = $signFile[10];
$config->{'totalDown'} = $signFile[11];
$config->{'totalUp'} = $signFile[12];
$config->{'aMuleVer'} = $signFile[13];
$config->{'SessionDown'} = $signFile[14];
$config->{'SessionUp'} = $signFile[15];
$config->{'TimeRun'} = $signFile[16];
}
}
# finalHijo atender la señal de los hijos (cuando terminan la mandan)
sub finalHijo {
$SIG{CHLD} = \&finalHijo;
my $pid = wait;
return unless $config->{$pid}; # El system() realiza un fork() también.
logsys ("msg", $lang{just_end} . $config->{$pid} .
" [" . $config->{$config->{$pid} . 'Pid'} . "]");
undef $config->{$config->{$pid} . 'Pid'};
undef $config->{$pid};
}
# finalizar correctamente y eliminar bloqueo
sub finalizar {
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = \&finalizar;
logsys ("msg", $lang{ending});
#Finalizar el bucle de mensajes
Gtk2->main_quit;
#Comprobar que no quede ninguna aplicación hijo en funcionamiento
#y si existe eliminarlas antes de finalizar no vayan a quedar zombies.
logsys ("msg", $lang{endChilds});
# Ahora la señal de retorno del hijo la trataremos aquí.
$SIG{CHLD} = 'DEFAULT';
foreach my $app (@appList) {
if (defined $config->{$app . "Pid"}){
logsys ("msg", "[$app] $lang{end_run_chld}");
kill ('SIGTERM', $config->{$app . "Pid"});
waitpid($config->{$app . "Pid"}, 0);
}
}
logsys ("msg", $lang{hasntChld} . &appRel . $lang{inSys});
#TODO Si archivo de bloqueo es usado para log volcar a otro sitio.
logsys ("warning", "TODO: $lang{to_do_1}");
logsys ("msg", $lang{appEnd});
logsys ("msg", "bye ;-)\n\n".&appRel."\n");
# borrar archivo de bloqueo
unlink $apppid or die "$lang{bad_blockage_file} $apppid";
}
# flushChars transforma utf8 a iso-8859-1
sub flushChars {
my ($tmpStr) = @_;
$tmpStr =~ s/([\200-\377]+)/from_utf8({ -string => $1, -charset => 'ISO-8859-1'})/eg
if $modUniCode;
return $tmpStr;
}
#logsys Mini sistema de logs.
sub logsys {
my ($mode, $text) = @_;
my $tmpStr;
if (open LOG, ">>$apppid") {
if (($logMode eq "debug" && ($mode eq "debug" or $mode eq "warning")) ||
($logMode eq "warning" && ($mode eq "warning" or $mode eq "msg")) ||
($logMode eq "msg" && $mode eq "msg")){
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time);
$year += 1900; $mon ++;
# $tmpStr="[" . uc($mode) . "] " . sprintf("%02d",$mday) . "-" .
# sprintf("%02d",$mon) . "-$year " . sprintf("%02d",$hour) . ":" .
# sprintf("%02d",$min) . ":" . sprintf("%02d",$sec) . " $text\n";
$tmpStr="[" . uc($mode) . "] " . sprintf("%02d",$mday) . "-";
$tmpStr.= sprintf("%02d",$mon) . "-$year " . sprintf("%02d",$hour) . ":" if $logMode ne "debug";
$tmpStr.= sprintf("%02d",$min) . ":" . sprintf("%02d",$sec) . " $text\n";
print LOG $tmpStr; print $tmpStr if $verbose;
}
close LOG;
}
}
# ClickOnIcon se lanzará tras un click en el TrayIcon.
# Para diferenciar el botón del ratón que se pulsó.
sub ClickOnIcon {
logsys ("debug", "sub: ClickOnIcon start");
my ($widget, $event) = @_;
return 1 if $event->button == 2;
$menu->popup(undef, undef, undef, undef, $event->button,$event->time) if $event->button == 3;
&extAppStatus($config->{'appOnClick'}) if $event->button == 1;
}
# extAppStatus lanzará una instancia de la aplicación si no existe
sub extAppStatus {
logsys ("debug", "sub: extAppStatus start");
my ($refApp) = @_;
$config->{ $refApp . 'Pid'} = fork()
unless ($config->{ $refApp . 'Pid'}); # Crea un proceso hijo
die "$lang{fork_error} $!" if !defined($config->{$refApp . 'Pid'});
if ( $config->{$refApp . 'Pid'} == 0) { # Si se trata del proceso hijo
logsys ("msg", "$lang{child_begin} [$refApp]");
if ($config->{$refApp . 'Ok'}) {
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT';
logsys ("warning", "$lang{stdout_redirect} $refApp $lang{a} $apppid");
open STDOUT, ">>$apppid";
exec ($config->{$refApp . 'App'}) ||
die "$lang{exec_fail} $refApp";
} else {exit -1}
} else { # Circuito del proceso padre
logsys ("msg", "$lang{father_loop}$refApp pid:"
. $config->{$refApp . 'Pid'} . "]");
# Asigno una clave en la configuración con el valor de la pid con el padre
$config->{$config->{$refApp . 'Pid'}} = $refApp
unless $config->{$config->{$refApp . 'Pid'}};
# a ejecutar por el proceso padre
logsys ("debug", "TODO: $lang{to_do_2}");
}
}
# appRel nombre y versión del script
sub appRel {
$0=~/.*\/(.*)$/;
my $fileRun = $1;
$fileRun = $0 unless $fileRun;
$fileRun = "aMulet.pl [$1]" if $fileRun ne 'aMulet.pl';
return $fileRun . " v.1.3 alpha";
}
# popUpsAct des/activar apartados del menú
sub popUpsAct {
$menu_aLinkCreator->set_sensitive($config->{'aLinkCreatorOk'});
$menu_wxCas->set_sensitive($config->{'wxCasOk'});
$menu_aMuleGui->set_sensitive($config->{'aMuleGuiOk'});
}
# pathsVerify comprobar la ruta de las aplicaciones
sub pathsVerify{
foreach my $app (@appList) {
$config->{$app . 'Ok'} = (-x $config->{$app . 'App'});
}
}
# inicializar comprobaciones iniciales
sub inicializar {
my $tmpStr;
my $runDaemon;
# Comprobar si ya estamos en marcha
if (-f $apppid){
my $appVerify=0;
# Comprobar si realmente la aplicación está en marcha.
if (open(APPPID, $apppid)){
my $line;
while ($line = <APPPID>) {
chop($line); last;
}
close(APPPID);
$appVerify=&isRunProcess($line);
}
if ($appVerify){
$tmpStr = "<b>" . appRel . "</b> $lang{itsRun}\n\n";
$SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{INT} = 'DEFAULT';
&showMessage( 'error', flushChars($tmpStr), 'ok');
exit -1;
} else {unlink $apppid}
}
# Iniciar Bloqueo
logsys ("msg", $lang{blockInit});
if (open LOG, ">$apppid"){print LOG "$$\n"}
# Cargar la configuración
logsys ("msg", $lang{loadConf});
&loadConfig;
readSignatureConf;
# Comprobar el estado del aMule como servicio
if ($config->{'aMuledOn'}){
logsys ("msg", $lang{isaMuled});
if (open(PROCESOS,"ps -A |")){
while (<PROCESOS>){
$runDaemon = 1 if ($_ =~ /amuled/);
}
close PROCESOS;
}
if (!$runDaemon) { $runDaemon = 1;
logsys ("msg", $lang{noaMuled});
if (open(AMULED,"$binaMuled |")){
my $aMuleRun;
while (<AMULED>){
logsys ("msg", $_);
logsys ("msg", "$lang{lock_chg} [$binaMuled] $lang{yourself}") if $_ =~ /binary requires/;
undef $runDaemon if $_ =~ /binary requires/;
$aMuleRun = 1 if $_ =~ /Raising current running instance/;
}
close AMULED;
if ($aMuleRun){
logsys ("msg", "*"x56 );
logsys ("msg", "*"x5 ." $lang{aMrun} " ."*"x6 );
logsys ("msg", "*"x56 );
logsys ("msg", $lang{tiTools} );
logsys ("msg", "*"x56 );
logsys ("msg", "* $lang{alfsay}" );
logsys ("msg", "*"x56 );
undef $runDaemon;
};
logsys ("msg", $lang{aMuledInit}) if $runDaemon;
} else {
undef $runDaemon;
logsys ("msg", $lang{aMuledNoRun});
logsys ("msg", $lang{jump_step});
$tmpStr = "<u><b>$lang{aMuledNoRun}</b></u>.\n\n";
$tmpStr .= "$lang{check_no_run}\n\n";
$tmpStr .= $lang{aMnoHere};
$tmpStr .= "\n\n$lang{noaMGui}" unless $config->{'aMuleGuiOk'};
$tmpStr .= "\n$lang{whereaMGUI}" unless $config->{'aMuleGuiOk'};
my $confirmacion= &showMessage( 'question', flushChars($tmpStr), 'yes-no');
if ($confirmacion eq 'yes'){
$config->{'aMuledOn'}=0;
&saveConfig;
$runDaemon = 1;
};
}
} else {logsys ("msg", $lang{aMuledIs});}
} else {
$runDaemon = 1;
logsys ("msg", $lang{noRunInit});
logsys ("msg", $lang{noRunInit2});
}
# Comprobar que la aplicación que arranca tras el click en el icono existe.
# Esto no afectará al retorno de esta función.
if ($runDaemon){
logsys ("msg", $lang{click_veryfy});
if (!$config->{$config->{'appOnClick'} . 'Ok'}){
$tmpStr = "$lang{writeItInConf}\n";
$tmpStr .= "$lang{of_app} <b>$config->{'appOnClick'}</b> $lang{another}\n";
$tmpStr .= $lang{appAnsw};
&showMessage( 'warning', flushChars($tmpStr), 'ok');
&opcionesGui;
}
logsys ("debug", "TODO: $lang{to_do_3}");
} # TODO: Intentar mostrarlo como modal y esperar respuesta.
return $runDaemon;
}
# visorTexto Crea una ventana Gtk en la que muestra el logfile del aMule
sub visorTexto {
logsys ("debug", "sub: visorTexto start");
my ($widget, $event) = @_;
logsys ("debug", $lang{menu_off});
$widget->set_sensitive(0);
my $visorTextWin = Gtk2::Window->new("toplevel");
my $vbox = Gtk2::VBox->new;
my $scrolledwindow = Gtk2::ScrolledWindow->new;
my $textBuffer = Gtk2::TextBuffer->new;
my $ok = Gtk2::Button->new_from_stock("gtk-close");
my $textView = Gtk2::TextView->new_with_buffer($textBuffer);
my $LineaLog;
$visorTextWin->set_title($lang{texView});
$visorTextWin->set_position('center');
$visorTextWin->set_default_size(640, 300);
logsys ("debug", "Leyendo " . $config->{'aMuleDir'} . "/logfile");
open (LOGFILE, $config->{'aMuleDir'} . "/logfile") || logsys ("warning", $config->{'aMuleDir'} . "/logfile: $!");
while (<LOGFILE>) {$LineaLog .= $_;}
close LOGFILE;
$textView->set_editable(0);
$textView->set_cursor_visible(0);
$textBuffer->set_text($LineaLog);
$scrolledwindow->set_policy('automatic', 'automatic');
$scrolledwindow->add($textView);
$vbox->add($scrolledwindow );
$vbox->pack_end($ok, 0, 0, 3);
$visorTextWin->add($vbox);
$ok->signal_connect("clicked", sub { $visorTextWin->destroy; } );
$visorTextWin->signal_connect('destroy' => sub { $widget->set_sensitive(1); });
logsys ("msg", $lang{Shw_log_win});
$visorTextWin->show_all;
}
# isRunProcess comprobará si un proceso está en ejecución
sub isRunProcess {
my ($proceso) = @_;
my $runDaemon = 0;
if (open(PROCESOS,"ps -A |")){
while (<PROCESOS>){$runDaemon = 1 if $_ =~ /^$proceso\s/;}
close PROCESOS;
}
return $runDaemon;
}
sub infoOnLine {
my $tmpStr = '';
&onlineInfo if $config->{'signOn'};
if ($config->{'signOn'} && $config->{'ConectStatus'}==1){
$tmpStr = "\n\n<b>" . $config->{'nickName'} . "</b> $lang{with} <b>aMule</b> [<i>";
$tmpStr .= $config->{'aMuleVer'} . "</i>]\n";
$tmpStr .= "$lang{connPort} <b>" . $config->{'portServ'};
$tmpStr .= "</b> $lang{of} <b>" . $config->{'nameServ'} . "</b>\n$lang{with} <b>ID ";
$tmpStr .= $config->{'typeId'}eq"H"?"$lang{hi}</b>":"$lang{low}</b>";
$tmpStr .= " $lang{ande} <b>$lang{nk} ";
if ($config->{'kadStatus'}==2) {$tmpStr .= "$lang{okcon}</b>\n";
} elsif ($config->{'kadStatus'}==1) {$tmpStr .= "$lang{infire}</b>\n";
} else {$tmpStr .= "$lang{disconnec}</b>\n"};
$tmpStr .= $lang{ittake};
my $tmpStr2 = $config->{'TimeRun'} % 60 . $lang{sec};
my $tiempo = sprintf("%d",$config->{'TimeRun'} / 60);
$tmpStr2 = $tiempo % 60 . " $lang{min} $tmpStr2" if $tiempo;
$tiempo = sprintf("%d",$tiempo / 60) if $tiempo;
$tmpStr2 = $tiempo % 24 . "$lang{hours} $tmpStr2" if $tiempo;
$tiempo = sprintf("%d",$tiempo / 24) if $tiempo;
$tmpStr2 = $tiempo . " $lang{days} $tmpStr2" if $tiempo;
$tmpStr .= $tmpStr2 . " $lang{connected}\n";
$tmpStr .= "$lang{inthistime}<b>";
$tmpStr .= sprintf("%.2f",$config->{'SessionDown'}/1048576) . " Mb</b>\n";
$tmpStr .= $lang{downTotal};
$tmpStr .= sprintf("%.2f",$config->{'totalDown'}/1048576) . " Mb\n";
$tmpStr .= "$lang{sharealso} <b>" . $config->{'filesShared'} . "</b> $lang{sesionFiles}\n";
$tmpStr .= "$lang{upload} <b>" . sprintf("%.2f",$config->{'SessionUp'}/1048576);
$tmpStr .= " Mb</b> $lang{obtaining}\n$lang{atotal} " . sprintf("%.2f",$config->{'totalUp'}/1048576);
$tmpStr .= " Mb $lang{totalup},\n$lang{hasRight} ";
$tmpStr .= $config->{'colaCli'} . $lang{cli};
}
return flushChars($tmpStr);
}
# opcionesGui muestra la ventana de opciones
sub opcionesGui {
my ($widget, $event) = @_;
logsys ("debug", $lang{callOff});
$widget->set_sensitive(0) if defined $widget;
my $guiOpciones = Gtk2::Window->new;
my $vboxPrincipal = Gtk2::VBox->new;
my $notebook = Gtk2::Notebook->new;
my $select_aMuleGui = Gtk2::RadioButton->new('appOnClick', 'aMuleGui');
my @grupo = $select_aMuleGui->get_group;
my $select_alc = Gtk2::RadioButton->new_with_label(@grupo, 'aLinkCreator');
my $select_wxcas = Gtk2::RadioButton->new_with_label(@grupo, 'wxCas');
my $check_aMuled_on = new Gtk2::CheckButton->new(flushChars($lang{runAsServer}));
my $vBoxTabRutas = Gtk2::VBox->new;
my $vBoxTabAbout = Gtk2::VBox->new;
my $hboxPrincipal = Gtk2::HBox->new;
my $hBoxTabRutas1 = Gtk2::HBox->new;
my $hBoxTabRutas2 = Gtk2::HBox->new;
my $hBoxTabRutas3 = Gtk2::HBox->new(1);
my $hseparator1 = Gtk2::HSeparator->new;
my $hseparator2 = Gtk2::HSeparator->new;
my $hseparator3 = Gtk2::HSeparator->new;
my $labelTabRutas = Gtk2::Label->new($lang{general});
my $labelTabAbout = Gtk2::Label->new($lang{about});
my $labelTabRut1 = Gtk2::Label->new($lang{aboutAmuled});
my $labelTabRut2 = Gtk2::Label->new($lang{AHD});
my $labelTabRut3 = Gtk2::Label->new($lang{appPaht});
my $labelTabRut4 = Gtk2::Label->new('aMuleGui: ');
my $labelTabRut5 = Gtk2::Label->new('wxCas: ');
my $labelTabRut6 = Gtk2::Label->new('aLinkCreator: ');
my $labelTabRut7 = Gtk2::Label->new(flushChars($lang{iconShow}));
my $labelTabRut8 = Gtk2::Label->new($lang{icon});
my $labelTabRut9 = Gtk2::Label->new(flushChars($lang{whatapp}));
my $labelAbout1 = Gtk2::Label->new('aMulet.pl');
my $labelAbout2 = Gtk2::Label->new($lang{oneHawk});
my $labelAbout3 = Gtk2::Label->new($lang{oneIdea});
my $labelAbout4 = Gtk2::Label->new($lang{licence});
my $labelAbout5 = Gtk2::Label->new('http://www.gnu.org/copyleft/gpl.html');
my $labelAbout6 = Gtk2::Label->new;
my $edit_home_aMule = Gtk2::Entry->new;
my $edit_aMuleGui_path = Gtk2::Entry->new;
my $edit_wxcas_path = Gtk2::Entry->new;
my $edit_alc_path = Gtk2::Entry->new;
my $edit_icon_path = Gtk2::Entry->new;
my $btnOk = Gtk2::Button->new_from_stock("gtk-apply");
my $btnCancel = Gtk2::Button->new_from_stock("gtk-cancel");
my $btnRutas1 = Gtk2::Button->new('...');
my $btnRutas2 = Gtk2::Button->new('...');
my $btnRutas3 = Gtk2::Button->new('...');
my $btnRutas4 = Gtk2::Button->new('...');
my $btnRutas5 = Gtk2::Button->new($lang{selec});
my $tableTabRutas = Gtk2::Table->new(3, 3, 0 );
# Posicionando en la ventana principal
$guiOpciones->add($vboxPrincipal);
# Posicionando en el notebook (contenedor de pestañas)
$vboxPrincipal->add($notebook);
# primera pestaña
$notebook->append_page($vBoxTabRutas, $labelTabRutas);
$vBoxTabRutas->pack_start($labelTabRut1, 0, 0, 3);
$vBoxTabRutas->pack_start($hBoxTabRutas1, 0, 0, 3);
$hBoxTabRutas1->pack_start($labelTabRut2, 0, 0, 3);
$hBoxTabRutas1->add($edit_home_aMule);
$hBoxTabRutas1->pack_end($btnRutas1, 0, 0, 3);
$vBoxTabRutas->pack_start($check_aMuled_on, 0, 0, 3);
$vBoxTabRutas->pack_start($hseparator2, 0, 0, 3);
$vBoxTabRutas->pack_start($labelTabRut3, 0, 0, 3);
$vBoxTabRutas->pack_start($tableTabRutas, 0, 0, 3);
$tableTabRutas->attach($labelTabRut4, 0, 1, 0, 1, ['fill'], [], 0, 0 );
$tableTabRutas->attach($edit_aMuleGui_path, 1, 2, 0, 1, ['expand', 'fill'], [], 0, 0 );
$tableTabRutas->attach($btnRutas2, 2, 3, 0, 1, ['fill'], [], 0, 0 );
$tableTabRutas->attach($labelTabRut5, 0, 1, 1, 2, ['fill'], [], 0, 0 );
$tableTabRutas->attach($edit_wxcas_path, 1, 2, 1, 2, ['expand', 'fill'], [], 0, 0 );
$tableTabRutas->attach($btnRutas3, 2, 3, 1, 2, ['fill'], [], 0, 0 );
$tableTabRutas->attach($labelTabRut6, 0, 1, 2, 3, ['fill'], [], 0, 0 );
$tableTabRutas->attach($edit_alc_path, 1, 2, 2, 3, ['expand', 'fill'], [], 0, 0 );
$tableTabRutas->attach($btnRutas4, 2, 3, 2, 3, ['fill'], [], 0, 0 );
$vBoxTabRutas->pack_start($hseparator1, 0, 0, 3);
$vBoxTabRutas->pack_start($labelTabRut9, 0, 0, 3);
$vBoxTabRutas->pack_start($hBoxTabRutas3, 0, 0, 3);
$hBoxTabRutas3->pack_start($select_aMuleGui, 0, 0, 3);
$hBoxTabRutas3->pack_start($select_alc, 0, 0, 3);
$hBoxTabRutas3->pack_start($select_wxcas, 0, 0, 3);
$vBoxTabRutas->pack_end($hBoxTabRutas2, 0, 0, 3);
$hBoxTabRutas2->pack_start($labelTabRut8, 0, 0, 3);
$hBoxTabRutas2->add($edit_icon_path);
$hBoxTabRutas2->pack_end($btnRutas5, 0, 0, 3);
$vBoxTabRutas->pack_end($labelTabRut7, 0, 0, 3);
$vBoxTabRutas->pack_end($hseparator3, 0, 0, 3);
# Segunda pestaña
$notebook->append_page($vBoxTabAbout, $labelTabAbout);
$vBoxTabAbout->pack_start($labelAbout1, 0, 0, 3);
$vBoxTabAbout->pack_start($labelAbout2, 0, 0, 3);
$vBoxTabAbout->pack_start($labelAbout3, 0, 0, 3);
$vBoxTabAbout->pack_start($labelAbout4, 0, 0, 3);
$vBoxTabAbout->pack_start($labelAbout5, 0, 0, 3);
$vBoxTabAbout->pack_start($labelAbout6, 0, 0, 3);
# Posicionando en la parte inferior de la ventana principal
$vboxPrincipal->pack_end($hboxPrincipal, 0, 0, 3);
$hboxPrincipal->pack_start($btnOk, 0, 0, 3);
$hboxPrincipal->pack_end($btnCancel, 0, 0, 3);
$labelAbout1->set_markup('<span foreground="DarkRed" size="x-large"><b>' . appRel . ' </b></span>');
#TODO: Intentar conseguir una UrlLabel, fácil con gnome-open (pero y si no existe gnome?)
#http://forum.amule.org/thread.php?threadid=9751
$labelAbout3->set_markup("<span>$lang{ideaOf} <b>tx2z</b> $lang{in} http://forum.amule.org</span>");
#Añado un mini resumen de la información disponible en amulesig.dat
$labelAbout6->set_markup(infoOnLine);
if ($config->{'signOn'}){
Glib::Timeout->add($config->{'signOnTime'}*1000, sub {
$labelAbout6->set_markup(infoOnLine);
$tray->send_message($config->{'signOnTime'}*1000, "[AnimAlf dice] No entiendo");});
}
# Propiedades de la ventana principal
$guiOpciones->set_title($lang{options});
$guiOpciones->set_position('center');
#TODO: Intentar que actuase como una ventana modal, como el showMessage
# y el punto de la llamada esperase la respuesta ok-cancel
logsys ("msg", $lang{shoOpsWin});
logsys ("warning", "*"x36) unless $widget;
logsys ("warning", "TODO: $lang{beModal}") unless $widget;
logsys ("warning", "*"x36) unless $widget;
# Propiedades del notebook
$notebook->set_tab_pos('top');
$notebook->set_show_tabs (1);
$notebook->set_show_border(1);
$notebook->set_scrollable (0);
$notebook->set_tab_hborder(2);
$notebook->set_tab_vborder(2);
# alineando de algunas etiquetas
$labelTabRut4->set_alignment(1,0.5);
$labelTabRut5->set_alignment(1,0.5);
$labelTabRut6->set_alignment(1,0.5);
# Asignando la configuración.
$edit_home_aMule->set_text($config->{'aMuleDir'});
$edit_aMuleGui_path->set_text($config->{'aMuleGuiApp'});
$edit_wxcas_path->set_text($config->{'wxCasApp'});
$edit_alc_path->set_text($config->{'aLinkCreatorApp'});
$edit_icon_path->set_text($config->{'iconPath'});
$check_aMuled_on->set_active($config->{'aMuledOn'});
$select_wxcas->set_active($config->{'appOnClick'} eq 'wxCas');
$select_alc->set_active($config->{'appOnClick'} eq 'aLinkCreator');
$select_aMuleGui->set_active($config->{'appOnClick'} eq 'aMuleGui');
$select_wxcas->set_sensitive($config->{'wxCasOk'});
$select_alc->set_sensitive($config->{'aLinkCreatorOk'});
$select_aMuleGui->set_sensitive($config->{'aMuleGuiOk'});
# Lo mostramos todo
$guiOpciones->show_all;
# La asignación de señales
$btnOk->signal_connect("clicked", sub {
my ($tmpStr, $tmpStr1);
$tmpStr1 = 'wxCas' if $select_wxcas->get_active;
$tmpStr1 = 'aLinkCreator' if $select_alc->get_active;
$tmpStr1 = 'aMuleGui' if $select_aMuleGui->get_active;
$tmpStr .= $edit_home_aMule->get_text . ": $lang{isntDir}\n"
if !(-d $edit_home_aMule->get_text);
$tmpStr .= $edit_aMuleGui_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n"
if !(-x $edit_aMuleGui_path->get_text);
$tmpStr .= $edit_wxcas_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n"
if !(-x $edit_wxcas_path->get_text);
$tmpStr .= $edit_alc_path->get_text . ": <b>$lang{isntExe}</b> ($lang{itisnt})\n"
if !(-x $edit_alc_path->get_text);
$tmpStr .= $edit_icon_path->get_text . ": <b>$lang{dontExist}</b>\n"
if !(-e $edit_icon_path->get_text);
if (defined $tmpStr){
$tmpStr = "<b>$lang{detectAny}</b>\n\n$tmpStr\n\n" . flushChars($lang{wantContinue});
my $confirmacion= &showMessage( 'question', $tmpStr, 'yes-no');
return if ($confirmacion eq 'no');
}
$config->{'appOnClick'} = 'wxCas' if $select_wxcas->get_active;
$config->{'appOnClick'} = 'aLinkCreator' if $select_alc->get_active;
$config->{'appOnClick'} = 'aMuleGui' if $select_aMuleGui->get_active;
$config->{'aMuleDir'} = $edit_home_aMule->get_text;
$config->{'aMuleGuiApp'} = $edit_aMuleGui_path->get_text;
$config->{'wxCasApp'} = $edit_wxcas_path->get_text;
$config->{'aLinkCreatorApp'} = $edit_alc_path->get_text;
&showMessage( 'info', flushChars($lang{iconWhenRestart}), 'ok')
if $config->{'iconPath'} ne $edit_icon_path->get_text;
$config->{'iconPath'} = $edit_icon_path->get_text;
$config->{'aMuledOn'} = $check_aMuled_on->get_active;
&saveConfig; pathsVerify; popUpsAct; readSignatureConf;
$guiOpciones->destroy;
}
);
$btnCancel->signal_connect("clicked", sub { $guiOpciones->destroy; } );
$guiOpciones->signal_connect('destroy' => sub {$widget->set_sensitive(1) if defined $widget;});
$btnRutas1->signal_connect('clicked' => sub { dialogOpen($edit_home_aMule,
$lang{selHomaMu}, 'select-folder'); });
$btnRutas2->signal_connect('clicked' => sub { dialogOpen($edit_aMuleGui_path,
flushChars($lang{selaMguiApp}), 'open'); });
$btnRutas3->signal_connect('clicked' => sub { dialogOpen($edit_wxcas_path,
flushChars($lang{selwxCasApp}), 'open'); });
$btnRutas4->signal_connect('clicked' => sub { dialogOpen($edit_alc_path,
flushChars($lang{selALCapp}), 'open'); });
$btnRutas5->signal_connect('clicked' => sub { dialogOpen($edit_icon_path,
flushChars($lang{selIcon}), 'open'); });
}
# loadConfig carga la configuración o la crea si no existe
sub loadConfig {
if ( open( CONFIGFILE, "$ENV{HOME}/.aMule/amulet.rc" ) ) {
while (<CONFIGFILE>) {
if ( $_ =~ /(\w+)\s=\s(.+)/ ) { $config->{$1} = $2 }
}
close CONFIGFILE;
} else {
# es la primera vez.
mkdir "$ENV{HOME}/.aMule" unless (-d "$ENV{HOME}/.aMule");
$config = { # Por defecto
'aMuleDir' => "$ENV{'HOME'}/.aMule",
'aMuleGuiApp' => 'amulegui',
'wxCasApp' => 'wxcas',
'aLinkCreatorApp' => 'alc',
'iconPath' => '/usr/share/pixmaps/amule.xpm',
'appOnClick' => 'aMuleGui',
'aMuledOn' => 1
};
foreach my $app (@appList) {
$config->{$app . 'App'} = which($config->{$app . 'App'});
}
pathsVerify;
&saveConfig;
}
pathsVerify;
}
# saveConfig guarda la configuración en un archivo
sub saveConfig {
my @keyList = ('aMuleDir', 'aMuleGuiApp', 'wxCasApp',
'aLinkCreatorApp', 'iconPath', 'appOnClick', 'aMuledOn');
if ( open( CONFIGFILE, '>', "$ENV{HOME}/.aMule/amulet.rc" ) ) {
foreach my $key (@keyList) {
print CONFIGFILE "$key = $config->{$key}\n" if $config->{$key} ne '';
}
close CONFIGFILE;
}else {logSys("warning", $lang{noConfWrite});}
};
# showMessage Muestra una ventana con un mensaje, y espera respuesta.
sub showMessage {
#$icon info warning error question
#$type none ok close cancel yes-no ok-cancel
my ($icon,$text,$type) = @_;
my $dialog = Gtk2::MessageDialog->new_with_markup (undef,
[qw/modal destroy-with-parent/], $icon, $type, sprintf "$text");
my $retval = $dialog->run;
$dialog->destroy;
return $retval;
}
# which Devuelve el path completo a la aplicación.
sub which {
my $appFile = shift;
foreach (split(':', $ENV{PATH})) {
my $tmpStr = "$_/$appFile";
if (-x $tmpStr) {
$appFile = $tmpStr;
last;
}
}
return $appFile;
}
# dialogOpen ventana de selección de archivos o directorios y escribe
# el resultado en en el entry que debe ser el primer parámetro.
sub dialogOpen {
# $widget debe ser un entry
# $type open save select-folder create-folder
my($widget,$caption,$type) =@_;
my $chooserDialog = Gtk2::FileChooserDialog->new ($caption, undef, $type,
'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok');
my $filename = $chooserDialog->get_filename if 'ok' eq $chooserDialog->run;
$widget->set_text ($filename) if defined $filename;
$chooserDialog->destroy;
return;
}
# Translations
sub initLang {
%lang_en = (
not_X11_msg => "ATTENTION: This script needs to be executed under the X Window",
not_TrayIcon_msg => "ATTENTION: This script needs Gtk2::TrayIcon module\n" .
"\tYou can install it through CPAN in the following way:\n\n" .
"\t~ \$ perl -MCPAN -e \'install Gtk2::TrayIcon\'\n\nbye",
interrupted_initialization => " ha abortado el arranque.",
bad_blockage_file => "I can't eliminate the blockade file",
initiated => " Initiate",
icon_load_Error => "Icon load error: ",
options => "options",
logfile => "aMule log",
quit => "Exit",
icon_load => "Itself proceeds to load the internal icon.",
signs_assignment => "Signs assignment",
witgets_show => "Visualizing witgets",
init_msg_loop => "Initiating messages loop",
just_end => "It has just concluded: ",
right_click_show => " - Right click to show options",
Hid => "[Hight ID]",
Lid => "[Low ID]",
Conecting => "[Connecting]",
dowSpeed => "downSpeed",
upSpeed => "upSpeed",
k_ok => "[kad ok]",
k_fire => "[kad firewalled]",
k_down => "[kad off]",
aMd_off => " [aMuled Not Conected]",
down => " Down:",
ending => "Concluding ...",
endChilds => "Concluding possible children",
end_run_chld => "it's in progress. Concluding him... ",
hasntChld => "There aren't child process of ",
to_do_1 => "Overt log files to final log file [if config]",
to_do_2 => "It send setFocus to the application",
to_do_3 => "try to show it as modal and wait the answer.",
inSys => " in the system",
appEnd => "Execution end",
child_begin => "child process beginning with",
fork_error => "error when making fork:",
stdout_redirect => "STDOUT redirect for",
a => "to",
exec_fail => "ATTENTION: It failed the execution of",
father_loop => "Process father circuit [son =>",
itsRun => "it\'s already running!",
blockInit => "block file init",
loadConf => "Loading the configuration",
isaMuled => "Beginning the amuled existence verification",
noaMuled => "It isn\'t detected. Beginning amuled ...",
lock_chg => "ATTENTION: You changes the order ",
yourself => "under your responsibility ",
aMrun => "It has been detected that aMule is running ",
tiTools => "aMulet.pl was designed thinking of the remote tools",
alfsay => "It would WORK, but I don't see the necessity of it. STOP!!",
aMuledInit => "The amuled has been started.",
aMuledNoRun => "It hasn\'t been possible to execute the amuled! ",
check_no_run => "Do I disable the option of pulling up the amuled in the configuration? ",
aMnoHere => "Disable this option if the aMuled is residing in another machine of your net.",
noaMGui => "I haven\'t detected the aMuleGui.",
whereaMGUI => "It will indicate where is this located in the configuration",
aMuledIs => "aMuled has been detected:)) ",
noRunInit => "ATTENTION won't be detected neither it will pull up the aMuled",
noRunInit2 => " It can modify this in the configuration",
click_veryfy => "Verifying the application that icon click responds.",
writeItInConf => "You should indicate in the configuration where are the executable one",
of_app => "of the application",
another => "or to choose one another",
jump_step => "You can indicate in the configuration file that jumps this step",
appAnsw => "application that icon click responds",
menu_off => "Disabling menu call",
texView => "Text viewer",
Shw_log_win => "Showing log win",
with => "with",
connPort => "it\'s connected to port",
hi => "high",
low => "low",
ande => "and the",
nk => "kad net",
okcon => "connected OK",
infire => "in firewalled",
disconnec => "disconnected",
ittake => "it takes ",
sec => " seconds",
min => "minutes and",
hours => " hours",
days => "days",
of => "of",
connected => "connected",
inthistime => "and in this time it has discharged: ",
downTotal => "with that has a total discharged of ",
sharealso => "also shares",
sesionFiles => "files and in this session",
obtaining => "obtaining a",
upload => "they has ascended",
atotal => "total of",
totalup => "ascended to the Net",
hasRight => "in line it has right now",
cli => "clients",
callOff => "Disabling the call in the menu",
runAsServer => "Run aMule like service at the beginning (if don't run).",
general => "General",
about => "About",
aboutAmuled => "About aMuled Service",
AHD => "aMule Home Dir",
appPaht => "Applications path",
iconShow => "Icon that will be shown in the task bar",
icon => "Icon:",
whatapp => "What application will be launcher when icon click?",
oneHawk => "by AnimAlf - AnimAlf\@users.sourceforge.net",
oneIdea => "a tx2z idea in http://forum.amule.org,",
ideaOf => "An idea of",
in => "in",
options => "aMulet.pl options",
shoOpsWin => "Showing options widget",
beModal => "Mush be modal as showMessage",
licence => "Distributed under GPL license",
selec => "Select",
itisnt => "or it doesn\'t exist",
isntDir => "It isn\'t a directory",
isntExe => "It isn\'t an executable one",
dontExist => "It doesn\'t seem that it exists",
detectAny => "The following things has been detected:",
wantContinue => "Do you want continue anyway?",
iconWhenRestart => "Icon will change when you restarts the application.",
selHomaMu => "Select the aMule home directory",
selaMguiApp => "Select the aMuleGui application",
selwxCasApp => "Select the wxCas application",
selALCapp => "Select the aLinCreator application",
selIcon => "Select the icon that will use aMulet",
noConfWrite => "One cann\'t write in the configuration file!"
);
%lang_es = (
not_X11_msg => "ATENCIÓN: Este script necesita ser ejecutado bajo las X Window",
not_TrayIcon_msg => "ATENCIÓN: Este script necesita el módulo Gtk2::TrayIcon\n" .
"\tPuede instalarlo a través de CPAN del siguiente modo:\n\n" .
"\t~ \$ perl -MCPAN -e \'install Gtk2::TrayIcon\'\n\nbye",
interrupted_initialization => " ha abortado el arranque.",
bad_blockage_file => "No puedo eliminar el archivo de bloqueo",
initiated => " iniciado",
icon_load_Error => "Error al cargar el icono: ",
options => "opciones",
logfile => "log del aMule",
quit => "Salir",
icon_load => "Se procede a cargar el icono interno.",
signs_assignment => "Asignación de señales",
witgets_show => "Visualizando los witgets",
init_msg_loop => "Inicio del bucle de mensajes",
just_end => "Acaba de finalizar: ",
right_click_show => " - Click derecho para opciones",
Hid => "[ID alta]",
Lid => "[ID baja]",
Conecting => "[Conectando]",
dowSpeed => "downSpeed",
upSpeed => "upSpeed",
k_ok => "[kad ok]",
k_fire => "[kad firewalled]",
k_down => "[kad off]",
aMd_off => " [aMuled No Conectado]",
down => " Bajada:",
ending => "Finalizando ...",
endChilds => "Finalizando posibles hijos",
end_run_chld => "está en marcha. Finalizándolo ...",
hasntChld => "No quedan procesos hijo de ",
to_do_1 => "volcar archivo log a log final [si se le ordena]",
to_do_2 => "Enviar setFocus a la aplicación",
to_do_3 => "Intentar mostrarlo como modal y esperar respuesta.",
inSys => " en el sistema",
appEnd => "Terminada la ejecución",
child_begin => "child process beginning with",
fork_error => "error al hacer fork:",
stdout_redirect => "Redirección de STDOUT para",
a => "a",
exec_fail => "ATENCIÓN: Falló la ejecución de",
father_loop => "Circuito del proceso padre [hijo=>",
itsRun => "ya está funcionando!",
blockInit => "Iniciando archivo de bloqueo",
loadConf => "Cargando la configuración",
isaMuled => "Iniciando la verificación de la existencia de amuled",
noaMuled => "No se detecta. Iniciando amuled ...",
lock_chg => "ATENCIÓN: Cambie la orden",
yourself => "bajo su responsabilidad",
aMrun => "Se ha detectado que el aMule está en marcha ",
tiTools => "aMulet.pl se diseñó pensando en las herramientas remotas",
alfsay => "FUNCIONARÍA, pero no veo la necesidad de ello. STOP!!",
aMuledInit => "El amuled ha sido puesto en marcha.",
aMuledNoRun => "No se ha podido ejecutar el amuled!",
check_no_run => "¿Desactivo la opción de arrancar el amuled en la configuración?",
aMnoHere => "Desactive esta opción si el aMuled está residente en otra máquina de su red.",
noaMGui => "No he detectado el aMuleGui.",
whereaMGUI => "Deberá indicar donde está situado éste en la configuración",
aMuledIs => "El aMuled ha sido detectado :))",
noRunInit => "ATENCIÓN No se detectará ni arrancará el aMuled",
noRunInit2 => " Se puede modificar esto en la configuración",
click_veryfy => "Verificando la aplicación que responde al click del icono.",
writeItInConf => "Debe indicar en la configuración dónde residen el ejecutable",
of_app => "de la aplicación",
another => "o escoger otra",
jump_step => "Se puede indicar en la configuración que se salte este paso",
appAnsw => "aplicación que responda al click en el icono",
menu_off => "Deshabilitando la llamada en el menú",
texView => "Visor de Texto",
Shw_log_win => "Mostrando la ventana de logs",
with => "con",
connPort => "está conectado al puerto",
hi => "alta",
low => "baja",
ande => "y la",
nk => "red kad",
okcon => "bien conectada",
infire => "en firewalled",
disconnec => "desconectada",
ittake => "lleva ",
sec => " segundos",
min => "minutos y",
hours => " horas",
days => "dias",
of => "de",
connected => "conectado",
inthistime => "y en este tiempo ha descargado: ",
downTotal => "con lo que tiene un total descagado de ",
sharealso => "Además comparte",
sesionFiles => "archivos y en esta sesión",
obtaining => "obteniendo un",
upload => "se han subido",
atotal => "total de",
totalup => "subidos a la Red",
hasRight => "en cola tiene ahora mismo",
cli => "clientes",
callOff => "Deshabilitando la llamada en el menú",
runAsServer => "Arrancar aMule como servicio al principio (si no lo está)",
general => "General",
about => "About",
aboutAmuled => "Relacionado con el Servicio amuled",
AHD => "aMule Home Dir",
appPaht => "Ruta a las aplicaciones",
iconShow => "Icono que se mostrará en la barra",
icon => "Icono:",
whatapp => "¿Qué aplicación arrancará tras hacer click en el icono?",
oneHawk => "by AnimAlf - AnimAlf\@users.sourceforge.net",
oneIdea => "una idea de tx2z en http://forum.amule.org",
ideaOf => "Una idea de",
in => "en",
options => "Opciones aMulet.pl",
shoOpsWin => "Mostrando la ventana de opciones",
beModal => "Que sea modal tipo showMessage",
licence => "Distribuido bajo la licencia GPL",
selec => "Selecciona",
itisnt => "o no existe",
isntDir => "No es un directorio",
isntExe => "No es un ejecutable",
dontExist => "No parece que exista",
detectAny => "Se ha detectado lo siguiente:",
wantContinue => "¿Desea continuar de todos modos?",
iconWhenRestart => "El icono cambiará cuando reinicie la aplicación.",
selHomaMu => "Seleccione el directorio home de aMule",
selaMguiApp => "Seleccione la aplicación aMuleGui",
selwxCasApp => "Seleccione la aplicación wxCas",
selALCapp => "Seleccione la aplicación aLinCreator",
selIcon => "Seleccione el icono que utilizará aMulet",
noConfWrite => "No se puede escribir en el archivo de configuración!"
);
}