Skip to main content

Implementation of the PEP 3156 Event-Loop with Qt

Project description

https://travis-ci.org/harvimt/quamash.png?branch=master

Requirements

Quamash requires Python 3.4 and either PyQt 5 or PySide.

Installation

pip install quamash

Usage

import sys
import asyncio
import time

from PyQt5.QtWidgets import QApplication, QProgressBar
from quamash import QEventLoop, QThreadExecutor

app = QApplication(sys.argv)
progress = QProgressBar()
loop = QEventLoop(app)

progress.setRange(0, 99)
progress.show()

@asyncio.coroutine
def master():
    yield from first_50()
    with QThreadExecutor(1) as exec:
        yield from loop.run_in_executor(exec, last_50)
    # TODO announce completion?

@asyncio.coroutine
def first_50():
    for i in range(50):
        progress.setValue(i)
        yield from asyncio.sleep(.1)

def last_50():
    for i in range(50,100):
        loop.call_soon_threadsafe(progress.setValue, i)
        time.sleep(.1)

with loop:
    loop.run_until_complete(master())

Testing

Quamash is tested with pytest; in order to run the test suite, just execute py.test on the commandline. The tests themselves are beneath the ‘tests’ directory.

License

You may use, modify, and redistribute this software under the terms of the BSD License. See LICENSE.

Name

Tulip related projects are being named after other flowers, Quamash is one of the few flowers that starts with a “Q”.

Project details


Release history Release notifications

History Node

0.6.0

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5

History Node

0.4.1

History Node

0.4

This version
History Node

0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Quamash-0.3.zip (13.5 kB) Copy SHA256 hash SHA256 Source None Jul 18, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page