Re: PyQt4.Gui.QFileDialog
Janwillem van Dijk <jwevandijk <at> xs4all.nl>
2011-11-01 11:27:45 GMT
I am sorry to say that this does not help either. On linux the
dialog shows until the sleep finishes on windows it exits as soon as
the button is clicked as expected.
For the time being I changed to traits. Bit heavy weight perhaps but
give the opportunity to have a few other parameters conveniently
adjusted too.
Thanks again, Janwillem
On 10/31/2011 10:19 AM, Vincent Vande Vyvre wrote:
Le 31/10/11 10:07, Vincent Vande Vyvre a écrit :
Le 31/10/11 09:32, Matteo Boscolo a écrit :
Try
this after instantiate the application:
app.setQuitOnLastWindowClosed(False)
and this after closing the dialog:
app.closeAllWindows()
I use this in some case in my com application .. hope it helps
Regards,
Matteo
Il 31/10/2011 09:08, Janwillem ha scritto:
Thanks, yes I see, that is under
windows (XP on VirtualBox, python 2.7.1 and
pyqt4 4.7.2 in my case) but under linux (ubuntu 11.10,
python 2.7.2+ and
pyqt 4.7.3) it only closes after the sleep has finished (or
in case of my
practical application, until the data processing finished)
So any tips from a ubuntu user???
cheers, Janwillem
Matteo Boscolo wrote:
with this configuration
Python 2.6.6
PyQt4 4.7.3
open dialog
dialog finished
C:\Users\mboscolo\Documents\.bzr.log
finished
it works perfectly .. after press the opendialog the form
is closed and
start to print the rest of the debug
regards,
Matteo
Il 31/10/2011 08:07, Janwillem ha scritto:
I want a small script with just a
few filedialogs not a full blown gui
application . However when I try the code below the
dialog does not
disappear after clicking the Open button on the dialog
but stays on top
until the script exits. What am I doing wrong??
Thanks, Janwillem
def open_files(default_dir=None):
"""Returns list of filenames optionally given a
default dir"""
from sys import argv
from os import environ
from PyQt4.QtGui import QApplication,
QFileDialog,QWidget
if default_dir == None:
default_dir = environ['HOME']
app = QApplication(argv)
fdialog = QFileDialog
filenames =
fdialog.getOpenFileNames(directory=default_dir)
app.exit()
return list(filenames)
if __name__ == '__main__':
from PyQt4.QtCore import QT_VERSION_STR
from platform import python_version
print('Python %s' % (python_version()))
print('PyQt4 %s' %QT_VERSION_STR)
print('open dialog')
lst = open_files()
print('dialog finished')
for fname in lst:
print(fname)
import time
time.sleep(2)
print 'finished'
_______________________________________________
PyQt mailing list PyQt <at> riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt <at> riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
No problem for me on Ubuntu 10.04
vincent <at> tiemoko:~/Bureau$ python test.py
Python 2.6.5
PyQt4 4.6.2
open dialog
dialog finished
/home/vincent/Documents/gabarit_cd.svg
finished
vincent <at> tiemoko:~/Bureau$
_______________________________________________
PyQt mailing list PyQt <at> riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Works as expected too on 11.10
vincent <at> bacoudian:~/Bureau$ python test.py
Python 2.7.2+
PyQt4 4.7.3
open dialog
dialog finished
/home/vincent/examples.desktop
finished
vincent <at> bacoudian:~/Bureau$
_______________________________________________
PyQt mailing list PyQt <at> riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
<div>
I am sorry to say that this does not help either. On linux the
dialog shows until the sleep finishes on windows it exits as soon as
the button is clicked as expected.<br>
For the time being I changed to traits. Bit heavy weight perhaps but
give the opportunity to have a few other parameters conveniently
adjusted too.<br>
Thanks again, Janwillem<br><br><br>
On 10/31/2011 10:19 AM, Vincent Vande Vyvre wrote:
<blockquote cite="mid:4EAE681A.9000002 <at> swing.be" type="cite">
Le 31/10/11 10:07, Vincent Vande Vyvre a écrit :
<blockquote cite="mid:4EAE6540.40300 <at> swing.be" type="cite">
Le 31/10/11 09:32, Matteo Boscolo a écrit :
<blockquote cite="mid:4EAE5D25.8060704 <at> boscolini.eu" type="cite">Try
this after instantiate the application: <br>
app.setQuitOnLastWindowClosed(False) <br><br>
and this after closing the dialog: <br>
app.closeAllWindows() <br><br>
I use this in some case in my com application .. hope it helps
<br><br>
Regards, <br>
Matteo <br><br><br><br>
Il 31/10/2011 09:08, Janwillem ha scritto: <br><blockquote type="cite">Thanks, yes I see, that is under
windows (XP on VirtualBox, python 2.7.1 and <br>
pyqt4 4.7.2 in my case) but under linux (ubuntu 11.10,
python 2.7.2+ and <br>
pyqt 4.7.3) it only closes after the sleep has finished (or
in case of my <br>
practical application, until the data processing finished) <br>
So any tips from a ubuntu user??? <br>
cheers, Janwillem <br><br><br>
Matteo Boscolo wrote: <br><blockquote type="cite">with this configuration <br>
Python 2.6.6 <br>
PyQt4 4.7.3 <br>
open dialog <br>
dialog finished <br>
C:\Users\mboscolo\Documents\.bzr.log <br>
finished <br><br>
it works perfectly .. after press the opendialog the form
is closed and <br>
start to print the rest of the debug <br><br>
regards, <br>
Matteo <br><br>
Il 31/10/2011 08:07, Janwillem ha scritto: <br><blockquote type="cite">I want a small script with just a
few filedialogs not a full blown gui <br>
application . However when I try the code below the
dialog does not <br>
disappear after clicking the Open button on the dialog
but stays on top <br>
until the script exits. What am I doing wrong?? <br>
Thanks, Janwillem <br><br>
def open_files(default_dir=None): <br>
"""Returns list of filenames optionally given a
default dir""" <br>
from sys import argv <br>
from os import environ <br>
from PyQt4.QtGui import QApplication,
QFileDialog,QWidget <br>
if default_dir == None: <br>
default_dir = environ['HOME'] <br>
app = QApplication(argv) <br>
fdialog = QFileDialog <br>
filenames =
fdialog.getOpenFileNames(directory=default_dir) <br>
app.exit() <br>
return list(filenames) <br><br>
if __name__ == '__main__': <br>
from PyQt4.QtCore import QT_VERSION_STR <br>
from platform import python_version <br>
print('Python %s' % (python_version())) <br>
print('PyQt4 %s' %QT_VERSION_STR) <br>
print('open dialog') <br>
lst = open_files() <br>
print('dialog finished') <br>
for fname in lst: <br>
print(fname) <br>
import time <br>
time.sleep(2) <br>
print 'finished' <br><br>
</blockquote>
_______________________________________________ <br>
PyQt mailing list <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PyQt <at> riverbankcomputing.com">PyQt <at> riverbankcomputing.com</a>
<br><a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
<br><br><br>
</blockquote>
</blockquote>
<br>
_______________________________________________ <br>
PyQt mailing list <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PyQt <at> riverbankcomputing.com">PyQt <at> riverbankcomputing.com</a>
<br><a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
<br><br>
</blockquote>
No problem for me on Ubuntu 10.04<br><br>
vincent <at> tiemoko:~/Bureau$ python test.py <br>
Python 2.6.5<br>
PyQt4 4.6.2<br>
open dialog<br>
dialog finished<br>
/home/vincent/Documents/gabarit_cd.svg<br>
finished<br>
vincent <at> tiemoko:~/Bureau$<br><br><div class="moz-signature">-- <br>
Vincent V.V.<br><a moz-do-not-send="true" href="https://launchpad.net/oqapy">Oqapy</a>
. <a moz-do-not-send="true" href="https://launchpad.net/qarte+7">Qarte+7</a> . <a moz-do-not-send="true" href="https://launchpad.net/paqager">PaQager</a>
</div>
_______________________________________________
PyQt mailing list <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PyQt <at> riverbankcomputing.com">PyQt <at> riverbankcomputing.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
</blockquote>
Works as expected too on 11.10<br><br>
vincent <at> bacoudian:~/Bureau$ python test.py <br>
Python 2.7.2+<br>
PyQt4 4.7.3<br>
open dialog<br>
dialog finished<br>
/home/vincent/examples.desktop<br>
finished<br>
vincent <at> bacoudian:~/Bureau$<br><br><div class="moz-signature">-- <br>
Vincent V.V.<br><a moz-do-not-send="true" href="https://launchpad.net/oqapy">Oqapy</a>
. <a moz-do-not-send="true" href="https://launchpad.net/qarte+7">Qarte+7</a> . <a moz-do-not-send="true" href="https://launchpad.net/paqager">PaQager</a>
</div>
<br><br>_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt <at> riverbankcomputing.com">PyQt <at> riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
</blockquote>
<br>
</div>