Printer setup in wxPerl

Steve Cookson <[email protected]>
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <[email protected]>
Hi Guys,

One of the things that always irritaed me about wxPerl, was that I 
couldn't set up printers.  It never really felt like a full solution 
because I always had to drop out to the operation system for users to do it.

Now if you are using wx 2.9.3 or above, you can access cups to set up 
printers.

Here is a very simple Perl script that will do it.

Have fun.

Regards

Steve.

#!/usr/bin/perl
use v5.12;
use Wx;

use Wx::WebView;
use strict;
use warnings;

package MyApp;
use vars qw(@ISA); @ISA=qw(Wx::App);

use Wx qw[:everything];

sub OnInit {
     my( $this ) = @_;
     my $frame = Wx::Frame->new(undef, -1, "cups printing", [-1,-1], 
[wxh()] );

     $frame->{defaulturl} = 'http://localhost:631';
     $frame->{webview} = Wx::WebView::New($frame, -1, 
$frame->{defaulturl},   ); # wxDefaultPosition, wxDefaultSize,


     $frame->SetIcon( Wx::GetWxPerlIcon() );
     $frame->Centre( );

     $this->SetTopWindow( $frame );
     $frame->Show( 1 );
     1;
}

sub wxh(){
     # Returns width and height (w X h) of screen as array.
         my $x = Wx::SystemSettings::GetMetric(wxSYS_SCREEN_X);
         my $y = Wx::SystemSettings::GetMetric(wxSYS_SCREEN_Y);
     return ($x, $y);
}
sub OnQuit {
     my( $this, $event ) = @_;
     $this->Close( 1 );
}


package main;
MyApp->new->MainLoop;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.