Пример #1
0
def createPrintScene(wallet, amountString, expiresString):
   
   scene = SimplePrintableGraphicsScene(None, None)

   INCH = scene.INCH
   MARGIN = scene.MARGIN_PIXELS 
   scene.resetCursor()
   scene.drawPixmapFile(':/armory_logo_h36.png') 
   scene.newLine()
   scene.drawText('Paper Backup for Armory Wallet', GETFONT('Var', 11))
   scene.newLine()
   scene.drawText('http://www.bitcoinarmory.com')

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)


   ssType = ' (Unencrypted)'
   bType = tr('Single-Sheet ' + ssType)
   colRect, rowHgt = scene.drawColumn(['Wallet Version:', 'Wallet ID:', \
                                                'Wallet Name:', 'Backup Type:'])
   scene.moveCursor(15, 0)
   suf = 'c'
   colRect, rowHgt = scene.drawColumn(['1.35'+suf, wallet.uniqueIDB58, \
                                                wallet.labelName, bType])
   scene.moveCursor(15, colRect.y() + colRect.height(), absolute=True)

   # Display warning about unprotected key data
   wrap = 0.9*scene.pageRect().width()

   container = 'this wallet'
   warnMsg = tr(""" 
         <font color="#aa0000"><b>WARNING:</b></font> Anyone who has access to this 
         page has access to all the bitcoins in %s!  Please keep this 
         page in a safe place.""" % container)

   scene.newLine()
   scene.drawText(warnMsg, GETFONT('Var', 9), wrapWidth=wrap)

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)
   numLine = 'two'

   descrMsg = tr(""" 
      The following %s lines backup all addresses 
      <i>ever generated</i> by this wallet (previous and future).
      This can be used to recover your wallet if you forget your passphrase or 
      suffer hardware failure and lose your wallet files. """ % numLine)
   scene.drawText(descrMsg, GETFONT('var', 8), wrapWidth=wrap)
   scene.newLine(extra_dy=10)
  
   ###########################################################################
   # Finally, draw the backup information.
   bottomOfSceneHeader = scene.cursorPos.y()

   code12 = wallet.addrMap['ROOT'].binPrivKey32_Plain.toBinStr()
   Lines = []
   Prefix = [] 
   Prefix.append('Root Key:')
   Lines.append(makeSixteenBytesEasy(code12[:16]))
   Prefix.append('')
   Lines.append(makeSixteenBytesEasy(code12[16:]))
   # Draw the prefix
   origX,origY = scene.getCursorXY()
   scene.moveCursor(20,0) 
   colRect, rowHgt = scene.drawColumn(['<b>'+l+'</b>' for l in Prefix])
   
   nudgeDown = 2  # because the differing font size makes it look unaligned
   scene.moveCursor(20, nudgeDown)
   scene.drawColumn(Lines, 
                    
                           font=GETFONT('Fixed', 8, bold=True), \
                           rowHeight=rowHgt, 
                           useHtml=False)

   scene.moveCursor(MARGIN, colRect.y()-2, absolute=True)
   width = scene.pageRect().width() - 2*MARGIN
   scene.drawRect( width, colRect.height()+7, edgeColor=QColor(0,0,0), fillColor=None)

   scene.newLine(extra_dy=30)
   scene.drawText( tr("""
      The following QR code is for convenience only.  It contains the 
      exact same data as the %s lines above.  If you copy this backup 
      by hand, you can safely ignore this QR code. """ % numLine), wrapWidth=4*INCH)

   scene.moveCursor(20,0)
   x,y = scene.getCursorXY()
   edgeRgt = scene.pageRect().width() - MARGIN
   edgeBot = scene.pageRect().height() - MARGIN

   qrSize = max(1.5*INCH, min(edgeRgt - x, edgeBot - y, 2.0*INCH))
   scene.drawQR('\n'.join(Lines), qrSize)
   scene.newLine(extra_dy=25)
   scene.drawHLine(7*INCH, 5)
   scene.newLine(extra_dy=25)
   scene.drawText(tr(""" 
         <font color="#aa0000"><b>CONGRATULATIONS:</b></font> Thank you for participating
         in the MIT BitComp. You have received a Bitcoin Armory
         wallet containing %s You may collect this money by installing Bitcoin Armory
         from the website shown above. After you install the software move the funds to a new
         wallet or any address that you own. Do not deposit any bitcoins to this wallet. You
         don't know who else has access to this wallet! You have until %s to claim your bitcoins. After
         this date we will remove all remaining bitcoins from this wallet.""" %
         (amountString, expiresString)), GETFONT('Var', 11), wrapWidth=wrap)
      
   scene.newLine(extra_dy=25)
   return scene
