You are not logged in.
Pages: 1
Hey all,
this is my 1st public script (1st proper script in python) so i applogise for any sloppy code
this basicly genrates a pipmenu that list the contents of your home directory a bit like the places menu in a ubuntu installation
All Sugestions are welcome and i've not yet done the show hidden files section
some of this code comes from obm-dir
#!/usr/bin/python -O
#ver 0.2
## some of this code is stolen from obm-dir
## Credit where credit is due
import obxml, sys, os, time
## Check we have the right number of args
### arg 1 Filemanager
###Set Home Dir#
homedir= os.path.expanduser('~')
menulist = []
menu = obxml.ObMenu()
menu.newPipe()
#os.path.expanduser('~') opps
## Stolen :)
if len(sys.argv) == 1:
menu.createItem(None, "ERROR: Wrong number of arguments:", "Execute", "true")
menu.createItem(None, "%s command" % (sys.argv[0]), "Execute", "true")
menu.printXml()
sys.exit(1)
filelist=(os.listdir(homedir))
for each in filelist:
#print each[0:1], each
if each[0:1] =='.' :
exit #Possibly add the option for showing hidden files
else:
menulist.append(each) #create a new list so we can play around with it
menulist.sort()
#for each in menulist:
# (mid,lst) = each
#menu.createMenu(None, 'dirlist', 'dirlist') this seems to be for submenus
for each in menulist:
menu.createItem('dirlist', each, "execute",(sys.argv[1]) +" " +homedir +"/" + each)
# for itm in lst:
# menu.createItem(mid, itm, "execute", sys.argv[2] + " " + ("\"" + sys.argv[1] + "/" + itm + "\""))
menu.printXml()
simply add this to your menu.xml and add your filemanager to the end so documents.py thunar
Thanks
Matthew
Added screen shot
Last edited by genisis300 (2008-09-24 22:06:31)
"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson
Offline
Pages: 1