class CustomTextOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__top = None self.__mid = None self.__bot = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): category_name = _("Text") self.__top = TextOption(_("Initial Text"), [""]) self.__top.set_help(_("Text to display at the top")) menu.add_option(category_name, "top", self.__top) self.__mid = TextOption(_("Middle Text"), [""]) self.__mid.set_help(_("Text to display in the middle")) menu.add_option(category_name, "mid", self.__mid) self.__bot = TextOption(_("Final Text"), [""]) self.__bot.set_help(_("Text to display at the bottom")) menu.add_option(category_name, "bot", self.__bot) def get_subject(self): """ Return a string that describes the subject of the report. """ if len(self.__top.get_value()[0]) > 0: return self.__top.get_value()[0] if len(self.__mid.get_value()[0]) > 0: return self.__mid.get_value()[0] if len(self.__bot.get_value()[0]) > 0: return self.__bot.get_value()[0] return "" def make_default_style(self, default_style): """Make the default output style for the Custom Text report.""" font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set(pad=0.5) para.set_description(_('Text to display at the top')) default_style.add_paragraph_style("CBT-Initial", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set(pad=0.5) para.set_alignment(PARA_ALIGN_CENTER) para.set_description(_('Text to display in the middle')) default_style.add_paragraph_style("CBT-Middle", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set(pad=0.5) para.set_description(_('Text to display at the bottom')) default_style.add_paragraph_style("CBT-Final", para)
class CustomTextOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__top = None self.__mid = None self.__bot = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): category_name = _("Text") self.__top = TextOption(_("Initial Text"), [""]) self.__top.set_help(_("Text to display at the top.")) menu.add_option(category_name, "top", self.__top) self.__mid = TextOption(_("Middle Text"), [""]) self.__mid.set_help(_("Text to display in the middle")) menu.add_option(category_name, "mid", self.__mid) self.__bot = TextOption(_("Final Text"), [""]) self.__bot.set_help(_("Text to display last.")) menu.add_option(category_name, "bot", self.__bot) def get_subject(self): """ Return a string that describes the subject of the report. """ if len(self.__top.get_value()[0]) > 0: return self.__top.get_value()[0] if len(self.__mid.get_value()[0]) > 0: return self.__mid.get_value()[0] if len(self.__bot.get_value()[0]) > 0: return self.__bot.get_value()[0] return "" def make_default_style(self, default_style): """Make the default output style for the Custom Text report.""" font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set(pad=0.5) para.set_description( _('The style used for the first portion of the custom text.')) default_style.add_paragraph_style("CBT-Initial", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set(pad=0.5) para.set_alignment(PARA_ALIGN_CENTER) para.set_description( _('The style used for the middle portion of the custom text.')) default_style.add_paragraph_style("CBT-Middle", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0) para = ParagraphStyle() para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set(pad=0.5) para.set_description( _('The style used for the last portion of the custom text.')) default_style.add_paragraph_style("CBT-Final", para)