mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 14:24:16 +02:00
centralizing gem selector panel
This commit is contained in:
@@ -12,6 +12,7 @@ from bauh.api.abstract.view import MultipleSelectComponent, InputOption
|
|||||||
from bauh.commons import resource, system
|
from bauh.commons import resource, system
|
||||||
from bauh.core.config import Configuration, save
|
from bauh.core.config import Configuration, save
|
||||||
from bauh.util import util
|
from bauh.util import util
|
||||||
|
from bauh.view.qt import qt_utils
|
||||||
from bauh.view.qt.components import MultipleSelectQt, CheckboxQt, new_spacer
|
from bauh.view.qt.components import MultipleSelectQt, CheckboxQt, new_spacer
|
||||||
|
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ class GemSelectorPanel(QWidget):
|
|||||||
|
|
||||||
self.adjustSize()
|
self.adjustSize()
|
||||||
self.setFixedSize(self.size())
|
self.setFixedSize(self.size())
|
||||||
|
qt_utils.centralize(self)
|
||||||
|
|
||||||
def check_state(self, model: CheckboxQt, checked: bool):
|
def check_state(self, model: CheckboxQt, checked: bool):
|
||||||
if self.isVisible():
|
if self.isVisible():
|
||||||
|
|||||||
9
bauh/view/qt/qt_utils.py
Normal file
9
bauh/view/qt/qt_utils.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QApplication
|
||||||
|
|
||||||
|
|
||||||
|
def centralize(widget: QWidget):
|
||||||
|
geo = widget.frameGeometry()
|
||||||
|
screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
|
||||||
|
center_point = QApplication.desktop().screenGeometry(screen).center()
|
||||||
|
geo.moveCenter(center_point)
|
||||||
|
widget.move(geo.topLeft())
|
||||||
@@ -15,7 +15,7 @@ from bauh.api.abstract.view import MessageType
|
|||||||
from bauh.core import gems
|
from bauh.core import gems
|
||||||
from bauh.core.config import Configuration
|
from bauh.core.config import Configuration
|
||||||
from bauh.util import util, resource
|
from bauh.util import util, resource
|
||||||
from bauh.view.qt import dialog, commons
|
from bauh.view.qt import dialog, commons, qt_utils
|
||||||
from bauh.view.qt.about import AboutDialog
|
from bauh.view.qt.about import AboutDialog
|
||||||
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
|
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
|
||||||
from bauh.view.qt.components import new_spacer, InputFilter, IconButton
|
from bauh.view.qt.components import new_spacer, InputFilter, IconButton
|
||||||
@@ -248,7 +248,7 @@ class ManageWindow(QWidget):
|
|||||||
|
|
||||||
self.layout.addWidget(self.toolbar_bottom)
|
self.layout.addWidget(self.toolbar_bottom)
|
||||||
|
|
||||||
self.centralize()
|
qt_utils.centralize(self)
|
||||||
|
|
||||||
self.filter_only_apps = True
|
self.filter_only_apps = True
|
||||||
self.type_filter = self.any_type_filter
|
self.type_filter = self.any_type_filter
|
||||||
@@ -539,13 +539,6 @@ class ManageWindow(QWidget):
|
|||||||
setattr(self, attr, checked)
|
setattr(self, attr, checked)
|
||||||
checkbox.blockSignals(False)
|
checkbox.blockSignals(False)
|
||||||
|
|
||||||
def centralize(self):
|
|
||||||
geo = self.frameGeometry()
|
|
||||||
screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
|
|
||||||
center_point = QApplication.desktop().screenGeometry(screen).center()
|
|
||||||
geo.moveCenter(center_point)
|
|
||||||
self.move(geo.topLeft())
|
|
||||||
|
|
||||||
def _gen_filters(self, updates: int = 0, ignore_updates: bool = False) -> dict:
|
def _gen_filters(self, updates: int = 0, ignore_updates: bool = False) -> dict:
|
||||||
return {
|
return {
|
||||||
'only_apps': self.filter_only_apps,
|
'only_apps': self.filter_only_apps,
|
||||||
@@ -668,7 +661,7 @@ class ManageWindow(QWidget):
|
|||||||
if self.ref_bt_upgrade.isVisible() and self.bt_upgrade.visibleRegion().isEmpty():
|
if self.ref_bt_upgrade.isVisible() and self.bt_upgrade.visibleRegion().isEmpty():
|
||||||
self.adjustSize()
|
self.adjustSize()
|
||||||
|
|
||||||
self.centralize()
|
qt_utils.centralize(self)
|
||||||
|
|
||||||
def update_selected(self):
|
def update_selected(self):
|
||||||
if self.pkgs:
|
if self.pkgs:
|
||||||
|
|||||||
Reference in New Issue
Block a user