From 440b9cd3cdd3e559891d4cae20a3fc0903654e89 Mon Sep 17 00:00:00 2001 From: Saptak S Date: Fri, 17 Dec 2021 19:49:21 +0530 Subject: [PATCH] Rescales the country images to fit the height --- desktop/src/onionshare/connection_tab.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/desktop/src/onionshare/connection_tab.py b/desktop/src/onionshare/connection_tab.py index 096c503f..b6dae138 100644 --- a/desktop/src/onionshare/connection_tab.py +++ b/desktop/src/onionshare/connection_tab.py @@ -443,11 +443,12 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): # Country shape self.country_image_label = QtWidgets.QLabel() - self.country_image_label.setFixedSize(256, 256) + self.country_image_label.setFixedSize(200, 200) country_image_layout = QtWidgets.QHBoxLayout() country_image_layout.addStretch() country_image_layout.addWidget(self.country_image_label) country_image_layout.addStretch() + country_image_layout.setContentsMargins(0, 0, 0, 0) self.country_image = QtWidgets.QWidget() self.country_image.setLayout(country_image_layout) @@ -534,7 +535,11 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): f"{self.country_code}-{self.common.gui.color_mode}.png", ) ) - self.country_image_label.setPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(path))) + pixmap = QtGui.QPixmap.fromImage(QtGui.QImage(path)).scaled( + self.country_image_label.width() - 10, + self.country_image_label.height() - 10, + ) + self.country_image_label.setPixmap(pixmap) def _detect_automatic_toggled(self): self.country_combobox.setEnabled(False)