home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/wish
-
- #Xwget, a tcl/Tk GUI for wget
- # Ian Mulgrew 2005
-
- wm title . "Xwget 0.4 for Puppy"
-
- wm minsize . 1 1
- # Frame for buttons, log & entry
-
- frame .top -width 10c -height 5c
-
- pack .top -side top -fill x
-
- #Menu Bar
-
- frame .menubar -relief raised -bd 2
- pack .menubar -in .top -fill x
-
- menubutton .menubar.file -text File -underline 0 -menu .menubar.file.menu
- menubutton .menubar.edit -text Edit -underline 0 -menu .menubar.edit.menu
- pack .menubar.file .menubar.edit -side left
-
- menubutton .menubar.help -text Help -underline 0 -menu .menubar.help.menu
- pack .menubar.help -side right
-
- menu .menubar.file.menu -tearoff 0
- .menubar.file.menu add command -label Quit -command exit
-
- menu .menubar.edit.menu -tearoff 0
- .menubar.edit.menu add command -label Grab -command grabSel
- .menubar.edit.menu add command -label "Clear output log" -command clearOut
-
- menu .menubar.help.menu -tearoff 0
- .menubar.help.menu add command -label Help -command {exec dillo /usr/local/xwget/xwget_help.html &}
- .menubar.help.menu add command -label About -command {exec dillo /usr/local/xwget/xwget_about.html &}
-
- ##########################
- #Proc for Menus
-
- proc clearOut {} {
- .log.t delete 1.0 end
- }
-
- proc grabSel {} {
- CopySelection
- PasteSelection
- }
-
- proc CopySelection {} {
- global seltxt
- set seltxt [selection get STRING]
- }
-
- proc PasteSelection {} {
- global seltxt
- .en.filAdres insert insert $seltxt
- }
-
-
- #Space
-
- frame .sp -height 10
- pack .sp -in .top -after .menubar
-
- #Message frame
-
- label .m -text " Please read the Help file first as it contains instructions on how to use Xwget. "
- pack .m -in .top -after .sp
-
- frame .spa -height 10
- pack .spa -in .top -after .m
-
- ###############################################
-
- #Download Button
-
- button .top.down -text "Download File" -command {
- set fle [.en.filAdres get]
- set ddr [.di.dir get]
- set fa [open "|wget -c -P $ddr $fle" r]
-
- fileevent $fa readable [list Reader $fa]
-
- proc Reader { fa } {
- if [eof $fa] {
- catch {close $fa}
- .log.t insert end "Download Finished "
- } else {
- set thisLine [gets $fa]
- .log.t insert end "$thisLine\n"
- .log.t yview end
- }
- }
- }
-
- pack .top.down -side bottom
-
- ########################################
-
- #Space
- frame .spdn -height 10
- pack .spdn -in .top -after .top.down
-
-
- frame .en -height 10
- pack .en -in .top -after .spa
-
-
- #Entry label & field
-
- label .en.l -text "Enter Address:" -padx 6
- entry .en.filAdres -width 65 -bg white -bd 2
-
- pack .en.l -side left
- pack .en.filAdres -side left -padx 4 -expand true
-
- #Space
- frame .spac -height 10
- pack .spac -in .top -after .en
-
-
- #Directory entry field
-
- frame .di -height 10
- pack .di -in .top -after .spac
-
- label .di.d -text "Enter Directory:" -padx 0
- entry .di.dir -width 65 -bg white -bd 2
-
- pack .di.d -side left
- pack .di.dir -side left -fill x -expand true
-
-
- focus .en.filAdres
-
- #Space
- frame .spacr -height 10
- pack .spacr -in .top -after .di
-
- # Frame for output log
-
- frame .log -relief raised -borderwidth 1
- label .log.lb -text "Xwget output log" -padx 0
- text .log.t -height 5 -bg white -yscrollc {.log.sb set}
- scrollbar .log.sb -command {.log.t yview}
-
- pack .log.lb -side top
- pack .log.sb -side right -fill y
- pack .log.t -side bottom -fill both -expand 1
- pack .log -side bottom -fill x
-
- ###############################
-
-
-
-
-