本文整理汇总了Python中cairo.version_info方法的典型用法代码示例。如果您正苦于以下问题:Python cairo.version_info方法的具体用法?Python cairo.version_info怎么用?Python cairo.version_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo
的用法示例。
在下文中一共展示了cairo.version_info方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_text
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [as 别名]
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
# Note: x,y are device/display coords, not user-coords, unlike other
# draw_* methods
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
if ismath:
self._draw_mathtext(gc, x, y, s, prop, angle)
else:
ctx = gc.ctx
ctx.new_path()
ctx.move_to (x, y)
ctx.select_font_face (prop.get_name(),
self.fontangles [prop.get_style()],
self.fontweights[prop.get_weight()])
size = prop.get_size_in_points() * self.dpi / 72.0
ctx.save()
if angle:
ctx.rotate (-angle * np.pi / 180)
ctx.set_font_size (size)
if sys.version_info[0] < 3:
ctx.show_text(s.encode("utf-8"))
else:
ctx.show_text(s)
ctx.restore()
示例2: _draw_mathtext
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [as 别名]
def _draw_mathtext(self, gc, x, y, s, prop, angle):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
ctx = gc.ctx
width, height, descent, glyphs, rects = self.mathtext_parser.parse(
s, self.dpi, prop)
ctx.save()
ctx.translate(x, y)
if angle:
ctx.rotate (-angle * np.pi / 180)
for font, fontsize, s, ox, oy in glyphs:
ctx.new_path()
ctx.move_to(ox, oy)
fontProp = ttfFontProperty(font)
ctx.save()
ctx.select_font_face (fontProp.name,
self.fontangles [fontProp.style],
self.fontweights[fontProp.weight])
size = fontsize * self.dpi / 72.0
ctx.set_font_size(size)
if sys.version_info[0] < 3:
ctx.show_text(s.encode("utf-8"))
else:
ctx.show_text(s)
ctx.restore()
for ox, oy, w, h in rects:
ctx.new_path()
ctx.rectangle (ox, oy, w, h)
ctx.set_source_rgb (0, 0, 0)
ctx.fill_preserve()
ctx.restore()
示例3: check1_python
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [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)
示例4: check31_EditExifMetadata
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [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()
示例5: get_version
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [as 别名]
def get_version():
v0, v1, v2 = cairo.version_info
return cairo.cairo_version_string(), '%d.%d.%d' % (v0, v1, v2)
示例6: check4_cairo
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import version_info [as 别名]
def check4_cairo(self):
'''Check cairo installed with GObject Introspection bindings
(the gi package)
'''
# Start check
MIN_CAIRO_VERSION = (1, 13, 1)
# min version that pycairo supports is 1.13.1
MIN_PYCAIRO_VERSION = (1, 13, 3)
try:
import cairo
try:
cairover_str = cairo.cairo_version_string()
cairover_tpl = vertup(cairover_str)
pycairo_result = cairo.version_info
pycairover_str = cairo.version
#print("pycairo_result : " + str(pycairo_result))
cairo_result = cairover_tpl
#print("cairo_result : " + str(cairo_result))
except Exception: # any failure to 'get' the version
pycairover_str = 'unknown version'
cairover_str = 'unknown version'
except ImportError:
pycairover_str = 'not found'
cairover_str = 'not found'
# Test Cairo
if not cairo_result >= MIN_CAIRO_VERSION:
#print("Failed")
result = ("* Cairo " + cairover_str + " (Requires version " +
verstr(MIN_CAIRO_VERSION) + " or greater.)\n")
else:
#print("Success")
result = ("* Cairo " + cairover_str + " (Success version " +
verstr(MIN_CAIRO_VERSION) + " or greater installed.)\n")
self.append_text(result)
# Test pycairo
if not pycairo_result >= MIN_PYCAIRO_VERSION:
#print("Failed")
result = ("* Pycairo " + pycairover_str + " (Requires " +
verstr(MIN_PYCAIRO_VERSION) + " or greater.)\n")
else:
#print("Success")
result = ("* Pycairo " + pycairover_str + " (Success version " +
verstr(MIN_PYCAIRO_VERSION) +
" or greater installed.)\n")
# End check
self.append_text(result)