def _lcg_presentation(self): presentation = lcg.Presentation() if self._vmargin == 0: presentation.separator_margin = lcg.UMm(0) else: presentation.separator_margin = lcg.UFont(0.2) return presentation
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Default presentation file for Braille output.""" from __future__ import unicode_literals import lcg import os braille_tables = {'en': ['en-us-g1.ctb'], 'en2': ['en-us-g2.ctb'], 'cs': ['cs-g1.ctb', os.path.join(os.path.dirname(lcg.__file__), 'export/braille-tables/lcg.utb')], 'nemeth': ['nemeth.ctb']} braille_hyphenation_tables = {'en': 'hyph_en_US.dic', 'cs': 'hyph_cs_CZ.dic'} page_width = lcg.UFont(20) page_height = lcg.UFont(10) left_page_footer = lcg.Container((lcg.PageNumber(), lcg.HSpace(lcg.UFont(3)), lcg.PageHeading(),)) right_page_footer = lcg.Container((lcg.PageHeading(), lcg.HSpace(lcg.UFont(3)), lcg.PageNumber(),)) braille_math_rules = 'czech' # 'nemeth', 'czech'
import lcg import os braille_tables = { 'en': ['en-us-g1.ctb'], 'cs': [ 'cs-g1.ctb', os.path.join(os.path.dirname(lcg.__file__), 'export/braille-tables/lcg.utb') ], 'nemeth': ['nemeth.ctb'] } braille_hyphenation_tables = {'en': 'hyph_en_US.dic', 'cs': 'hyph_cs_CZ.dic'} braille_math_rules = 'nemeth' # 'nemeth', 'czech' page_width = lcg.UFont(35) page_height = lcg.UFont(29) inner_margin = lcg.UFont(0) outer_margin = lcg.UFont(0) top_margin = lcg.UFont(0) bottom_margin = lcg.UFont(0) left_page_footer = lcg.Container(( lcg.PageNumber(), lcg.TextContent(' '), lcg.Container((lcg.PageHeading(), ), halign=lcg.HorizontalAlignment.CENTER), )) right_page_footer = lcg.Container(( lcg.Container((lcg.PageHeading(), ), halign=lcg.HorizontalAlignment.CENTER),
def _lcg_presentation(self): if self._vmargin == 0: margin = lcg.UMm(0) else: margin = lcg.UFont(0.2) return lcg.Presentation(separator_margin=margin)
def body(self): spec = self._parameter(pytis.output.P_NAME) parts = [] row = self._parameter(( spec, pytis.output.P_ROW, )) id_continent = row['id'] pcond = pd.EQ('continent', id_continent) parts.append(pytis.output.Center(self._parameter('title'))) columns = ( pytis.output.Table.Column( 'Alpha-2', lcg.UMm(10), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), pytis.output.Table.Column( 'Alpha-3', lcg.UMm(10), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), pytis.output.Table.Column( 'Numeric', lcg.UMm(10), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), pytis.output.Table.Column( 'Continent', lcg.UMm(10), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), pytis.output.Table.Column( 'Short name', lcg.UMm(60), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), pytis.output.Table.Column( 'Full name', lcg.UMm(70), label_alignment=pytis.output.Table.Column.ALIGN_LEFT, alignment=pytis.output.Table.Column.ALIGN_LEFT, ), ) def data_table(condition): def generator_init(): self._data.select(condition=condition) def generator(): row = self._data.fetchone() if row is None: return None id_ = row['id'].export() id3 = row['id3'].export() num = row['num'].export() continent = row['continent'].export() name = row['name'].export() fullname = row['fullname'].export() return (id_, id3, num, continent, name, fullname) table = pytis.output.LongTable(columns, generator, row_generator_init=generator_init, separator_height=1.2, separator_margin=2) return table table_countries = data_table(pcond) parts.append(pytis.output.VSpace(lcg.UFont(1))) parts.append(pytis.output.f_smaller(table_countries)) return pytis.output.Document(pytis.output.Group(*parts, vertical=True))