当前位置: 首页>>代码示例>>Python>>正文


Python CurrentFont.selection方法代码示例

本文整理汇总了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'
开发者ID:jeremymickel,项目名称:hTools2,代码行数:27,代码来源:glyphs_paint.py

示例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
开发者ID:gferreira,项目名称:hTools2,代码行数:41,代码来源:paint_select.py


注:本文中的mojo.roboFont.CurrentFont.selection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。