Fix bug in download_window.py. Set fixed aspect ratio for forecast images.
This commit is contained in:
19
fixed_aspect_ratio_widget.py
Normal file
19
fixed_aspect_ratio_widget.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
class FixedAspectRatioWidget(QWidget):
|
||||
space = 10
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(parent)
|
||||
self.labels = []
|
||||
|
||||
def resizeEvent(self, event):
|
||||
h, w = self.height(), self.width()
|
||||
h_lbl = h / 9 - self.space
|
||||
w_lbl = 5 * h_lbl
|
||||
|
||||
if w_lbl > w:
|
||||
w_lbl = w
|
||||
h_lbl = h / 9 - self.space
|
||||
|
||||
for label in self.labels:
|
||||
label.rescale(w_lbl, h_lbl)
|
||||
Reference in New Issue
Block a user