Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Google Translator -> wxPerl frontend

by jwkrahn (Monsignor)
on Oct 03, 2010 at 18:01 UTC ( #863193=note: print w/ replies, xml ) Need Help??


in reply to Google Translator -> wxPerl frontend

my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name;

Perl now has the // operator which would simplify that to:

my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent //= undef; $id //= -1; $title //= ""; $pos //= wxDefaultPosition; $size //= wxDefaultSize; $name //= "";

Although I don't see much point in assigning undef to a variable that already contains undef?


Comment on Re: Google Translator -> wxPerl frontend
Select or Download Code
Re^2: Google Translator -> wxPerl frontend
by Swalif (Scribe) on Oct 03, 2010 at 18:13 UTC
    This code is wxGlade generated .. Thanks a lot for pointing the // operator great notice..
      Update:
      fixed the size of the frame by removing Min & Max buttons.. new code:
      $style = wxCAPTION|wxCLOSE_BOX|wxFRAME_NO_TASKBAR|wxCLIP_CHILDREN unless defined $style;
        Interesting enough upon testing the code on windows the first critical point disappeared and the application responses efficiently to requests; I was really impressed this seems to imply that the issue is ubuntu specific, did you notice that some applications like emesene quickly go to unresponsive mode and come back after few seconds?...
        Also sortCombo working great in windows and the options are sorted alphabetically so this one also may be an ubuntu specific..
        however windows wX raised unicode issues.. like the opposite of tk where it works pretty well on windows but on linux no luck with utf8ing the text ;) thanks
Re^2: Google Translator -> wxPerl frontend
by Anonymous Monk on Oct 04, 2010 at 12:06 UTC
      Since only Lingua::Translate->new( src => $tag_1, dest => $tag_2 ) needs connection... how about:
      my ($message, $trans); my $tag_1 = getTag($self->{origin}->GetValue()); my $tag_2 = getTag($self->{destination}->GetValue()); eval { $object = Lingua::Translate->new( src => $tag_1, dest => $tag_2 ) + or die "Cannot Create an instance"; $message = $self->{origin_text}->GetValue(); $trans = $object->translate($message); }; if ($@){$self->{translated_text}->SetValue("An Error occured : $@ + \n Perhaps your not online."); } else{ $self->{translated_text}->SetValue($trans); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-09-16 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (46 votes), past polls