Changeset 5524


Ignore:
Timestamp:
06/24/09 04:35:22 (3 years ago)
Author:
waxhead
Message:

Change the behaviour when docbrowser can't find help to an ugly Dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Wx/DocBrowser.pm

    r5503 r5524  
    142142    #my @menu_id; 
    143143    $exitMenu->Append(Wx::wxID_CLOSE, Wx::gettext("&Close\tCtrl+W") ); 
    144     $exitMenu->Append(22222, Wx::gettext("E&xit\tCtrl+X") ); 
     144    my $exitID = Wx::NewId; 
     145     
     146    $exitMenu->Append($exitID, Wx::gettext("E&xit\tCtrl+X") ); 
    145147     
    146148    my $menuBar = Wx::MenuBar->new(); 
     
    148150    $self->SetMenuBar($menuBar); 
    149151     
    150     my $table = Wx::AcceleratorTable->new( [Wx::wxACCEL_NORMAL, Wx::WXK_ESCAPE, 22222 ] ); 
     152    my $table = Wx::AcceleratorTable->new( [Wx::wxACCEL_NORMAL, Wx::WXK_ESCAPE, $exitID ] ); 
    151153    $self->SetAcceleratorTable( $table ); 
    152154     
    153155    # you can create fictional menu items for use by the accelerator table 
    154     Wx::Event::EVT_MENU( $self, 22222, sub { $_[0]->_close(); } ); 
     156    Wx::Event::EVT_MENU( $self, $exitID, sub { $_[0]->_close(); } ); 
    155157    Wx::Event::EVT_MENU( $self, Wx::wxID_CLOSE, sub { $_[0]->_close_tab(); } ); 
    156158     
     
    340342 
    341343sub not_found { 
     344    # trying a dialog rather than the open tab. 
    342345    my ( $self, $query ) = @_; 
    343     my $html = qq| 
    344 <html><body> 
    345 <h1>Not Found</h1> 
    346 <p>Could not find documentation for 
    347 <pre>$query</pre> 
    348 </p> 
    349 </body> 
    350 </html> 
    351 |; 
    352     my $frame = Padre::Wx::HtmlWindow->new($self); 
    353     $self->notebook->AddPage( $frame, 'Not Found', 1 ); 
    354     $frame->SetPage($html); 
     346     
     347        my $layout = [ 
     348        [ 
     349                        [ 'Wx::StaticText', undef,         "Nothing found for $query"], 
     350        ], 
     351        [ 
     352                        [ 'Wx::Button',     'ok',           Wx::wxID_OK   ], 
     353                ], 
     354        ]; 
     355         
     356        # Wx::Perl::Dialog 
     357        my $dialog = Padre::Wx::Dialog->new( 
     358                parent => $self, 
     359                title  => 'Unable to locate help...', 
     360                layout => $layout, 
     361                width  => [250, 550], 
     362 
     363        );     
     364         
     365         
     366        $dialog->Show(); 
     367         
     368         
     369#    my $html = qq| 
     370#<html><body> 
     371#<h1>Not Found</h1> 
     372#<p>Could not find documentation for 
     373#<pre>$query</pre> 
     374#</p> 
     375#</body> 
     376#</html> 
     377#|; 
     378#    my $frame = Padre::Wx::HtmlWindow->new($self); 
     379#    $self->notebook->AddPage( $frame, 'Not Found', 1 ); 
     380#    $frame->SetPage($html); 
    355381 
    356382} 
Note: See TracChangeset for help on using the changeset viewer.