From 3b86888b1d382042d68aeac0d1f29ec13499ce37 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Sun, 3 May 2020 12:24:08 -0300 Subject: [PATCH] [ui] "click" cursor set for most "clickable" components --- CHANGELOG.md | 4 +++- bauh/view/qt/apps_table.py | 11 +++++++---- bauh/view/qt/components.py | 3 ++- bauh/view/qt/info.py | 6 ++++-- bauh/view/qt/screenshots.py | 4 +++- bauh/view/qt/window.py | 10 ++++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85cf0745..6048c5e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### UI - icons, buttons and colors changes -- removed more unnecessary **x** buttons from some dialogs +- more unnecessary **x** buttons were removed from dialogs +- "click" cursor set for most "clickable" components +- minor improvements ### i18n contributors - Turkish (tr): [tuliana](https://github.com/tulliana) diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index f72b91c3..7b24ad4f 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -39,6 +39,7 @@ class UpdateToggleButton(QWidget): self.setLayout(layout) self.bt = QToolButton() + self.bt.setCursor(QCursor(Qt.PointingHandCursor)) self.bt.setCheckable(True) self.bt.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) @@ -115,8 +116,9 @@ class AppsTable(QTableWidget): pkg.model.can_be_downgraded() or \ bool(pkg.model.get_custom_supported_actions()) - def show_pkg_settings(self, pkg: PackageView): + def show_pkg_actions(self, pkg: PackageView): menu_row = QMenu() + menu_row.setCursor(QCursor(Qt.PointingHandCursor)) if pkg.model.installed: if pkg.model.has_history(): @@ -256,7 +258,7 @@ class AppsTable(QTableWidget): self._set_col_publisher(3, pkg) self._set_col_type(4, pkg) self._set_col_installed(5, pkg) - self._set_col_settings(6, pkg) + self._set_col_actions(6, pkg) if change_update_col: col_update = None @@ -277,6 +279,7 @@ class AppsTable(QTableWidget): col.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) col_bt = QToolButton() + col_bt.setCursor(QCursor(Qt.PointingHandCursor)) col_bt.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) col_bt.setText(text) col_bt.setStyleSheet('QToolButton { ' + style + '}') @@ -451,7 +454,7 @@ class AppsTable(QTableWidget): self.setCellWidget(pkg.table_index, col, item) - def _set_col_settings(self, col: int, pkg: PackageView): + def _set_col_actions(self, col: int, pkg: PackageView): item = QToolBar() item.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) @@ -464,7 +467,7 @@ class AppsTable(QTableWidget): item.addWidget(bt) def handle_click(): - self.show_pkg_settings(pkg) + self.show_pkg_actions(pkg) settings = self.has_any_settings(pkg) if pkg.model.installed: diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 4c569405..2bb34e14 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -6,7 +6,7 @@ from threading import Thread from typing import Tuple from PyQt5.QtCore import Qt, QSize -from PyQt5.QtGui import QIcon, QPixmap, QIntValidator +from PyQt5.QtGui import QIcon, QPixmap, QIntValidator, QCursor from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \ QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, \ QSlider, QScrollArea, QFrame @@ -393,6 +393,7 @@ class IconButton(QWidget): def __init__(self, icon: QIcon, action, i18n: I18n, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None, expanding: bool = False): super(IconButton, self).__init__() self.bt = QToolButton() + self.bt.setCursor(QCursor(Qt.PointingHandCursor)) self.bt.setIcon(icon) self.bt.clicked.connect(action) self.i18n = i18n diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index b91435f3..1635a983 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -1,5 +1,5 @@ -from PyQt5.QtCore import QSize -from PyQt5.QtGui import QIcon +from PyQt5.QtCore import QSize, Qt +from PyQt5.QtGui import QIcon, QCursor from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar @@ -22,6 +22,7 @@ class InfoDialog(QDialog): self.toolbar_field = QToolBar() self.bt_back = QPushButton(i18n['back'].capitalize()) self.bt_back.clicked.connect(self.back_to_info) + self.bt_back.setCursor(QCursor(Qt.PointingHandCursor)) self.toolbar_field.addWidget(self.bt_back) self.layout().addWidget(self.toolbar_field) self.toolbar_field.hide() @@ -89,6 +90,7 @@ class InfoDialog(QDialog): self.text_field.setPlainText(val) bt_full_field = QPushButton(self.i18n['show'].capitalize()) + bt_full_field.setCursor(QCursor(Qt.PointingHandCursor)) bt_full_field.clicked.connect(show_full_field) self.gbox_info_layout.addWidget(bt_full_field, idx, 2) diff --git a/bauh/view/qt/screenshots.py b/bauh/view/qt/screenshots.py index 62f4bfdc..48f3c860 100644 --- a/bauh/view/qt/screenshots.py +++ b/bauh/view/qt/screenshots.py @@ -3,7 +3,7 @@ from threading import Thread from typing import List from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIcon, QPixmap +from PyQt5.QtGui import QIcon, QPixmap, QCursor from PyQt5.QtWidgets import QDialog, QLabel, QPushButton, QToolBar, QVBoxLayout, QProgressBar, QApplication from bauh.api.abstract.cache import MemoryCache @@ -54,6 +54,7 @@ class ScreenshotsDialog(QDialog): self.bottom_bar = QToolBar() self.bt_back = QPushButton(' < ' + self.i18n['screenshots.bt_back.label'].capitalize()) + self.bt_back.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_back.clicked.connect(self.back) self.ref_bt_back = self.bottom_bar.addWidget(self.bt_back) self.bottom_bar.addWidget(new_spacer(50)) @@ -66,6 +67,7 @@ class ScreenshotsDialog(QDialog): self.bottom_bar.addWidget(new_spacer(50)) self.bt_next = QPushButton(self.i18n['screenshots.bt_next.label'].capitalize() + ' > ') + self.bt_next.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_next.clicked.connect(self.next) self.ref_bt_next = self.bottom_bar.addWidget(self.bt_next) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 4765ff46..d23560f9 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -150,11 +150,13 @@ class ManageWindow(QWidget): self.toolbar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.checkbox_updates = QCheckBox() + self.checkbox_updates.setCursor(QCursor(Qt.PointingHandCursor)) self.checkbox_updates.setText(self.i18n['updates'].capitalize()) self.checkbox_updates.stateChanged.connect(self._handle_updates_filter) self.ref_checkbox_updates = self.toolbar.addWidget(self.checkbox_updates) self.checkbox_only_apps = QCheckBox() + self.checkbox_only_apps.setCursor(QCursor(Qt.PointingHandCursor)) self.checkbox_only_apps.setText(self.i18n['manage_window.checkbox.only_apps']) self.checkbox_only_apps.setChecked(True) self.checkbox_only_apps.stateChanged.connect(self._handle_filter_only_apps) @@ -163,6 +165,7 @@ class ManageWindow(QWidget): self.any_type_filter = 'any' self.cache_type_filter_icons = {} self.combo_filter_type = QComboBox() + self.combo_filter_type.setCursor(QCursor(Qt.PointingHandCursor)) self.combo_filter_type.setView(QListView()) self.combo_filter_type.setStyleSheet('QLineEdit { height: 2px; }') self.combo_filter_type.setIconSize(QSize(14, 14)) @@ -176,6 +179,7 @@ class ManageWindow(QWidget): self.any_category_filter = 'any' self.combo_categories = QComboBox() + self.combo_categories.setCursor(QCursor(Qt.PointingHandCursor)) self.combo_categories.setStyleSheet('QLineEdit { height: 2px; }') self.combo_categories.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.combo_categories.setEditable(True) @@ -199,6 +203,7 @@ class ManageWindow(QWidget): if config['suggestions']['enabled']: self.bt_suggestions = QPushButton() + self.bt_suggestions.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_suggestions.setToolTip(self.i18n['manage_window.bt.suggestions.tooltip']) self.bt_suggestions.setText(self.i18n['manage_window.bt.suggestions.text'].capitalize()) self.bt_suggestions.setIcon(QIcon(resource.get_path('img/suggestions.svg'))) @@ -211,6 +216,7 @@ class ManageWindow(QWidget): self.ref_bt_suggestions = None self.bt_installed = QPushButton() + self.bt_installed.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_installed.setToolTip(self.i18n['manage_window.bt.installed.tooltip']) self.bt_installed.setIcon(QIcon(resource.get_path('img/disk.svg'))) self.bt_installed.setText(self.i18n['manage_window.bt.installed.text'].capitalize()) @@ -220,6 +226,7 @@ class ManageWindow(QWidget): toolbar_bts.append(self.bt_installed) self.bt_refresh = QPushButton() + self.bt_refresh.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_refresh.setToolTip(i18n['manage_window.bt.refresh.tooltip']) self.bt_refresh.setIcon(QIcon(resource.get_path('img/refresh.svg'))) self.bt_refresh.setText(self.i18n['manage_window.bt.refresh.text']) @@ -229,6 +236,7 @@ class ManageWindow(QWidget): self.ref_bt_refresh = self.toolbar.addWidget(self.bt_refresh) self.bt_upgrade = QPushButton() + self.bt_upgrade.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_upgrade.setToolTip(i18n['manage_window.bt.upgrade.tooltip']) self.bt_upgrade.setIcon(QIcon(resource.get_path('img/app_update.svg'))) self.bt_upgrade.setText(i18n['manage_window.bt.upgrade.text']) @@ -259,6 +267,7 @@ class ManageWindow(QWidget): toolbar_console = QToolBar() self.checkbox_console = QCheckBox() + self.checkbox_console.setCursor(QCursor(Qt.PointingHandCursor)) self.checkbox_console.setText(self.i18n['manage_window.checkbox.show_details']) self.checkbox_console.stateChanged.connect(self._handle_console) self.checkbox_console.setVisible(False) @@ -1241,6 +1250,7 @@ class ManageWindow(QWidget): def show_custom_actions(self): if self.custom_actions: menu_row = QMenu() + menu_row.setCursor(QCursor(Qt.PointingHandCursor)) actions = [self._map_custom_action(a) for a in self.custom_actions] menu_row.addActions(actions) menu_row.adjustSize()