[view] fix: several issues related to resizing

This commit is contained in:
Vinicius Moreira
2022-11-04 17:53:05 -03:00
parent 96d38f3b7f
commit de8b143273
8 changed files with 111 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
from collections.abc import Iterable
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \
QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QScrollArea, QFrame, QWidget, QSizePolicy, \
@@ -8,6 +8,7 @@ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \
from bauh.api.abstract.cache import MemoryCache
from bauh.view.qt.components import new_spacer
from bauh.view.qt.qt_utils import get_current_screen_geometry
from bauh.view.util.translation import I18n
IGNORED_ATTRS = {'name', '__app__'}
@@ -15,10 +16,9 @@ IGNORED_ATTRS = {'name', '__app__'}
class InfoDialog(QDialog):
def __init__(self, pkg_info: dict, icon_cache: MemoryCache, i18n: I18n, screen_size: QSize):
def __init__(self, pkg_info: dict, icon_cache: MemoryCache, i18n: I18n):
super(InfoDialog, self).__init__()
self.setWindowTitle(str(pkg_info['__app__']))
self.screen_size = screen_size
self.i18n = i18n
layout = QVBoxLayout()
self.setLayout(layout)
@@ -108,7 +108,9 @@ class InfoDialog(QDialog):
lower_container.layout().addWidget(self.bt_close)
layout.addWidget(lower_container)
self.setMinimumWidth(int(self.gbox_info.sizeHint().width() * 1.2))
self.setMaximumHeight(int(screen_size.height() * 0.8))
screen_height = get_current_screen_geometry().height()
self.setMaximumHeight(int(screen_height * 0.8))
self.adjustSize()
def _gen_show_button(self, idx: int, val):