本文整理汇总了Python中mojo.roboFont.CurrentFont.selection方法的典型用法代码示例。如果您正苦于以下问题:Python CurrentFont.selection方法的具体用法?Python CurrentFont.selection怎么用?Python CurrentFont.selection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mojo.roboFont.CurrentFont
的用法示例。
在下文中一共展示了CurrentFont.selection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: select_callback
# 需要导入模块: from mojo.roboFont import CurrentFont [as 别名]
# 或者: from mojo.roboFont.CurrentFont import selection [as 别名]
def select_callback(self, sender):
f = CurrentFont()
if f is not None:
glyph_names = get_glyphs(f)
if len(glyph_names) > 0:
glyph_name = get_glyphs(f)[0]
color = f[glyph_name].mark
print 'selecting glyphs:\n'
print '\t',
# print '\tcolor: %s %s %s %s' % color
glyph_names = []
for glyph in f:
if glyph.mark == color:
print glyph.name,
glyph_names.append(glyph.name)
#print '\tglyphs: %s' % glyph_names
f.selection = glyph_names
print
print '\n...done.\n'
# no glyph selected
else:
print 'please select a glyph first.\n'
# no font open
else:
print 'please open a font first.\n'
示例2: select_callback
# 需要导入模块: from mojo.roboFont import CurrentFont [as 别名]
# 或者: from mojo.roboFont.CurrentFont import selection [as 别名]
def select_callback(self, sender):
f = CurrentFont()
if f is not None:
glyph_names = get_glyphs(f)
if len(glyph_names) > 0:
glyph_name = get_glyphs(f)[0]
# RF 2.0
if version[0] == '2':
color = f[glyph_name].markColor
# RF 1.8.X
else:
color = f[glyph_name].mark
print 'selecting glyphs:\n'
print '\t',
glyph_names = []
for glyph in f:
# RF 2.0
if version[0] == '2':
if glyph.markColor == color:
print glyph.name,
glyph_names.append(glyph.name)
# RF 1.8.X
else:
if glyph.mark == color:
print glyph.name,
glyph_names.append(glyph.name)
f.selection = glyph_names
print
print '\n...done.\n'
# no glyph selected
else:
print no_glyph_selected
# no font open
else:
print no_font_open