<s> try : <EOL> from mojo . roboFont import RFont <EOL> except ImportError : <EOL> from robofab . world import RFont <EOL> from vanilla import * <EOL> from vanilla . dialogs import getFolder <EOL> from hTools2 import hDialog <EOL> from hTools2 . modules . fileutils import walk <EOL> from hTools2 . modules . fontutils import get_full_name , decompose , auto_contour_order , auto_contour_direction , add_extremes <EOL> from hTools2 . modules . opentype import clear_features <EOL> from hTools2 . modules . messages import no_font_in_folder <EOL> class actionsFolderDialog ( hDialog ) : <EOL> """<STR_LIT>""" <EOL> round = False <EOL> decompose = False <EOL> order = False <EOL> direction = False <EOL> overlaps = True <EOL> extremes = False <EOL> remove_features = False <EOL> save = False <EOL> close = False <EOL> ufos_folder = None <EOL> def __init__ ( self ) : <EOL> self . title = '<STR_LIT>' <EOL> self . width = <NUM_LIT> <EOL> self . height = ( self . text_height * <NUM_LIT:8> ) + ( self . button_height * <NUM_LIT:2> ) + ( self . padding_y * <NUM_LIT:5> ) + self . progress_bar <EOL> self . w = FloatingWindow ( ( self . width , self . height ) , self . title ) <EOL> x = self . padding_x <EOL> y = self . padding_y <EOL> self . w . ufos_get_folder_button = SquareButton ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . button_height ) , <EOL> "<STR_LIT>" , <EOL> sizeStyle = self . size_style , <EOL> callback = self . ufos_get_folder_callback ) <EOL> y += self . button_height + self . padding_y <EOL> self . w . round_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . round_callback , <EOL> value = self . round , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . decompose_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . decompose_callback , <EOL> value = self . decompose , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . order_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . order_callback , <EOL> value = self . order , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . direction_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . direction_callback , <EOL> value = self . direction , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . overlaps_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . overlaps_callback , <EOL> value = self . overlaps , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . extremes_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . extremes_callback , <EOL> value = self . overlaps , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . remove_features_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . remove_features_callback , <EOL> value = self . remove_features , <EOL> sizeStyle = self . size_style ) <EOL> y += self . text_height <EOL> self . w . save_checkBox = CheckBox ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> "<STR_LIT>" , <EOL> callback = self . save_callback , <EOL> value = self . save , <EOL> sizeStyle = self . size_style ) <EOL> y += ( self . text_height + self . padding_y ) - <NUM_LIT:2> <EOL> self . w . bar = ProgressBar ( <EOL> ( x , y , <EOL> - self . padding_x , <EOL> self . progress_bar ) , <EOL> isIndeterminate = True , <EOL> sizeStyle = self . size_style ) <EOL> y += ( self . progress_bar + self . padding_y ) <EOL> self . w . button_apply = 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> self . w . open ( ) <EOL> def ufos_get_folder_callback ( self , sender ) : <EOL> folder_ufos = getFolder ( ) <EOL> self . ufos_folder = folder_ufos [ <NUM_LIT:0> ] <EOL> def clear_callback ( self , sender ) : <EOL> self . clear = sender . get ( ) <EOL> def close_font_callback ( self , sender ) : <EOL> self . close = sender . get ( ) <EOL> def round_callback ( self , sender ) : <EOL> self . round = sender . get ( ) <EOL> def save_callback ( self , sender ) : <EOL> self . save = sender . get ( ) <EOL> def decompose_callback ( self , sender ) : <EOL> self . decompose = sender . get ( ) <EOL> def order_callback ( self , sender ) : <EOL> self . order = sender . get ( ) <EOL> def direction_callback ( self , sender ) : <EOL> self . direction = sender . get ( ) <EOL> def overlaps_callback ( self , sender ) : <EOL> self . overlaps = sender . get ( ) <EOL> def extremes_callback ( self , sender ) : <EOL> self . extremes = sender . get ( ) <EOL> def remove_features_callback ( self , sender ) : <EOL> self . remove_features = sender . get ( ) <EOL> def mark_callback ( self , sender ) : <EOL> self . mark = sender . get ( ) <EOL> def apply_callback ( self , sender ) : <EOL> ufo_paths = walk ( self . ufos_folder , '<STR_LIT>' ) <EOL> if len ( ufo_paths ) > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> self . w . bar . start ( ) <EOL> for ufo_path in ufo_paths : <EOL> font = RFont ( ufo_path , showUI = False ) <EOL> print '<STR_LIT>' % get_full_name ( font ) <EOL> if self . round : <EOL> print '<STR_LIT>' <EOL> font . round ( ) <EOL> if self . decompose : <EOL> print '<STR_LIT>' <EOL> decompose ( font ) <EOL> if self . overlaps : <EOL> print '<STR_LIT>' <EOL> font . removeOverlap ( ) <EOL> if self . order : <EOL> print '<STR_LIT>' <EOL> auto_contour_order ( font ) <EOL> if self . direction : <EOL> print '<STR_LIT>' <EOL> auto_contour_direction ( font ) <EOL> if self . extremes : <EOL> print '<STR_LIT>' <EOL> add_extremes ( font ) <EOL> if self . remove_features : <EOL> print '<STR_LIT>' <EOL> clear_features ( font ) <EOL> if self . save : <EOL> print '<STR_LIT>' <EOL> font . save ( ) <EOL> print '<STR_LIT>' <EOL> self . w . bar . stop ( ) <EOL> print '<STR_LIT>' <EOL> else : <EOL> print no_font_in_folder </s>
