|
Revision 24441, 0.8 KB
(checked in by thijs, 2 years ago)
|
|
Merge maintainer-email-2438: Get rid of references to maintainer email addresses from code.
Author: thijs
Reviewer: exarkun
Fixes: #2438
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | """ |
|---|
| 6 | This module integrates PyUI with twisted.internet's mainloop. |
|---|
| 7 | |
|---|
| 8 | Maintainer: Jp Calderone |
|---|
| 9 | |
|---|
| 10 | See doc/examples/pyuidemo.py for example usage. |
|---|
| 11 | """ |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | import pyui |
|---|
| 15 | |
|---|
| 16 | def _guiUpdate(reactor, delay): |
|---|
| 17 | pyui.draw() |
|---|
| 18 | if pyui.update() == 0: |
|---|
| 19 | pyui.quit() |
|---|
| 20 | reactor.stop() |
|---|
| 21 | else: |
|---|
| 22 | reactor.callLater(delay, _guiUpdate, reactor, delay) |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | def install(ms=10, reactor=None, args=(), kw={}): |
|---|
| 26 | """ |
|---|
| 27 | Schedule PyUI's display to be updated approximately every C{ms} |
|---|
| 28 | milliseconds, and initialize PyUI with the specified arguments. |
|---|
| 29 | """ |
|---|
| 30 | d = pyui.init(*args, **kw) |
|---|
| 31 | |
|---|
| 32 | if reactor is None: |
|---|
| 33 | from twisted.internet import reactor |
|---|
| 34 | _guiUpdate(reactor, ms / 1000.0) |
|---|
| 35 | return d |
|---|
| 36 | |
|---|
| 37 | __all__ = ["install"] |
|---|