def format_header(self): if len(self.cv.basic.name) + len(self.cv.basic.surnames) > 0: with self.doc.create(pylatex.MiniPage(width='0.7\\textwidth', pos='c')): self.doc.append(Command('alternativeheadername', self.cv.basic.name + ' ' + self.cv.basic.surnames)) # self.format_skills() self.doc.append(pylatex.HFill()) with self.doc.create(pylatex.MiniPage(width='0.3\\textwidth', pos='c')): # self.doc.append(Command('mobi', self.cv.basic.disponibilite_geographique)) # self.doc.append(pylatex.NewLine()) if len(self.cv.contact.email) > 0: self.doc.append(Command('icon', ['At', 12, self.cv.contact.email])) if len(self.cv.contact.phone) > 0: self.doc.append(pylatex.NewLine()) self.doc.append(Command('icon', ['Phone', 12, self.cv.contact.phone])) if len(self.cv.basic.residence) > 0: self.doc.append(pylatex.NewLine()) self.doc.append(Command('icon', ['MapMarker', 12, str(self.cv.basic.residence)])) if len(self.cv.basic.disponibilite_geographique) > 0: self.doc.append(pylatex.NewLine()) self.doc.append(Command('mobi', ["Mobilité", self.cv.basic.disponibilite_geographique])) if len(self.cv.basic.biography) > 0: self.doc.append(pylatex.NewLine()) self.doc.append(Command('cvsect', ('Présentation'))) self.doc.append(self.cv.basic.biography) self.doc.append(pylatex.NewLine())
def _format_languages(self): with self.doc.create(pylatex.MiniPage(width='0.5\\textwidth', pos='t')): self.doc.append(Command('cvsect', _('DEVELOPER_LANGUAGES_TITLE'))) self.doc.append(pylatex.NewLine()) for language_item in self.cv.languages: self.doc.append( pylatex.NoEscape('\\textbf{{{}}} - {}'.format( language_item.name, language_item.level))) self.doc.append(pylatex.NewLine())
def format_languages(self): if len(self.cv.languages) > 0: self.vertical_division_coefficient = 0.95 / ( (len(self.cv.languages) > 0) + (len(self.cv.certifications) > 0) + ( len(self.cv.informatique) > 0)) with self.doc.create( pylatex.MiniPage(width='{}\\textwidth'.format(self.vertical_division_coefficient), pos='t')): self.doc.append(Command('cvsect', ('Langues'))) self.doc.append(pylatex.NewLine()) for certification_item in self.cv.languages: self.doc.append( pylatex.NoEscape('\\textbf{{{}}}'.format(certification_item.name))) self.doc.append(pylatex.NewLine())
def ImprLtxPresEjecMat(self, doc): #doc.append(u"\\subportadilla{Presupuestos Generales}{Presupuesto de ejecución material}" + '\n') chapter = pylatex_utils.Chapter( title=u'Presupuesto de ejecución material', numbering=False) chapter.append(pylatex.Command('cleardoublepage')) center = pylatex.Center() center.append(pylatex_utils.LargeCommand()) center.append(pylatex.utils.bold(u'Presupuesto de Ejecución Material')) center.append(pylatex_utils.largeCommand()) chapter.append(center) chapter.append(pylatex.VerticalSpace('2cm')) self.subcapitulos.ImprLtxResumen(chapter, "", False) chapter.append( pylatex.utils.bold(u'Presupuesto de Ejecución Material:')) chapter.append(pylatex.Command('dotfill')) chapter.append(pylatex.utils.bold(self.getLtxPriceString())) chapter.append(pylatex.VerticalSpace('0.5cm')) chapter.append(pylatex.NewLine()) chapter.append( u'Asciende el presente presupuesto de ejecución material a la expresada cantidad de: ' ) chapter.append( pylatex_utils.textsc( basic_types.to_words(self.getRoundedPrice(), False) + ' euros.')) chapter.append(pylatex_utils.input('firmas')) doc.append(chapter)
def _format_hobbies(self): if self.cv.basic.hobbies: with self.doc.create( pylatex.MiniPage(width='0.5\\textwidth', pos='t')): self.doc.append(Command('cvsect', _('DEVELOPER_HOBBIES_TITLE'))) self.doc.append(pylatex.NewLine()) self.doc.append(self.cv.basic.hobbies)
def format_experience(self): if self.cv.experience and len(self.cv.experience) > 0: self.doc.append(pylatex.NewLine()) self.doc.append(Command('cvsect', ('Expériences professionnelles'))) entry_list = self.EntryList() for experience_item in self.cv.experience: experience_item_date_start = experience_item.date_start.strftime('%m/%Y') experience_item_date_end = experience_item.date_end.strftime('%m/%Y') \ if experience_item.date_end is not None else ('en cours') experience_period = '{} - {}'.format(experience_item_date_start, experience_item_date_end) experience_item_args = [experience_period, experience_item.position, experience_item.institution, experience_item.description] entry_list.append(Command('entry', experience_item_args)) self.doc.append(entry_list)
def ImprLtxPre(self, doc, sect): '''Imprime presupuestos parciales.''' if (self.hasQuantities()): if (sect != 'root'): doc.append(pylatex.Section(self.getTitle())) self.quantities.ImprLtxPre(doc, self.getTitle()) self.subcapitulos.ImprLtxPre(doc, pylatex_utils.getLatexSection(sect)) if self.subcapitulos: doc.append(pylatex.Command('noindent')) doc.append(pylatex_utils.largeCommand()) doc.append( pylatex.utils.bold('Total: ' + self.getTitle() + ' ')) doc.append(pylatex.Command('dotfill')) doc.append(pylatex.utils.bold(self.getLtxPriceString())) doc.append(pylatex.NewLine()) doc.append(pylatex_utils.NormalSizeCommand())
def _export_pdf(self, fname: str): geometry_options = {"margin": "1in"} doc = pylatex.Document(geometry_options=geometry_options) header = pylatex.PageStyle("header") with doc.create(pylatex.MiniPage(align="c")): doc.append( pylatex.HugeText(pylatex.utils.bold("Practice Sessions"))) doc.append(pylatex.LineBreak()) with header.create(pylatex.Foot("L")): header.append("@2019 Musicavis") with header.create(pylatex.Foot("R")): header.append(pylatex.simple_page_number()) doc.preamble.append(header) doc.change_document_style("header") for practice in self.practices: with doc.create( pylatex.Section( f"{practice.instrument.name.title()} ({practice.date:%a, %B %m %Y})" )): self._add_list_itemize_latex(doc, "Goals", practice.goals.all()) with doc.create(pylatex.Subsection("Exercises")): with doc.create(pylatex.Itemize()) as itemize: for x in practice.exercises.all(): itemize.add_item( f"{x.name} at {x.bpm_start}-{x.bpm_end}bpm for {x.minutes}m" ) self._add_list_itemize_latex(doc, "Improvements", practice.improvements.all()) self._add_list_itemize_latex(doc, "Positives", practice.positives.all()) with doc.create(pylatex.Subsection("Notes:")): if practice.notes: for note in practice.notes.split("\r\n"): doc.append(note) if note else doc.append( pylatex.NewLine()) doc.generate_pdf(fname.split(".pdf")[0], clean=True)
def printLtx(self, doc, precio_ejec_mat): precision = 2 with doc.create(pylatex.Itemize()) as itemize: itemize.add_item(u'Total presupuesto de ejecución material ') itemize.append(pylatex.Command('dotfill')) itemize.append( basic_types.human_readable(precio_ejec_mat, precision)) precio_gg = basic_types.ppl_price(self.GGenerales(precio_ejec_mat)) itemize.add_item(str(self.gg * 100) + u'% Gastos generales ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_gg, precision)) precio_bi = basic_types.ppl_price( self.BIndustrial(precio_ejec_mat)) itemize.add_item(str(self.bi * 100) + u'% Beneficio industrial ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_bi, precision)) suma_gg_bi = precio_ejec_mat + precio_gg + precio_bi itemize.add_item('Suma ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(suma_gg_bi, precision)) precio_iva = basic_types.ppl_price(self.IVA(suma_gg_bi)) itemize.add_item(str(self.iva * 100) + u'% I.V.A. ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_iva, precision)) total = suma_gg_bi + precio_iva doc.append( pylatex.utils.bold(u'Presupuesto de ejecución por contrata:') + pylatex.NoEscape('\dotfill') + pylatex.utils.bold(basic_types.human_readable(total, precision))) doc.append(pylatex.VerticalSpace('0.5cm')) doc.append(pylatex.NewLine()) doc.append( u'Asciende el presente presupuesto de ejecución por contrata a la expresada cantidad de: ' ) doc.append( pylatex_utils.textsc( basic_types.to_words(total, False) + ' euros.'))
def _format_header(self): self.doc.append( Command('headername', self.cv.basic.name + ' ' + self.cv.basic.surnames)) self.doc.append( pylatex.base_classes.Arguments( pylatex.NoEscape('\\\\ \\huge' + ' ' + self.cv.basic.profession))) self.doc.append(pylatex.NewLine()) with self.doc.create(pylatex.MiniPage(width='0.60\\textwidth', pos='c')): self.doc.append(Command('cvsect', _('DEVELOPER_BIOGRAPHY_TITLE'))) self.doc.append(pylatex.NewLine()) self.doc.append(self.cv.basic.biography) self._format_skills() self.doc.append(pylatex.HFill()) with self.doc.create(pylatex.MiniPage(width='0.30\\textwidth', pos='c')): self.doc.append( Command('icon', ['MapMarker', 12, self.cv.basic.residence])) self.doc.append(pylatex.NewLine()) self.doc.append( Command('icon', ['Phone', 12, self.cv.contact.phone])) self.doc.append(pylatex.NewLine()) self.doc.append(Command('icon', ['At', 12, self.cv.contact.email])) if self.cv.contact.personal_website or self.cv.contact.twitter or self.cv.contact.linkedin or \ self.cv.contact.github: self.doc.append(pylatex.NewLine()) self.doc.append(pylatex.VerticalSpace('0.25cm')) self.doc.append(pylatex.NewLine()) if self.cv.contact.personal_website: self.doc.append( Command('icon', [ 'Globe', 12, Command('href', [ self.cv.contact.personal_website.href, self.cv.contact.personal_website.anchor ]) ])) self.doc.append(pylatex.NewLine()) if self.cv.contact.twitter: self.doc.append( Command('icon', [ 'Twitter', 12, Command('href', [ self.cv.contact.twitter.href, self.cv.contact.twitter.anchor ]) ])) self.doc.append(pylatex.NewLine()) if self.cv.contact.linkedin: self.doc.append( Command('icon', [ 'Linkedin', 12, Command('href', [ self.cv.contact.linkedin.href, self.cv.contact.linkedin.anchor ]) ])) self.doc.append(pylatex.NewLine()) if self.cv.contact.github: self.doc.append( Command('icon', [ 'Github', 12, Command('href', [ self.cv.contact.github.href, self.cv.contact.github.anchor ]) ])) self.doc.append(pylatex.VerticalSpace('0.50cm')) self.doc.append(pylatex.NewLine())