type : PRINT_DOCUMENT, PRINT_PAGE_HEADER, PRINT_PAGE_FOOTER
355109
private Table buildRtfTable(int type) throws DocumentException {
		List<Band> bands = new ArrayList<Band>();
		if (type == 1) {
			bands.add(getReportLayout().getPageHeaderBand());
		} else if (type == 2) {
			bands.add(getReportLayout().getPageFooterBand());
		} else {
			bands = getReportLayout().getDocumentBands();
		}
		int totalRows = 0;
		int totalColumns = 0;
		for (Band band : bands) {
			totalRows += band.getRowCount();
			int cols = band.getColumnCount();
			if (cols > totalColumns) {
				totalColumns = cols;
			}
		}

		// no page header or no page footer
		if (totalColumns == 0) {
			return null;
		}
		Table datatable = new Table(totalColumns);
		int[] headerwidths = new int[totalColumns]; // %
		int size = 100 / totalColumns;
		int totalWidth = 0;
		for (int i = 0; i < totalColumns; i++) {
			if (bean.getReportLayout().isUseSize()) {
				headerwidths[i] = bean.getReportLayout().getColumnsWidth().get(i);
			} else {
				headerwidths[i] = size;
			}
			totalWidth += headerwidths[i];
		}

		if (bean.getReportLayout().isUseSize()) {
			float pixels = A4_PORTRAIT_PIXELS;
			if (bean.getReportLayout().getOrientation() == LANDSCAPE) {
				pixels = A4_LANDSCAPE_PIXELS;
			}
			float percentage = totalWidth * 100 / pixels;
			// do not allow to go outside an A4 frame
			if (percentage > 100) {
				percentage = 100;
			}
			if (!ReportLayout.CUSTOM.equals(bean.getReportLayout().getPageFormat())) {
				datatable.setWidth(percentage);
			}
			datatable.setWidths(headerwidths);
		} else {
			datatable.setWidth(100);
		}

		datatable.setPadding(2);
		if (type == PRINT_DOCUMENT) {
			writeHeader(datatable);
		}
		return datatable;
	}
117957
protected void doPrint() {

        PrintablePage pageInView = previewPane.getPrintablePage();
        PrintablePage pageToPrint = new PrintablePage();

        try {
            pageInView.bindPage(pageToPrint);

            Printer printer = Printer.getDefaultPrinter();

            if (printer == null || settingsView.getPaperView()
                    .getAvailablePapers().isEmpty()) {
                // Show an Error
                Alert alert = new Alert(AlertType.INFORMATION);
                alert.initOwner(dialog);
                alert.setTitle(Messages
                        .getString("DateControl.TITLE_CALENDAR_PROBLEM"));
                alert.setHeaderText(
                        Messages.getString("PrintView.NO_PRINTERS"));
                alert.setContentText(
                        Messages.getString("PrintView.ERROR_NO_PRINTER"));
                alert.show();
                return;
            }

            hide();
            LoggingDomain.PRINTING.fine("printer = " + printer);

            PageLayout layout = null;

            final Paper paper = pageInView.getPaper();
            final PageOrientation pageOrientation = pageInView.getViewType()
                    .getPageOrientation();
            final PaperView.MarginType marginType = pageInView.getMarginType();

            LoggingDomain.PRINTING.fine("paper = " + paper);
            LoggingDomain.PRINTING.fine("pageOrientation = " + pageOrientation);
            LoggingDomain.PRINTING.fine("marginType = " + marginType);
            LoggingDomain.PRINTING
                    .fine("custom margins = left: " + pageInView.getLeftMargin()
                            + ", right: " + pageInView.getRightMargin()
                            + ", top: " + pageInView.getTopMargin()
                            + ", bottom: " + pageInView.getBottomMargin());

            switch (marginType) {
            case DEFAULT:
                layout = printer.createPageLayout(paper, pageOrientation,
                        Printer.MarginType.DEFAULT);
                break;
            case MINIMUM:
                layout = printer.createPageLayout(paper, pageOrientation,
                        Printer.MarginType.HARDWARE_MINIMUM);
                break;
            case CUSTOM:
                layout = printer.createPageLayout(paper, pageOrientation,
                        pageInView.getLeftMargin(), pageInView.getRightMargin(),
                        pageInView.getTopMargin(),
                        pageInView.getBottomMargin());
                break;
            }

            // sizes of print page and physical page
            double pageWidth = pageToPrint.prefWidth(-1);
            double pageHeight = pageToPrint.prefHeight(-1);

            double printableWidth = layout.getPrintableWidth();
            double printableHeight = layout.getPrintableHeight();

            // scaling
            double scaleX = printableWidth / pageWidth;
            double scaleY = printableHeight / pageHeight;
            double scale = Math.min(scaleX, scaleY);

            LoggingDomain.PRINTING.fine("pageWidth / pageHeight = " + pageWidth
                    + " / " + pageHeight);
            LoggingDomain.PRINTING.fine("printableWidth / printableHeight = "
                    + printableWidth + " / " + printableHeight);
            LoggingDomain.PRINTING
                    .fine("scaleX / scaleY = " + scaleX + " / " + scaleY);
            LoggingDomain.PRINTING.fine("scale = " + scale);

            pageToPrint.applyCss();
            pageToPrint.layout();
            pageToPrint.getTransforms().add(new Scale(scale, scale));

            // transformation = center
            final double translateX = (printableWidth - (pageWidth * scale))
                    / 2;
            final double translateY = (printableHeight - (pageHeight * scale))
                    / 2;

            LoggingDomain.PRINTING.fine("translateX / translateY = "
                    + translateX + " / " + translateY);

            pageToPrint.setTranslateX(translateX);
            pageToPrint.setTranslateY(translateY);

            PrinterJob job = PrinterJob.createPrinterJob(printer);
            JobSettings settings = job.getJobSettings();
            settings.setJobName(Messages.getString("PrintView.TITLE_LABEL"));
            settings.setPageLayout(layout);

            if (job.showPrintDialog(getScene().getWindow())) {
                do {
                    boolean success = job.printPage(pageToPrint);
                    if (!success) {
                        break;
                    }
                } while (pageToPrint.next());

                job.endJob();
            }
        } finally {
            pageInView.unbindPage(pageToPrint);
        }
    }
