diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index eb8e1929..c3e90949 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -426,14 +426,14 @@ class AppsTable(QTableWidget): def run(): self.window.run_app(pkg) - bt = IconButton(QIcon(resource.get_path('img/app_play.svg')), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']) + bt = IconButton(QIcon(resource.get_path('img/app_play.svg')), i18n=self.i18n, action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']) bt.setEnabled(pkg.model.can_be_run()) item.addWidget(bt) def get_info(): self.window.get_app_info(pkg) - bt = IconButton(QIcon(resource.get_path('img/app_info.svg')), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']) + bt = IconButton(QIcon(resource.get_path('img/app_info.svg')), i18n=self.i18n, action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']) bt.setEnabled(bool(pkg.model.has_info())) item.addWidget(bt) @@ -441,7 +441,7 @@ class AppsTable(QTableWidget): def get_screenshots(): self.window.get_screenshots(pkg) - bt = IconButton(QIcon(resource.get_path('img/camera.svg')), action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']) + bt = IconButton(QIcon(resource.get_path('img/camera.svg')), i18n=self.i18n, action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']) bt.setEnabled(bool(pkg.model.has_screenshots())) item.addWidget(bt) @@ -449,8 +449,8 @@ class AppsTable(QTableWidget): self.show_pkg_settings(pkg) settings = self.has_any_settings(pkg) - if pkg.model.installed or settings: - bt = IconButton(QIcon(resource.get_path('img/app_settings.svg')), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip']) + if pkg.model.installed: + bt = IconButton(QIcon(resource.get_path('img/app_settings.svg')), i18n=self.i18n, action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip']) bt.setEnabled(bool(settings)) item.addWidget(bt) diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index b2da4f12..847ac0ae 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -241,11 +241,15 @@ class InputFilter(QLineEdit): class IconButton(QWidget): - def __init__(self, icon: QIcon, action, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None): + def __init__(self, icon: QIcon, action, i18n: I18n, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None): super(IconButton, self).__init__() self.bt = QToolButton() self.bt.setIcon(icon) self.bt.clicked.connect(action) + self.i18n = i18n + self.default_tootip = tooltip + self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.bt.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) if background: style = 'QToolButton { color: white; background: ' + background + '} ' @@ -261,6 +265,14 @@ class IconButton(QWidget): layout.addWidget(self.bt) self.setLayout(layout) + def setEnabled(self, enabled): + super(IconButton, self).setEnabled(enabled) + + if not enabled: + self.bt.setToolTip(self.i18n['icon_button.tooltip.disabled']) + else: + self.bt.setToolTip(self.default_tootip) + class FormQt(QGroupBox): diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index c09f24b8..d7b40215 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -322,6 +322,7 @@ class ManageWindow(QWidget): self.ref_combo_styles = self.toolbar_bottom.addWidget(self.combo_styles) bt_settings = IconButton(QIcon(resource.get_path('img/app_settings.svg')), + i18n=self.i18n, action=self._show_settings_menu, background='#12ABAB', tooltip=self.i18n['manage_window.bt_settings.tooltip']) @@ -837,8 +838,8 @@ class ManageWindow(QWidget): new_width = max(table_width, toolbar_width, topbar_width) - if self.bt_upgrade.isVisible(): - new_width *= 1.03 # this extra size is not because of the toolbar button, but the table upgrade buttons + # if self.bt_upgrade.isVisible(): + # new_width *= 1.03 # this extra size is not because of the toolbar button, but the table upgrade buttons if (self.pkgs and accept_lower_width) or new_width > self.width(): self.resize(new_width, self.height()) diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index 965fe179..e44ebf72 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -217,4 +217,5 @@ files=fitxers all_files=tots els fitxers file_chooser.title=Selector de fitxers message.file.not_exist=Fitxer no existeix -message.file.not_exist.body=El fitxer {} sembla no existir \ No newline at end of file +message.file.not_exist.body=El fitxer {} sembla no existir +icon_button.tooltip.disabled=Aquesta acció no està disponible \ No newline at end of file diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de index d931929d..483bff89 100644 --- a/bauh/view/resources/locale/de +++ b/bauh/view/resources/locale/de @@ -172,4 +172,5 @@ all_files=Alle Dateien file_chooser.title=Dateiauswahl message.file.not_exist=Datei existiert nicht message.file.not_exist.body=Die Datei {} scheint nicht zu existieren -development=Entwicklung \ No newline at end of file +development=Entwicklung +icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar \ No newline at end of file diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index 079441d4..080408aa 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -176,4 +176,5 @@ all_files=all files file_chooser.title=File selector message.file.not_exist=File does not exist message.file.not_exist.body=The file {} seems not to exist -development=development \ No newline at end of file +development=development +icon_button.tooltip.disabled=This action is unavailable \ No newline at end of file diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index ba5dfe81..9f818708 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -216,4 +216,5 @@ files=archivos all_files=todos los archivos file_chooser.title=Selector de archivos message.file.not_exist=Archivo no existe -message.file.not_exist.body=El archivo {} parece no existir \ No newline at end of file +message.file.not_exist.body=El archivo {} parece no existir +icon_button.tooltip.disabled=This action is unavailable \ No newline at end of file diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index d9d9fed0..3b451471 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -173,4 +173,5 @@ all_files=tutti i files file_chooser.title=Selettore file message.file.not_exist=File non esiste message.file.not_exist.body=Il file {} sembra non esistere -development=sviluppo \ No newline at end of file +development=sviluppo +icon_button.tooltip.disabled=Questa azione non è disponibile \ No newline at end of file diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index 55e63265..68cb5e4b 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -219,4 +219,5 @@ files=arquivos all_files=todos os arquivos file_chooser.title=Seletor arquivos message.file.not_exist=Arquivo não existe -message.file.not_exist.body=O arquivo {} parece não existir \ No newline at end of file +message.file.not_exist.body=O arquivo {} parece não existir +icon_button.tooltip.disabled=Esta ação está indisponível \ No newline at end of file