def __init__(self, controlState, xml): controlState.displayHeaderBar = True controlState.windowIcon = 'abouttoinstall.png' controlState.windowTitle = "Summary of installation settings" controlState.windowText = \ "Review the summary of the installation settings" htmlTextView = HtmlTextView() htmlTextView.set_wrap_mode(gtk.WRAP_NONE) context = htmlTextView.get_pango_context() initialFont = context.get_font_description() # The review uses monospace, so get the font description for that at the # same size as the default font used by the text view. metrics = context.get_metrics( pango.FontDescription('monospace, %d' % (initialFont.get_size() / pango.SCALE))) # Generate the list of tab stops from the column widths specified in # the review module. tabPosition = 0 ta = pango.TabArray(len(review.COLUMN_WIDTHS), True) for index, charWidth in enumerate(review.COLUMN_WIDTHS): tabPosition += pango.PIXELS(metrics.get_approximate_char_width() * charWidth) ta.set_tab(index, pango.TAB_LEFT, tabPosition) htmlTextView.set_tabs(ta) buf = review.produceText() htmlTextView.display_html(buf) viewPort = xml.get_widget('ReviewViewPort') assert (viewPort) for child in viewPort.get_children(): viewPort.remove(child) viewPort.add(htmlTextView) htmlTextView.show()
def __init__(self, controlState, xml): controlState.displayHeaderBar = True controlState.windowIcon = 'abouttoinstall.png' controlState.windowTitle = "Summary of installation settings" controlState.windowText = \ "Review the summary of the installation settings" htmlTextView = HtmlTextView() htmlTextView.set_wrap_mode(gtk.WRAP_NONE) context = htmlTextView.get_pango_context() initialFont = context.get_font_description() # The review uses monospace, so get the font description for that at the # same size as the default font used by the text view. metrics = context.get_metrics(pango.FontDescription( 'monospace, %d' % (initialFont.get_size() / pango.SCALE))) # Generate the list of tab stops from the column widths specified in # the review module. tabPosition = 0 ta = pango.TabArray(len(review.COLUMN_WIDTHS), True) for index, charWidth in enumerate(review.COLUMN_WIDTHS): tabPosition += pango.PIXELS( metrics.get_approximate_char_width() * charWidth) ta.set_tab(index, pango.TAB_LEFT, tabPosition) htmlTextView.set_tabs(ta) buf = review.produceText() htmlTextView.display_html(buf) viewPort = xml.get_widget('ReviewViewPort') assert(viewPort) for child in viewPort.get_children(): viewPort.remove(child) viewPort.add(htmlTextView) htmlTextView.show()