[Pkg-bitcoin-commits] [python-quamash] 05/269: put example code in ..code:: directive so it renders nice

Jonas Smedegaard dr at jones.dk
Fri Nov 24 11:26:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository python-quamash.

commit 84000fc4aef74fd84322b551673fb0096ce36c06
Author: Mark Harviston <mark.harviston at gmail.com>
Date:   Tue Jun 11 15:40:40 2013 -0700

    put example code in ..code:: directive so it renders nice
---
 README | 50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/README b/README
index d09a636..080300f 100644
--- a/README
+++ b/README
@@ -8,38 +8,44 @@ Tulip API for the Qt Event-Loop
 Usage
 =====
 
-import quamash
-import tulip
-import time
+.. code:: python
 
-from PyQt4 import QtCore, QtGui
-# - or - #
-from PySide import QtCore, QtGui
+    import quamash
+    import tulip
+    import time
 
-def identity(x):
-	time.sleep(10)
-	return x
+    from PyQt4 import QtCore, QtGui
+    # - or - #
+    from PySide import QtCore, QtGui
 
- at quamash.task
-def my_task(loop, executor):
-	for x in range(5):
-		y = yield from loop.run_in_executor(executor, identity, x)
-		assert x == y
+    def identity(x):
+        time.sleep(10)
+        return x
 
-if __name__ == '__main__':
-	app = QApplication
-	loop = quamash.QEventLoop(app)
+    @quamash.task
+    def my_task(loop, executor):
+        for x in range(5):
+            y = yield from loop.run_in_executor(executor, identity, x)
+            assert x == y
 
-	win = QtGui.QMainWindow()
-	win.show()
+        loop.stop()
 
-	with loop:
-		
+    if __name__ == '__main__':
+        app = QApplication
+        loop = quamash.QEventLoop(app)
+        executor = quamash.QThreadExecutor(5)
+
+        win = QtGui.QMainWindow()
+        win.show()
+
+        with loop, executor:
+            loop.call_soon(my_task, loop, executor)
+            loop.run_forever()
 
 
 Name
 ====
-Tulip related projects are being named after other flowers, Quamash starts with a "Q".
+Tulip related projects are being named after other flowers, Quamash is one of the few flowers that starts with a "Q".
 
 License
 =======

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git



More information about the Pkg-bitcoin-commits mailing list