Comments (3)
It seems that I have a problem with @easycallback
. The test is broken, but the following test, not using easycallback, runs nicely :
import asyncio
import quamash
QThread, QObject = quamash.QtCore.QThread, quamash.QtCore.QObject
from PyQt5.QtCore import pyqtSignal
app = quamash.QApplication([])
global_thread = QThread.currentThread()
called = False
class MyObject(QObject):
def mycallback(self):
global global_thread, mythread, called
cur_thread = QThread.currentThread()
assert cur_thread is not global_thread
assert cur_thread is mythread
called = True
class Signalizer(QObject):
signaling = pyqtSignal()
mythread = QThread()
mythread.start()
myobject = MyObject()
myobject.moveToThread(mythread)
signer = Signalizer()
signer.signaling.connect(myobject.mycallback)
@asyncio.coroutine
def mycoroutine():
signer.signaling.emit()
loop = quamash.QEventLoop(app)
asyncio.set_event_loop(loop)
with loop:
loop.run_until_complete(mycoroutine())
assert called is True
I'm using PyQt5 5.5.1 and python 3.4.3.
If connect this custom Signaler with using a lambda, I get an error again :
signer.signaling.connect(lambda: myobject.mycallback())
(cutecoin) ➜ quamash git:(master) ✗ python bug.py
Traceback (most recent call last):
File "bug.py", line 28, in <lambda>
signer.signaling.connect(lambda: myobject.mycallback())
File "bug.py", line 16, in mycallback
assert cur_thread is not global_thread
AssertionError
This bug seems present on windows : https://ci.appveyor.com/project/harvimt/quamash/branch/master/job/48blugynxumjoo5p
from quamash.
_easycallback will probably be removed in future versions of Quamash, so I
wouldn't rely on it.
This code:
https://github.com/harvimt/quamash/blob/depinject5realz/quamash/__init__.py#L133-L142
is used instead.
On Thu, Dec 10, 2015 at 1:13 PM, Insoleet [email protected] wrote:
It seems that I have a problem with @easycallback . The test is broken,
but the following test, not using easycallback, runs nicely :import asyncio
import quamash
QThread, QObject = quamash.QtCore.QThread, quamash.QtCore.QObjectfrom PyQt5.QtCore import pyqtSignal
app = quamash.QApplication([])global_thread = QThread.currentThread()
called = Falseclass MyObject(QObject):
def mycallback(self):
global global_thread, mythread, called
cur_thread = QThread.currentThread()
assert cur_thread is not global_thread
assert cur_thread is mythread
called = True
class Signalizer(QObject):
signaling = pyqtSignal()mythread = QThread()
mythread.start()
myobject = MyObject()
myobject.moveToThread(mythread)
signer = Signalizer()
signer.signaling.connect(myobject.mycallback)
@asyncio.coroutinedef mycoroutine():
signer.signaling.emit()loop = quamash.QEventLoop(app)
asyncio.set_event_loop(loop)with loop:
loop.run_until_complete(mycoroutine())assert called is TrueI'm using PyQt5 5.5.1 and python 3.4.3.
—
Reply to this email directly or view it on GitHub
#58 (comment).
from quamash.
and by probably I mean the next version 😄
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.