<s> try : <EOL> from mojo . roboFont import CurrentFont <EOL> except ImportError : <EOL> from robofab . world import CurrentFont <EOL> from vanilla import * <EOL> from hTools2 import hDialog <EOL> from hTools2 . modules . fontutils import print_selected_glyphs , get_glyphs <EOL> from hTools2 . modules . messages import no_font_open , no_glyph_selected <EOL> class printGlyphsDialog ( hDialog ) : <EOL> """<STR_LIT>""" <EOL> sort_names = True <EOL> def __init__ ( self ) : <EOL> self . title = '<STR_LIT>' <EOL> self . height = ( self . padding_y * <NUM_LIT:4> ) + ( self . text_height * <NUM_LIT:5> ) + self . button_height <EOL> self . w = FloatingWindow ( ( self . width , self . height ) , self . title ) <EOL> x = self . padding_x <EOL> y = self . padding_y <EOL> self . w . print_mode = RadioGroup ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height * <NUM_LIT:4> ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> sizeStyle = self . size_style , <EOL> isVertical = True ) <EOL> self . w . print_mode . set ( <NUM_LIT:0> ) <EOL> y += ( self . text_height * <NUM_LIT:4> ) + self . padding_y <EOL> self . w . apply_button = SquareButton ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . button_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . apply_callback , <EOL> sizeStyle = self . size_style ) <EOL> y += self . button_height + self . padding_y <EOL> self . w . sort_names = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> value = self . sort_names , <EOL> sizeStyle = self . size_style ) <EOL> self . w . open ( ) <EOL> def apply_callback ( self , sender ) : <EOL> mode = self . w . print_mode . get ( ) <EOL> sort_names = self . w . sort_names . get ( ) <EOL> font = CurrentFont ( ) <EOL> if font is not None : <EOL> glyph_names = get_glyphs ( font ) <EOL> if len ( glyph_names ) : <EOL> print_selected_glyphs ( font , mode , sort = sort_names ) <EOL> else : <EOL> print no_glyph_selected <EOL> else : <EOL> print no_font_open </s>
