commit e5b44bacda6da6c69538ae2efd04ba6eb0f3b2b3
parent 3fa113d76b989325da33bddfb013236146abf284
Author: ThomasV <thomasv@gitorious>
Date: Tue, 17 Jun 2014 14:58:12 +0200
fixedSize qrcode widget
Diffstat:
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -687,7 +687,7 @@ class ElectrumWindow(QMainWindow):
grid.addWidget(clear_button, 3, 2)
grid.setRowStretch(4, 1)
- self.receive_qr = QRCodeWidget()
+ self.receive_qr = QRCodeWidget(fixedSize=200)
grid.addWidget(self.receive_qr, 0, 4, 5, 2)
grid.setRowStretch(5, 1)
diff --git a/gui/qt/qrcodewidget.py b/gui/qt/qrcodewidget.py
@@ -13,10 +13,13 @@ from electrum.i18n import _
class QRCodeWidget(QWidget):
- def __init__(self, data = None):
+ def __init__(self, data = None, fixedSize=False):
QWidget.__init__(self)
self.data = None
self.qr = None
+ self.fixedSize=fixedSize
+ if fixedSize:
+ self.setFixedSize(fixedSize, fixedSize)
self.setData(data)
@@ -26,8 +29,9 @@ class QRCodeWidget(QWidget):
if self.data:
self.qr = qrcode.QRCode()
self.qr.add_data(self.data)
- k = len(self.qr.get_matrix())
- self.setMinimumSize(k*5,k*5)
+ if not self.fixedSize:
+ k = len(self.qr.get_matrix())
+ self.setMinimumSize(k*5,k*5)
else:
self.qr = None