def sr_save_clicked(self): from calibre.ebooks.conversion.cli import escape_sr_pattern as escape filename = choose_save_file(self, 'sr_saved_patterns', _('Save calibre search-replace definitions file'), filters=[ (_('calibre search-replace definitions file'), ['csr']) ]) if filename: with codecs.open(filename, 'w', 'utf-8') as f: for search, replace in self.get_definitions(): f.write(escape(search) + u'\n' + escape(replace) + u'\n\n')
def sr_save_clicked(self): from calibre.ebooks.conversion.cli import escape_sr_pattern as escape filename = choose_save_file( self, 'sr_saved_patterns', _('Save calibre search-replace definitions file'), filters=[(_('calibre search-replace definitions file'), ['csr'])]) if filename: with codecs.open(filename, 'w', 'utf-8') as f: for search, replace in self.get_definitions(): f.write(escape(search) + '\n' + escape(replace) + '\n\n')