Add docstrings. Also add safe_cast function. Finally

fix some minor issues.
This commit is contained in:
alessandro90
2019-05-25 15:18:06 +02:00
parent a7e36505e9
commit 43a9ce954e
14 changed files with 531 additions and 181 deletions

View File

@@ -3,12 +3,16 @@ from PyQt5.QtCore import QSize
class FixedAspectRatioWidget(QWidget):
"""Subclass QWidget. Keep all the internal labels to a fixed aaspect ratio."""
space = 10
def __init__(self, parent=None):
"""Initialize the instance."""
super().__init__(parent)
self.labels = []
def resizeEvent(self, event):
"""Override QWidget.resizeEvent. Rescale all the internal widgets."""
h, w = self.height(), self.width()
h_lbl = h / 9 - self.space
w_lbl = 5 * h_lbl