From 932cf4ca5e926b28123a2e827cf5bb30a4c25f5f Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Wed, 11 Sep 2024 23:48:02 +0200 Subject: [PATCH 1/8] Qt6 enables UseHighDpiPixmaps and EnableHighDpiScaling by default --- bauh/app.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bauh/app.py b/bauh/app.py index 8dcb57b2..7230306e 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -5,7 +5,7 @@ import traceback import urllib3 -from PyQt5.QtCore import QCoreApplication, Qt +from PyQt6.QtCore import QCoreApplication, Qt from bauh import __app_name__, app_args from bauh.view.core.config import CoreConfigManager @@ -48,11 +48,6 @@ def main(tray: bool = False): except Exception: traceback.print_exc() - if bool(app_config['ui']['hdpi']): - logger.info("HDPI settings activated") - QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) - QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) - if bool(args.suggestions): logger.info("Forcing loading software suggestions after the initialization process") From 8abd6ca0516bb49a0af33a71aed57f2594a6732a Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 00:09:36 +0200 Subject: [PATCH 2/8] Update some attribute/method calling --- README.md | 2 +- bauh/context.py | 4 +- bauh/manage.py | 2 +- bauh/tray.py | 4 +- bauh/view/core/settings.py | 2 +- bauh/view/qt/about.py | 6 +-- bauh/view/qt/apps_table.py | 42 +++++++-------- bauh/view/qt/components.py | 70 ++++++++++++------------- bauh/view/qt/dialog.py | 24 ++++----- bauh/view/qt/history.py | 6 +-- bauh/view/qt/info.py | 14 ++--- bauh/view/qt/prepare.py | 46 ++++++++-------- bauh/view/qt/qt_utils.py | 8 +-- bauh/view/qt/root.py | 18 +++---- bauh/view/qt/screenshots.py | 20 +++---- bauh/view/qt/settings.py | 16 +++--- bauh/view/qt/systray.py | 6 +-- bauh/view/qt/thread.py | 6 +-- bauh/view/qt/window.py | 62 +++++++++++----------- bauh/view/util/util.py | 4 +- linux_dist/appimage/AppImageBuilder.yml | 4 +- tests/gems/arch/resources/bauh_srcinfo | 4 +- tests/gems/arch/test_aur.py | 2 +- tests/gems/arch/test_sorting.py | 2 +- 24 files changed, 187 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index 161d064d..b5c8bb1b 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Key features ##### Required dependencies -`sudo apt-get install python3 python3-pip python3-yaml python3-dateutil python3-pyqt5 python3-packaging python3-requests` +`sudo apt-get install python3 python3-pip python3-yaml python3-dateutil python3-PyQt6 python3-packaging python3-requests` ##### Installing bauh diff --git a/bauh/context.py b/bauh/context.py index 5443c9a3..5be2757e 100644 --- a/bauh/context.py +++ b/bauh/context.py @@ -3,8 +3,8 @@ from logging import Logger from typing import Tuple -from PyQt5.QtCore import QCoreApplication -from PyQt5.QtWidgets import QApplication +from PyQt6.QtCore import QCoreApplication +from PyQt6.QtWidgets import QApplication from bauh import __app_name__, __version__ from bauh.stylesheet import process_theme, read_default_themes, read_user_themes, read_theme_metada diff --git a/bauh/manage.py b/bauh/manage.py index 469aefb5..652ab361 100644 --- a/bauh/manage.py +++ b/bauh/manage.py @@ -2,7 +2,7 @@ from argparse import Namespace from typing import Tuple -from PyQt5.QtWidgets import QApplication, QWidget +from PyQt6.QtWidgets import QApplication, QWidget from bauh import ROOT_DIR, __app_name__, __version__ from bauh.api import user diff --git a/bauh/tray.py b/bauh/tray.py index dc579652..c75c8d67 100644 --- a/bauh/tray.py +++ b/bauh/tray.py @@ -1,8 +1,8 @@ from logging import Logger from typing import Tuple -from PyQt5.QtCore import QObject -from PyQt5.QtWidgets import QApplication +from PyQt6.QtCore import QObject +from PyQt6.QtWidgets import QApplication from bauh.context import new_qt_application from bauh.view.qt.systray import TrayIcon diff --git a/bauh/view/core/settings.py b/bauh/view/core/settings.py index ae276e56..702f57c5 100644 --- a/bauh/view/core/settings.py +++ b/bauh/view/core/settings.py @@ -5,7 +5,7 @@ from threading import Thread from typing import List, Tuple, Optional, Dict, Type, Iterable -from PyQt5.QtWidgets import QApplication, QStyleFactory +from PyQt6.QtWidgets import QApplication, QStyleFactory from bauh import ROOT_DIR, __app_name__ from bauh.api.abstract.context import ApplicationContext diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py index c75f4297..e422218a 100644 --- a/bauh/view/qt/about.py +++ b/bauh/view/qt/about.py @@ -1,7 +1,7 @@ from glob import glob -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel, QWidget, QHBoxLayout, QSizePolicy, QApplication +from PyQt6.QtGui import QIcon +from PyQt6.QtWidgets import QVBoxLayout, QDialog, QLabel, QWidget, QHBoxLayout, QSizePolicy, QApplication from bauh import __version__, __app_name__, ROOT_DIR from bauh.context import generate_i18n @@ -22,7 +22,7 @@ def __init__(self, app_config: dict): logo_container = QWidget() logo_container.setObjectName('logo_container') - logo_container.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + logo_container.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) logo_container.setLayout(QHBoxLayout()) label_logo = QLabel() diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 3fe9a583..ee1efe5c 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -5,9 +5,9 @@ from threading import Lock from typing import List, Optional, Dict -from PyQt5.QtCore import Qt, QSize -from PyQt5.QtGui import QPixmap, QIcon, QCursor -from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QToolButton, QWidget, \ +from PyQt6.QtCore import Qt, QSize +from PyQt6.QtGui import QPixmap, QIcon, QCursor +from PyQt6.QtWidgets import QTableWidget, QTableView, QMenu, QToolButton, QWidget, \ QHeaderView, QLabel, QHBoxLayout, QToolBar, QSizePolicy from bauh.api.abstract.cache import MemoryCache @@ -31,7 +31,7 @@ def __init__(self, pkg: Optional[PackageView], root: QWidget, i18n: I18n, checke self.app_view = pkg self.root = root - self.setCursor(QCursor(Qt.PointingHandCursor)) + self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.setCheckable(True) if clickable: @@ -80,17 +80,17 @@ def __init__(self, parent: QWidget, icon_cache: MemoryCache, download_icons: boo self.download_icons = download_icons self.logger = logger self.setColumnCount(self.COL_NUMBER) - self.setFocusPolicy(Qt.NoFocus) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setShowGrid(False) self.verticalHeader().setVisible(False) self.horizontalHeader().setVisible(False) - self.horizontalHeader().setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) - self.setSelectionBehavior(QTableView.SelectRows) + self.horizontalHeader().setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) + self.setSelectionBehavior(QTableView.SelectionBehavior.SelectRows) self.setHorizontalHeaderLabels(('' for _ in range(self.columnCount()))) - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) - self.horizontalScrollBar().setCursor(QCursor(Qt.PointingHandCursor)) - self.verticalScrollBar().setCursor(QCursor(Qt.PointingHandCursor)) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) + self.horizontalScrollBar().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.verticalScrollBar().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.file_downloader: Optional[URLFileDownloader] = None @@ -109,9 +109,9 @@ def has_any_settings(self, pkg: PackageView): def show_pkg_actions(self, pkg: PackageView): menu_row = QMenu() - menu_row.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + menu_row.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) menu_row.setObjectName('app_actions') - menu_row.setCursor(QCursor(Qt.PointingHandCursor)) + menu_row.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) if pkg.model.installed: @@ -312,7 +312,7 @@ def _gen_row_button(self, text: str, name: str, callback, tip: Optional[str] = N col_bt = QToolButton() col_bt.setProperty('text_only', 'true') col_bt.setObjectName(name) - col_bt.setCursor(QCursor(Qt.PointingHandCursor)) + col_bt.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) col_bt.setText(text) col_bt.clicked.connect(callback) @@ -363,7 +363,7 @@ def _set_col_type(self, col: int, pkg: PackageView): col_type_icon = QLabel() col_type_icon.setProperty('icon', 'true') - col_type_icon.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + col_type_icon.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) col_type_icon.setPixmap(icon_data['px']) col_type_icon.setToolTip(icon_data['tip']) self.setCellWidget(pkg.table_index, col, col_type_icon) @@ -371,7 +371,7 @@ def _set_col_type(self, col: int, pkg: PackageView): def _set_col_version(self, col: int, pkg: PackageView, screen_width: int): label_version = QLabel(str(pkg.model.version if pkg.model.version else '?')) label_version.setObjectName('app_version') - label_version.setAlignment(Qt.AlignCenter) + label_version.setAlignment(Qt.AlignmentFlag.AlignCenter) item = QWidget() item.setProperty('container', 'true') @@ -445,14 +445,14 @@ def _set_col_icon(self, col: int, pkg: PackageView): col_icon = QLabel() col_icon.setProperty('icon', 'true') - col_icon.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + col_icon.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) self._update_icon(col_icon, icon) self.setCellWidget(pkg.table_index, col, col_icon) def _set_col_name(self, col: int, pkg: PackageView, screen_width: int): col_name = QLabel() col_name.setObjectName('app_name') - col_name.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + col_name.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) name = pkg.model.get_display_name().strip() if name: @@ -601,14 +601,14 @@ def show_info(): self.setCellWidget(pkg.table_index, col, toolbar) - def change_headers_policy(self, policy: QHeaderView = QHeaderView.ResizeToContents, maximized: bool = False): + def change_headers_policy(self, policy: QHeaderView = QHeaderView.ResizeMode.ResizeToContents, maximized: bool = False): header_horizontal = self.horizontalHeader() for i in range(self.columnCount()): if maximized: if i in (2, 3): - header_horizontal.setSectionResizeMode(i, QHeaderView.Stretch) + header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeMode.Stretch) else: - header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeToContents) + header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeMode.ResizeToContents) else: header_horizontal.setSectionResizeMode(i, policy) diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index dabd6bc9..8c5fd2c0 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -3,11 +3,11 @@ from pathlib import Path from typing import Tuple, Dict, Optional, Set -from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QIcon, QIntValidator, QCursor, QFocusEvent -from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \ +from PyQt6.QtCore import Qt, QTimer +from PyQt6.QtGui import QIcon, QIntValidator, QCursor, QFocusEvent, QAction +from PyQt6.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \ QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, \ - QSlider, QScrollArea, QFrame, QAction, QSpinBox, QPlainTextEdit, QWidgetAction, QPushButton, QMenu + QSlider, QScrollArea, QFrame, QSpinBox, QPlainTextEdit, QWidgetAction, QPushButton, QMenu from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \ TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, TabGroupComponent, PanelComponent, \ @@ -259,7 +259,7 @@ def remove_saved_state(self, state_id: int): def map_alignment(alignment: ViewComponentAlignment) -> Optional[int]: if alignment == ViewComponentAlignment.CENTER: - return Qt.AlignCenter + return Qt.AlignmentFlag.AlignCenter elif alignment == ViewComponentAlignment.LEFT: return Qt.AlignLeft elif alignment == ViewComponentAlignment.RIGHT: @@ -283,7 +283,7 @@ def __init__(self, model: InputOption, model_parent: SingleSelectComponent): self.model = model self.model_parent = model_parent self.toggled.connect(self._set_checked) - self.setCursor(QCursor(Qt.PointingHandCursor)) + self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) if model_parent.id: self.setProperty('parent', model_parent.id) @@ -328,7 +328,7 @@ def __init__(self, model: InputOption, model_parent: MultipleSelectComponent, ca self.setAttribute(Qt.WA_TransparentForMouseEvents) self.setFocusPolicy(Qt.NoFocus) else: - self.setCursor(QCursor(Qt.PointingHandCursor)) + self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) if model.extra_properties: for name, val in model.extra_properties.items(): @@ -367,9 +367,9 @@ class FormComboBoxQt(QComboBox): def __init__(self, model: SingleSelectComponent): super(FormComboBoxQt, self).__init__() self.model = model - self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) - self.setCursor(QCursor(Qt.PointingHandCursor)) - self.view().setCursor(QCursor(Qt.PointingHandCursor)) + self.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed) + self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.view().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.setEditable(True) self.lineEdit().setReadOnly(True) @@ -408,7 +408,7 @@ class FormRadioSelectQt(QWidget): def __init__(self, model: SingleSelectComponent, parent: QWidget = None): super(FormRadioSelectQt, self).__init__(parent=parent) self.model = model - self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) + self.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Minimum) self.setProperty('opts', str(len(self.model.options) if self.model.options else 0)) if model.id: @@ -423,7 +423,7 @@ def __init__(self, model: SingleSelectComponent, parent: QWidget = None): line, col = 0, 0 for op in model.options: comp = RadioButtonQt(op, model) - comp.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + comp.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) comp.setText(op.label) comp.setToolTip(op.tooltip) @@ -598,7 +598,7 @@ def __init__(self, model: MultipleSelectComponent, callback): comp.setChecked(True) widget = QWidget() - widget.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + widget.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) widget.setLayout(QHBoxLayout()) widget.layout().addWidget(comp) @@ -638,7 +638,7 @@ class FormMultipleSelectQt(QWidget): def __init__(self, model: MultipleSelectComponent, parent: QWidget = None): super(FormMultipleSelectQt, self).__init__(parent=parent) self.model = model - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) if model.min_width and model.min_width > 0: self.setMinimumWidth(int(model.min_width)) @@ -668,7 +668,7 @@ def __init__(self, model: MultipleSelectComponent, parent: QWidget = None): comp.setChecked(True) widget = QWidget() - widget.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + widget.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) widget.setLayout(QHBoxLayout()) widget.layout().addWidget(comp) @@ -736,13 +736,13 @@ def setText(self, p_str): class IconButton(QToolButton): - def __init__(self, action, i18n: I18n, align: int = Qt.AlignCenter, tooltip: str = None, expanding: bool = False): + def __init__(self, action, i18n: I18n, align: int = Qt.AlignmentFlag.AlignCenter, tooltip: str = None, expanding: bool = False): super(IconButton, self).__init__() - self.setCursor(QCursor(Qt.PointingHandCursor)) + self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.clicked.connect(action) self.i18n = i18n self.default_tootip = tooltip - self.setSizePolicy(QSizePolicy.Expanding if expanding else QSizePolicy.Minimum, QSizePolicy.Minimum) + self.setSizePolicy(QSizePolicy.Expanding if expanding else QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) if tooltip: self.setToolTip(tooltip) @@ -767,7 +767,7 @@ def __init__(self, model: PanelComponent, i18n: I18n, parent: QWidget = None): self.setObjectName(model.id) self.setLayout(QVBoxLayout()) - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) if model.components: for c in model.components: @@ -836,7 +836,7 @@ def __init__(self, model: FormComponent, i18n: I18n): def _new_label(self, comp) -> QWidget: label = QWidget() - label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + label.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) label.setLayout(QHBoxLayout()) label_comp = QLabel() label.layout().addWidget(label_comp) @@ -873,7 +873,7 @@ def gen_tip_icon(self, tip: str) -> QLabel: def _new_text_input(self, c: TextInputComponent) -> Tuple[QLabel, QLineEdit]: view = QLineEditObserver() if c.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver() - view.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) + view.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed) if c.id: view.setObjectName(c.id) @@ -907,7 +907,7 @@ def update_model(text: str): c.observers.append(view) label = QWidget() - label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + label.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) label.setLayout(QHBoxLayout()) label_component = QLabel() @@ -923,8 +923,8 @@ def update_model(text: str): def _new_range_input(self, model: RangeInputComponent) -> QSpinBox: spinner = QSpinBox() - spinner.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) - spinner.setCursor(QCursor(Qt.PointingHandCursor)) + spinner.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed) + spinner.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) spinner.setMinimum(model.min) spinner.setMaximum(model.max) spinner.setSingleStep(model.step) @@ -944,7 +944,7 @@ def _update_value(): def _wrap(self, comp: QWidget, model: ViewComponent) -> QWidget: field_container = QWidget() - field_container.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + field_container.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) field_container.setLayout(QHBoxLayout()) field_container.layout().setContentsMargins(0, 0, 0, 0) field_container.layout().setSpacing(0) @@ -964,7 +964,7 @@ def _wrap(self, comp: QWidget, model: ViewComponent) -> QWidget: def _new_file_chooser(self, c: FileChooserComponent) -> Tuple[QLabel, QLineEdit]: chooser = QLineEditObserver() chooser.setProperty('file_chooser', 'true') - chooser.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) + chooser.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed) chooser.setReadOnly(True) if c.id: @@ -1031,7 +1031,7 @@ class TabGroupQt(QTabWidget): def __init__(self, model: TabGroupComponent, i18n: I18n, parent: QWidget = None): super(TabGroupQt, self).__init__(parent=parent) self.model = model - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) self.setTabPosition(QTabWidget.North) for c in model.tabs: @@ -1048,7 +1048,7 @@ def __init__(self, model: TabGroupComponent, i18n: I18n, parent: QWidget = None) scroll.setWidget(to_widget(c.get_content(), i18n)) self.addTab(scroll, icon, c.label) - self.tabBar().setCursor(QCursor(Qt.PointingHandCursor)) + self.tabBar().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) def new_single_select(model: SingleSelectComponent) -> QWidget: @@ -1073,7 +1073,7 @@ def new_spacer(min_width: Optional[int] = None, min_height: Optional[int] = None if min_height is not None and min_height >= 0: spacer.setMaximumHeight(int(min_height)) - spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + spacer.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) return spacer @@ -1106,7 +1106,7 @@ def to_widget(comp: ViewComponent, i18n: I18n, parent: QWidget = None) -> QWidge if comp.size is not None: label.setStyleSheet("QLabel { font-size: " + str(comp.size) + "px }") - label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + label.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) return label elif isinstance(comp, SpacerComponent): return new_spacer() @@ -1126,7 +1126,7 @@ def __init__(self, model: RangeInputComponent): self.setMaximumWidth(int(self.model.max_width)) self.spinner = QSpinBox() - self.spinner.setCursor(QCursor(Qt.PointingHandCursor)) + self.spinner.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.spinner.setMinimum(model.min) self.spinner.setMaximum(model.max) self.spinner.setSingleStep(model.step) @@ -1188,7 +1188,7 @@ def __init__(self, search_callback, parent: Optional[QWidget] = None): self.search_button = QPushButton() self.search_button.setObjectName('search_button') - self.search_button.setCursor(QCursor(Qt.PointingHandCursor)) + self.search_button.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.search_button.clicked.connect(search_callback) self.layout().addWidget(self.search_button) @@ -1275,9 +1275,9 @@ def get_label(self) -> str: class QCustomToolbar(QWidget): - def __init__(self, spacing: int = 2, parent: Optional[QWidget] = None, alignment: Qt.Alignment = Qt.AlignRight, - policy_width: QSizePolicy.Policy = QSizePolicy.Minimum, - policy_height: QSizePolicy.Policy = QSizePolicy.Preferred): + def __init__(self, spacing: int = 2, parent: Optional[QWidget] = None, alignment: Qt.AlignmentFlag = Qt.AlignmentFlag.AlignRight, + policy_width: QSizePolicy.Policy = QSizePolicy.Policy.Minimum, + policy_height: QSizePolicy.Policy = QSizePolicy.Policy.Preferred): super(QCustomToolbar, self).__init__(parent=parent) self.setProperty('container', 'true') self.setSizePolicy(policy_width, policy_height) diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py index 94de3e11..184abdf1 100644 --- a/bauh/view/qt/dialog.py +++ b/bauh/view/qt/dialog.py @@ -1,8 +1,8 @@ from typing import List, Optional -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIcon, QCursor -from PyQt5.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout, QDialog, QVBoxLayout, QSizePolicy, QPushButton, \ +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon, QCursor +from PyQt6.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout, QDialog, QVBoxLayout, QSizePolicy, QPushButton, \ QScrollArea, QFrame from bauh.api.abstract.view import MessageType @@ -11,9 +11,9 @@ from bauh.view.util.translation import I18n MSG_TYPE_MAP = { - MessageType.ERROR: QMessageBox.Critical, - MessageType.INFO: QMessageBox.Information, - MessageType.WARNING: QMessageBox.Warning + MessageType.ERROR: QMessageBox.Icon.Critical, + MessageType.INFO: QMessageBox.Icon.Information, + MessageType.WARNING: QMessageBox.Icon.Warning } @@ -44,7 +44,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI self.setLayout(QVBoxLayout()) self.setWindowTitle(title) - self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) self.setMinimumWidth(min_width if min_width and min_width > 0 else 250) if max_width is not None and max_width > 0: @@ -60,7 +60,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI container_body = QWidget() container_body.setObjectName('confirm_container_body') - container_body.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + container_body.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) if isinstance(min_height, int) and min_height > 0: container_body.setMinimumWidth(min_height) @@ -68,7 +68,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI if widgets: container_body.setLayout(QVBoxLayout()) scroll = QScrollArea(self) - scroll.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + scroll.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) scroll.setFrameShape(QFrame.NoFrame) scroll.setWidgetResizable(True) scroll.setWidget(container_body) @@ -96,7 +96,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI container_bottom = QWidget() container_bottom.setObjectName('confirm_container_bottom') - container_bottom.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + container_bottom.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) container_bottom.setLayout(QHBoxLayout()) self.layout().addWidget(container_bottom) @@ -105,7 +105,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI if confirmation_button: bt_confirm = QPushButton(confirmation_label.capitalize() if confirmation_label else i18n['popup.button.yes']) bt_confirm.setObjectName('ok') - bt_confirm.setCursor(QCursor(Qt.PointingHandCursor)) + bt_confirm.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) bt_confirm.setDefault(True) bt_confirm.setAutoDefault(True) bt_confirm.clicked.connect(self.confirm) @@ -114,7 +114,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI if deny_button: bt_cancel = QPushButton(deny_label.capitalize() if deny_label else i18n['popup.button.no']) bt_cancel.setObjectName('bt_cancel') - bt_cancel.setCursor(QCursor(Qt.PointingHandCursor)) + bt_cancel.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) bt_cancel.clicked.connect(self.close) container_bottom.layout().addWidget(bt_cancel) diff --git a/bauh/view/qt/history.py b/bauh/view/qt/history.py index 30ad4d02..13b20855 100644 --- a/bauh/view/qt/history.py +++ b/bauh/view/qt/history.py @@ -1,9 +1,9 @@ import operator from functools import reduce -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIcon, QCursor -from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QHeaderView, QLabel +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon, QCursor +from PyQt6.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QHeaderView, QLabel from bauh.api.abstract.cache import MemoryCache from bauh.api.abstract.model import PackageHistory diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index 01abcacc..ec64a6b2 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -4,9 +4,9 @@ from subprocess import Popen from typing import Optional -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIcon, QCursor -from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon, QCursor +from PyQt6.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QScrollArea, QFrame, QWidget, QSizePolicy, \ QHBoxLayout @@ -95,13 +95,13 @@ def __init__(self, pkg_info: dict, icon_cache: MemoryCache, i18n: I18n, can_open lower_container = QWidget() lower_container.setObjectName('lower_container') - lower_container.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + lower_container.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) lower_container.setLayout(QHBoxLayout()) self.bt_back = QPushButton('< {}'.format(self.i18n['back'].capitalize())) self.bt_back.setObjectName('back') self.bt_back.setVisible(False) - self.bt_back.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_back.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_back.clicked.connect(self.back_to_info) lower_container.layout().addWidget(self.bt_back) @@ -109,7 +109,7 @@ def __init__(self, pkg_info: dict, icon_cache: MemoryCache, i18n: I18n, can_open self.bt_close = QPushButton(self.i18n['close'].capitalize()) self.bt_close.setObjectName('close') - self.bt_close.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_close.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_close.clicked.connect(self.close) lower_container.layout().addWidget(self.bt_close) @@ -147,7 +147,7 @@ def _show_field(): bt_full_field = QPushButton(bt_label) bt_full_field.setObjectName("show") - bt_full_field.setCursor(QCursor(Qt.PointingHandCursor)) + bt_full_field.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) bt_full_field.clicked.connect(_show_field) self.gbox_info.layout().addWidget(bt_full_field, idx, 2) diff --git a/bauh/view/qt/prepare.py b/bauh/view/qt/prepare.py index fc80fd83..4e4a2331 100644 --- a/bauh/view/qt/prepare.py +++ b/bauh/view/qt/prepare.py @@ -4,9 +4,9 @@ from functools import reduce from typing import Tuple, Optional -from PyQt5.QtCore import QSize, Qt, QThread, pyqtSignal, QCoreApplication, QMutex -from PyQt5.QtGui import QIcon, QCursor, QCloseEvent, QShowEvent -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy, QTableWidget, QHeaderView, QPushButton, \ +from PyQt6.QtCore import QSize, Qt, QThread, pyqtSignal, QCoreApplication, QMutex +from PyQt6.QtGui import QIcon, QCursor, QCloseEvent, QShowEvent +from PyQt6.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy, QTableWidget, QHeaderView, QPushButton, \ QProgressBar, QPlainTextEdit, QToolButton, QHBoxLayout from bauh import __app_name__ @@ -155,7 +155,7 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, self.setWindowTitle('{} ({})'.format(__app_name__, self.i18n['prepare_panel.title.start'].lower())) self.setLayout(QVBoxLayout()) - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) self.manager = manager self.tasks = {} self.output = {} @@ -185,7 +185,7 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, self.progress_thread.signal_change.connect(self._change_progress) self.label_top = QLabel() - self.label_top.setCursor(QCursor(Qt.WaitCursor)) + self.label_top.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.label_top.setText("{}...".format(self.i18n['prepare_panel.title.start'].capitalize())) self.label_top.setObjectName('prepare_status') self.label_top.setAlignment(Qt.AlignHCenter) @@ -194,16 +194,16 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, self.table = QTableWidget() self.table.setObjectName('tasks') - self.table.setCursor(QCursor(Qt.WaitCursor)) + self.table.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.table.setFocusPolicy(Qt.NoFocus) self.table.setShowGrid(False) self.table.verticalHeader().setVisible(False) self.table.horizontalHeader().setVisible(False) - self.table.horizontalHeader().setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + self.table.horizontalHeader().setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) self.table.setColumnCount(4) self.table.setHorizontalHeaderLabels(['' for _ in range(4)]) - self.table.horizontalScrollBar().setCursor(QCursor(Qt.PointingHandCursor)) - self.table.verticalScrollBar().setCursor(QCursor(Qt.PointingHandCursor)) + self.table.horizontalScrollBar().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.table.verticalScrollBar().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.layout().addWidget(self.table) self.textarea_details = QPlainTextEdit(self) @@ -223,16 +223,16 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, bt_hide_details = QPushButton(self.i18n['prepare.bt_hide_details']) bt_hide_details.setObjectName('bt_hide_details') bt_hide_details.clicked.connect(self.hide_output) - bt_hide_details.setCursor(QCursor(Qt.PointingHandCursor)) + bt_hide_details.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bottom_widget.layout().addWidget(bt_hide_details) self.bottom_widget.layout().addStretch() self.layout().addWidget(self.bottom_widget) self.bottom_widget.setVisible(False) - self.bt_bar = QCustomToolbar(policy_height=QSizePolicy.Fixed) + self.bt_bar = QCustomToolbar(policy_height=QSizePolicy.Policy.Fixed) self.bt_close = QPushButton(self.i18n['close'].capitalize()) self.bt_close.setObjectName('bt_cancel') - self.bt_close.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_close.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_close.clicked.connect(self.close) self.bt_close.setVisible(False) self.bt_bar.add_widget(self.bt_close) @@ -242,14 +242,14 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, self.progress_bar.setObjectName('prepare_progress') self.progress_bar.setTextVisible(False) self.progress_bar.setVisible(False) - self.progress_bar.setCursor(QCursor(Qt.WaitCursor)) + self.progress_bar.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.bt_bar.add_widget(self.progress_bar) self.bt_bar.add_widget(new_spacer()) self.bt_skip = QPushButton(self.i18n['prepare_panel.bt_skip.label'].capitalize()) self.bt_skip.clicked.connect(self.finish) self.bt_skip.setEnabled(False) - self.bt_skip.setCursor(QCursor(Qt.WaitCursor)) + self.bt_skip.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.bt_bar.add_widget(self.bt_skip) self.layout().addWidget(self.bt_bar) @@ -272,7 +272,7 @@ def ask_root_password(self): def _enable_skip_button(self): self.bt_skip.setEnabled(True) - self.bt_skip.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_skip.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) def _change_progress(self, value: int): self.progress_bar.setValue(value) @@ -323,7 +323,7 @@ def register_task(self, id_: str, label: str, icon_path: str): bt_icon = QToolButton() bt_icon.setObjectName('bt_task') - bt_icon.setCursor(QCursor(Qt.WaitCursor)) + bt_icon.setCursor(QCursor(Qt.CursorShape.WaitCursor)) bt_icon.setEnabled(False) bt_icon.setToolTip(self.i18n['prepare.bt_icon.no_output']) @@ -356,27 +356,27 @@ def _show_output(): lb_status = QLabel(label) lb_status.setObjectName('task_status') lb_status.setProperty('status', 'running') - lb_status.setCursor(Qt.WaitCursor) + lb_status.setCursor(Qt.CursorShape.WaitCursor) lb_status.setMinimumWidth(50) - lb_status.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + lb_status.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) lb_status_col = 1 self.table.setCellWidget(task_row, lb_status_col, lb_status) lb_progress = QLabel('{0:.2f}'.format(0) + '%') lb_progress.setObjectName('task_progress') lb_progress.setProperty('status', 'running') - lb_progress.setCursor(Qt.WaitCursor) + lb_progress.setCursor(Qt.CursorShape.WaitCursor) lb_progress.setContentsMargins(10, 0, 10, 0) - lb_progress.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + lb_progress.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) lb_progress_col = 2 self.table.setCellWidget(task_row, lb_progress_col, lb_progress) lb_sub = QLabel() lb_sub.setObjectName('task_substatus') - lb_sub.setCursor(Qt.WaitCursor) + lb_sub.setCursor(Qt.CursorShape.WaitCursor) lb_sub.setContentsMargins(10, 0, 10, 0) - lb_sub.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + lb_sub.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) lb_sub.setMinimumWidth(50) self.table.setCellWidget(task_row, 3, lb_sub) @@ -412,7 +412,7 @@ def update_output(self, task_id: str, output: str): self.output[task_id] = full_output task = self.tasks[task_id] task['bt_icon'].setEnabled(True) - task['bt_icon'].setCursor(QCursor(Qt.PointingHandCursor)) + task['bt_icon'].setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) task['bt_icon'].setToolTip(self.i18n['prepare.bt_icon.output']) full_output.append(output) diff --git a/bauh/view/qt/qt_utils.py b/bauh/view/qt/qt_utils.py index 0bcaa7c9..ab0f1b8b 100644 --- a/bauh/view/qt/qt_utils.py +++ b/bauh/view/qt/qt_utils.py @@ -1,8 +1,8 @@ from typing import Optional, Union -from PyQt5.QtCore import Qt, QRect, QPoint -from PyQt5.QtGui import QIcon, QPixmap -from PyQt5.QtWidgets import QWidget, QApplication, QDesktopWidget +from PyQt6.QtCore import Qt, QRect, QPoint +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtWidgets import QWidget, QApplication, QDesktopWidget from bauh.view.util import resource @@ -19,7 +19,7 @@ def centralize(widget: QWidget, align_top_left: bool = True): 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)) + return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.AspectRatioMode.KeepAspectRatio, Qt.SmoothTransformation)) def load_resource_icon(path: str, width: int, height: int = None) -> QIcon: diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index 0c58c10c..80fcdd4d 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -2,9 +2,9 @@ import traceback from typing import Tuple, Optional -from PyQt5.QtCore import Qt, QThread, pyqtSignal -from PyQt5.QtGui import QCursor -from PyQt5.QtWidgets import QLineEdit, QApplication, QDialog, QPushButton, QVBoxLayout, \ +from PyQt6.QtCore import Qt, QThread, pyqtSignal +from PyQt6.QtGui import QCursor +from PyQt6.QtWidgets import QLineEdit, QApplication, QDialog, QPushButton, QVBoxLayout, \ QSizePolicy, QToolBar, QLabel from bauh.api.abstract.context import ApplicationContext @@ -43,7 +43,7 @@ def __init__(self, i18n: I18n, max_tries: int = 3): self.i18n = i18n self.max_tries = max_tries self.tries = 0 - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) self.setWindowIcon(util.get_default_icon()[1]) self.setWindowTitle(i18n['popup.root.title']) self.setLayout(QVBoxLayout()) @@ -69,8 +69,8 @@ def __init__(self, i18n: I18n, max_tries: int = 3): self.bt_ok = QPushButton(i18n['popup.root.continue']) self.bt_ok.setDefault(True) self.bt_ok.setAutoDefault(True) - self.bt_ok.setCursor(QCursor(Qt.PointingHandCursor)) - self.bt_ok.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.bt_ok.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.bt_ok.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) self.bt_ok.setObjectName('ok') self.bt_ok.clicked.connect(self._validate_password) self.lower_bar.addWidget(self.bt_ok) @@ -78,8 +78,8 @@ def __init__(self, i18n: I18n, max_tries: int = 3): self.bt_cancel = QPushButton() self.bt_cancel.setText(i18n['popup.button.cancel']) - self.bt_cancel.setCursor(QCursor(Qt.PointingHandCursor)) - self.bt_cancel.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.bt_cancel.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.bt_cancel.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) self.bt_cancel.setObjectName('bt_cancel') self.bt_cancel.clicked.connect(self.close) self.lower_bar.addWidget(self.bt_cancel) @@ -101,7 +101,7 @@ def _validate_password(self): self.input_password.setEnabled(False) self.label_error.setText('') - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) + QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) self.validate_password.password = password self.validate_password.start() diff --git a/bauh/view/qt/screenshots.py b/bauh/view/qt/screenshots.py index 08a30fe0..7b327667 100644 --- a/bauh/view/qt/screenshots.py +++ b/bauh/view/qt/screenshots.py @@ -4,9 +4,9 @@ from threading import Thread from typing import List, Dict -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIcon, QPixmap, QCursor -from PyQt5.QtWidgets import QDialog, QLabel, QPushButton, QVBoxLayout, QProgressBar, QApplication, QWidget, \ +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon, QPixmap, QCursor +from PyQt6.QtWidgets import QDialog, QLabel, QPushButton, QVBoxLayout, QProgressBar, QApplication, QWidget, \ QSizePolicy, QHBoxLayout from bauh.api.abstract.cache import MemoryCache @@ -31,7 +31,7 @@ def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: Memory self.http_client = http_client self.progress_bar = QProgressBar() self.progress_bar.setObjectName('progress_screenshots') - self.progress_bar.setCursor(QCursor(Qt.WaitCursor)) + self.progress_bar.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.progress_bar.setMaximumHeight(10 if QApplication.instance().style().objectName().lower() == 'windows' else 6) self.progress_bar.setTextVisible(False) self.thread_progress = AnimateProgress() @@ -52,11 +52,11 @@ def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: Memory self.bt_close = QPushButton(self.i18n['screenshots.bt_close']) self.bt_close.setObjectName('close') self.bt_close.clicked.connect(self.close) - self.bt_close.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_close.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.upper_buttons = QWidget() self.upper_buttons.setObjectName('upper_buttons') - self.upper_buttons.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + self.upper_buttons.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.upper_buttons.setContentsMargins(0, 0, 0, 0) self.upper_buttons.setLayout(QHBoxLayout()) self.upper_buttons.layout().setAlignment(Qt.AlignRight) @@ -72,14 +72,14 @@ def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: Memory self.container_buttons = QWidget() self.container_buttons.setObjectName('buttons_container') - self.container_buttons.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + self.container_buttons.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.container_buttons.setContentsMargins(0, 0, 0, 0) self.container_buttons.setLayout(QHBoxLayout()) self.bt_back = QPushButton(' < ' + self.i18n['screenshots.bt_back.label'].capitalize()) self.bt_back.setObjectName('back') self.bt_back.setProperty('control', 'true') - self.bt_back.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_back.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_back.clicked.connect(self.back) self.container_buttons.layout().addWidget(self.bt_back) self.container_buttons.layout().addWidget(new_spacer()) @@ -94,7 +94,7 @@ def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: Memory self.bt_next = QPushButton(self.i18n['screenshots.bt_next.label'].capitalize() + ' > ') self.bt_next.setObjectName('next') self.bt_next.setProperty('control', 'true') - self.bt_next.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_next.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_next.clicked.connect(self.next) self.container_buttons.layout().addWidget(self.bt_next) self.download_progress: Dict[int, float] = dict() @@ -136,7 +136,7 @@ def _load_img(self, img_idx: int): self.progress_bar.setVisible(False) else: self.img.setPixmap(QPixmap()) - self.img.setCursor(QCursor(Qt.WaitCursor)) + self.img.setCursor(QCursor(Qt.CursorShape.WaitCursor)) progress = self.download_progress.get(self.img_idx, 0) self.img.setText(f"{self.i18n['screenshots.image.loading']} " diff --git a/bauh/view/qt/settings.py b/bauh/view/qt/settings.py index 2b1d9bdd..8019dddf 100644 --- a/bauh/view/qt/settings.py +++ b/bauh/view/qt/settings.py @@ -2,9 +2,9 @@ from io import StringIO from typing import Optional -from PyQt5.QtCore import Qt, QCoreApplication, QThread, pyqtSignal -from PyQt5.QtGui import QCursor, QShowEvent -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QPushButton, QHBoxLayout, QApplication +from PyQt6.QtCore import Qt, QCoreApplication, QThread, pyqtSignal +from PyQt6.QtGui import QCursor, QShowEvent +from PyQt6.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QPushButton, QHBoxLayout, QApplication from bauh import __app_name__ from bauh.api.abstract.controller import SoftwareManager @@ -42,7 +42,7 @@ def __init__(self, manager: SoftwareManager, i18n: I18n, window: QWidget, parent self.setLayout(QVBoxLayout()) self.manager = manager self.i18n = i18n - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) self.window = window self.settings_model = tuple(v for v in self.manager.get_settings())[0].component @@ -55,12 +55,12 @@ def __init__(self, manager: SoftwareManager, i18n: I18n, window: QWidget, parent lower_container.setObjectName('lower_container') lower_container.setProperty('container', 'true') lower_container.setLayout(QHBoxLayout()) - lower_container.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + lower_container.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.bt_close = QPushButton() self.bt_close.setObjectName('cancel') self.bt_close.setAutoDefault(True) - self.bt_close.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_close.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_close.setText(self.i18n['close'].capitalize()) self.bt_close.clicked.connect(lambda: self.close()) lower_container.layout().addWidget(self.bt_close) @@ -70,7 +70,7 @@ def __init__(self, manager: SoftwareManager, i18n: I18n, window: QWidget, parent self.bt_change = QPushButton() self.bt_change.setAutoDefault(True) self.bt_change.setObjectName('ok') - self.bt_change.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_change.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_change.setText(self.i18n['change'].capitalize()) self.bt_change.clicked.connect(self._save_settings) lower_container.layout().addWidget(self.bt_change) @@ -127,7 +127,7 @@ def _save_settings(self): util.restart_app() else: self.thread_reload_panel.start() - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor) else: msg = StringIO() msg.write(f"

