本文整理汇总了Python中cairo.version方法的典型用法代码示例。如果您正苦于以下问题:Python cairo.version方法的具体用法?Python cairo.version怎么用?Python cairo.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo
的用法示例。
在下文中一共展示了cairo.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check7_sqlite3
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check7_sqlite3(self):
'''sqlite3
#TODO need to add to required section readme
https://stackoverflow.com/a/1546162
'''
self.append_text("\n")
# Start check
#SQLITE_MIN_VERSION = (0, 0, 0)
try:
import sqlite3
# sqlite3.version - pysqlite version
sqlite3_py_version_str = sqlite3.version
# sqlite3.sqlite_version - sqlite version
sqlite3_version_str = sqlite3.sqlite_version
except ImportError:
sqlite3_version_str = 'not found'
sqlite3_py_version_str = 'not found'
result = ("* SQLite Database library (sqlite3: " +
sqlite3_version_str + ") (Python-sqlite3: " +
sqlite3_py_version_str + ")")
# End check
self.append_text(result)
示例2: check13_pyicu
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check13_pyicu(self):
'''PyICU'''
self.append_text("\n")
# Start check
try:
import PyICU
try:
pyicu_str = PyICU.VERSION
icu_str = PyICU.ICU_VERSION
except Exception: # any failure to 'get' the version
pyicu_str = 'unknown version'
icu_str = 'unknown version'
except ImportError:
pyicu_str = 'not found'
icu_str = 'not found'
result = "* PyICU " + pyicu_str + "(ICU " + icu_str + ")"
# End check
self.append_text(result)
示例3: __write_text
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def __write_text(self, text, mark=None, markup=False, links=False):
"""
@param text: text to write.
@param mark: IndexMark to use for indexing
@param markup: True if text already contains markup info.
Then text will no longer be escaped
@param links: True if URLs should be made clickable
"""
if links == True:
import cairo
if cairo.cairo_version() < 11210 and self._links_error == False:
# Cairo v1.12 is suppose to be the first version
# that supports clickable links
print("""
WARNING: This version of cairo (%s) does NOT support clickable links.
The first version that is suppose to is v1.12. See the roadmap:
http://www.cairographics.org/roadmap/
The work around is to save to another format that supports clickable
links (like ODF) and write PDF from that format.
""" % cairo.version)
self._links_error = True
text = self.__markup(text, markup)
if mark:
self._active_element.add_mark(mark)
self._active_element.add_text(text)
示例4: check1_python
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check1_python(self):
'''Check python version Gramps is currently running with against min
version required
#TODO - does not handle an older version of Gramps using python 2 on
that a system that has python 3 installed (same for each of the other
test)
'''
# Start check
MIN_PYTHON_VERSION = (3, 3, 0)
min_py_str = verstr(MIN_PYTHON_VERSION)
# version to check against
# Gramps running version of python
py_str = '%d.%d.%d' % sys.version_info[:3]
check1 = "* Python "
if not sys.version_info >= MIN_PYTHON_VERSION:
#print("Failed")
messagefailed1 = " (Requires version "
messagefailed3 = " or greater installed.)\n"
messagefailed = messagefailed1 + min_py_str + messagefailed3
result = check1 + py_str + messagefailed
else:
#print("Success")
messagesuccess1 = " (Success version "
messagesuccess3 = " or greater installed.)\n"
messagesuccess = messagesuccess1 + min_py_str + messagesuccess3
result = check1 + py_str + messagesuccess
# End check
self.append_text(result)
示例5: check11_osmgpsmap
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check11_osmgpsmap(self):
'''osmgpsmap'''
# Start check
OSMGPSMAP_MIN_VERSION = (1, 0)
OSMGPSMAP_FOUND = False
try:
from gi import Repository
repository = Repository.get_default()
if repository.enumerate_versions("OsmGpsMap"):
gi.require_version('OsmGpsMap', '1.0')
from gi.repository import OsmGpsMap as osmgpsmap
try:
osmgpsmap_str = osmgpsmap._version
OSMGPSMAP_FOUND = True
except Exception: # any failure to 'get' the version
osmgpsmap_str = 'unknown version'
else:
osmgpsmap_str = 'not found'
except ImportError:
osmgpsmap_str = 'not found'
if OSMGPSMAP_FOUND:
result = ("* osmgpsmap " + osmgpsmap_str + " (Success version " +
verstr(OSMGPSMAP_MIN_VERSION) +
" or greater installed.)")
else:
result = ("* osmgpsmap " + osmgpsmap_str + " (Requires version " +
verstr(OSMGPSMAP_MIN_VERSION) + " or greater)")
# End check
self.append_text(result)
示例6: check12_graphviz
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check12_graphviz(self):
'''Graphviz
Needs the liblasi library with utf-8 support to create ps/ps2 output
GRAPHVIZ_MIN_VER = (2, 28)
https://github.com/Alexpux/MINGW-packages/issues/737#issuecomment-147185667
# bpisoj commented that Gramps needs a version of Graphviz that :
[needs additional]...library be added to msys2-mingw stack as
libann, libgts and liblasi?
I am interested in last one as only that support utf-8 characters
in ps/ps2 output.
'''
#self.append_text("\n")
# Start check
try:
dotversion_str = Popen(['dot', '-V'],
stderr=PIPE).communicate(input=None)[1]
if isinstance(dotversion_str, bytes) and sys.stdin.encoding:
dotversion_str = dotversion_str.decode(sys.stdin.encoding)
if dotversion_str:
dotversion_str = dotversion_str.replace('\n', '')[23:27]
except Exception:
dotversion_str = 'Graphviz not in system PATH'
result = "Graphviz " + dotversion_str
# End check
self.append_text(result)
示例7: check14_ghostscript
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check14_ghostscript(self):
'''Ghostscript - need to add to strongly recomended or optional?
section of readme
Q:What does it do ?
A:
https://www.gramps-project.org/wiki/index.php?title=Gramps_5.0_Wiki_Manual_-_Reports_-_part_5#Graphviz_Layout
*Number of Horizontal Pages: (1 default) Graphviz can create very
large graphs by spreading the graph across a rectangular array of
pages. This controls the number of pages in the array horizontally.
Only valid for dot and pdf via Ghostscript.
*Number of Vertical Pages: (1 default) Graphviz can create very large
graphs by spreading the graph across a rectangular array of pages.
This controls the number of pages in the array vertically.
Only valid for dot and pdf via Ghostscript.
'''
self.append_text("\n")
# Start check
try:
if win():
try:
gsvers_str = Popen(['gswin32c', '--version'],
stdout=PIPE).communicate(input=None)[0]
except Exception:
gsvers_str = Popen(['gswin64c', '--version'],
stdout=PIPE).communicate(input=None)[0]
else:
gsvers_str = Popen(['gs', '--version'],
stdout=PIPE).communicate(input=None)[0]
if isinstance(gsvers_str, bytes) and sys.stdin.encoding:
gsvers_str = gsvers_str.decode(sys.stdin.encoding)
if gsvers_str:
gsvers_str = gsvers_str.replace('\n', '')
except Exception:
gsvers_str = 'Ghostscript not in system PATH'
result = "* Ghostscript " + gsvers_str
# End check
self.append_text(result)
示例8: check17_pillow
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check17_pillow(self):
'''PILLOW
Allows Production of jpg images from non-jpg images in LaTeX documents
#TODO prculley mentions that : And PIL (Pillow) is also used by the
main Gramps ([]narrativeweb and []other reports for image cropping)
as well as [x]editexifmetadata and the
new [x]latexdoc type addons (genealogytree).
#TODO add check for PILLOW to "gramps -v" section
https://github.com/gramps-project/gramps/blob/maintenance/gramps50/gramps/plugins/docgen/latexdoc.py
'''
#self.append_text("\n")
# Start check
try:
import PIL
# from PIL import Image
try:
pil_ver = PIL.__version__
except Exception:
try:
pil_ver = str(PIL.PILLOW_VERSION)
except Exception:
try:
#print(dir(PIL))
pil_ver = str(PIL.VERSION)
except Exception:
pil_ver = "Installed but does not supply version"
except ImportError:
pil_ver = "Not found"
result = "(PILLOW " + pil_ver + ")"
# End check
self.append_text(result)
示例9: check19_geocodeglib
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check19_geocodeglib(self):
'''geocodeglib
# added to gramps master v5.1.0
#TODO: add to gramps-v check
https://github.com/gramps-project/gramps/blob/maintenance/gramps50/gramps/plugins/lib/maps/placeselection.py
'''
self.append_text("\n")
# Start check
geocodeglib_min_ver = "1.0"
try:
gi.require_version('GeocodeGlib', '1.0')
from gi.repository import GeocodeGlib
geocodeglib_ver = str(GeocodeGlib._version)
GEOCODEGLIB = True
except Exception:
geocodeglib_ver = "Not found"
GEOCODEGLIB = False
if GEOCODEGLIB:
result = ("* geocodeglib " + geocodeglib_ver +
" (Success version " + geocodeglib_min_ver +
" or greater installed.)")
else:
result = ("* geocodeglib " + geocodeglib_ver +
" (Requires version " + geocodeglib_min_ver +
" or greater installed.)")
# End check
self.append_text(result)
示例10: check22_graphview
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check22_graphview(self):
'''
Graph View - Requires: PyGoocanvas and Goocanvas and
graphviz (python-pygoocanvas, gir1.2-goocanvas-2.0)
'''
self.append_text("\n")
self.render_text("""<b>02. <a href="https://gramps-project.org/wiki"""
"""/index.php?title=Graph_View">"""
"""Addon:Graph View</a> :</b> """)
# Start check
# check for GooCanvas
try:
try:
gi.require_version('GooCanvas', '2.0')
except Exception:
print("Why, when same code works in Graphview")
from gi.repository import GooCanvas
goocanvas_ver = str(GooCanvas._version)
#print("GooCanvas version:" + goocanvas_ver)
except ImportError:
goocanvas_ver = "Not installed"
result = "(GooCanvas:" + goocanvas_ver + ")(PyGoocanvas: TBD?)"
# End check
self.append_text(result)
self.append_text("(")
self.check12_graphviz()
self.append_text(")")
示例11: check28_webconnectpacks
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check28_webconnectpacks(self):
'''Webconnect Pack - needs the gramps addon : "libwebconnect"
installed at the same time.
libwebconnect is the support Library for web site collections.
'''
self.append_text("\n")
self.render_text("""<b>08. <a href="https://gramps-project.org/wiki/"""
"""index.php?title=Web_Connect_Pack">"""
"""Addon:Webconnect Pack</a> :</b> """)
# Start check
try:
import libwebconnect
LIBWEBCONNECT_test = True
LIBWEBCONNECT_result = "Installed"
# TODO add version addon string.
except Exception:
LIBWEBCONNECT_test = False
LIBWEBCONNECT_result = "Not found"
if LIBWEBCONNECT_test:
result = "(libwebconnect : " + LIBWEBCONNECT_result + ")(Success)"
else:
result = ("(libwebconnect : " + LIBWEBCONNECT_result +
")(Requires the gramps addon listed under 'Plugin lib')")
# End check
self.append_text(result)
#self.append_text("\n")
示例12: check31_EditExifMetadata
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check31_EditExifMetadata(self):
'''Edit Image Exif Metadata -
requires:
* PIL (Pillow)
* pyexiv2 ( 0.2.0 )
* exiv2
https://github.com/gramps-project/addons-source/tree/master/EditExifMetadata
'''
self.append_text("\n")
self.render_text("""<b>11. <a href="https://gramps-project.org/"""
"""wiki/index.php?title=Edit_Image_Exif_Metadata">"""
"""Addon:Edit Image Exif Metadata</a> :</b> """)
# Start check
self.check17_pillow()
'''
# validate that pyexiv2 is installed and its version...
import pyexiv2
# v0.1 has a different API to v0.2 and above
if hasattr(pyexiv2, 'version_info'):
OLD_API = False
else:
# version_info attribute does not exist prior to v0.2.0
OLD_API = True
# validate the exiv2 is installed and its executable
system_platform = os.sys.platform
if system_platform == "win32":
EXIV2_FOUND = "exiv2.exe" if search_for("exiv2.exe") else False
else:
EXIV2_FOUND = "exiv2" if search_for("exiv2") else False
if not EXIV2_FOUND:
msg = 'You must have exiv2 and its development file installed.'
raise SystemExit(msg)
'''
# End checks
self.append_text(" ")
self.check_gexiv2()
示例13: draw_image
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def draw_image(self, gc, x, y, im):
# bbox - not currently used
if sys.byteorder == 'little':
im = im[:, :, (2, 1, 0, 3)]
else:
im = im[:, :, (3, 0, 1, 2)]
if HAS_CAIRO_CFFI:
# cairocffi tries to use the buffer_info from array.array
# that we replicate in ArrayWrapper and alternatively falls back
# on ctypes to get a pointer to the numpy array. This works
# correctly on a numpy array in python3 but not 2.7. We replicate
# the array.array functionality here to get cross version support.
imbuffer = ArrayWrapper(im.flatten())
else:
# pycairo uses PyObject_AsWriteBuffer to get a pointer to the
# numpy array; this works correctly on a regular numpy array but
# not on a py2 memoryview.
imbuffer = im.flatten()
surface = cairo.ImageSurface.create_for_data(
imbuffer, cairo.FORMAT_ARGB32,
im.shape[1], im.shape[0], im.shape[1]*4)
ctx = gc.ctx
y = self.height - y - im.shape[0]
ctx.save()
ctx.set_source_surface(surface, float(x), float(y))
if gc.get_alpha() != 1.0:
ctx.paint_with_alpha(gc.get_alpha())
else:
ctx.paint()
ctx.restore()
示例14: gramps_version
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def gramps_version(self):
'''Report Currently installed Gramps Version
#if current < installed version then mention current version?
#if current == installed version then don't mention current version?
#if current > installed version then don't mention current version
running test or development version?
https://gramps-project.org/wiki/index.php?title=Previous_releases_of_Gramps
'''
self.append_text("\n")
# Start check
LATEST_GRAMPS_VERSION = (5, 1, 2)
LATEST_GRAMPS_DATE = "2020-01-10"
latest_release_message = ("Gramps " + verstr(LATEST_GRAMPS_VERSION) +
" released " + LATEST_GRAMPS_DATE +
" is the most current version.\n")
try:
try:
from gramps.gen.const import VERSION, VERSION_TUPLE
gramps_str = VERSION
gramps_ver = VERSION_TUPLE
except ImportError:
# Gramps 3.x series
from const import VERSION, VERSION_TUPLE
gramps_str = VERSION
gramps_ver = VERSION_TUPLE
except ImportError:
gramps_str = 'not found'
# Test
if not gramps_ver >= LATEST_GRAMPS_VERSION:
# print("Failed")
result = ("You have Gramps %s. Please make a backup and then "
"upgrade.\n%s" % (gramps_str, latest_release_message))
else:
if not gramps_ver == LATEST_GRAMPS_VERSION:
result = ("You have Gramps %s installed; an unreleased "
"development version. Thank you for contributing and"
" testing; please report any issues. Backups are "
"your friend.\n" % (gramps_str))
# print(gramps_ver)
else:
# print("Success")
# TODO add further check that this is true?
result = ("You have Gramps %s. Congratulations you have the"
" current version.\n" % (gramps_str))
# End check
self.render_text(result)
#self.append_text(result)
#Requirements
示例15: check3_pygobject
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version [as 别名]
def check3_pygobject(self):
'''Check for pygobject
pygobject 3.12 or greater - Python Bindings for GLib/GObject/GIO/GTK+
https://wiki.gnome.org/Projects/PyGObject
# pygobject 3.12+
'''
# Start check
MIN_PYGOBJECT_VERSION = (3, 12, 0)
try:
from gi.repository import GObject
try:
pygobjectver_str = verstr(GObject.pygobject_version)
pygobject_result = GObject.pygobject_version
except Exception: # any failure to 'get' the version
pygobjectver_str = 'unknown version'
pygobject_result = (0, 0, 0)
except ImportError:
pygobjectver_str = 'not found'
pygobject_result = (0, 0, 0)
'''
# test for older pygobject for gtk 2
# https://github.com/gramps-project/gramps/blob/maintenance/gramps34/src/gramps.py
try:
import gobject
try:
gobjectver_str = '%d.%d.%d' % gobject.pygobject_version
except :# any failure to 'get' the version
gobjectver_str = 'unknown version'
except ImportError:
gobjectver_str = 'not found'
'''
# Test
if not pygobject_result >= MIN_PYGOBJECT_VERSION:
#print("Failed")
result = ("* PyGObject " + pygobjectver_str +
" (Requires version " +
verstr(MIN_PYGOBJECT_VERSION) + " or greater.)\n")
else:
#print("Success")
result = ("* PyGObject " + pygobjectver_str +
" (Success version " +
verstr(MIN_PYGOBJECT_VERSION) +
" or greater installed.)\n")
# End check
self.append_text(result)