Skip to content

Commit

Permalink
Merge branch 'gh45' into gh66
Browse files Browse the repository at this point in the history
  • Loading branch information
harvimt committed Nov 20, 2017
2 parents e5fc6b1 + e8de434 commit 9c0c66b
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 231 deletions.
30 changes: 21 additions & 9 deletions quamash/__init__.py
Expand Up @@ -171,14 +171,6 @@ class Signaller(qtimpl_qtcore.QObject):
return Signaller()


if os.name == 'nt':
from . import _windows
_baseclass = _windows.baseclass
else:
from . import _unix
_baseclass = _unix.baseclass


@with_logger
class _SimpleTimer(QtCore.QObject):
def __init__(self):
Expand Down Expand Up @@ -223,7 +215,7 @@ def stop(self):


@with_logger
class QEventLoop(_baseclass):
class _QEventLoop:

"""
Implementation of asyncio event loop that uses the Qt Event loop.
Expand Down Expand Up @@ -593,3 +585,23 @@ def __log_error(cls, *args, **kwds):
cls._logger.error(*args, **kwds)
except: # noqa E722
sys.stderr.write('{!r}, {!r}\n'.format(args, kwds))


from ._unix import _SelectorEventLoop
QSelectorEventLoop = type('QSelectorEventLoop', (_QEventLoop, _SelectorEventLoop), {})

if os.name == 'nt':
from ._windows import _ProactorEventLoop
QIOCPEventLoop = type('QIOCPEventLoop', (_QEventLoop, _ProactorEventLoop), {})
QEventLoop = QIOCPEventLoop
else:
QEventLoop = QSelectorEventLoop


class _Cancellable:
def __init__(self, timer, loop):
self.__timer = timer
self.__loop = loop

def cancel(self):
self.__timer.stop()

0 comments on commit 9c0c66b

Please sign in to comment.