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: add wallpaper tool, yep, thats what im making< Next Oldest | Next Newest >
jaapz Offline





Group: Members
Posts: 129
Joined: May 2007
Posted: Mar. 25 2008,15:07 QUOTE

hi,

im making a addWallpaper.lua tool, wich ads a wallpaper to /opt/.backgrounds. Now i got the problem that the fltk filechooser returns a full path of the selected wallpaper, like /home/dsl/image.png. I just need the image.png piece of that... It should be possible with regexes, but i have no clue how i would do it. Can anybody help me? (mikshaw :P)

Thanks for your help,
Jaapz
Back to top
Profile PM 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Mar. 25 2008,15:19 QUOTE

Are you using Robert's wallpaper.lua as a base (not sure if it's still in DSL 4, but probably still in DSL 3)?

--------------
"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. 25 2008,15:39 QUOTE

We already have a wallpaper.lua.

There are many examples for the  question you are asking. Do you know how to use grep?

Just grep for the lua construct over /usr/local/bin/*.lua
Back to top
Profile PM WEB 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Mar. 25 2008,16:13 QUOTE

If you just wanted some kind of simple matching pattern, you could use something like [^\/]*$ with string:match (not sure if you'll need to escape the / )

I think these need to be asked:
- is this for personal learning?
- if not, are you adding anything that the current wallpaper tool doesn't do?
Back to top
Profile PM 
mikshaw Offline





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

Quote
the fltk filechooser returns a full path of the selected wallpaper, like /home/dsl/image.png. I just need the image.png piece of that

use fl_filename_name()
Code Sample
image_path=fltk.fl_file_chooser("Choose an image","Image Files (*.{jp{,e}g,png,bmp,xbm,xpm,gif})",nil, nil)
if image_path then
   my_image=fltk.fl_filename_name(image_path)
   print(my_image)
end


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
20 replies since Mar. 25 2008,15:07 < 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: add wallpaper tool

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