gamera (3.3.3-2) gendoc-draw-text.diff

Summary

 doc/draw_text_helper.py |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 doc/gendoc.py           |    2 ++
 2 files changed, 48 insertions(+)

    
download this patch

Patch contents

Description: use pre-built image for draw_text plugin
 Use a pre-built image for the draw_text plugin documentation example if X
 server is not available.
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Last-Update: 2012-04-18

--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -5,6 +5,8 @@
 import wxversion
 wxversion.select(["2.8", "2.6", "2.5", "2.4"])
 
+import draw_text_helper
+
 if __name__ == "__main__":
    core.init_gamera()
    gendoc.gendoc(classes=[
--- /dev/null
+++ b/doc/draw_text_helper.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+# This script (including  the following line) was generated by running itself:
+DATA = 320, 300, 'QlpoOTFBWSZTWdT8V9AAWJt//5JJJJJJJpJZJJJBIpCpJJJJJppNpLJJJIBJJEKVJJLI4A/ufO53Prd6Mni97e15cWWKl3prPPd7eeNnbwdWntjmcc3tyAHoZvduEiQQnop6BTap4EnkjT1NPTUMTamRpp6gDQB6mjIJETIiapijGSDIA0aAAaGgAAAADhoZNNDTI0NMjIMjI0MgMTRk0AZMjEMJNSJNBMmTCamjTKAGgNqPUGjQAGgAHqApKpKbTaICNGifqBPQEMI9QwAGpkYAnoAIkiaelIZFNT1P0oaA0DR6magANAABoDQPagQc/V5u+jPOOthnhRyPQ0BV7HVgNrJhTdUAuymBSUwmoQmoScE+f5aDbk21aqrVyDSMARwBCFJOcQ3sIZECzwYTB4488CGYm4PfFJFDpDEO05LlI90SiLqei/RhTExF1LPDphJx6KwVnuzkkpqk64N0UuMeSzI5WBtE8+pJxBBpGOtxnJZKqQnBtIC+ZWcCc81dIbCXWDRtqiAYai4Ps9M3fRYmVL82mOHtrYzxuqGOTXqkF7EsGJYNLSKCBlEIZqM9iEqM1pNqQLOlKZSdpIFVUimiBcBuPSC9IIOIi+o4pXO6JE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CGNjROYgkqIUt2RImEC7Ly1RkRiMFVJxsNxdxeJhOIu5UqZMHISqLaxc4YKXaM6i4QyosURbRmmqpBpgsstgrx1cq46fhlz/wLuSKcKEhqfivoA=='
+
+import sys
+import os
+import bz2
+import base64
+
+from gamera.core import init_gamera, Point, Dim, RGB, DENSE
+from gamera import plugin
+from gamera.plugins.draw import draw_text
+from gamera.plugins.string_io import _from_raw_string
+
+sys.stdout = file(os.devnull, 'w')
+init_gamera()
+sys.stdout = sys.__stdout__
+
+if __name__ == '__main__':
+	if not os.getenv('DISPLAY'):
+		print >>sys.stderr, 'This script needs access to an X server'
+		sys.exit(1)
+	import wxversion
+	wxversion.select(['2.8', '2.6', '2.5', '2.4'])
+	image = draw_text().__doc_example1__()
+	raw_string = image._to_raw_string()
+	bz2_string = bz2.compress(raw_string)
+	base64_string = base64.b64encode(bz2_string)
+	for line in open(__file__, 'rt'):
+		if line.startswith('DATA = '):
+			sys.stdout.write('DATA = %d, %d, %r\n' % (image.dim.ncols, image.dim.nrows, base64_string))
+		else:
+			sys.stdout.write(line)
+	sys.exit(0)
+
+if not os.getenv('DISPLAY'):
+	ncols, nrows, base64_string = DATA
+	bz2_string = base64.decodestring(base64_string)
+	raw_string = bz2.decompress(bz2_string)
+	image = _from_raw_string(Point(0, 0), Dim(ncols, nrows), RGB, DENSE, raw_string)
+	def static_draw_text_example(self, image=image):
+		return image
+	plugin.plugin_methods[RGB]['Draw']['draw_text'].doc_examples = [static_draw_text_example]
+
+# vim:ts=4 sw=4 noet