home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 July / Chip_2001-07_cd1.bin / tema / linux6 / guiwget.tcl < prev    next >
Text File  |  2001-06-04  |  6KB  |  201 lines

  1. #!/usr/bin/wish -f
  2.  
  3. # Front-end for wget
  4. # Created using a program of  Michal Burda, 1999,as template, by Jiri KOuba 2000
  5. # as graphical interface for wget
  6.  
  7. #************************************************************************
  8. # procedures:
  9. #************************************************************************
  10. proc newurl {  } {
  11. set w .form1
  12.  
  13. catch {destroy $w}
  14. toplevel $w
  15. wm title $w "NovΘ URL"
  16. wm iconname $w ""
  17.  
  18. label $w.msg -wraplength 4i -justify left -text "Sta╛enφ URL"
  19. pack $w.msg -side top
  20.  
  21. wm title $w "NovΘ URL - vstupnφ ·daje"
  22. wm iconname $w "NovΘ sta╛enφ"
  23.  
  24. label $w.msg1 -wraplength 4i -justify left -text "Vypl≥te nßsledujφcφ ·daje"
  25. pack $w.msg1 -side top
  26.  
  27. frame $w.buttons1
  28. pack $w.buttons1 -side bottom -fill x -pady 2m
  29. button $w.buttons1.dismiss -text Zru╣it -command "destroy $w"
  30. button $w.buttons1.run -text Dßle -command "runwget"
  31. pack $w.buttons1.run $w.buttons1.dismiss  -side left -expand 1
  32.  
  33. frame $w.checkframeleft -borderwidth .5c
  34. frame $w.checkframeright -borderwidth .5c
  35. pack $w.checkframeleft $w.checkframeright  -side top -expand yes -fill y
  36.  
  37.    checkbutton $w.checkframeleft.b1 -text "Jen relativnφ linky" -variable m1 \
  38.         -relief flat  
  39.     pack $w.checkframeleft.b1  -side top -pady 2 -anchor w
  40.  
  41. checkbutton $w.checkframeleft.b3 -text "Rekurze" -variable m3 \
  42.         -relief flat 
  43.     pack $w.checkframeleft.b3  -side top -pady 2 -anchor w
  44.  
  45.  
  46. checkbutton $w.checkframeleft.b4 -text "Nezaklßdat adresß°e" -variable m4 \
  47.         -relief flat 
  48.     pack $w.checkframeleft.b4  -side top -pady 2 -anchor w
  49.  
  50.  
  51. foreach i { f5 f6 f2 } {
  52.     frame $w.$i -bd 2
  53.     entry $w.$i.entry -relief sunken -width 40 -textvariable m$i
  54.     label $w.$i.label
  55.     pack $w.$i.entry -side right
  56.     pack $w.$i.label -side left
  57. }
  58.  
  59. $w.f6.label config -text "Odkud stahovat URL (http://www.xxx.zzz/ddd):"
  60. $w.f5.label config -text "Kam uklßdat lokßln∞ (./Dokumenty)"
  61. $w.f2.label config -text "Stupe≥ zano°enφ odkaz∙"
  62. pack $w.msg  $w.f5 $w.f6  $w.f2 -side top -fill x
  63. bind $w <Return> "destroy $w"
  64.         }
  65. #------------------------------------------------------------------------
  66. proc runwget {  } {
  67. global m1 mf2 m3 m4 mf5 mf6
  68. if {$m1 == "1" } { 
  69. set mf1 L
  70.   }
  71.  
  72. if {$m3 == "1" } { 
  73. set mf3 r
  74.   }
  75. if {$m4 == "1" } { 
  76. set mf4 nd
  77.   }
  78. exec xterm -fn 10x20 -e  wget  -$mf1 -l$mf2 -$mf3 -$mf4 -P $mf5 $mf6
  79. #diagnostika
  80. #exec echo wget -$mf1 -l$mf2 -$mf3 -$mf4 -P $mf5 $mf6 >/tmp/wget.txt
  81.  
  82.  
  83.         }
  84. #------------------------------------------------------------------------
  85. proc setoptions {} {
  86. #
  87. }
  88. #------------------------------------------------------------------------
  89. proc about {} {
  90.     global appname
  91.     toplevel .awin -class Dialog
  92.     wm title .awin "About $appname"
  93.     frame .awin.top -relief raised -border 1
  94.     pack .awin.top -side top -fill both
  95.     frame .awin.bot -relief raised -border 1
  96.     pack .awin.bot -side bottom -fill both
  97.     message .awin.top.msg -width 5i -anchor center \
  98.     -text "$appname\
  99.     \n
  100.     \n
  101. Guiwget is an window interface for wget grabber.\
  102. This file is freeware and it was last modified in August, 30th 2000.\
  103. No warranty granted.\    
  104.     \nContact me: jiri.kouba@volny.cz\
  105.     \nMy homepage: www.volny.cz/jiri.kouba\
  106.     \n
  107.     \nCopyright (C) 2000 Jiri Kouba. All Rights Reserved."
  108.     pack .awin.top.msg -side top -expand 1 -fill both -padx 5m -pady 5m
  109.     button .awin.okbutton -text "OK" -command {destroy .awin}
  110.     pack .awin.okbutton -side bottom
  111.     grab .awin
  112.     focus .awin
  113. }
  114. #------------------------------------------------------------------------
  115. proc howuninstall {} {
  116.     global appname
  117.     toplevel .uwin -class Dialog
  118.     wm title .uwin "How to uninstall $appname"
  119.     frame .uwin.top -relief raised -border 1
  120.     pack .uwin.top -side top -fill both
  121.     frame .uwin.bot -relief raised -border 1
  122.     pack .uwin.bot -side bottom -fill both
  123.     message .uwin.top.msg -width 6i -anchor center \
  124.     -text "How to uninstall $appname?\
  125.     \n
  126.     \nSimply remove this file. "
  127.     
  128.     pack .uwin.top.msg -side top -expand 1 -fill both -padx 5m -pady 5m
  129.     button .uwin.okbutton -text "OK" -command {destroy .uwin}
  130.     pack .uwin.okbutton -side bottom
  131.     grab .uwin
  132.     focus .uwin
  133. }
  134. #-----------------------------------------------------------------------
  135. #
  136. proc quitme {} {
  137.  
  138.     destroy .
  139. }
  140. #************************************************************************
  141.  
  142. set appname "WGETgui Tcl 1.0"
  143. set metoda ""
  144. set delka ""
  145. set id ""
  146. set validita ""
  147. set passphrase ""
  148. set w .form
  149. set uncurl ""
  150. set f ""
  151. catch {destroy $w}
  152. toplevel $w
  153. wm title $w "Sta╛enφ"
  154. wm iconname $w "Sta╛enφ soubor∙"
  155. #positionWindow $w
  156. label $w.msg -wraplength 4i -justify left -text "Wget"
  157. pack $w.msg -side top
  158. global f
  159.  
  160. ########
  161. wm title . $appname
  162.  
  163. frame .mbar -relief raised -bd 2
  164. menubutton .mbar.file -text "Soubor" -underline 0 \
  165.     -menu .mbar.file.menu
  166. menubutton .mbar.keylist -text "URL" -underline 0 \
  167.     -menu .mbar.keylist.menu
  168. menubutton .mbar.options -text "Nastavenφ" -underline 0 \
  169.     -menu .mbar.options.menu
  170. menubutton .mbar.help -text "Help" -underline 0 -menu .mbar.help.menu
  171.  
  172. menu .mbar.file.menu
  173.  
  174. .mbar.file.menu add command -label "Quit" -underline 0 \
  175.     -command {quitme}
  176. #    -accelerator "Alt+F4"
  177.  
  178. menu .mbar.keylist.menu
  179. .mbar.keylist.menu add command -label "NovΘ URL.." -underline 0 \
  180.     -command {newurl}
  181.  
  182.  
  183. menu .mbar.options.menu
  184. .mbar.options.menu add command -label "Volby.." -underline 0 \
  185.     -command {setoptions}
  186.  
  187. menu .mbar.help.menu
  188. .mbar.help.menu add command -label "About..." -underline 0 \
  189.     -command {about}
  190. .mbar.help.menu add command -label "How to uninstall..." -underline 0 \
  191.     -command {howuninstall}
  192.  
  193.  
  194.  
  195.  
  196. pack .mbar -side top -fill x
  197. pack .mbar.file .mbar.keylist .mbar.options -side left -in .mbar
  198. pack .mbar.help -side right -in .mbar
  199.  
  200.  
  201.