parameters: (self)
docstring: initialization
docstring_summary: initialization
docstring_tokens: initialization
function: def OnPreparePrinting(self):
          """ initialization """
          dc = self.GetDC()
  
          ppiScreenX, ppiScreenY = self.GetPPIScreen()
          ppiPrinterX, ppiPrinterY = self.GetPPIPrinter()
          scaleX = float(ppiPrinterX)/ppiScreenX
          scaleY = float(ppiPrinterY)/ppiScreenY
  
          pageWidth, pageHeight = self.GetPageSizePixels()
          self._scaleFactorX = scaleX/pageWidth
          self._scaleFactorY = scaleY/pageHeight
  
          w, h = dc.GetSize()
          overallScaleX = self._scaleFactorX * w
          overallScaleY = self._scaleFactorY * h
          
          txtCtrl = self._printoutView.GetCtrl()
          font, color = txtCtrl.GetFontAndColorFromConfig()
  
          self._margin = 40
          self._fontHeight = font.GetPointSize() + 1
          self._pageLines = int((h/overallScaleY - (2 * self._margin))/self._fontHeight)
          self._maxLines = txtCtrl.GetLineCount()
          self._numPages, remainder = divmod(self._maxLines, self._pageLines)
          if remainder != 0:
              self._numPages += 1
  
          spaces = 1
          lineNum = self._maxLines
          while lineNum >= 10:
              lineNum = lineNum/10
              spaces += 1
          self._printFormat = "%%0%sd: %%s" % spaces
function_tokens: def OnPreparePrinting ( self ) : dc = self . GetDC ( ) ppiScreenX , ppiScreenY = self . GetPPIScreen ( ) ppiPrinterX , ppiPrinterY = self . GetPPIPrinter ( ) scaleX = float ( ppiPrinterX ) / ppiScreenX scaleY = float ( ppiPrinterY ) / ppiScreenY pageWidth , pageHeight = self . GetPageSizePixels ( ) self . _scaleFactorX = scaleX / pageWidth self . _scaleFactorY = scaleY / pageHeight w , h = dc . GetSize ( ) overallScaleX = self . _scaleFactorX * w overallScaleY = self . _scaleFactorY * h txtCtrl = self . _printoutView . GetCtrl ( ) font , color = txtCtrl . GetFontAndColorFromConfig ( ) self . _margin = 40 self . _fontHeight = font . GetPointSize ( ) + 1 self . _pageLines = int ( ( h / overallScaleY - ( 2 * self . _margin ) ) / self . _fontHeight ) self . _maxLines = txtCtrl . GetLineCount ( ) self . _numPages , remainder = divmod ( self . _maxLines , self . _pageLines ) if remainder != 0 : self . _numPages += 1 spaces = 1 lineNum = self . _maxLines while lineNum >= 10 : lineNum = lineNum / 10 spaces += 1 self . _printFormat = "%%0%sd: %%s" % spaces