mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 07:34:16 +02:00
[improvement][ui] big refactoring regarding the components states
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import QWidget, QApplication
|
||||
|
||||
from bauh.view.util import resource
|
||||
|
||||
|
||||
def centralize(widget: QWidget):
|
||||
geo = widget.frameGeometry()
|
||||
@@ -7,3 +11,11 @@ def centralize(widget: QWidget):
|
||||
center_point = QApplication.desktop().screenGeometry(screen).center()
|
||||
geo.moveCenter(center_point)
|
||||
widget.move(geo.topLeft())
|
||||
|
||||
|
||||
def load_icon(path: str, width: int, height: int = None) -> QIcon:
|
||||
return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.KeepAspectRatio, Qt.SmoothTransformation))
|
||||
|
||||
|
||||
def load_resource_icon(path: str, width: int, height: int = None) -> QIcon:
|
||||
return load_icon(resource.get_path(path), width, height)
|
||||
|
||||
Reference in New Issue
Block a user