864858
def _prior_headerfooter(self):
        """"""
        preceding_sectPr = self._sectPr.preceding_sectPr
        return (
            None if preceding_sectPr is None
            else _Header(preceding_sectPr, self._document_part, self._hdrftr_index)
        )
165791
private void preparePrint(final AbstractPrint _print) throws EFapsException {
        for (final Select select : _print.getSelection().getAllSelects()) {
            for (final AbstractElement<?> element : select.getElements()) {
                if (element instanceof AbstractDataElement) {
                    ((AbstractDataElement<?>) element).append2SQLSelect(sqlSelect);
                }
            }
        }
        if (sqlSelect.getColumns().size() > 0) {
            for (final Select select : _print.getSelection().getAllSelects()) {
                for (final AbstractElement<?> element : select.getElements()) {
                    if (element instanceof AbstractDataElement) {
                        ((AbstractDataElement<?>) element).append2SQLWhere(sqlSelect.getWhere());
                    }
                }
            }
            if (_print instanceof ObjectPrint) {
                addWhere4ObjectPrint((ObjectPrint) _print);
            } else if (_print instanceof ListPrint) {
                addWhere4ListPrint((ListPrint) _print);
            } else {
                addTypeCriteria((QueryPrint) _print);
                addWhere4QueryPrint((QueryPrint) _print);
            }
            addCompanyCriteria(_print);
        }
    }
540129
def print_details(self):
		""""""
		print("Title:", self.title)
		print("Category:", self.category)
		print("Page: ", self.page)
		print("Size: ", self.size)
		print("Files: ", self.files)
		print("Age: ", self.age)
		print("Seeds:", self.seeders)
		print("Leechers: ", self.leechers)
		print("Magnet: ", self.magnet)
		print("Download: ", self.download)
		print("Verified:", self.isVerified)
