[view] improvement: enforcing maximum width and height for the management window based on the primary screen resolution

This commit is contained in:
Vinicius Moreira
2022-05-17 10:12:09 -03:00
parent af46feb64e
commit 712a72edf6
2 changed files with 8 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- manage window minimum width related to the table columns - manage window minimum width related to the table columns
- table columns width for maximized window - table columns width for maximized window
- settings window size rules moved to stylesheet files - settings window size rules moved to stylesheet files
- enforcing maximum width and height for the management window based on the primary screen resolution [#261](https://github.com/vinifmor/bauh/issues/261)
### Fixes ### Fixes

View File

@@ -453,8 +453,10 @@ class ManageWindow(QWidget):
self.thread_load_installed = NotifyInstalledLoaded() self.thread_load_installed = NotifyInstalledLoaded()
self.thread_load_installed.signal_loaded.connect(self._finish_loading_installed) self.thread_load_installed.signal_loaded.connect(self._finish_loading_installed)
self.setMinimumHeight(550) self.setMinimumHeight(int(screen_size.height() * 0.5))
self.setMinimumWidth(1000) self.setMaximumHeight(int(screen_size.height()))
self.setMinimumWidth(int(screen_size.width() * 0.5))
self.setMaximumWidth(int(screen_size.width() - screen_size.width() * 0.015))
self._register_groups() self._register_groups()
def _register_groups(self): def _register_groups(self):
@@ -1132,6 +1134,9 @@ class ManageWindow(QWidget):
new_width *= 1.05 # this extra size is not because of the toolbar button, but the table upgrade buttons new_width *= 1.05 # this extra size is not because of the toolbar button, but the table upgrade buttons
new_width = int(new_width) new_width = int(new_width)
if new_width >= self.maximumWidth():
new_width = self.maximumWidth()
if (self.pkgs and accept_lower_width) or new_width > self.width(): if (self.pkgs and accept_lower_width) or new_width > self.width():
self.resize(new_width, self.height()) self.resize(new_width, self.height())
self.setMinimumWidth(new_width) self.setMinimumWidth(new_width)