thunders has asked for the wisdom of the Perl Monks concerning the following question:
I've started down the mildly ambitious road of writing my own GUI ftp client. So far it's four boxes and a file select dialog. eventually I plan to set up two windows one to browse my pc and another to browse the remote. As well as config files to store site info. My question relates to file browsing on tk.
Are their any widgets or code examples of embeddable file navigators written in Tk. I've taken a look at Tk::DirTree and Tk::DirList, but neither works well as a file navigator as each requires a root directory to be set and can only(apparently) browse downward from that root, and lists dont collapse, etc etc, and they are not that attractive anyhow. Am i missing a better option?
#!/usr/bin/perl use Net::Ftp; use Tk; my $top = new MainWindow; my $l_ftpsite = $top->Label(-text=>"Site")->pack; my $entry_ftpsite = $top->Entry(-textvariable=>\$ftpsite)->pack; my $l_username = $top->Label(-text=>"Username")->pack; my $entry_username = $top->Entry(-textvariable=>\$username)->pack; my $l_password = $top->Label(-text=>"Password")->pack; my $entry_password = $top->Entry(-textvariable=>\$password)->pack; my $l_directory = $top->Label(-text=>"Directory")->pack; my $entry_directory = $top->Entry(-textvariable=>\$directory)->pack; my $browse = $top->Button ( -text=>"Browse..", -command=> sub{ my $filename = $top->getOpenFile( +); ftp_me($username,$password,$ftpsit +e,$directory,$filename); } )->pack(); MainLoop; sub ftp_me{ my ($username,$password,$ftpsite,$directory,$filename) = @_; $ftp = Net::FTP->new($ftpsite, Debug => 0); $ftp->login($username,$password); if (defined $directory) { $ftp->cwd(q|$directory|); } $ftp->put($filename); $ftp->quit; }
BTW, I'm aware of the lack of error checking and am working on that :) this was just a test case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need advice on my Tk ftp client
by rbc (Curate) on Apr 26, 2002 at 20:16 UTC | |
by thunders (Priest) on Apr 26, 2002 at 20:44 UTC | |
by bbfu (Curate) on Apr 27, 2002 at 02:17 UTC |