Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (5) </ [1] 2 3 4 5 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: wget gui, in lua< Next Oldest | Next Newest >
jaapz Offline





Group: Members
Posts: 129
Joined: May 2007
Posted: Mar. 31 2008,15:53 QUOTE

I was planning to make a wget gui some time ago, and now as mikshaw mentioned it, i started one. For now its only a simple base, it can only download to the dir the lua script is in, but i will add some more features later, cos wget has a LOT of features.
Feel free to edit the code, but please post it here again when u r done :).

EDIT: updated script

Code Sample

#!/bin/lua
-- Written by Jaap Broekhuizen aka Jaapz
-- This script is released under the terms of the GPL2 License

-- aswg.lua
--- A Simple Wget Gui written in murgaLua

prefix = os.getenv("HOME").."/"

--Main
w = fltk:Fl_Window(300,110,"ASWG for DSL")
w:callback(
function(w)
 os.exit(0)
end)

text = fltk:Fl_Box(135,5,30,30,"Fill in the URL of the file you want to download.")

urlInput = fltk:Fl_Input(5,35,290,30)
urlInput:value("http://")

okBtn = fltk:Fl_Return_Button(5,75,50,25,"Ok")
okBtn:callback(
function(okBtn)
 url = urlInput:value()
 os.execute("aterm +tr -geometry 80x4 -e wget --directory-prefix=" ..prefix.. " " ..url)
end)

closeBtn = fltk:Fl_Button(60,75,50,25,"Close")
closeBtn:callback(
function(closeBtn)
 os.exit(0)
end)

optionsBtn = fltk:Fl_Button(115,75,60,25,"Options")
optionsBtn:callback(
function(optionsBtn)
 optionsw = fltk:Fl_Window(300,110,"Options")

 preftext = fltk:Fl_Box(135,5,30,30,"Target Directory:")
 prefixval = fltk:Fl_Input(5,35,290,30)
 prefixval:value(prefix)

 applyBtn = fltk:Fl_Button(100,75,100,25,"Apply")
 applyBtn:callback(
 function(applyBtn)
   prefix = prefixval:value()
   optionsw:hide()
 end)

 optionsw:show()
end)

helpBtn = fltk:Fl_Button(245,75,50,25,"Help")
helpBtn:callback(
function(helpBtn)
 fltk:fl_message([[A Simple Wget GUI, written in murgaLua.

The files will be automatically downloaded to your home directory,
unless otherwise specified.
Click on the "Options" button to edit the options.]])
end)

w:show()
Fl:run()
Back to top
Profile PM 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Mar. 31 2008,17:27 QUOTE

Quote
Feel free to edit the code

I did by stripping out over a quarter of the lines (11?) that tell me about you and your copyright instead of actually doing something with wget.:)

I'll see if I can find my tcl/tk scripts for wget. My last version allowed recursion of N levels, select file extension, etc. And mine's not even copyrighted because I figured it's just a front end to someone else's program...


--------------
"It felt kind of like having a pitbull terrier on my rear end."
-- meo (copyright(c)2008, all rights reserved)
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Mar. 31 2008,18:09 QUOTE

Code Sample
 os.execute("aterm +tr -geometry 80x4 -e wget " ..url)


This is what I have used many times. Do a grep 80x4 /usr/bin/*.lua

We didn't have popen until much later when murgaLua added it.

A better goal would be not to do another os.execute of a wget hosted by aterm, but instead without the os.execute and without the hosting aterm.

Possibly io.popen - see examples of netcardconf.lua and printing.lua
then add a murgaLua progess meter.


Edited by roberts on Mar. 31 2008,18:10
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Mar. 31 2008,18:15 QUOTE

in my opinion, a person that puts in the work required to make something useful or creative deserves to put his name on it.  I don't see a frontend as being part of the backend, but a compliment to it, so I think a copyright notice or a simple "written by so-and-so" is perfectly acceptable.

What I dislike is dishonesty and selfishness. A person deliberately writing code that no one but himself can understand, or  adding a license prohibiting users from modifying/improving the code, even for personal use.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Mar. 31 2008,18:18 QUOTE

Quote
Possibly io.popen - see examples of netcardconf.lua and printing.lua
then add a murgaLua progess meter.
This is exactly what kept me from starting this project. I don't know how to keep checking on the progress...guessing it requires coroutine, which I've never learned.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
21 replies since Mar. 31 2008,15:53 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (5) </ [1] 2 3 4 5 >/
reply to topic new topic new poll
Quick Reply: wget gui

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code