ZipFile and file rigths

2005-07-10 Thread perchef
hi,

i have written this small code which allow me to unzip files using
python :

import zipfile
import os
import os.path

pathDir="/home/toto/Desktop"
pathZip= os.path.join(pathDir,"foobar.zip")

if zipfile.is_zipfile(pathZip):
zf = zipfile.ZipFile(pathZip)

for file in zf.namelist():
newPath = os.path.join(pathDir,file)
print newPath
if not file.endswith('/') and not os.path.exists(newPath) :
newFile = open(newPath, 'wb')
newFile.write(zf.read(file))
newFile.flush()
newFile.close()
else :
os.makedirs(newPath)

zf.close()
else:
print pathZip + " is not a zip file"

it works well but i have a small problem : i can't see how i can deal
with file rights.
When I unzip files with this script all the unzipped files haven't the
good rights.
for example :
   with this script :
   -rw-r--r-- foo.exe
   with a traditional zip program (ie : stuffit ):
   -rwxr-xr-x foo.exe
ZipInfo objects doesn't store informations about rights ?
(http://www.python.org/doc/current/lib/zipinfo-objects.html#zipinfo-objects)

How can i fix this ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZipFile and file rigths

2005-07-10 Thread perchef
ok thanks, it works even if it's a little bit dirty.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZipFile and file rigths

2005-07-10 Thread perchef
> ZIP doesn't store file permissions.
ok, but in that case how could stuffit retrieve these permissions ?

Thanks for the link Robert.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZipFile and file rigths

2005-07-11 Thread perchef
> OTOH, I don't know if this has any relevance to the problem that you are 
> seeing.

not really, i have used the 'os.chmod' trick, but it's still
interesting.
thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython, Tree and Checkbox

2005-07-26 Thread perchef
Hello,

I'm looking for a way to select some leafs in a tree.
My idea is to use a TreeListCtrl, with the tree in the first column and
checkboxes in the second.
But I don't know how to do this, tree items seems only to be able to
contain text, not a wx-object.

ideas or suggestion are welcome.

-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython and threads again

2005-08-10 Thread perchef
Hi,

I have several files to download and a GUI to update. I know this is a
frequently asked question but i can't find an appropriate solution.
My Downloader extends threading.Thread and update a wx.Gauge in GUI
during the process.

for src in urls:
   downloader = Downloader( src, destination, GUI )
   downloader.start()

#work with the downloaded files...

If i don't use a downloader.join() in this for loop, I launch several
threads at the same time and so my wx.Gauge is bouncing up and down.
If i do add the downloader.join() my GUI is no more updated ( in fact,
nothing appears, it's frozen )
How can I wait the end of the thread and also be able to update the GUI
?
( I have to wait, otherwise I will work uncompleted files )

Any way to work around it?
Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython and threads again

2005-08-10 Thread perchef
thanks for all these advices.
I think a custom event will be the way to go.
for the moment I use something _really_ ugly : a mix between GUI,
threads and recursive fonctions.

-- 
http://mail.python.org/mailman/listinfo/python-list


wx.MessageDialog displayed without components inside

2005-08-13 Thread perchef
Is there a reason why a wx.MessageDialog would be displayed without
components inside ?

this :

md = wx.MessageDialog(None,'foo','bar',wx.YES_NO)
result = md.ShowModal()
md.Destroy()

In my application, give me :
http://img252.imageshack.us/my.php?image=messagedialog6nw.jpg

This isn't a bug in wxPython because when I use the same code in
pyshell I obtain the expected result. So, there must be a reason but I
can't figure out why.

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wx.MessageDialog displayed without components inside

2005-08-13 Thread perchef
nope, I have put md.Destroy() away and it didn't change something.
I don't think that's the problem because ShowModal() is a blocking
method, execution is stop until you press YES or NO (in my case with
wx.YES_NO)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wx.MessageDialog displayed without components inside

2005-08-14 Thread perchef

> Just a thought, do you call the event loop ?
yes i do.
I really can't see my a MessageDialog would appear without components
inside. maybe a thread problem ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wx.MessageDialog displayed without components inside

2005-08-14 Thread perchef
yes, it did work.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: get a list of mounted filesystems under MacOSX

2005-08-16 Thread perchef
maybe you can catch the result of  /bin/df and parse it.

-- 
http://mail.python.org/mailman/listinfo/python-list