mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[view.qt] using the showEvent callback instead of show to try fix centralisation issues
This commit is contained in:
@@ -5,7 +5,7 @@ from functools import reduce
|
|||||||
from typing import Tuple, Optional
|
from typing import Tuple, Optional
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt, QThread, pyqtSignal, QCoreApplication, QMutex
|
from PyQt5.QtCore import QSize, Qt, QThread, pyqtSignal, QCoreApplication, QMutex
|
||||||
from PyQt5.QtGui import QIcon, QCursor, QCloseEvent
|
from PyQt5.QtGui import QIcon, QCursor, QCloseEvent, QShowEvent
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy, QTableWidget, QHeaderView, QPushButton, \
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy, QTableWidget, QHeaderView, QPushButton, \
|
||||||
QProgressBar, QPlainTextEdit, QToolButton, QHBoxLayout
|
QProgressBar, QPlainTextEdit, QToolButton, QHBoxLayout
|
||||||
|
|
||||||
@@ -287,14 +287,14 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
|
|
||||||
self.resize(int(self.get_table_width() * 1.05), self.sizeHint().height())
|
self.resize(int(self.get_table_width() * 1.05), self.sizeHint().height())
|
||||||
|
|
||||||
def show(self):
|
def showEvent(self, event: Optional[QShowEvent]) -> None:
|
||||||
|
super().showEvent(event)
|
||||||
self.prepare_thread.start()
|
self.prepare_thread.start()
|
||||||
screen_size = get_current_screen_geometry()
|
screen_size = get_current_screen_geometry()
|
||||||
self.setMinimumWidth(int(screen_size.width() * 0.5))
|
self.setMinimumWidth(int(screen_size.width() * 0.5))
|
||||||
self.setMinimumHeight(int(screen_size.height() * 0.35))
|
self.setMinimumHeight(int(screen_size.height() * 0.35))
|
||||||
self.setMaximumHeight(int(screen_size.height() * 0.95))
|
self.setMaximumHeight(int(screen_size.height() * 0.95))
|
||||||
centralize(self)
|
centralize(self)
|
||||||
super(PreparePanel, self).show()
|
|
||||||
|
|
||||||
def start(self, tasks: int):
|
def start(self, tasks: int):
|
||||||
self.started_at = time.time()
|
self.started_at = time.time()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from io import StringIO
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QCoreApplication, QThread, pyqtSignal
|
from PyQt5.QtCore import Qt, QCoreApplication, QThread, pyqtSignal
|
||||||
from PyQt5.QtGui import QCursor
|
from PyQt5.QtGui import QCursor, QShowEvent
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QPushButton, QHBoxLayout, QApplication
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QPushButton, QHBoxLayout, QApplication
|
||||||
|
|
||||||
from bauh import __app_name__
|
from bauh import __app_name__
|
||||||
@@ -81,10 +81,10 @@ class SettingsWindow(QWidget):
|
|||||||
self.thread_reload_panel.signal_finished.connect(self._reload_manage_panel)
|
self.thread_reload_panel.signal_finished.connect(self._reload_manage_panel)
|
||||||
centralize(self)
|
centralize(self)
|
||||||
|
|
||||||
def show(self):
|
def showEvent(self, event: Optional[QShowEvent]):
|
||||||
super(SettingsWindow, self).show()
|
super(SettingsWindow, self).showEvent(event)
|
||||||
centralize(self)
|
|
||||||
self.setMinimumWidth(int(self.sizeHint().width()))
|
self.setMinimumWidth(int(self.sizeHint().width()))
|
||||||
|
centralize(self)
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
if self.window and self.window.settings_window == self:
|
if self.window and self.window.settings_window == self:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
|||||||
from typing import List, Type, Set, Tuple, Optional, Dict, Any
|
from typing import List, Type, Set, Tuple, Optional, Dict, Any
|
||||||
|
|
||||||
from PyQt5.QtCore import QEvent, Qt, pyqtSignal, QRect
|
from PyQt5.QtCore import QEvent, Qt, pyqtSignal, QRect
|
||||||
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QCursor, QCloseEvent
|
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QCursor, QCloseEvent, QShowEvent
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \
|
||||||
QLabel, QPlainTextEdit, QProgressBar, QPushButton, QComboBox, QApplication, QListView, QSizePolicy, \
|
QLabel, QPlainTextEdit, QProgressBar, QPushButton, QComboBox, QApplication, QListView, QSizePolicy, \
|
||||||
QMenu, QHBoxLayout
|
QMenu, QHBoxLayout
|
||||||
@@ -607,14 +607,14 @@ class ManageWindow(QWidget):
|
|||||||
if warnings:
|
if warnings:
|
||||||
dialog.show_message(title=self.i18n['warning'].capitalize(), body='<p>{}</p>'.format('<br/><br/>'.join(warnings)), type_=MessageType.WARNING)
|
dialog.show_message(title=self.i18n['warning'].capitalize(), body='<p>{}</p>'.format('<br/><br/>'.join(warnings)), type_=MessageType.WARNING)
|
||||||
|
|
||||||
def show(self):
|
def showEvent(self, event: Optional[QShowEvent]) -> None:
|
||||||
|
super().showEvent(event)
|
||||||
if not self.thread_warnings.isFinished():
|
if not self.thread_warnings.isFinished():
|
||||||
self.thread_warnings.start()
|
self.thread_warnings.start()
|
||||||
|
|
||||||
self._screen_geometry = get_current_screen_geometry()
|
self._screen_geometry = get_current_screen_geometry()
|
||||||
self._update_size_limits()
|
self._update_size_limits()
|
||||||
qt_utils.centralize(self)
|
qt_utils.centralize(self)
|
||||||
super(ManageWindow, self).show()
|
|
||||||
|
|
||||||
def verify_warnings(self):
|
def verify_warnings(self):
|
||||||
self.thread_warnings.start()
|
self.thread_warnings.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user