{self.i18n['settings.error']}

") diff --git a/bauh/view/qt/systray.py b/bauh/view/qt/systray.py index 44228971..9737775d 100755 --- a/bauh/view/qt/systray.py +++ b/bauh/view/qt/systray.py @@ -9,9 +9,9 @@ from threading import Lock, Thread from typing import List -from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, QSize -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QSystemTrayIcon, QMenu +from PyQt6.QtCore import QThread, pyqtSignal, QCoreApplication, QSize +from PyQt6.QtGui import QIcon +from PyQt6.QtWidgets import QSystemTrayIcon, QMenu from bauh import __app_name__, ROOT_DIR from bauh.api.abstract.model import PackageUpdate diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index 44584418..aa336e61 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -12,9 +12,9 @@ from typing import List, Type, Set, Tuple, Optional, Pattern import requests -from PyQt5.QtCore import QThread, pyqtSignal, QObject -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QWidget +from PyQt6.QtCore import QThread, pyqtSignal, QObject +from PyQt6.QtGui import QIcon +from PyQt6.QtWidgets import QWidget from bauh.api import user from bauh.api.abstract.cache import MemoryCache diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 7fb06c86..910cd67f 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -6,9 +6,9 @@ from pathlib import Path from typing import List, Type, Set, Tuple, Optional, Dict, Any -from PyQt5.QtCore import QEvent, Qt, pyqtSignal, QRect -from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QCursor, QCloseEvent, QShowEvent -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \ +from PyQt6.QtCore import QEvent, Qt, pyqtSignal, QRect +from PyQt6.QtGui import QIcon, QWindowStateChangeEvent, QCursor, QCloseEvent, QShowEvent +from PyQt6.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \ QLabel, QPlainTextEdit, QProgressBar, QPushButton, QComboBox, QApplication, QListView, QSizePolicy, \ QMenu, QHBoxLayout @@ -147,12 +147,12 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.toolbar_filters = QWidget() self.toolbar_filters.setObjectName('table_filters') self.toolbar_filters.setLayout(QHBoxLayout()) - self.toolbar_filters.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + self.toolbar_filters.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.toolbar_filters.setContentsMargins(0, 0, 0, 0) self.check_updates = QCheckBox() self.check_updates.setObjectName('check_updates') - self.check_updates.setCursor(QCursor(Qt.PointingHandCursor)) + self.check_updates.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.check_updates.setText(self.i18n['updates'].capitalize()) self.check_updates.stateChanged.connect(self._handle_updates_filter) self.check_updates.sizePolicy().setRetainSizeWhenHidden(True) @@ -161,7 +161,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.check_installed = QCheckBox() self.check_installed.setObjectName('check_installed') - self.check_installed.setCursor(QCursor(Qt.PointingHandCursor)) + self.check_installed.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.check_installed.setText(self.i18n['manage_window.checkbox.only_installed']) self.check_installed.setChecked(False) self.check_installed.stateChanged.connect(self._handle_filter_only_installed) @@ -171,7 +171,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.check_apps = QCheckBox() self.check_apps.setObjectName('check_apps') - self.check_apps.setCursor(QCursor(Qt.PointingHandCursor)) + self.check_apps.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.check_apps.setText(self.i18n['manage_window.checkbox.only_apps']) self.check_apps.setChecked(True) self.check_apps.stateChanged.connect(self._handle_filter_only_apps) @@ -181,7 +181,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.check_verified = QCheckBox() self.check_verified.setObjectName('check_verified') - self.check_verified.setCursor(QCursor(Qt.PointingHandCursor)) + self.check_verified.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.check_verified.setText(self.i18n['manage_window.checkbox.only_verified']) self.check_verified.setChecked(False) self.check_verified.stateChanged.connect(self._handle_filter_only_verified) @@ -193,13 +193,13 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.cache_type_filter_icons = {} self.combo_filter_type = QComboBox() self.combo_filter_type.setObjectName('combo_types') - self.combo_filter_type.setCursor(QCursor(Qt.PointingHandCursor)) + self.combo_filter_type.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.combo_filter_type.setView(QListView()) - self.combo_filter_type.view().setCursor(QCursor(Qt.PointingHandCursor)) - self.combo_filter_type.setSizeAdjustPolicy(QComboBox.AdjustToContents) + self.combo_filter_type.view().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.combo_filter_type.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents) self.combo_filter_type.setEditable(True) self.combo_filter_type.lineEdit().setReadOnly(True) - self.combo_filter_type.lineEdit().setAlignment(Qt.AlignCenter) + self.combo_filter_type.lineEdit().setAlignment(Qt.AlignmentFlag.AlignCenter) self.combo_filter_type.activated.connect(self._handle_type_filter) self.combo_filter_type.addItem('--- {} ---'.format(self.i18n['type'].capitalize()), self.any_type_filter) self.combo_filter_type.sizePolicy().setRetainSizeWhenHidden(True) @@ -209,12 +209,12 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.any_category_filter = 'any' self.combo_categories = QComboBox() self.combo_categories.setObjectName('combo_categories') - self.combo_categories.setCursor(QCursor(Qt.PointingHandCursor)) - self.combo_categories.setSizeAdjustPolicy(QComboBox.AdjustToContents) - self.combo_categories.view().setCursor(QCursor(Qt.PointingHandCursor)) + self.combo_categories.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.combo_categories.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents) + self.combo_categories.view().setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.combo_categories.setEditable(True) self.combo_categories.lineEdit().setReadOnly(True) - self.combo_categories.lineEdit().setAlignment(Qt.AlignCenter) + self.combo_categories.lineEdit().setAlignment(Qt.AlignmentFlag.AlignCenter) self.combo_categories.activated.connect(self._handle_category_filter) self.combo_categories.sizePolicy().setRetainSizeWhenHidden(True) self.combo_categories.addItem('--- {} ---'.format(self.i18n['category'].capitalize()), self.any_category_filter) @@ -238,7 +238,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager bt_inst = QPushButton() bt_inst.setObjectName('bt_installed') bt_inst.setProperty('root', 'true') - bt_inst.setCursor(QCursor(Qt.PointingHandCursor)) + bt_inst.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) bt_inst.setToolTip(self.i18n['manage_window.bt.installed.tooltip']) bt_inst.setText(self.i18n['manage_window.bt.installed.text'].capitalize()) bt_inst.clicked.connect(self._begin_loading_installed) @@ -250,7 +250,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager bt_ref = QPushButton() bt_ref.setObjectName('bt_refresh') bt_ref.setProperty('root', 'true') - bt_ref.setCursor(QCursor(Qt.PointingHandCursor)) + bt_ref.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) bt_ref.setToolTip(i18n['manage_window.bt.refresh.tooltip']) bt_ref.setText(self.i18n['manage_window.bt.refresh.text']) bt_ref.clicked.connect(self.begin_refresh_packages) @@ -262,7 +262,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.bt_upgrade = QPushButton() self.bt_upgrade.setProperty('root', 'true') self.bt_upgrade.setObjectName('bt_upgrade') - self.bt_upgrade.setCursor(QCursor(Qt.PointingHandCursor)) + self.bt_upgrade.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.bt_upgrade.setToolTip(i18n['manage_window.bt.upgrade.tooltip']) self.bt_upgrade.setText(i18n['manage_window.bt.upgrade.text']) self.bt_upgrade.clicked.connect(self.upgrade_selected) @@ -302,13 +302,13 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.toolbar_console = QWidget() self.toolbar_console.setObjectName('console_toolbar') - self.toolbar_console.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + self.toolbar_console.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.toolbar_console.setLayout(QHBoxLayout()) self.toolbar_console.setContentsMargins(0, 0, 0, 0) self.check_details = QCheckBox() self.check_details.setObjectName('check_details') - self.check_details.setCursor(QCursor(Qt.PointingHandCursor)) + self.check_details.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.check_details.setText(self.i18n['manage_window.checkbox.show_details']) self.check_details.stateChanged.connect(self._handle_console) self.toolbar_console.layout().addWidget(self.check_details) @@ -318,7 +318,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.label_displayed = QLabel() self.label_displayed.setObjectName('apps_displayed') - self.label_displayed.setCursor(QCursor(Qt.WhatsThisCursor)) + self.label_displayed.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) self.label_displayed.setToolTip(self.i18n['manage_window.label.apps_displayed.tip']) self.toolbar_console.layout().addWidget(self.label_displayed) self.label_displayed.hide() @@ -339,7 +339,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.label_substatus = QLabel() self.label_substatus.setObjectName('label_substatus') - self.label_substatus.setCursor(QCursor(Qt.WaitCursor)) + self.label_substatus.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.toolbar_substatus.addWidget(self.label_substatus) self.toolbar_substatus.addWidget(new_spacer()) self.layout.addWidget(self.toolbar_substatus) @@ -384,7 +384,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.container_bottom = QWidget() self.container_bottom.setObjectName('container_bottom') - self.container_bottom.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + self.container_bottom.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.container_bottom.setLayout(QHBoxLayout()) self.container_bottom.layout().setContentsMargins(0, 0, 0, 0) @@ -434,13 +434,13 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.layout.addWidget(self.container_bottom) - self.container_progress = QCustomToolbar(spacing=0, policy_height=QSizePolicy.Fixed) + self.container_progress = QCustomToolbar(spacing=0, policy_height=QSizePolicy.Policy.Fixed) self.container_progress.setObjectName('container_progress') self.container_progress.add_space() self.progress_bar = QProgressBar() self.progress_bar.setObjectName('progress_manage') - self.progress_bar.setCursor(QCursor(Qt.WaitCursor)) + self.progress_bar.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.progress_bar.setTextVisible(False) self.container_progress.add_widget(self.progress_bar) @@ -506,7 +506,7 @@ def _update_process_progress(self, val: int): def _change_status(self, status: str = None): if status: self.label_status.setText(status + '...') - self.label_status.setCursor(QCursor(Qt.WaitCursor)) + self.label_status.setCursor(QCursor(Qt.CursorShape.WaitCursor)) else: self.label_status.setText('') self.label_status.unsetCursor() @@ -516,7 +516,7 @@ def _set_table_enabled(self, enabled: bool): if enabled: self.table_container.unsetCursor() else: - self.table_container.setCursor(QCursor(Qt.WaitCursor)) + self.table_container.setCursor(QCursor(Qt.CursorShape.WaitCursor)) def begin_apply_filters(self): self.stop_notifying_package_states() @@ -1235,7 +1235,7 @@ def set_progress_controll(self, enabled: bool): def upgrade_selected(self): body = QWidget() body.setLayout(QHBoxLayout()) - body.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + body.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) body.layout().addWidget(QLabel(self.i18n['manage_window.upgrade_all.popup.body'])) body.layout().addWidget(UpgradeToggleButton(pkg=None, root=self, i18n=self.i18n, clickable=False)) if ConfirmationDialog(title=self.i18n['manage_window.upgrade_all.popup.title'], @@ -1683,7 +1683,7 @@ def _map_custom_action(self, action: CustomSoftwareAction, parent: QWidget) -> Q def show_custom_actions(self): if self.custom_actions: menu_row = QMenu() - menu_row.setCursor(QCursor(Qt.PointingHandCursor)) + menu_row.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) actions = [self._map_custom_action(a, menu_row) for a in self.custom_actions] menu_row.addActions(actions) menu_row.adjustSize() @@ -1775,7 +1775,7 @@ def _change_theme(): def show_themes(self): menu_row = QMenu() - menu_row.setCursor(QCursor(Qt.PointingHandCursor)) + menu_row.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) menu_row.addActions(self._map_theme_actions(menu_row)) menu_row.adjustSize() menu_row.popup(QCursor.pos()) diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index 42dbe685..341830e2 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -5,8 +5,8 @@ import traceback from typing import List, Tuple -from PyQt5.QtCore import QCoreApplication -from PyQt5.QtGui import QIcon +from PyQt6.QtCore import QCoreApplication +from PyQt6.QtGui import QIcon from colorama import Fore from bauh import __app_name__ diff --git a/linux_dist/appimage/AppImageBuilder.yml b/linux_dist/appimage/AppImageBuilder.yml index f9b360df..7c29083f 100755 --- a/linux_dist/appimage/AppImageBuilder.yml +++ b/linux_dist/appimage/AppImageBuilder.yml @@ -49,9 +49,9 @@ AppDir: - python3-distutils after_bundle: - - pip3 install pyqt5==5.15.10 --prefix=/usr --root=AppDir || exit 1 + - pip3 install PyQt6==6.6.2 --prefix=/usr --root=AppDir || exit 1 - rm -rf AppDir/usr/share/doc || exit 1 - - cd AppDir/usr/lib/python3.9/site-packages/PyQt5/Qt5/plugins || exit 1 + - cd AppDir/usr/lib/python3.9/site-packages/PyQt6/Qt5/plugins || exit 1 - rm -rf audio gamepad gamepads geoservices printsupport sceneparsers sensorgestures sensors sqldrivers texttospeech webview mediaservice playlistformats || exit 1 - cd ../lib/ || exit 1 - rm libQt5Bluetooth.so.5 libQt5Designer.so.5 libQt5Multimedia.so.5 libQt5MultimediaGstTools.so.5 libQt5MultimediaWidgets.so.5 || exit 1 diff --git a/tests/gems/arch/resources/bauh_srcinfo b/tests/gems/arch/resources/bauh_srcinfo index ba7e53ae..8a588047 100644 --- a/tests/gems/arch/resources/bauh_srcinfo +++ b/tests/gems/arch/resources/bauh_srcinfo @@ -10,8 +10,8 @@ pkgbase = bauh makedepends = python-pip makedepends = python-setuptools depends = python - depends = python-pyqt5 - depends = python-pyqt5-sip + depends = python-PyQt6 + depends = python-PyQt6-sip depends = python-requests depends = python-colorama depends = python-pyaml diff --git a/tests/gems/arch/test_aur.py b/tests/gems/arch/test_aur.py index 6f34cebe..4ce45eda 100644 --- a/tests/gems/arch/test_aur.py +++ b/tests/gems/arch/test_aur.py @@ -19,7 +19,7 @@ def test_map_srcinfo__only_one_pkgname(self): 'license': 'zlib/libpng', 'makedepends': ['git', 'python', 'python-pip', 'python-setuptools'], 'depends': [ - 'python', 'python-colorama', 'python-pyaml', 'python-pyqt5', 'python-pyqt5-sip', 'python-requests', 'qt5-svg' + 'python', 'python-colorama', 'python-pyaml', 'python-PyQt6', 'python-PyQt6-sip', 'python-requests', 'qt5-svg' ], 'optdepends': [ 'flatpak: required for Flatpak support', diff --git a/tests/gems/arch/test_sorting.py b/tests/gems/arch/test_sorting.py index ee9dea01..baef461a 100644 --- a/tests/gems/arch/test_sorting.py +++ b/tests/gems/arch/test_sorting.py @@ -7,7 +7,7 @@ class SortingTest(TestCase): def test_sort__aur_not_related(self): pkgs = {'google-chrome': {'d': {'alsa-lib', 'gtk3', 'libcups'}, 'p': {'google-chrome': 'google-chrome'}, 'r': 'extra'}, - 'git-cola': {'d': {'git', 'python-pyqt5', 'icu qt5-svg'}, 'p': {'git-cola': 'git-cola'}, 'r': 'extra'}, + 'git-cola': {'d': {'git', 'python-PyQt6', 'icu qt5-svg'}, 'p': {'git-cola': 'git-cola'}, 'r': 'extra'}, 'kazam': {'d': {'python', 'python-cairo'}, 'p': {'kazam': 'kazam'}, 'r': 'extra'}} sorted_list = sorting.sort(pkgs.keys(), pkgs) From a5ddd29b3cc362b4b8c041511198481b7009adf2 Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 20:16:48 +0200 Subject: [PATCH 3/8] Updated getting the geometry of the primary screen --- bauh/view/qt/qt_utils.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bauh/view/qt/qt_utils.py b/bauh/view/qt/qt_utils.py index ab0f1b8b..81cce195 100644 --- a/bauh/view/qt/qt_utils.py +++ b/bauh/view/qt/qt_utils.py @@ -1,12 +1,12 @@ from typing import Optional, Union from PyQt6.QtCore import Qt, QRect, QPoint -from PyQt6.QtGui import QIcon, QPixmap -from PyQt6.QtWidgets import QWidget, QApplication, QDesktopWidget +from PyQt6.QtGui import QIcon, QPixmap, QScreen, QGuiApplication +from PyQt6.QtWidgets import QWidget, QApplication from bauh.view.util import resource -desktop: Optional[QDesktopWidget] = None +desktop: Optional[QScreen] = None def centralize(widget: QWidget, align_top_left: bool = True): @@ -35,10 +35,4 @@ def measure_based_on_height(percent: float) -> int: def get_current_screen_geometry(source_widget: Optional[Union[QWidget, QPoint]] = None) -> QRect: - global desktop - - if not desktop: - desktop = QDesktopWidget() - - current_screen_idx = desktop.screenNumber(source_widget if source_widget else desktop.cursor().pos()) - return desktop.screen(current_screen_idx).geometry() + return QGuiApplication.primaryScreen().geometry() From 10ac74226d3ad91e1f98187f6e8e5a9749fb1c10 Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 20:32:30 +0200 Subject: [PATCH 4/8] Changed app.exec()_ to app.exec() --- bauh/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bauh/app.py b/bauh/app.py index 7230306e..67aa8804 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -59,7 +59,7 @@ def main(tray: bool = False): app, widget = new_manage_panel(args, app_config, logger) widget.show() - sys.exit(app.exec_()) + sys.exit(app.exec()) def tray(): From 2e4d72aae37234b445d42259decdeaca33f29dfb Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 20:32:59 +0200 Subject: [PATCH 5/8] Changed even more attribute calling --- bauh/view/qt/apps_table.py | 2 +- bauh/view/qt/components.py | 12 ++++++------ bauh/view/qt/dialog.py | 2 +- bauh/view/qt/history.py | 8 ++++---- bauh/view/qt/prepare.py | 12 ++++++------ bauh/view/qt/root.py | 2 +- bauh/view/qt/settings.py | 2 +- bauh/view/qt/window.py | 16 ++++++++-------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index ee1efe5c..4aaa0a78 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -540,7 +540,7 @@ def _set_col_publisher(self, col: int, pkg: PackageView, screen_width: int): if pkg.model.is_trustable(): lb_verified = QLabel() lb_verified.setObjectName('icon_publisher_verified') - lb_verified.setCursor(QCursor(Qt.WhatsThisCursor)) + lb_verified.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) lb_verified.setToolTip(self.i18n['publisher.verified'].capitalize()) item.addWidget(lb_verified) else: diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 8c5fd2c0..9b1113ad 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -265,7 +265,7 @@ def map_alignment(alignment: ViewComponentAlignment) -> Optional[int]: elif alignment == ViewComponentAlignment.RIGHT: return Qt.AlignRight elif alignment == ViewComponentAlignment.HORIZONTAL_CENTER: - return Qt.AlignHCenter + return Qt.AlignmentFlag.AlignHCenter elif alignment == ViewComponentAlignment.VERTICAL_CENTER: return Qt.AlignVCenter elif alignment == ViewComponentAlignment.BOTTOM: @@ -296,7 +296,7 @@ def __init__(self, model: InputOption, model_parent: SingleSelectComponent): if self.model.read_only: self.setAttribute(Qt.WA_TransparentForMouseEvents) - self.setFocusPolicy(Qt.NoFocus) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) if model.extra_properties: for name, val in model.extra_properties.items(): @@ -326,7 +326,7 @@ def __init__(self, model: InputOption, model_parent: MultipleSelectComponent, ca if model.read_only: self.setAttribute(Qt.WA_TransparentForMouseEvents) - self.setFocusPolicy(Qt.NoFocus) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) else: self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) @@ -613,7 +613,7 @@ def __init__(self, model: MultipleSelectComponent, callback): else: help_icon.setProperty('help_icon', 'true') - help_icon.setCursor(QCursor(Qt.WhatsThisCursor)) + help_icon.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) help_icon.setToolTip(op.tooltip) widget.layout().addWidget(help_icon) @@ -684,7 +684,7 @@ def __init__(self, model: MultipleSelectComponent, parent: QWidget = None): help_icon.setProperty('help_icon', 'true') help_icon.setToolTip(op.tooltip) - help_icon.setCursor(QCursor(Qt.WhatsThisCursor)) + help_icon.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) widget.layout().addWidget(help_icon) self._layout.addWidget(widget, line, col) @@ -868,7 +868,7 @@ def gen_tip_icon(self, tip: str) -> QLabel: tip_icon = QLabel() tip_icon.setProperty('tip_icon', 'true') tip_icon.setToolTip(tip.strip()) - tip_icon.setCursor(QCursor(Qt.WhatsThisCursor)) + tip_icon.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) return tip_icon def _new_text_input(self, c: TextInputComponent) -> Tuple[QLabel, QLineEdit]: diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py index 184abdf1..f4397d85 100644 --- a/bauh/view/qt/dialog.py +++ b/bauh/view/qt/dialog.py @@ -40,7 +40,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI super(ConfirmationDialog, self).__init__() if not window_cancel: - self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) + self.setWindowFlags(Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowTitleHint) self.setLayout(QVBoxLayout()) self.setWindowTitle(title) diff --git a/bauh/view/qt/history.py b/bauh/view/qt/history.py index 13b20855..e4c52b3f 100644 --- a/bauh/view/qt/history.py +++ b/bauh/view/qt/history.py @@ -15,7 +15,7 @@ class HistoryDialog(QDialog): def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n): super(HistoryDialog, self).__init__() - self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint) + self.setWindowFlags(Qt.WindowType.CustomizeWindowHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint) view = PackageView(model=history.pkg, i18n=i18n) @@ -25,7 +25,7 @@ def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n) self.setLayout(layout) table_history = QTableWidget() - table_history.setFocusPolicy(Qt.NoFocus) + table_history.setFocusPolicy(Qt.FocusPolicy.NoFocus) table_history.setShowGrid(False) table_history.verticalHeader().setVisible(False) table_history.setAlternatingRowColors(True) @@ -44,7 +44,7 @@ def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n) item.setText(' {}'.format(data[key])) if current_status: - item.setCursor(QCursor(Qt.WhatsThisCursor)) + item.setCursor(QCursor(Qt.CursorShape.WhatsThisCursor)) item.setProperty('outdated', str(row != 0).lower()) tip = '{}. {}.'.format(i18n['popup.history.selected.tooltip'], i18n['version.{}'.format('updated'if row == 0 else 'outdated')].capitalize()) @@ -57,7 +57,7 @@ def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n) header_horizontal = table_history.horizontalHeader() for i in range(0, table_history.columnCount()): - header_horizontal.setSectionResizeMode(i, QHeaderView.Stretch) + header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeMode.Stretch) new_width = reduce(operator.add, [table_history.columnWidth(i) for i in range(table_history.columnCount())]) self.resize(new_width, table_history.height()) diff --git a/bauh/view/qt/prepare.py b/bauh/view/qt/prepare.py index 4e4a2331..847d3621 100644 --- a/bauh/view/qt/prepare.py +++ b/bauh/view/qt/prepare.py @@ -147,7 +147,7 @@ class PreparePanel(QWidget, TaskManager): def __init__(self, context: ApplicationContext, manager: SoftwareManager, i18n: I18n, manage_window: QWidget, app_config: dict, force_suggestions: bool = False): - super(PreparePanel, self).__init__(flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) + super(PreparePanel, self).__init__(flags=Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowTitleHint) self.i18n = i18n self.context = context self.app_config = app_config @@ -188,14 +188,14 @@ def __init__(self, context: ApplicationContext, manager: SoftwareManager, self.label_top.setCursor(QCursor(Qt.CursorShape.WaitCursor)) self.label_top.setText("{}...".format(self.i18n['prepare_panel.title.start'].capitalize())) self.label_top.setObjectName('prepare_status') - self.label_top.setAlignment(Qt.AlignHCenter) + self.label_top.setAlignment(Qt.AlignmentFlag.AlignHCenter) self.layout().addWidget(self.label_top) self.layout().addWidget(QLabel()) self.table = QTableWidget() self.table.setObjectName('tasks') self.table.setCursor(QCursor(Qt.CursorShape.WaitCursor)) - self.table.setFocusPolicy(Qt.NoFocus) + self.table.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.table.setShowGrid(False) self.table.verticalHeader().setVisible(False) self.table.horizontalHeader().setVisible(False) @@ -261,7 +261,7 @@ def hide_output(self): self.textarea_details.clear() self.bottom_widget.setVisible(False) self._resize_columns() - self.setFocus(Qt.NoFocusReason) + self.setFocus(Qt.FocusPolicy.NoFocusReason) if not self.bt_bar.isVisible(): self.bt_bar.setVisible(True) @@ -283,7 +283,7 @@ def get_table_width(self) -> int: def _resize_columns(self): header_horizontal = self.table.horizontalHeader() for i in range(self.table.columnCount()): - header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeToContents) + header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeMode.ResizeToContents) self.resize(int(self.get_table_width() * 1.05), self.sizeHint().height()) @@ -343,7 +343,7 @@ def _show_output(): self.bottom_widget.setVisible(True) - self.setFocus(Qt.NoFocusReason) + self.setFocus(Qt.FocusPolicy.NoFocusReason) if self.bt_bar.isVisible(): self.bt_bar.setVisible(False) diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index 80fcdd4d..27d2156a 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -39,7 +39,7 @@ def run(self): class RootDialog(QDialog): def __init__(self, i18n: I18n, max_tries: int = 3): - super(RootDialog, self).__init__(flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) + super(RootDialog, self).__init__(flags=Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowTitleHint) self.i18n = i18n self.max_tries = max_tries self.tries = 0 diff --git a/bauh/view/qt/settings.py b/bauh/view/qt/settings.py index 8019dddf..3e7c12ca 100644 --- a/bauh/view/qt/settings.py +++ b/bauh/view/qt/settings.py @@ -37,7 +37,7 @@ def run(self): class SettingsWindow(QWidget): def __init__(self, manager: SoftwareManager, i18n: I18n, window: QWidget, parent: Optional[QWidget] = None): - super(SettingsWindow, self).__init__(parent=parent, flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) + super(SettingsWindow, self).__init__(parent=parent, flags=Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowTitleHint) self.setWindowTitle(f"{i18n['settings'].capitalize()} ({__app_name__})") self.setLayout(QVBoxLayout()) self.manager = manager diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 910cd67f..dedffee5 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -530,7 +530,7 @@ def begin_apply_filters(self): self.thread_apply_filters.index = self.pkg_idx self.thread_apply_filters.filters = self._gen_filters() self.thread_apply_filters.start() - self.setFocus(Qt.NoFocusReason) + self.setFocus(Qt.FocusPolicy.NoFocusReason) def _finish_apply_filters(self): self._finish_action(ACTION_APPLY_FILTERS) @@ -879,8 +879,8 @@ def _finish_uninstall(self, res: dict): self._update_installed_filter() self._update_index() self.begin_apply_filters() - self.table_apps.change_headers_policy(policy=QHeaderView.Stretch, maximized=self._maximized) - self.table_apps.change_headers_policy(policy=QHeaderView.ResizeToContents, maximized=self._maximized) + self.table_apps.change_headers_policy(policy=QHeaderView.ResizeMode.Stretch, maximized=self._maximized) + self.table_apps.change_headers_policy(policy=QHeaderView.ResizeMode.ResizeToContents, maximized=self._maximized) self._resize(accept_lower_width=True) notify_tray() else: @@ -926,7 +926,7 @@ def _change_label_substatus(self, substatus: str): def _reorganize(self): if not self._maximized: - self.table_apps.change_headers_policy(QHeaderView.Stretch) + self.table_apps.change_headers_policy(QHeaderView.ResizeMode.Stretch) self.table_apps.change_headers_policy() self._resize(accept_lower_width=len(self.pkgs) > 0) @@ -942,7 +942,7 @@ def _update_table(self, pkgs_info: dict, signal: bool = False): if not self._maximized: self.label_displayed.show() - self.table_apps.change_headers_policy(QHeaderView.Stretch) + self.table_apps.change_headers_policy(QHeaderView.ResizeMode.Stretch) self.table_apps.change_headers_policy() self._resize(accept_lower_width=len(self.pkgs) > 0) @@ -1306,7 +1306,7 @@ def _set_lower_buttons_visible(self, visible: bool): def _finish_action(self, action_id: int = None): self.thread_animate_progress.stop = True - self.thread_animate_progress.wait(msecs=1000) + self.thread_animate_progress.wait(1000) self.progress_bar.setVisible(False) self.progress_bar.setValue(0) @@ -1575,8 +1575,8 @@ def _finish_install(self, res: dict): self.update_custom_actions() self._update_installed_filter(installed_available=True, keep_state=True) self._update_index() - self.table_apps.change_headers_policy(policy=QHeaderView.Stretch, maximized=self._maximized) - self.table_apps.change_headers_policy(policy=QHeaderView.ResizeToContents, maximized=self._maximized) + self.table_apps.change_headers_policy(policy=QHeaderView.ResizeMode.Stretch, maximized=self._maximized) + self.table_apps.change_headers_policy(policy=QHeaderView.ResizeMode.ResizeToContents, maximized=self._maximized) self._resize(accept_lower_width=False) else: self._show_console_errors() From 00b3d555c8e3d7ce548d4b3efee4ca5249910f14 Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 20:40:42 +0200 Subject: [PATCH 6/8] Change NoFocusReason calling to correct class --- bauh/view/qt/window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index dedffee5..3f605312 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -530,7 +530,7 @@ def begin_apply_filters(self): self.thread_apply_filters.index = self.pkg_idx self.thread_apply_filters.filters = self._gen_filters() self.thread_apply_filters.start() - self.setFocus(Qt.FocusPolicy.NoFocusReason) + self.setFocus(Qt.FocusReason.NoFocusReason) def _finish_apply_filters(self): self._finish_action(ACTION_APPLY_FILTERS) From c0b577cf3565438e73a727733c2b6b09c45d7981 Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 21:07:16 +0200 Subject: [PATCH 7/8] Updated even more more attribute callings --- bauh/view/qt/apps_table.py | 2 +- bauh/view/qt/components.py | 34 +++++++++++++++++----------------- bauh/view/qt/dialog.py | 8 ++++---- bauh/view/qt/history.py | 2 +- bauh/view/qt/info.py | 2 +- bauh/view/qt/prepare.py | 4 ++-- bauh/view/qt/qt_utils.py | 2 +- bauh/view/qt/screenshots.py | 6 +++--- bauh/view/qt/settings.py | 4 ++-- bauh/view/qt/window.py | 10 +++++----- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 4aaa0a78..bb47faeb 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -160,7 +160,7 @@ def ignore_updates(): menu_row.adjustSize() menu_row.popup(QCursor.pos()) - menu_row.exec_() + menu_row.exec() def _map_custom_action(self, pkg: PackageView, action: CustomSoftwareAction, parent: QWidget) -> QCustomMenuAction: def custom_action(): diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 9b1113ad..589fce4a 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -261,17 +261,17 @@ def map_alignment(alignment: ViewComponentAlignment) -> Optional[int]: if alignment == ViewComponentAlignment.CENTER: return Qt.AlignmentFlag.AlignCenter elif alignment == ViewComponentAlignment.LEFT: - return Qt.AlignLeft + return Qt.AlignmentFlag.AlignLeft elif alignment == ViewComponentAlignment.RIGHT: - return Qt.AlignRight + return Qt.AlignmentFlag.AlignRight elif alignment == ViewComponentAlignment.HORIZONTAL_CENTER: return Qt.AlignmentFlag.AlignHCenter elif alignment == ViewComponentAlignment.VERTICAL_CENTER: - return Qt.AlignVCenter + return Qt.AlignmentFlag.AlignVCenter elif alignment == ViewComponentAlignment.BOTTOM: - return Qt.AlignBottom + return Qt.AlignmentFlag.AlignBottom elif alignment == ViewComponentAlignment.TOP: - return Qt.AlignTop + return Qt.AlignmentFlag.AlignTop else: return @@ -295,7 +295,7 @@ def __init__(self, model: InputOption, model_parent: SingleSelectComponent): self.setIcon(QIcon.fromTheme(model.icon_path)) if self.model.read_only: - self.setAttribute(Qt.WA_TransparentForMouseEvents) + self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents) self.setFocusPolicy(Qt.FocusPolicy.NoFocus) if model.extra_properties: @@ -325,7 +325,7 @@ def __init__(self, model: InputOption, model_parent: MultipleSelectComponent, ca self.setIcon(QIcon.fromTheme(model.icon_path)) if model.read_only: - self.setAttribute(Qt.WA_TransparentForMouseEvents) + self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents) self.setFocusPolicy(Qt.FocusPolicy.NoFocus) else: self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) @@ -350,7 +350,7 @@ def _set_checked(self, state): class TwoStateButtonQt(QSlider): def __init__(self, model: TwoStateButtonComponent): - super(TwoStateButtonQt, self).__init__(Qt.Horizontal) + super(TwoStateButtonQt, self).__init__(Qt.Orientation.Horizontal) self.model = model self.setMaximum(1) self.valueChanged.connect(self._change_state) @@ -387,7 +387,7 @@ def __init__(self, model: SingleSelectComponent): self.addItem(icon, op.label, op.value) if op.tooltip: - self.setItemData(idx, op.tooltip, Qt.ToolTipRole) + self.setItemData(idx, op.tooltip, Qt.ItemDataRole.ToolTipRole) if model.value and model.value == op: # default self.setCurrentIndex(idx) @@ -742,7 +742,7 @@ def __init__(self, action, i18n: I18n, align: int = Qt.AlignmentFlag.AlignCenter self.clicked.connect(action) self.i18n = i18n self.default_tootip = tooltip - self.setSizePolicy(QSizePolicy.Expanding if expanding else QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) + self.setSizePolicy(QSizePolicy.Policy.Expanding if expanding else QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) if tooltip: self.setToolTip(tooltip) @@ -948,7 +948,7 @@ def _wrap(self, comp: QWidget, model: ViewComponent) -> QWidget: field_container.setLayout(QHBoxLayout()) field_container.layout().setContentsMargins(0, 0, 0, 0) field_container.layout().setSpacing(0) - field_container.layout().setAlignment(Qt.AlignLeft) + field_container.layout().setAlignment(Qt.AlignmentFlag.AlignLeft) field_container.setProperty('wrapper', 'true') field_container.setProperty('wrapped_type', comp.__class__.__name__) @@ -1000,11 +1000,11 @@ def open_chooser(e): cur_path = str(Path.home()) if c.directory: - opts = QFileDialog.DontUseNativeDialog - opts |= QFileDialog.ShowDirsOnly + opts = QFileDialog.Option.DontUseNativeDialog + opts |= QFileDialog.Option.ShowDirsOnly file_path = QFileDialog.getExistingDirectory(self, self.i18n['file_chooser.title'], cur_path, options=opts) else: - file_path, _ = QFileDialog.getOpenFileName(self, self.i18n['file_chooser.title'], cur_path, exts, options=QFileDialog.DontUseNativeDialog) + file_path, _ = QFileDialog.getOpenFileName(self, self.i18n['file_chooser.title'], cur_path, exts, options=QFileDialog.Option.DontUseNativeDialog) if file_path: c.set_file_path(file_path) @@ -1032,7 +1032,7 @@ def __init__(self, model: TabGroupComponent, i18n: I18n, parent: QWidget = None) super(TabGroupQt, self).__init__(parent=parent) self.model = model self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) - self.setTabPosition(QTabWidget.North) + self.setTabPosition(QTabWidget.TabPosition.North) for c in model.tabs: try: @@ -1042,8 +1042,8 @@ def __init__(self, model: TabGroupComponent, i18n: I18n, parent: QWidget = None) icon = QIcon() scroll = QScrollArea() - scroll.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) - scroll.setFrameShape(QFrame.NoFrame) + scroll.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + scroll.setFrameShape(QFrame.Shape.NoFrame) scroll.setWidgetResizable(True) scroll.setWidget(to_widget(c.get_content(), i18n)) self.addTab(scroll, icon, c.label) diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py index f4397d85..8d3aacdf 100644 --- a/bauh/view/qt/dialog.py +++ b/bauh/view/qt/dialog.py @@ -26,7 +26,7 @@ def show_message(title: str, body: str, type_: MessageType, icon: QIcon = QIcon( if icon: popup.setWindowIcon(icon) - popup.exec_() + popup.exec() class ConfirmationDialog(QDialog): @@ -69,7 +69,7 @@ def __init__(self, title: str, body: Optional[str], i18n: I18n, icon: QIcon = QI container_body.setLayout(QVBoxLayout()) scroll = QScrollArea(self) scroll.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) - scroll.setFrameShape(QFrame.NoFrame) + scroll.setFrameShape(QFrame.Shape.NoFrame) scroll.setWidgetResizable(True) scroll.setWidget(container_body) self.layout().addWidget(scroll) @@ -127,12 +127,12 @@ def confirm(self): self.close() def ask(self) -> bool: - self.exec_() + self.exec() return self.confirmed def ask_confirmation(title: str, body: str, i18n: I18n, icon: QIcon = QIcon(resource.get_path('img/logo.svg')), widgets: List[QWidget] = None) -> bool: popup = ConfirmationDialog(title=title, body=body, i18n=i18n, icon=icon, widgets=widgets) - popup.exec_() + popup.exec() return popup.confirmed diff --git a/bauh/view/qt/history.py b/bauh/view/qt/history.py index e4c52b3f..63953650 100644 --- a/bauh/view/qt/history.py +++ b/bauh/view/qt/history.py @@ -15,7 +15,7 @@ class HistoryDialog(QDialog): def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n): super(HistoryDialog, self).__init__() - self.setWindowFlags(Qt.WindowType.CustomizeWindowHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint) + self.setWindowFlags(Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowMinMaxButtonsHint | Qt.WindowType.WindowCloseButtonHint) view = PackageView(model=history.pkg, i18n=i18n) diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index ec64a6b2..8c126b98 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -30,7 +30,7 @@ def __init__(self, pkg_info: dict, icon_cache: MemoryCache, i18n: I18n, can_open self.setLayout(layout) scroll = QScrollArea(self) - scroll.setFrameShape(QFrame.NoFrame) + scroll.setFrameShape(QFrame.Shape.NoFrame) scroll.setWidgetResizable(True) comps_container = QWidget() comps_container.setObjectName('root_container') diff --git a/bauh/view/qt/prepare.py b/bauh/view/qt/prepare.py index 847d3621..88874ddb 100644 --- a/bauh/view/qt/prepare.py +++ b/bauh/view/qt/prepare.py @@ -261,7 +261,7 @@ def hide_output(self): self.textarea_details.clear() self.bottom_widget.setVisible(False) self._resize_columns() - self.setFocus(Qt.FocusPolicy.NoFocusReason) + self.setFocus(Qt.FocusReason.NoFocusReason) if not self.bt_bar.isVisible(): self.bt_bar.setVisible(True) @@ -343,7 +343,7 @@ def _show_output(): self.bottom_widget.setVisible(True) - self.setFocus(Qt.FocusPolicy.NoFocusReason) + self.setFocus(Qt.FocusReason.NoFocusReason) if self.bt_bar.isVisible(): self.bt_bar.setVisible(False) diff --git a/bauh/view/qt/qt_utils.py b/bauh/view/qt/qt_utils.py index 81cce195..a89e7642 100644 --- a/bauh/view/qt/qt_utils.py +++ b/bauh/view/qt/qt_utils.py @@ -19,7 +19,7 @@ def centralize(widget: QWidget, align_top_left: bool = True): def load_icon(path: str, width: int, height: int = None) -> QIcon: - return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.AspectRatioMode.KeepAspectRatio, Qt.SmoothTransformation)) + return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)) def load_resource_icon(path: str, width: int, height: int = None) -> QIcon: diff --git a/bauh/view/qt/screenshots.py b/bauh/view/qt/screenshots.py index 7b327667..bc4961d0 100644 --- a/bauh/view/qt/screenshots.py +++ b/bauh/view/qt/screenshots.py @@ -59,7 +59,7 @@ def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: Memory self.upper_buttons.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) self.upper_buttons.setContentsMargins(0, 0, 0, 0) self.upper_buttons.setLayout(QHBoxLayout()) - self.upper_buttons.layout().setAlignment(Qt.AlignRight) + self.upper_buttons.layout().setAlignment(Qt.AlignmentFlag.AlignRight) self.upper_buttons.layout().addWidget(self.bt_close) self.layout().addWidget(self.upper_buttons) @@ -201,8 +201,8 @@ def _download_img(self, idx: int, url: str): pixmap.loadFromData(byte_stream.getvalue()) if pixmap.size().height() > self.max_img_height or pixmap.size().width() > self.max_img_width: - pixmap = pixmap.scaled(self.max_img_width, self.max_img_height, Qt.KeepAspectRatio, - Qt.SmoothTransformation) + pixmap = pixmap.scaled(self.max_img_width, self.max_img_height, Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation) self.loaded_imgs.append(pixmap) self._load_img(idx) diff --git a/bauh/view/qt/settings.py b/bauh/view/qt/settings.py index 3e7c12ca..5930e477 100644 --- a/bauh/view/qt/settings.py +++ b/bauh/view/qt/settings.py @@ -97,11 +97,11 @@ def closeEvent(self, event): def handle_display(self): if self.isMinimized(): - self.setWindowState(Qt.WindowNoState) + self.setWindowState(Qt.WindowState.WindowNoState) elif self.isHidden(): self.show() else: - self.setWindowState(self.windowState() and Qt.WindowMinimized or Qt.WindowActive) + self.setWindowState(self.windowState() and Qt.WindowState.WindowMinimized or Qt.WindowState.WindowActive) def _save_settings(self): self.tab_group.setEnabled(False) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 3f605312..2a4c3939 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -1372,7 +1372,7 @@ def _finish_show_info(self, pkg_info: dict): if len(pkg_info) > 1: dialog_info = InfoDialog(pkg_info=pkg_info, icon_cache=self.icon_cache, i18n=self.i18n, can_open_url=self.can_open_urls) - dialog_info.exec_() + dialog_info.exec() else: dialog.show_message(title=self.i18n['warning'].capitalize(), body=self.i18n['manage_window.info.no_info'].format(bold(pkg_info['__app__'].model.name)), @@ -1396,7 +1396,7 @@ def _finish_show_screenshots(self, res: dict): logger=self.logger, i18n=self.i18n, screenshots=res['screenshots']) - diag.exec_() + diag.exec() else: dialog.show_message(title=self.i18n['error'], body=self.i18n['popup.screenshots.no_screenshot.body'].format(bold(res['pkg'].model.name)), @@ -1422,7 +1422,7 @@ def _finish_show_history(self, res: dict): type_=MessageType.WARNING) else: dialog_history = HistoryDialog(res['history'], self.icon_cache, self.i18n) - dialog_history.exec_() + dialog_history.exec() def search(self): word = self.search_bar.text().strip() @@ -1688,7 +1688,7 @@ def show_custom_actions(self): menu_row.addActions(actions) menu_row.adjustSize() menu_row.popup(QCursor.pos()) - menu_row.exec_() + menu_row.exec() def begin_ignore_updates(self, pkg: PackageView): status_key = 'ignore_updates' if not pkg.model.is_update_ignored() else 'ignore_updates_reverse' @@ -1779,7 +1779,7 @@ def show_themes(self): menu_row.addActions(self._map_theme_actions(menu_row)) menu_row.adjustSize() menu_row.popup(QCursor.pos()) - menu_row.exec_() + menu_row.exec() def _map_theme_actions(self, menu: QMenu) -> List[QCustomMenuAction]: core_config = CoreConfigManager().get_config() From 7f9da099b48c7aba495e7759f178a1680e7ce2d9 Mon Sep 17 00:00:00 2001 From: PrivateN00b Date: Thu, 12 Sep 2024 21:47:57 +0200 Subject: [PATCH 8/8] rename python3-PyQt6 to python3-pyqt6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a833a41..738f9f23 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Key features ##### Required dependencies -`sudo apt-get install python3 python3-pip python3-yaml python3-dateutil python3-PyQt6 python3-packaging python3-requests` +`sudo apt-get install python3 python3-pip python3-yaml python3-dateutil python3-pyqt6 python3-packaging python3-requests` ##### Installing bauh