Browse Source

Merge pull request #4611 from tiagotrs/master

fix Revealer hidpi related bug #4576, and make PNGs the same size
3.2.x
ThomasV 6 years ago
committed by GitHub
parent
commit
e7ef4aa4f6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      electrum/plugins/revealer/qt.py

11
electrum/plugins/revealer/qt.py

@ -263,20 +263,21 @@ class Plugin(BasePlugin):
painter.begin(bitmap) painter.begin(bitmap)
QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'SourceSansPro-Bold.otf') ) QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'SourceSansPro-Bold.otf') )
if len(txt) < 102 : if len(txt) < 102 :
fontsize = 12 fontsize = 15
linespace = 15 linespace = 15
max_letters = 17 max_letters = 17
max_lines = 6 max_lines = 6
max_words = 3 max_words = 3
else: else:
fontsize = 9 fontsize = 12
linespace = 10 linespace = 10
max_letters = 24 max_letters = 23
max_lines = 9 max_lines = 9
max_words = int(max_letters/4) max_words = int(max_letters/4)
font = QFont('Source Sans Pro', fontsize, QFont.Bold) font = QFont('Source Sans Pro', fontsize, QFont.Bold)
font.setLetterSpacing(QFont.PercentageSpacing, 100) font.setLetterSpacing(QFont.PercentageSpacing, 100)
font.setPixelSize(fontsize)
painter.setFont(font) painter.setFont(font)
seed_array = txt.split(' ') seed_array = txt.split(' ')
@ -339,8 +340,9 @@ class Plugin(BasePlugin):
revealer = self.pixelcode_2x2(self.rawnoise) revealer = self.pixelcode_2x2(self.rawnoise)
revealer.invertPixels() revealer.invertPixels()
revealer = QBitmap.fromImage(revealer) revealer = QBitmap.fromImage(revealer)
revealer = revealer.scaled(self.f_size, Qt.KeepAspectRatio)
revealer = self.overlay_marks(revealer) revealer = self.overlay_marks(revealer)
revealer = revealer.scaled(1014, 642)
self.filename = 'Revealer - ' self.filename = 'Revealer - '
revealer.save(self.base_dir + self.filename + self.version+'_'+self.code_id + '.png') revealer.save(self.base_dir + self.filename + self.version+'_'+self.code_id + '.png')
self.toPdf(QImage(revealer)) self.toPdf(QImage(revealer))
@ -519,6 +521,7 @@ class Plugin(BasePlugin):
f_size = 37 f_size = 37
QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'DejaVuSansMono-Bold.ttf')) QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'DejaVuSansMono-Bold.ttf'))
font = QFont("DejaVu Sans Mono", f_size-11, QFont.Bold) font = QFont("DejaVu Sans Mono", f_size-11, QFont.Bold)
font.setPixelSize(35)
painter.setFont(font) painter.setFont(font)
if not calibration_sheet: if not calibration_sheet:

Loading…
Cancel
Save