#NEWLINE# def get_print_style( style = None , print_format = None , for_legacy = False ) : #NEWLINE# #INDENT# print_settings = frappe . get_doc ( 'Print Settings' ) #NEWLINE# if ( not style ) : #NEWLINE# #INDENT# style = ( print_settings . print_style or 'Standard' ) #NEWLINE# #UNINDENT# context = { #NEWLINE# #INDENT# 'print_settings' : print_settings , #NEWLINE# 'print_style' : style , #NEWLINE# 'font' : get_font ( print_settings , print_format , for_legacy ) , #NEWLINE# #UNINDENT# } #NEWLINE# css = frappe . get_template ( 'templates/styles/standard.css' ) . render ( context ) #NEWLINE# try : #NEWLINE# #INDENT# css += frappe . get_template ( ( ( 'templates/styles/' + style . lower ( ) ) + '.css' ) ) . render ( context ) #NEWLINE# #UNINDENT# except TemplateNotFound : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# for at_import in list ( set ( re . findall ( '(@import url\\([^\\)]+\\)[;]?)' , print_format ) ) ) : #NEWLINE# #INDENT# css = css . replace ( at_import , '' ) #NEWLINE# css = ( at_import + css ) #NEWLINE# #UNINDENT# if ( print_format and print_format . css ) : #NEWLINE# #INDENT# css += ( '\n\n' + print_format . css ) #NEWLINE# #UNINDENT# return css