Пример #2
0
def createPrintScene(wallet, amountString, expiresString):
   
   scene = SimplePrintableGraphicsScene(None, None)

   INCH = scene.INCH
   MARGIN = scene.MARGIN_PIXELS 
   scene.resetCursor()
   scene.drawPixmapFile(':/armory_logo_h36.png') 
   scene.newLine()
   scene.drawText('Paper Backup for Armory Wallet', GETFONT('Var', 11))
   scene.newLine()
   scene.drawText('http://www.bitcoinarmory.com')

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)


   ssType = ' (Unencrypted)'
   bType = tr('Single-Sheet ' + ssType)
   colRect, rowHgt = scene.drawColumn(['Wallet Version:', 'Wallet ID:', \
                                                'Wallet Name:', 'Backup Type:'])
   scene.moveCursor(15, 0)
   suf = 'c'
   colRect, rowHgt = scene.drawColumn(['1.35'+suf, wallet.uniqueIDB58, \
                                                wallet.labelName, bType])
   scene.moveCursor(15, colRect.y() + colRect.height(), absolute=True)

   # Display warning about unprotected key data
   wrap = 0.9*scene.pageRect().width()

   container = 'this wallet'
   warnMsg = tr(""" 
         <font color="#aa0000"><b>WARNING:</b></font> Anyone who has access to this 
         page has access to all the bitcoins in %s!  Please keep this 
         page in a safe place.""" % container)

   scene.newLine()
   scene.drawText(warnMsg, GETFONT('Var', 9), wrapWidth=wrap)

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)
   numLine = 'two'

   descrMsg = tr(""" 
      The following %s lines backup all addresses 
      <i>ever generated</i> by this wallet (previous and future).
      This can be used to recover your wallet if you forget your passphrase or 
      suffer hardware failure and lose your wallet files. """ % numLine)
   scene.drawText(descrMsg, GETFONT('var', 8), wrapWidth=wrap)
   scene.newLine(extra_dy=10)
  
   ###########################################################################
   # Finally, draw the backup information.
   bottomOfSceneHeader = scene.cursorPos.y()

   code12 = wallet.addrMap['ROOT'].binPrivKey32_Plain.toBinStr()
   Lines = []
   Prefix = [] 
   Prefix.append('Root Key:')
   Lines.append(makeSixteenBytesEasy(code12[:16]))
   Prefix.append('')
   Lines.append(makeSixteenBytesEasy(code12[16:]))
   # Draw the prefix
   origX,origY = scene.getCursorXY()
   scene.moveCursor(20,0) 
   colRect, rowHgt = scene.drawColumn(['<b>'+l+'</b>' for l in Prefix])
   
   nudgeDown = 2  # because the differing font size makes it look unaligned
   scene.moveCursor(20, nudgeDown)
   scene.drawColumn(Lines, 
                    
                           font=GETFONT('Fixed', 8, bold=True), \
                           rowHeight=rowHgt, 
                           useHtml=False)

   scene.moveCursor(MARGIN, colRect.y()-2, absolute=True)
   width = scene.pageRect().width() - 2*MARGIN
   scene.drawRect( width, colRect.height()+7, edgeColor=QColor(0,0,0), fillColor=None)

   scene.newLine(extra_dy=30)
   scene.drawText( tr("""
      The following QR code is for convenience only.  It contains the 
      exact same data as the %s lines above.  If you copy this backup 
      by hand, you can safely ignore this QR code. """ % numLine), wrapWidth=4*INCH)

   scene.moveCursor(20,0)
   x,y = scene.getCursorXY()
   edgeRgt = scene.pageRect().width() - MARGIN
   edgeBot = scene.pageRect().height() - MARGIN

   qrSize = max(1.5*INCH, min(edgeRgt - x, edgeBot - y, 2.0*INCH))
   scene.drawQR('\n'.join(Lines), qrSize)
   scene.newLine(extra_dy=25)
   scene.drawHLine(7*INCH, 5)
   scene.newLine(extra_dy=25)
   scene.drawText(tr(""" 
         <font color="#aa0000"><b>CONGRATULATIONS:</b></font> Thank you for participating
         in the MIT BitComp. You have received a Bitcoin Armory
         wallet containing %s You may collect this money by installing Bitcoin Armory
         from the website shown above. After you install the software move the funds to a new
         wallet or any address that you own. Do not deposit any bitcoins to this wallet. You
         don't know who else has access to this wallet! You have until %s to claim your bitcoins. After
         this date we will remove all remaining bitcoins from this wallet.""" %
         (amountString, expiresString)), GETFONT('Var', 11), wrapWidth=wrap)
      
   scene.newLine(extra_dy=25)
   return scene