Changeset 492


Ignore:
Timestamp:
10/26/08 07:27:47 (3 years ago)
Author:
tsee
Message:

follow api changes of padre 0.12_01

Location:
plugins/par
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/par/Changes

    r67 r492  
     1v0.03 2008.10.26 
     2 
     3Follow the API changes of Padre 0.12_01 
     4 
    15v0.02 2008.08.17 
    26 
  • plugins/par/lib/Padre/Plugin/PAR.pm

    r180 r492  
    77use File::Temp (); 
    88 
    9 our $VERSION = '0.02'; 
     9our $VERSION = '0.03'; 
    1010 
    1111=head1 NAME 
     
    1616 
    1717This is an experimental version of the plugin using the experimental 
    18 plugin interface of Padre 0.06 
     18plugin interface of Padre 0.12_01 
    1919 
    2020After installation there should be a menu item Padre - PAR - Stand Alone 
     
    3636 
    3737sub on_stand_alone { 
    38     my ($mw, $event) = @_; 
     38    my ($self, $event) = @_; 
    3939 
    4040    #print "Stand alone called\n"; 
    4141    # get name of the current file, if it is a pl file create the corresponding .exe 
    4242 
    43     my $filename = $mw->get_current_filename; 
     43    my $doc = $self->selected_document; 
     44 
     45    my $filename = $doc->filename; 
    4446    my $tmpfh; 
    4547    my $cleanup = sub { unlink $filename if $tmpfh }; 
     
    4850 
    4951    if (not $filename) { 
    50         ($filename, $tmpfh) = _to_temp_file($mw); 
     52        ($filename, $tmpfh) = _to_temp_file($doc); 
    5153    } 
    5254 
    5355    if ($filename !~ /\.pl$/i) { 
    54         Wx::MessageBox( "Currently we only support exe generation from .pl files", "Cannot create", wxOK|wxCENTRE, $mw ); 
     56        Wx::MessageBox( "Currently we only support exe generation from .pl files", "Cannot create", wxOK|wxCENTRE, $self ); 
    5557        return; 
    5658    } 
     
    5860    my $ret = system("pp", $filename, "-o", $out); 
    5961    if ($ret) { 
    60        Wx::MessageBox( "Error generating '$out': $!", "Failed", wxOK|wxCENTRE, $mw ); 
     62       Wx::MessageBox( "Error generating '$out': $!", "Failed", wxOK|wxCENTRE, $self ); 
    6163    } else { 
    62        Wx::MessageBox( "$out generated", "Done", wxOK|wxCENTRE, $mw ); 
     64       Wx::MessageBox( "$out generated", "Done", wxOK|wxCENTRE, $self ); 
    6365    } 
    6466 
     
    7173 
    7274sub _to_temp_file { 
    73     my $mw = shift; 
     75    my $doc = shift; 
    7476 
    75     my $id   = $mw->{notebook}->GetSelection; 
    76     my $page = $mw->{notebook}->GetPage($id); 
    77     my $code = $page->GetTextRange(0, $page->GetLength()); 
    78   
     77    my $text = $doc->text_get(); 
     78 
    7979    my ($fh, $tempfile) = File::Temp::tempfile( 
    8080      "padre_standalone_XXXXXX", 
     
    8484    ); 
    8585    local $| = 1; 
    86     warn $code; 
    87     print $fh $code; 
     86    print $fh $text; 
    8887    return($tempfile, $fh); 
    8988} 
Note: See TracChangeset for help on using the changeset viewer.