@ -22,11 +22,11 @@ import sys
from typing import TYPE_CHECKING
import qrcode
from PyQt5 . QtPrintSupport import QPrinter
from PyQt5 . QtCore import Qt , QRectF , QRect , QSizeF , QUrl , QPoint , QSize
from PyQt5 . QtGui import ( QPixmap , QImage , QBitmap , QPainter , QFontDatabase , QPen , QFont ,
QColor , QDesktopServices , qRgba , QPainterPath )
from PyQt5 . QtWidgets import ( QGridLayout , QVBoxLayout , QHBoxLayout , QLabel ,
from PyQt6 . QtPrintSupport import QPrinter
from PyQt6 . QtCore import Qt , QRectF , QRect , QSizeF , QUrl , QPoint , QSize , QMarginsF
from PyQt6 . QtGui import ( QPixmap , QImage , QBitmap , QPainter , QFontDatabase , QPen , QFont ,
QColor , QDesktopServices , qRgba , QPainterPath , QPageSize )
from PyQt6 . QtWidgets import ( QGridLayout , QVBoxLayout , QHBoxLayout , QLabel ,
QPushButton , QLineEdit )
from electrum . plugin import hook
@ -128,7 +128,7 @@ class Plugin(RevealerPlugin):
logo_label . setPixmap ( QPixmap ( icon_path ( ' revealer.png ' ) ) )
# Align the logo label to the top left.
logo_label . setAlignment ( Qt . AlignLeft )
logo_label . setAlignment ( Qt . AlignmentFlag . Align Left )
# Create a VBox layout for the main contents of the dialog.
vbox_layout = QVBoxLayout ( )
@ -143,8 +143,8 @@ class Plugin(RevealerPlugin):
instructions_label = QLabel ( _ ( " Click the button above or type an existing revealer code in the box below. " ) )
# Allow users to select text in the labels.
create_or_load_noise_file_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
instructions_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
create_or_load_noise_file_label . setTextInteractionFlags ( Qt . TextInteractionFlag . Text SelectableByMouse )
instructions_label . setTextInteractionFlags ( Qt . TextInteractionFlag . Text SelectableByMouse )
# Create the buttons.
create_button = QPushButton ( _ ( " Create a new Revealer noise file " ) )
@ -187,7 +187,7 @@ class Plugin(RevealerPlugin):
# Populate the VBox layout.
vbox_layout . addWidget ( create_or_load_noise_file_label )
vbox_layout . addWidget ( create_button , alignment = Qt . AlignCenter )
vbox_layout . addWidget ( create_button , alignment = Qt . AlignmentFlag . Align Center )
vbox_layout . addWidget ( instructions_label )
vbox_layout . addWidget ( self . noise_scan_qr_textedit )
vbox_layout . addLayout ( Buttons ( self . next_button ) )
@ -196,7 +196,7 @@ class Plugin(RevealerPlugin):
hbox_layout . addStretch ( 1 )
vbox_layout . addStretch ( 1 )
return bool ( self . d . exec_ ( ) )
return bool ( self . d . exec ( ) )
def get_noise ( self ) :
# Get the text from the scan QR text edit.
@ -270,7 +270,7 @@ class Plugin(RevealerPlugin):
textCursor = self . custom_secret_scan_qr_textedit . textCursor ( )
# Move the cursor position to the end (setting the text above automatically moves the cursor to the beginning, which is undesirable)
textCursor . movePosition ( textCursor . End )
textCursor . movePosition ( textCursor . MoveOperation . End )
# Set the text cursor with the corrected position.
self . custom_secret_scan_qr_textedit . setTextCursor ( textCursor )
@ -311,7 +311,7 @@ class Plugin(RevealerPlugin):
logo_label . setPixmap ( QPixmap ( icon_path ( ' revealer.png ' ) ) )
# Align the logo label to the top left.
logo_label . setAlignment ( Qt . AlignLeft )
logo_label . setAlignment ( Qt . AlignmentFlag . Align Left )
# Create a VBox layout for the main contents of the dialog.
vbox_layout = QVBoxLayout ( )
@ -331,14 +331,13 @@ class Plugin(RevealerPlugin):
one_time_pad_warning_label = QLabel ( " <b> " + _ ( " Warning " ) + " </b>: " + _ ( " each Revealer is a one-time-pad, use it for a single secret. " ) )
# Allow users to select text in the labels.
ready_to_encrypt_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
instructions_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
self . custom_secret_character_count_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
self . custom_secret_maximum_characters_warning_label
one_time_pad_warning_label . setTextInteractionFlags ( Qt . TextSelectableByMouse )
ready_to_encrypt_label . setTextInteractionFlags ( Qt . TextInteractionFlag . TextSelectableByMouse )
instructions_label . setTextInteractionFlags ( Qt . TextInteractionFlag . TextSelectableByMouse )
self . custom_secret_character_count_label . setTextInteractionFlags ( Qt . TextInteractionFlag . TextSelectableByMouse )
one_time_pad_warning_label . setTextInteractionFlags ( Qt . TextInteractionFlag . TextSelectableByMouse )
# Align the custom secret character count label to the right.
self . custom_secret_character_count_label . setAlignment ( Qt . AlignRight )
self . custom_secret_character_count_label . setAlignment ( Qt . AlignmentFlag . Align Right )
# Initially hide the custom secret character count label.
self . custom_secret_maximum_characters_warning_label . setVisible ( False )
@ -376,12 +375,12 @@ class Plugin(RevealerPlugin):
# Populate the VBox layout.
vbox_layout . addWidget ( ready_to_encrypt_label )
vbox_layout . addWidget ( encrypt_seed_button , alignment = Qt . AlignCenter )
vbox_layout . addWidget ( encrypt_seed_button , alignment = Qt . AlignmentFlag . Align Center )
vbox_layout . addWidget ( instructions_label )
vbox_layout . addWidget ( self . custom_secret_scan_qr_textedit )
vbox_layout . addWidget ( self . custom_secret_character_count_label )
vbox_layout . addWidget ( self . custom_secret_maximum_characters_warning_label )
vbox_layout . addWidget ( self . encrypt_custom_secret_button , alignment = Qt . AlignCenter )
vbox_layout . addWidget ( self . encrypt_custom_secret_button , alignment = Qt . AlignmentFlag . Align Center )
vbox_layout . addSpacing ( 40 )
vbox_layout . addWidget ( one_time_pad_warning_label )
vbox_layout . addLayout ( Buttons ( CloseButton ( d ) ) )
@ -390,7 +389,7 @@ class Plugin(RevealerPlugin):
hbox_layout . addStretch ( 1 )
vbox_layout . addStretch ( 1 )
return bool ( d . exec_ ( ) )
return bool ( d . exec ( ) )
def update_wallet_name ( self , name ) :
self . wallet_name = str ( name )
@ -412,9 +411,9 @@ class Plugin(RevealerPlugin):
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 )
img = QImage ( self . SIZE [ 0 ] , self . SIZE [ 1 ] , QImage . Format . Format _Mono)
bitmap = QBitmap . fromImage ( img , Qt . ImageConversionFlag . MonoOnly )
bitmap . fill ( Qt . GlobalColor . white )
painter = QPainter ( )
painter . begin ( bitmap )
if len ( txt ) < 102 :
@ -430,8 +429,8 @@ class Plugin(RevealerPlugin):
max_lines = 9
max_words = int ( max_letters / 4 )
font = QFont ( ' Source Sans 3 ' , fontsize , QFont . Bold )
font . setLetterSpacing ( QFont . PercentageSpacing , 100 )
font = QFont ( ' Source Sans 3 ' , fontsize , QFont . Weight . Bold )
font . setLetterSpacing ( QFont . SpacingType . PercentageSpacing , 100 )
font . setPixelSize ( fontsize )
painter . setFont ( font )
seed_array = txt . split ( ' ' )
@ -442,7 +441,7 @@ class Plugin(RevealerPlugin):
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 ) ) )
painter . drawText ( QRect ( 0 , linespace * n , self . SIZE [ 0 ] , self . SIZE [ 1 ] ) , Qt . AlignmentFlag . Align HCenter , ' ' . join ( map ( str , temp_seed ) ) )
del seed_array [ : nwords ]
painter . end ( )
@ -458,7 +457,7 @@ class Plugin(RevealerPlugin):
self . versioned_seed = self . gen_random_versioned_seed ( )
assert self . versioned_seed
w , h = self . SIZE
rawnoise = QImage ( w , h , QImage . Format_Mono )
rawnoise = QImage ( w , h , QImage . Format . Format _Mono)
noise_map = self . get_noise_map ( self . versioned_seed )
for ( x , y ) , pixel in noise_map . items ( ) :
@ -471,7 +470,7 @@ class Plugin(RevealerPlugin):
def make_calnoise ( self ) :
random . seed ( self . calibration_noise )
w , h = self . SIZE
rawnoise = QImage ( w , h , QImage . Format_Mono )
rawnoise = QImage ( w , h , QImage . Format . Format _Mono)
for x in range ( w ) :
for y in range ( h ) :
rawnoise . setPixel ( x , y , random . randint ( 0 , 1 ) )
@ -481,7 +480,7 @@ class Plugin(RevealerPlugin):
revealer = self . pixelcode_2x2 ( self . rawnoise )
revealer . invertPixels ( )
revealer = QBitmap . fromImage ( revealer )
revealer = revealer . scaled ( self . f_size , Qt . KeepAspectRatio )
revealer = revealer . scaled ( self . f_size , Qt . AspectRatioMode . KeepAspectRatio )
revealer = self . overlay_marks ( revealer )
self . filename_prefix = ' revealer_ '
@ -489,7 +488,7 @@ class Plugin(RevealerPlugin):
self . toPdf ( QImage ( revealer ) )
def make_cypherseed ( self , img , rawnoise , calibration = False , is_seed = True ) :
img = img . convertToFormat ( QImage . Format_Mono )
img = img . convertToFormat ( QImage . Format . Format _Mono)
p = QPainter ( )
p . begin ( img )
p . setCompositionMode ( 26 ) #xor
@ -497,7 +496,7 @@ class Plugin(RevealerPlugin):
p . end ( )
cypherseed = self . pixelcode_2x2 ( img )
cypherseed = QBitmap . fromImage ( cypherseed )
cypherseed = cypherseed . scaled ( self . f_size , Qt . KeepAspectRatio )
cypherseed = cypherseed . scaled ( self . f_size , Qt . AspectRatioMode . KeepAspectRatio )
cypherseed = self . overlay_marks ( cypherseed , True , calibration )
if not is_seed :
@ -517,9 +516,9 @@ class Plugin(RevealerPlugin):
return cypherseed
def calibration ( self ) :
img = QImage ( self . SIZE [ 0 ] , self . SIZE [ 1 ] , QImage . Format_Mono )
bitmap = QBitmap . fromImage ( img , Qt . MonoOnly )
bitmap . fill ( Qt . black )
img = QImage ( self . SIZE [ 0 ] , self . SIZE [ 1 ] , QImage . Format . Format _Mono)
bitmap = QBitmap . fromImage ( img , Qt . ImageConversionFlag . MonoOnly )
bitmap . fill ( Qt . GlobalColor . black )
self . make_calnoise ( )
img = self . overlay_marks ( self . calnoise . scaledToHeight ( self . f_size . height ( ) ) , False , True )
self . calibration_pdf ( img )
@ -528,11 +527,11 @@ class Plugin(RevealerPlugin):
def toPdf ( self , image ) :
printer = QPrinter ( )
printer . setPap er Size ( QSizeF ( 210 , 297 ) , QPrinter . Millimeter )
printer . setPageSize ( QPag eSize ( QSizeF ( 210 , 297 ) , QPrinter . Unit . Millimeter ) )
printer . setResolution ( 600 )
printer . setOutputFormat ( QPrinter . PdfFormat )
printer . setOutputFormat ( QPrinter . OutputFormat . PdfFormat )
printer . setOutputFileName ( self . get_path_to_revealer_file ( ' .pdf ' ) )
printer . setPageMargins ( 0 , 0 , 0 , 0 , 6 )
printer . setPageMargins ( QMarginsF ( 0 , 0 , 0 , 0 ) , QPrinter . Unit . DevicePixel )
painter = QPainter ( )
painter . begin ( printer )
@ -547,28 +546,28 @@ class Plugin(RevealerPlugin):
painter . drawImage ( 553 , 533 , image )
wpath = QPainterPath ( )
wpath . addRoundedRect ( QRectF ( 553 , 533 , size_h , size_v ) , 19 , 19 )
painter . setPen ( QPen ( Qt . black , 1 ) )
painter . setPen ( QPen ( Qt . GlobalColor . black , 1 ) )
painter . drawPath ( wpath )
painter . end ( )
def calibration_pdf ( self , image ) :
printer = QPrinter ( )
printer . setPap er Size ( QSizeF ( 210 , 297 ) , QPrinter . Millimeter )
printer . setPageSize ( QPag eSize ( QSizeF ( 210 , 297 ) , QPrinter . Unit . Millimeter ) )
printer . setResolution ( 600 )
printer . setOutputFormat ( QPrinter . PdfFormat )
printer . setOutputFormat ( QPrinter . OutputFormat . PdfFormat )
printer . setOutputFileName ( self . get_path_to_calibration_file ( ) )
printer . setPageMargins ( 0 , 0 , 0 , 0 , 6 )
printer . setPageMargins ( QMarginsF ( 0 , 0 , 0 , 0 ) , QPrinter . Unit . DevicePixel )
painter = QPainter ( )
painter . begin ( printer )
painter . drawImage ( 553 , 533 , image )
font = QFont ( ' Source Sans 3 ' , 10 , QFont . Bold )
font = QFont ( ' Source Sans 3 ' , 10 , QFont . Weight . Bold )
painter . setFont ( font )
painter . drawText ( 254 , 277 , _ ( " Calibration sheet " ) )
font = QFont ( ' Source Sans 3 ' , 7 , QFont . Bold )
font = QFont ( ' Source Sans 3 ' , 7 , QFont . Weight . Bold )
painter . setFont ( font )
painter . drawText ( 600 , 2077 , _ ( " Instructions: " ) )
font = QFont ( " " , 7 , QFont . Normal )
font = QFont ( " " , 7 , QFont . Weight . Normal )
painter . setFont ( font )
painter . drawText ( 700 , 2177 , _ ( " 1. Place this paper on a flat and well illuminated surface. " ) )
painter . drawText ( 700 , 2277 , _ ( " 2. Align your Revealer borderlines to the dashed lines on the top and left. " ) )
@ -578,7 +577,7 @@ class Plugin(RevealerPlugin):
painter . end ( )
def pixelcode_2x2 ( self , img ) :
result = QImage ( img . width ( ) * 2 , img . height ( ) * 2 , QImage . Format_ARGB32 )
result = QImage ( img . width ( ) * 2 , img . height ( ) * 2 , QImage . Format . Format _ARGB32)
white = qRgba ( 255 , 255 , 255 , 0 )
black = qRgba ( 0 , 0 , 0 , 255 )
@ -600,8 +599,8 @@ class Plugin(RevealerPlugin):
return result
def overlay_marks ( self , img , is_cseed = False , calibration_sheet = False ) :
border_color = Qt . white
base_img = QImage ( self . f_size . width ( ) , self . f_size . height ( ) , QImage . Format_ARGB32 )
border_color = Qt . GlobalColor . white
base_img = QImage ( self . f_size . width ( ) , self . f_size . height ( ) , QImage . Format . Format _ARGB32)
base_img . fill ( border_color )
img = QImage ( img )
@ -618,7 +617,7 @@ class Plugin(RevealerPlugin):
img )
#frame around image
pen = QPen ( Qt . black , 2 )
pen = QPen ( Qt . GlobalColor . black , 2 )
painter . setPen ( pen )
#horz
@ -635,8 +634,8 @@ class Plugin(RevealerPlugin):
( total_distance_h ) + ( border_thick / 2 ) ,
base_img . width ( ) - ( ( total_distance_h ) * 2 ) - ( ( border_thick ) - 1 ) ,
( base_img . height ( ) - ( ( total_distance_h ) ) * 2 ) - ( ( border_thick ) - 1 ) ) )
pen = QPen ( Qt . black , border_thick )
pen . setJoinStyle ( Qt . MiterJoin )
pen = QPen ( Qt . GlobalColor . black , border_thick )
pen . setJoinStyle ( Qt . PenJoinStyle . MiterJoin )
painter . setPen ( pen )
painter . drawPath ( Rpath )
@ -644,11 +643,11 @@ class Plugin(RevealerPlugin):
Bpath = QPainterPath ( )
Bpath . addRect ( QRectF ( ( total_distance_h ) , ( total_distance_h ) ,
base_img . width ( ) - ( ( total_distance_h ) * 2 ) , ( base_img . height ( ) - ( ( total_distance_h ) ) * 2 ) ) )
pen = QPen ( Qt . black , 1 )
pen = QPen ( Qt . GlobalColor . black , 1 )
painter . setPen ( pen )
painter . drawPath ( Bpath )
pen = QPen ( Qt . black , 1 )
pen = QPen ( Qt . GlobalColor . black , 1 )
painter . setPen ( pen )
painter . drawLine ( 0 , base_img . height ( ) / / 2 , total_distance_h , base_img . height ( ) / / 2 )
painter . drawLine ( base_img . width ( ) / / 2 , 0 , base_img . width ( ) / / 2 , total_distance_h )
@ -658,29 +657,29 @@ class Plugin(RevealerPlugin):
#print code
f_size = 37
font = QFont ( " DejaVu Sans Mono " , f_size - 11 , QFont . Bold )
font = QFont ( " DejaVu Sans Mono " , f_size - 11 , QFont . Weight . Bold )
font . setPixelSize ( 35 )
painter . setFont ( font )
if not calibration_sheet :
if is_cseed : #its a secret
painter . setPen ( QPen ( Qt . black , 1 , Qt . DashDotDotLine ) )
painter . setPen ( QPen ( Qt . GlobalColor . black , 1 , Qt . PenStyle . DashDotDotLine ) )
painter . drawLine ( 0 , dist_v , base_img . width ( ) , dist_v )
painter . drawLine ( dist_h , 0 , dist_h , base_img . height ( ) )
painter . drawLine ( 0 , base_img . height ( ) - dist_v , base_img . width ( ) , base_img . height ( ) - ( dist_v ) )
painter . drawLine ( base_img . width ( ) - ( dist_h ) , 0 , base_img . width ( ) - ( dist_h ) , base_img . height ( ) )
painter . drawImage ( ( ( total_distance_h ) ) + 11 , ( ( total_distance_h ) ) + 11 ,
QImage ( icon_path ( ' electrumb.png ' ) ) . scaledToWidth ( round ( 2.1 * total_distance_h ) , Qt . SmoothTransformation ) )
QImage ( icon_path ( ' electrumb.png ' ) ) . scaledToWidth ( round ( 2.1 * total_distance_h ) , Qt . TransformationMode . SmoothTransformation ) )
painter . setPen ( QPen ( Qt . white , border_thick * 8 ) )
painter . setPen ( QPen ( Qt . GlobalColor . white , border_thick * 8 ) )
painter . drawLine ( int ( base_img . width ( ) - total_distance_h - ( border_thick * 8 ) / 2 - ( border_thick / 2 ) - 2 ) ,
int ( base_img . height ( ) - total_distance_h - ( ( border_thick * 8 ) / 2 ) - ( border_thick / 2 ) - 2 ) ,
int ( base_img . width ( ) - total_distance_h - ( border_thick * 8 ) / 2 - ( border_thick / 2 ) - 2 - 77 ) ,
int ( base_img . height ( ) - total_distance_h - ( ( border_thick * 8 ) / 2 ) - ( border_thick / 2 ) - 2 ) )
painter . setPen ( QColor ( 0 , 0 , 0 , 255 ) )
painter . drawText ( QRect ( 0 , base_img . height ( ) - 107 , base_img . width ( ) - total_distance_h - border_thick - 11 ,
base_img . height ( ) - total_distance_h - border_thick ) , Qt . AlignRight ,
base_img . height ( ) - total_distance_h - border_thick ) , Qt . AlignmentFlag . Align Right ,
self . versioned_seed . version + ' _ ' + self . versioned_seed . checksum )
painter . end ( )
@ -692,16 +691,16 @@ class Plugin(RevealerPlugin):
painter . drawLine ( 0 , base_img . height ( ) - dist_v , base_img . width ( ) , base_img . height ( ) - ( dist_v ) )
painter . drawLine ( base_img . width ( ) - ( dist_h ) , 0 , base_img . width ( ) - ( dist_h ) , base_img . height ( ) )
painter . setPen ( QPen ( Qt . black , 2 ) )
painter . setPen ( QPen ( Qt . GlobalColor . black , 2 ) )
painter . drawLine ( 0 , dist_v , base_img . width ( ) , dist_v )
painter . drawLine ( dist_h , 0 , dist_h , base_img . height ( ) )
painter . drawLine ( 0 , base_img . height ( ) - dist_v , base_img . width ( ) , base_img . height ( ) - ( dist_v ) )
painter . drawLine ( base_img . width ( ) - ( dist_h ) , 0 , base_img . width ( ) - ( dist_h ) , base_img . height ( ) )
logo = QImage ( icon_path ( ' revealer_c.png ' ) ) . scaledToWidth ( round ( 1.3 * ( total_distance_h ) ) )
painter . drawImage ( int ( total_distance_h + border_thick ) , int ( total_distance_h + border_thick ) , logo , Qt . SmoothTransformation )
painter . drawImage ( int ( total_distance_h + border_thick ) , int ( total_distance_h + border_thick ) , logo , Qt . TransformationMode . SmoothTransformation )
#frame around logo
painter . setPen ( QPen ( Qt . black , border_thick ) )
painter . setPen ( QPen ( Qt . GlobalColor . black , border_thick ) )
painter . drawLine ( int ( total_distance_h + border_thick ) , int ( total_distance_h + logo . height ( ) + 3 * ( border_thick / 2 ) ) ,
int ( total_distance_h + logo . width ( ) + border_thick ) , int ( total_distance_h + logo . height ( ) + 3 * ( border_thick / 2 ) ) )
painter . drawLine ( int ( logo . width ( ) + total_distance_h + 3 * ( border_thick / 2 ) ) , int ( total_distance_h + ( border_thick ) ) ,
@ -720,7 +719,7 @@ class Plugin(RevealerPlugin):
int ( base_img . width ( ) / / 2 + ( total_distance_h / 2 ) - border_thick - ( border_thick * 8 ) / / 2 - qr_size ) ,
int ( ( base_img . height ( ) - ( ( total_distance_h ) ) ) - ( border_thick / 2 ) - 2 ) )
painter . setPen ( QPen ( Qt . white , border_thick * 8 ) )
painter . setPen ( QPen ( Qt . GlobalColor . white , border_thick * 8 ) )
painter . drawLine (
int ( base_img . width ( ) - ( ( total_distance_h ) ) - ( border_thick * 8 ) / 2 - ( border_thick / 2 ) - 2 ) ,
int ( ( base_img . height ( ) - ( ( total_distance_h ) ) ) - ( ( border_thick * 8 ) / 2 ) - ( border_thick / 2 ) - 2 ) ,
@ -732,9 +731,9 @@ class Plugin(RevealerPlugin):
int ( base_img . height ( ) - 107 ) ,
int ( base_img . width ( ) - total_distance_h - border_thick - 93 ) ,
int ( base_img . height ( ) - total_distance_h - border_thick ) ) ,
Qt . AlignLeft , self . versioned_seed . get_ui_string_version_plus_seed ( ) )
Qt . AlignmentFlag . Align Left , self . versioned_seed . get_ui_string_version_plus_seed ( ) )
painter . drawText ( QRect ( 0 , base_img . height ( ) - 107 , base_img . width ( ) - total_distance_h - border_thick - 3 - qr_size ,
base_img . height ( ) - total_distance_h - border_thick ) , Qt . AlignRight , self . versioned_seed . checksum )
base_img . height ( ) - total_distance_h - border_thick ) , Qt . AlignmentFlag . Align Right , self . versioned_seed . checksum )
# draw qr code
qr_qt = self . paintQR ( self . versioned_seed . get_ui_string_version_plus_seed ( )
@ -743,7 +742,7 @@ class Plugin(RevealerPlugin):
base_img . height ( ) - 65 - qr_size ,
qr_size , qr_size )
painter . drawImage ( target , qr_qt )
painter . setPen ( QPen ( Qt . black , 4 ) )
painter . setPen ( QPen ( Qt . GlobalColor . black , 4 ) )
painter . drawLine (
int ( base_img . width ( ) - 65 - qr_size ) ,
int ( base_img . height ( ) - 65 - qr_size ) ,
@ -761,23 +760,23 @@ class Plugin(RevealerPlugin):
else : # calibration only
painter . end ( )
cal_img = QImage ( self . f_size . width ( ) + 100 , self . f_size . height ( ) + 100 ,
QImage . Format_ARGB32 )
cal_img . fill ( Qt . white )
QImage . Format . Format _ARGB32)
cal_img . fill ( Qt . GlobalColor . white )
cal_painter = QPainter ( )
cal_painter . begin ( cal_img )
cal_painter . drawImage ( 0 , 0 , base_img )
#black lines in the middle of border top left only
cal_painter . setPen ( QPen ( Qt . black , 1 , Qt . DashDotDotLine ) )
cal_painter . setPen ( QPen ( Qt . GlobalColor . black , 1 , Qt . PenStyle . DashDotDotLine ) )
cal_painter . drawLine ( 0 , dist_v , base_img . width ( ) , dist_v )
cal_painter . drawLine ( dist_h , 0 , dist_h , base_img . height ( ) )
pen = QPen ( Qt . black , 2 , Qt . DashDotDotLine )
pen = QPen ( Qt . GlobalColor . black , 2 , Qt . PenStyle . DashDotDotLine )
cal_painter . setPen ( pen )
n = 15
cal_painter . setFont ( QFont ( " DejaVu Sans Mono " , 21 , QFont . Bold ) )
cal_painter . setFont ( QFont ( " DejaVu Sans Mono " , 21 , QFont . Weight . Bold ) )
for x in range ( - n , n ) :
#lines on bottom (vertical calibration)
cal_painter . drawLine ( int ( ( ( ( base_img . width ( ) ) / ( n * 2 ) ) * ( x ) ) + ( base_img . width ( ) / / 2 ) - 13 ) ,
@ -818,8 +817,8 @@ class Plugin(RevealerPlugin):
qr . add_data ( data )
matrix = qr . get_matrix ( )
k = len ( matrix )
border_color = Qt . white
base_img = QImage ( k * 5 , k * 5 , QImage . Format_ARGB32 )
border_color = Qt . GlobalColor . white
base_img = QImage ( k * 5 , k * 5 , QImage . Format . Format _ARGB32)
base_img . fill ( border_color )
qrpainter = QPainter ( )
qrpainter . begin ( base_img )
@ -827,8 +826,8 @@ class Plugin(RevealerPlugin):
size = k * boxsize
left = ( base_img . width ( ) - size ) / / 2
top = ( base_img . height ( ) - size ) / / 2
qrpainter . setBrush ( Qt . black )
qrpainter . setPen ( Qt . black )
qrpainter . setBrush ( Qt . GlobalColor . black )
qrpainter . setPen ( Qt . GlobalColor . black )
for r in range ( k ) :
for c in range ( k ) :
@ -869,7 +868,7 @@ class Plugin(RevealerPlugin):
vbox . addSpacing ( 13 )
vbox . addLayout ( Buttons ( CloseButton ( d ) , OkButton ( d ) ) )
if not d . exec_ ( ) :
if not d . exec ( ) :
return
self . calibration_h = int ( Decimal ( horizontal . text ( ) ) )