[tray] changing how the icons are retrieved

This commit is contained in:
Vinícius Moreira
2019-12-20 13:20:40 -03:00
parent bf3391f1f6
commit aa6876269f
3 changed files with 27 additions and 4 deletions

View File

@@ -42,7 +42,11 @@ updates:
check_interval: 30 # old '--check-interval' check_interval: 30 # old '--check-interval'
``` ```
- The default update checking interval is now 30 seconds - The default update checking interval is now 30 seconds
- New tray icons loading priority:
1) Icon paths defined in **~/.config/bauh/config.yml**
2) Icons from the system with the following names: `bauh_tray_default` and `bauh_tray_updates`
3) Own packaged icons
- AppImage: - AppImage:
- cleaning the downloaded database files when **--reset** is passed as parameter - cleaning the downloaded database files when **--reset** is passed as parameter
- environment variables **BAUH_APPIMAGE_DB_UPDATER** and **BAUH_APPIMAGE_DB_UPDATER_TIME** dropped in favor of the new configuration file located at **~/.config/bauh/appimage.yml** - environment variables **BAUH_APPIMAGE_DB_UPDATER** and **BAUH_APPIMAGE_DB_UPDATER_TIME** dropped in favor of the new configuration file located at **~/.config/bauh/appimage.yml**

View File

@@ -218,6 +218,11 @@ updates:
check_interval: 30 # the updates checking interval in SECONDS check_interval: 30 # the updates checking interval in SECONDS
``` ```
#### Tray icons
Priority:
1) Icon paths defined in **~/.config/bauh/config.yml**
2) Icons from the system with the following names: `bauh_tray_default` and `bauh_tray_updates`
3) Own packaged icons
### How to improve the performance ### How to improve the performance
- Disable package types that you do not want to deal with ( via GUI ) - Disable package types that you do not want to deal with ( via GUI )

View File

@@ -41,8 +41,22 @@ class TrayIcon(QSystemTrayIcon):
self.i18n = i18n self.i18n = i18n
self.manager = manager self.manager = manager
self.icon_default = QIcon(config['ui']['tray']['default_icon'] or resource.get_path('img/logo.png')) if config['ui']['tray']['default_icon']:
self.icon_update = QIcon(config['ui']['tray']['updates_icon'] or resource.get_path('img/logo_update.png')) self.icon_default = QIcon(config['ui']['tray']['default_icon'])
else:
self.icon_default = QIcon.fromTheme('bauh_tray_default')
if self.icon_default.isNull():
self.icon_default = QIcon(resource.get_path('img/logo.png'))
if config['ui']['tray']['updates_icon']:
self.icon_updates = QIcon(config['ui']['tray']['updates_icon'])
else:
self.icon_updates = QIcon.fromTheme('bauh_tray_updates')
if self.icon_updates.isNull():
self.icon_updates = QIcon(resource.get_path('img/logo_update.png'))
self.setIcon(self.icon_default) self.setIcon(self.icon_default)
self.menu = QMenu() self.menu = QMenu()
@@ -94,7 +108,7 @@ class TrayIcon(QSystemTrayIcon):
if len(updates) > 0: if len(updates) > 0:
update_keys = {'{}:{}:{}'.format(up.type, up.id, up.version) for up in updates} update_keys = {'{}:{}:{}'.format(up.type, up.id, up.version) for up in updates}
new_icon = self.icon_update new_icon = self.icon_updates
if update_keys.difference(self.last_updates): if update_keys.difference(self.last_updates):
self.last_updates = update_keys self.last_updates = update_keys