def seed_img(self, is_seed=True):
    if is_seed:
        try:
            cseed = self.get_seed()
        except UserCancelled:
            return
        except InvalidPassword as e:
            self.d.show_error(str(e))
            return
        if (not cseed):
            self.d.show_message(_('This wallet has no seed'))
            return
        txt = cseed.upper()
    else:
        txt = self.txt.upper()
    img = QImage(self.SIZE[0], self.SIZE[1], QImage.Format_Mono)
    bitmap = QBitmap.fromImage(img, Qt.MonoOnly)
    bitmap.fill(Qt.white)
    painter = QPainter()
    painter.begin(bitmap)
    QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'SourceSansPro-Bold.otf'))
    if (len(txt) < 102):
        fontsize = 15
        linespace = 15
        max_letters = 17
        max_lines = 6
        max_words = 3
    else:
        fontsize = 12
        linespace = 10
        max_letters = 21
        max_lines = 9
        max_words = int((max_letters / 4))
    font = QFont('Source Sans Pro', fontsize, QFont.Bold)
    font.setLetterSpacing(QFont.PercentageSpacing, 100)
    font.setPixelSize(fontsize)
    painter.setFont(font)
    seed_array = txt.split(' ')
    for n in range(max_lines):
        nwords = max_words
        temp_seed = seed_array[:nwords]
        while (len(' '.join(map(str, temp_seed))) > max_letters):
            nwords = (nwords - 1)
            temp_seed = seed_array[:nwords]
        painter.drawText(QRect(0, (linespace * n), self.SIZE[0], self.SIZE[1]), Qt.AlignHCenter, ' '.join(map(str, temp_seed)))
        del seed_array[:nwords]
    painter.end()
    img = bitmap.toImage()
    if (self.rawnoise == False):
        self.make_rawnoise()
    self.make_cypherseed(img, self.rawnoise, False, is_seed)
    return img
def seed_img(self, is_seed=True):
    if is_seed:
        try:
            cseed = self.get_seed()
        except UserCancelled:
            return
        except InvalidPassword as e:
            self.d.show_error(str(e))
            return
        if (not cseed):
            self.d.show_message(_('This wallet has no seed'))
            return
        txt = cseed.upper()
    else:
        txt = self.txt.upper()
    img = QImage(self.SIZE[0], self.SIZE[1], QImage.Format_Mono)
    bitmap = QBitmap.fromImage(img, Qt.MonoOnly)
    bitmap.fill(Qt.white)
    painter = QPainter()
    painter.begin(bitmap)
    QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'SourceSansPro-Bold.otf'))
    if (len(txt) < 102):
        fontsize = 15
        linespace = 15
        max_letters = 17
        max_lines = 6
        max_words = 3
    else:
        fontsize = 12
        linespace = 10
        max_letters = 21
        max_lines = 9
        max_words = int((max_letters / 4))
    font = QFont('Source Sans Pro', fontsize, QFont.Bold)
    font.setLetterSpacing(QFont.PercentageSpacing, 100)
    font.setPixelSize(fontsize)
    painter.setFont(font)
    seed_array = txt.split(' ')
    for n in range(max_lines):
        nwords = max_words
        temp_seed = seed_array[:nwords]
        while (len(' '.join(map(str, temp_seed))) > max_letters):
            nwords = (nwords - 1)
            temp_seed = seed_array[:nwords]
        painter.drawText(QRect(0, (linespace * n), self.SIZE[0], self.SIZE[1]), Qt.AlignHCenter, ' '.join(map(str, temp_seed)))
        del seed_array[:nwords]
    painter.end()
    img = bitmap.toImage()
    if (self.rawnoise == False):
        self.make_rawnoise()
    self.make_cypherseed(img, self.rawnoise, False, is_seed)
    return img