Comments (6)
adding app.setQuitOnLastWindowClosed(False)
makes everything work correctly.
from quamash.
this looks like it's working as expected. The wizard closes, then the application quits because all windows attached to the application are closed, but the asyncio loop attached to the QApplication hasn't closed yet. You either need the extra QWidget or you need to reorganize your application.
Example reordering:
async def amain():
global app # not technically needed, but adds clarity
wiz1 = QWizard()
wiz1.addPage(QWizardPage())
wiz1.setWindowTitle("First Wizard")
result = await async_dialog_exec(wiz1)
if result != QDialog.Accepted:
app.quit()
return
wiz2 = QWizard()
wiz2.addPage(QWizardPage())
wiz2.setWindowTitle("Second Wizard")
result = await async_dialog_exec(wiz2)
if result != QDialog.Accepted:
app.quit()
return
app.quit()
app = QApplication(sys.argv)
loop = QEventLoop(app)
asyncio.set_event_loop(loop)
with loop:
asyncio.ensure_future(amain())
loop.run_forever()
Just because this is expected doesn't mean it's the best way for quamash to be designed. (perhaps the loop should wrap a QtCore.QEventLoop
or QtCore.QThread
instead of a QApplication
in order to keep app from quitting until the future run with run_until_complete
exits
from quamash.
This is now a sort of feature request that's essentially a duplicate of #33. In all cases so far there's been a workaround, but nested execs are a thing people expect to be able to do since you can do them in vanilla Qt.
from quamash.
I re-read this and I will need to investigate further.
from quamash.
hrm. I'm not able to reproduce (I'm on Mac OS X using python 3.5.2 and PyQt5.6) I'll try on windows and linux when I get home.
from quamash.
replicated on windows. In all cases the problem is that the loop exits when all windows are closed, so a dummy window that keeps the app open and the
do to the magic of duck typing, this will work:
app = QApplication(sys.argv)
wiz1 = QWizard()
wiz1.addPage(QWizardPage(wiz1))
wiz1.setWindowTitle("First Wizard")
loop = QEventLoop(wiz1)
asyncio.set_event_loop(loop)
with loop:
loop.run_forever()
wiz2 = QWizard()
wiz2.addPage(QWizardPage(wiz2))
wiz2.setWindowTitle("Second Wizard")
loop = QEventLoop(wiz2)
asyncio.set_event_loop(loop)
with loop:
loop.run_forever()
from quamash.
Related Issues (20)
- Interest in creating a conda-forge package
- asyncio.async is deprecated since python 3.4.4, use asyncio.ensure_future instead HOT 4
- exceptions not set on pending futures
- unnecessary warnings HOT 6
- Release tagging HOT 1
- PipeServer closure race
- asyncio.create_task is not working
- Intalling quamash using PIP forces install of both pyside2 and pyqt5 HOT 9
- [Bug or Feature Requests] aioredis connect raise 'Event callback failed'
- Problem with Anaconda HOT 1
- the anaconda navigator dose not open HOT 1
- call asyncio.sleep(0.1) RuntimeError: no running event loop
- AttributeError: module 'collections' has no attribute 'Mapping' HOT 1
- [python3.10] implicit float to int conversion
- Update package on PyPI?
- Release 0.6.2 HOT 5
- RuntimeError: no running event loop HOT 1
- Module 'collections' has no attribute 'Mapping' HOT 1
- collections.Mapping has been removed HOT 1
- SyntaxError: Non-ASCII character in quamash/__init__.py
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quamash.