Programming and Scripting :: add wallpaper tool
I haven't looked at the modified wallpaper.lua yet, but I have a couple of suggestions for addWallpaper.lua
The next DSL release (including the new RC), will have file copy built into murgaLua:
murgaLua.fileCopy(source,target)
I suppose it's mostly a matter of personal preference which to choose, but if in the future you have it built to handle multiple files, the built-in copy function will probably use fewer system resources than os.execute(command).
I would seriously consider reorganizing the script to use two functions. One function is the copy, and the other is the file selector. The way you have it now is an uncommon way to present a graphical interface and commandline/drag-and-drop as two options to perform the same task. GUIs tend to be interactive and perform tasks only when the user chooses.
I would make the file selector a function triggered by a button, rather than have it be automatic and quit if you cancel.
The interface would show only if this isn't a drag/drop or filename given as a commandline parameter. Having the copy as a function would allow you to simply run that function and quit if arg[1] is present. It also provides a way for the user to browse for and copy a file, and then copy another without having to restart the program.
A minor thing that is also more personal preference, it's not necessary to specify home. Applications tend to use the current directory as the default working directory, which in DSL and other Linux systems is almost always $HOME.
Specifying that you want the file selector to start at home will force it to go back to home every time it's opened. If instead you use nil (or don't specify that option at all), it will open in the current directory anyway, but the second time around will open in the last directory chosen. When the program is restarted, it goes back to the current directory.
Sorry, I think a file mamager is the proper tool for the management of files. What if I don't want to copy, but move? What if I want to rename? All file manager functions that are best done with the already provided two file managers, dfm or emelfm.
@mikshaw: for now, ill wont use those functions, but when v4.3 of DSL is released, ill try to change the code. Also, its a good idea of you to make an input box where people can put the filename, and a button where u can select a file. I'll make that.
@robert: i made this patch/script/whatever to overcome a shortcoming in wallpaper.lua, cos a wallpaper GUI tool is just not complete without the function to add and remove wallpapers, and also, i dont think everybody wants to rename their wallpaper filenames, cos they wont see it!
Even though, if u dont want to add it to DSL, doesnt matter to me (although im a very little bit dissapointed off course ;-)) its been good learning to make this.
EDIT:
Ok, now changed addWallpaper.lua a bit. Now with browser button and an output box showing the selected wallpaper filename.
http://jaapz.fambro.nl/dump/wallpapertool.tar.gz
Here's the senaniro, user downloads very large background to home directory. Take for example the original background that you made. Then copy to /opt/.backgrounds via your mod. Now they have two copies of a very large file in their backup. To add only copy/delete functions therefore means that the use will still have to use a file manager to avoid this situation, i.e, (to delete the duplicate in home/dsl, therfore, it would be more efficent to move it. Therefore the filemanager is the more appropriate tool. Always thinking of small machines having duplicates (especially large ones) only magifies this situation, longer, slower backups, or even "broken pipe" backup situation.
Everything I write I try to keep in mind the intended use and possible ramificatons. To you, it may seem incomplete. But that is your opinion. I write in script so you can read and learn how I did things. You are free to modify and even post here, etc.
There are many GUIs that still need to be made. However as developer of DSL I reserve the right on what will be included in core DSL. There are many users whose murgaLua scripts (ucitool.lua, netcardconf.lua, flrun.lua, editor.lua, slide_puzzle.lua, and mydslBrowser.lua) have been accepted.
roberts: If you have the time, maybe you'd consider posting a list of "GUIs that still need to be made". Some of us might attack one or two of them. Typically I only come up with ideas for gui projects I know I will personally use (even though some of those projects eventually get replaced by shell scripts, file manager configs, etc). maybe there's something I haven't thought about that might be an interesting project. maybe others will feel the same.
One thing I've had in the back of my mind for some time is a wget gui, since my experiences with gwget have been anything but pleasant. The main thing that has kept me from that, though, is that I kinda want to use a murgaLua browser or progress to keep track of the download instead of opening a terminal window, but i have no idea how to do that.
Still, any Lua script that you hope to eventually put into DSL, but can't find the time or desire for any time soon, might be worth mentioning to the rest of us.
Next Page...
original here.