Fix bug in download_window.py. Set fixed aspect ratio for forecast images.
This commit is contained in:
14
fixed_aspect_ratio_label.py
Normal file
14
fixed_aspect_ratio_label.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from PyQt5.QtWidgets import QLabel
|
||||
from PyQt5.QtCore import QSize, Qt
|
||||
|
||||
class FixedAspectRatioLabel(QLabel):
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(parent)
|
||||
self.pixmap = None
|
||||
|
||||
def rescale(self, w, h):
|
||||
self.resize(QSize(w, h))
|
||||
if self.pixmap:
|
||||
self.setPixmap(
|
||||
self.pixmap.scaled(
|
||||
self.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
|
||||
Reference in New Issue
Block a user