891726
def pretty_print(self, printer: Optional[Printer] = None, align: int = ALIGN_CENTER, border: bool = False):
        
        if printer is None:
            printer = get_printer()
        table_string = self._get_pretty_table(indent=printer.indents_sum, align=align, border=border).get_string()
        if table_string != '':
            first_line = table_string.splitlines()[0]
            first_line_length = len(first_line) - len(re.findall(Printer._ANSI_REGEXP, first_line)) * \
                Printer._ANSI_COLOR_LENGTH
            if self.title_align == self.ALIGN_CENTER:
                title = '{}{}'.format(' ' * (first_line_length // 2 - len(self.title) // 2), self.title)
            elif self.title_align == self.ALIGN_LEFT:
                title = self.title
            else:
                title = '{}{}'.format(' ' * (first_line_length - len(self.title)), self.title)
            printer.write_line(printer.YELLOW + title)
            # We split the table to lines in order to keep the indentation.
            printer.write_line(table_string)
851072
function TypeAlias(node, print) {
  this.push("type ");
  print.plain(node.id);
  print.plain(node.typeParameters);
  this.space();
  this.push("=");
  this.space();
  print.plain(node.right);
  this.semicolon();
}
184821
def print_summary(self, w=0, objs=(), **print3opts):
        '''
        '''
        self._printf('%*d bytes%s%s', w, self._total, _SI(self._total), self._incl, **print3opts)
        if self._mask:
            self._printf('%*d byte aligned', w, self._mask + 1, **print3opts)
        self._printf('%*d byte sizeof(void*)', w, _sizeof_Cvoidp, **print3opts)
        n = len(objs or ())
        if n > 0:
            d = self._duplicate or ''
            if d:
                d = ', %d duplicate' % self._duplicate
            self._printf('%*d object%s given%s', w, n, _plural(n), d, **print3opts)
        t = _sum([1 for t in _values(self._seen) if t != 0])  # [] for Python 2.2
        self._printf('%*d object%s sized', w, t, _plural(t), **print3opts)
        if self._excl_d:
            t = _sum(_values(self._excl_d))
            self._printf('%*d object%s excluded', w, t, _plural(t), **print3opts)
        t = _sum(_values(self._seen))
        self._printf('%*d object%s seen', w, t, _plural(t), **print3opts)
        if self._missed > 0:
            self._printf('%*d object%s missed', w, self._missed, _plural(self._missed), **print3opts)
        if self._depth > 0:
            self._printf('%*d recursion depth', w, self._depth, **print3opts)
410541
def _prior_headerfooter(self):
        """"""
        preceding_sectPr = self._sectPr.preceding_sectPr
        return (
            None if preceding_sectPr is None
            else _Footer(preceding_sectPr, self._document_part, self._hdrftr_index)
        )
1144258
def p_print_list_at(p):
    
    p[0] = make_sentence('PRINT_AT',
                         make_typecast(TYPE.ubyte, p[2], p.lineno(1)),
                         make_typecast(TYPE.ubyte, p[4], p.lineno(3)))
1035233
def print(self, indent=0):
        """"""
        text = (
            '{indent}{magenta}{name}{none} ({dim}{cls}{none}, '
            'default {dim}{default}{none})'
        ).format(
            indent=' ' * indent,
            dim=Style.DIM,
            magenta=Fore.MAGENTA,
            none=Style.RESET_ALL,
            name=self.name,
            cls=self.cls,
            default=self.default
        )

        if self.description:
            text += ':\n' + pretty_description(self.description,
                                               indent=indent + 2)

        print(text)
432552
def write(self, fd):
        
        print >>fd, self.classHead
        for t in self.items:
            print >>fd, t
        print >>fd, self.classFoot
102564
def menu_pages(colors, page=1, print_keys=True, per_page=15):
    """"""

    c = os.system('clear')
    length = len(colors)
    last_page = length / per_page
    if (last_page * per_page) < length:
        last_page += 1

    page_display = "page (%d/%d)" % (page, last_page)
    start = per_page * (page - 1)
    keys = """
(j/k): Next/Previous page, (J/K): Transparency Down/Up

(P/p): set prefix,         (Q/q): Quit

Or simply enter the number of a theme
    """

    print '=' * 30
    print page_display
    print '-' * len(page_display)

    for i,v in enumerate(colors[start : start + per_page]):
        print '%2d) %s' % (i + start + 1, v)

    print '=' * 30
    print 'Current theme is: %s' % get_current()
    print 'Transparency: %%%d' % transparency
    print '=' * 30

    if(print_keys):
        print keys
1238573
def _printClassDomain(self, hrlinetop=True, print_inferred=False):
        
        if not self.currentEntity:  # ==> ontology level
            return
        x = self.currentEntity['object']
        if self.currentEntity['type'] == 'class':
            if hrlinetop:
                self._print("----------------")
            self._print("DOMAIN OF:", "IMPORTANT")
            self._print("[%d] Explicitly declared" % len(x.domain_of), "IMPORTANT")
            for i in x.domain_of:
                if i.ranges:
                    ranges = ",".join([y.qname if hasattr(y, "qname") else str(y)
                                       for y in i.ranges])
                else:
                    ranges = "owl:Thing"
                    # print( Style.RESET_ALL + " => " + Fore.MAGENTA +
                print(Fore.GREEN + x.qname + Style.RESET_ALL + " => " + Fore.MAGENTA +
                      i.qname + Style.RESET_ALL + " => " + Style.DIM + ranges +
                      Style.RESET_ALL)

            # inferred stuff
            if print_inferred:
                for _dict in x.domain_of_inferred:
                    _class = list(_dict.items())[0][0]
                    _propslist = list(_dict.items())[0][1]
                    if _class.id != x.id and len(_propslist):  # print only inferred properties
                        self._print("[%d] Inherited from [%s]" % (len(_propslist), _class.qname),
                                    "IMPORTANT")
                        for i in _propslist:
                            if i.ranges:
                                ranges = ",".join([y.qname if hasattr(y, "qname")
                                                   else str(y) for y in i.ranges])
                            else:
                                ranges = "owl:Thing"
                                # print(Style.RESET_ALL + " => " + Fore.MAGENTA +
                            print(Fore.GREEN + x.qname + Style.RESET_ALL + " => " + Fore.MAGENTA +
                                  i.qname + Style.RESET_ALL + " => " + Style.DIM +
                                  ranges + Style.RESET_ALL)

            self._print("----------------")
        return
1202146
def print_with_pager(output):
    """"""
    if sys.stdout.isatty():
        try:
            pager = subprocess.Popen(
                ['less', '-F', '-r', '-S', '-X', '-K'],
                stdin=subprocess.PIPE, stdout=sys.stdout)
        except subprocess.CalledProcessError:
            # Don't use the pager since starting it has failed.
            print(output)
            return
        else:
            pager.stdin.write(output.encode('utf-8'))
            pager.stdin.close()
            pager.wait()
    else:
        # Output directly to stdout since not in tty.
        print(output)
423495
def pretty_print_domain(rows, keyword, domain):
    
    if len(rows.get('records')) == 0:
        return None

    # six columns; priority, name, content, ttl, change_date, type
    header_l = ['prio', 'name', 'content',
                'ttl', 'change date', 'type']
    # 0->4, 1->0, 2->2, 3->3, 4->5, 5->1
    header_l_sorted = ['name', 'type', 'content',
                       'ttl', 'prio', 'change date']
    header_l_sorted.reverse()

    cols_width = [len(i) for i in header_l]

    """
    if key == 'change_date':
        value = datetime.fromtimestamp(
            int(row_d.get(key))).strftime("%Y%m%d-%H%M%S")
            """

    cw_, soa = get_columns_width(rows.get('records'),
                                 cols_width, True)

    # sorted as name, type, content, ttl, priority, change_date
    cols_width_sorted = [cw_[1], cw_[5], cw_[2],
                         cw_[3], cw_[0], cw_[4]]

    if isinstance(soa, dict):
        soa_s = ('zone:        ' + soa.get('name') + '\n' +
                 'SOA record:  ' + soa.get('content') + '\n' +
                 'ttl:         ' + soa.get('ttl') + '\n' +
                 'change date: ' + soa.get('change_date'))
        domain = soa.get('name')
        print(soa_s)

    print domain

    if keyword != 'SOA':
        print_header(cols_width_sorted, header_l_sorted, len(domain))
        str_value = ''
        for row in rows.get('records'):
            if row.get('type') == 'SOA':
                pass
            else:
                # name
                if row.get('name'):
                    str_value = get_row_s(row, 'name',
                                          cols_width_sorted[0],
                                          domain=domain)
                    sys.stdout.write("|%s" % str_value)
                # type
                if row.get('type'):
                    str_value = get_row_s(row, 'type',
                                          cols_width_sorted[1])
                    sys.stdout.write("|%s" % str_value)
                # content
                if row.get('content'):
                    str_value = get_row_s(row, 'content',
                                          cols_width_sorted[2])
                    sys.stdout.write("|%s" % str_value)
                # ttl
                if row.get('ttl'):
                    str_value = get_row_s(row, 'ttl',
                                          cols_width_sorted[3])
                    sys.stdout.write("|%s" % str_value)
                # priority
                if row.get('priority') is None:
                    val = {'priority': '-'}
                else:
                    val = row.copy()
                str_value = get_row_s(val, 'priority',
                                      cols_width_sorted[4])
                sys.stdout.write("|%s" % str_value)
                if row.get('change_date') is None:
                    val = {'change_date': '-'}
                else:
                    val = row.copy()
                str_value = get_row_s(val, 'change_date',
                                      cols_width_sorted[5])
                print("|%s|" % str_value)

        print_bottom(cols_width_sorted, len(domain))
572806
def printer(self):
        """"""
        for key in self.statediag:
            if key.trans is not None and len(key.trans) > 0:
                print '****** ' + repr(key.id) + '(' + repr(key.type)\
                      + ' on sym ' + repr(key.sym) + ') ******'
                print key.trans