mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
BAUH_SYSTEM_NOTIFICATIONS
This commit is contained in:
@@ -19,7 +19,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- **Show button** for large fields in the **Info** window
|
- **Show button** for large fields in the **Info** window
|
||||||
- New environment variables / parameters: BAUH_MAX_DISPLAYED and BAUH_LOGS
|
- New environment variables / parameters: BAUH_MAX_DISPLAYED and BAUH_LOGS
|
||||||
|
|
||||||
|
|
||||||
### Improvements:
|
### Improvements:
|
||||||
- Reading installed Snaps now takes around 95% less time
|
- Reading installed Snaps now takes around 95% less time
|
||||||
- Reading Snap suggestions now takes around 75% less time
|
- Reading Snap suggestions now takes around 75% less time
|
||||||
@@ -29,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Progress bar status can now be controlled by the software manager while an operation is being executed
|
- Progress bar status can now be controlled by the software manager while an operation is being executed
|
||||||
- Flatpak: showing runtime branches as versions when they are not available
|
- Flatpak: showing runtime branches as versions when they are not available
|
||||||
- small UI improvements
|
- small UI improvements
|
||||||
|
- Environment variable / parameter BAUH_UPDATE_NOTIFICATION renamed to BAUH_SYSTEM_NOTIFICATIONS and now works for any system notification
|
||||||
|
|
||||||
### UI Changes
|
### UI Changes
|
||||||
- **Upgrade selected** and **Refresh** buttons now have text labels and new colors
|
- **Upgrade selected** and **Refresh** buttons now have text labels and new colors
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ In order to autostart the application, use your Desktop Environment settings to
|
|||||||
|
|
||||||
### Settings
|
### Settings
|
||||||
You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information).
|
You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information).
|
||||||
- **BAUH_UPDATE_NOTIFICATION**: enable or disable system updates notifications. Use **0** (disable) or **1** (enable, default).
|
- **BAUH_SYSTEM_NOTIFICATIONS**: enable or disable system notifications. Use **0** (disable) or **1** (enable, default).
|
||||||
- **BAUH_CHECK_INTERVAL**: define the updates check interval in seconds. Default: 60.
|
- **BAUH_CHECK_INTERVAL**: define the updates check interval in seconds. Default: 60.
|
||||||
- **BAUH_LOCALE**: define a custom app translation for a given locale key (e.g: 'pt', 'en', 'es', ...). Default: system locale.
|
- **BAUH_LOCALE**: define a custom app translation for a given locale key (e.g: 'pt', 'en', 'es', ...). Default: system locale.
|
||||||
- **BAUH_CACHE_EXPIRATION**: define a custom expiration time in SECONDS for cached API data. Default: 3600 (1 hour).
|
- **BAUH_CACHE_EXPIRATION**: define a custom expiration time in SECONDS for cached API data. Default: 3600 (1 hour).
|
||||||
|
|||||||
@@ -61,14 +61,15 @@ def main():
|
|||||||
suggestions=args.sugs,
|
suggestions=args.sugs,
|
||||||
display_limit=args.max_displayed,
|
display_limit=args.max_displayed,
|
||||||
config=user_config,
|
config=user_config,
|
||||||
context=context)
|
context=context,
|
||||||
|
notifications=bool(args.system_notifications))
|
||||||
|
|
||||||
if args.tray:
|
if args.tray:
|
||||||
tray_icon = TrayIcon(locale_keys=i18n,
|
tray_icon = TrayIcon(i18n=i18n,
|
||||||
manager=manager,
|
manager=manager,
|
||||||
manage_window=manage_window,
|
manage_window=manage_window,
|
||||||
check_interval=args.check_interval,
|
check_interval=args.check_interval,
|
||||||
update_notification=bool(args.update_notification),)
|
update_notification=bool(args.system_notifications))
|
||||||
manage_window.set_tray_icon(tray_icon)
|
manage_window.set_tray_icon(tray_icon)
|
||||||
tray_icon.show()
|
tray_icon.show()
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ def read() -> Namespace:
|
|||||||
help='Translation key. Default: %(default)s')
|
help='Translation key. Default: %(default)s')
|
||||||
parser.add_argument('-i', '--check-interval', action="store", default=int(os.getenv('BAUH_CHECK_INTERVAL', 60)),
|
parser.add_argument('-i', '--check-interval', action="store", default=int(os.getenv('BAUH_CHECK_INTERVAL', 60)),
|
||||||
type=int, help='Updates check interval in SECONDS. Default: %(default)s')
|
type=int, help='Updates check interval in SECONDS. Default: %(default)s')
|
||||||
parser.add_argument('-n', '--update-notification', action="store", choices=[0, 1],
|
parser.add_argument('-n', '--system-notifications', action="store", choices=[0, 1],
|
||||||
default=os.getenv('BAUH_UPDATE_NOTIFICATION', 1), type=int,
|
default=os.getenv('BAUH_SYSTEM_NOTIFICATIONS', 1), type=int,
|
||||||
help='Enables / disables system notifications for new updates. Default: %(default)s')
|
help='Enables / disables system notifications. Default: %(default)s')
|
||||||
parser.add_argument('-dc', '--disk-cache', action="store", choices=[0, 1],
|
parser.add_argument('-dc', '--disk-cache', action="store", choices=[0, 1],
|
||||||
default=os.getenv('BAUH_DISK_CACHE', 1), type=int,
|
default=os.getenv('BAUH_DISK_CACHE', 1), type=int,
|
||||||
help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s')
|
help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s')
|
||||||
@@ -55,8 +55,8 @@ def validate(args: Namespace, logger: logging.Logger):
|
|||||||
logger.info("'check-interval' set as '{}'. It must be >= 0. Aborting...".format(args.check_interval))
|
logger.info("'check-interval' set as '{}'. It must be >= 0. Aborting...".format(args.check_interval))
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if args.update_notification == 0:
|
if args.system_notifications == 0:
|
||||||
logger.info('updates notifications are disabled')
|
logger.info('system notifications are disabled')
|
||||||
|
|
||||||
if args.download_icons == 0:
|
if args.download_icons == 0:
|
||||||
logger.info("'download-icons' is disabled")
|
logger.info("'download-icons' is disabled")
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ class UpdateCheck(QThread):
|
|||||||
|
|
||||||
class TrayIcon(QSystemTrayIcon):
|
class TrayIcon(QSystemTrayIcon):
|
||||||
|
|
||||||
def __init__(self, locale_keys: dict, manager: SoftwareManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True):
|
def __init__(self, i18n: dict, manager: SoftwareManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True):
|
||||||
super(TrayIcon, self).__init__()
|
super(TrayIcon, self).__init__()
|
||||||
self.locale_keys = locale_keys
|
self.i18n = i18n
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|
||||||
self.icon_default = QIcon(resource.get_path('img/logo.png'))
|
self.icon_default = QIcon(resource.get_path('img/logo.png'))
|
||||||
@@ -44,13 +44,13 @@ class TrayIcon(QSystemTrayIcon):
|
|||||||
|
|
||||||
self.menu = QMenu()
|
self.menu = QMenu()
|
||||||
|
|
||||||
self.action_manage = self.menu.addAction(self.locale_keys['tray.action.manage'])
|
self.action_manage = self.menu.addAction(self.i18n['tray.action.manage'])
|
||||||
self.action_manage.triggered.connect(self.show_manage_window)
|
self.action_manage.triggered.connect(self.show_manage_window)
|
||||||
|
|
||||||
self.action_about = self.menu.addAction(self.locale_keys['tray.action.about'])
|
self.action_about = self.menu.addAction(self.i18n['tray.action.about'])
|
||||||
self.action_about.triggered.connect(self.show_about)
|
self.action_about.triggered.connect(self.show_about)
|
||||||
|
|
||||||
self.action_exit = self.menu.addAction(self.locale_keys['tray.action.exit'])
|
self.action_exit = self.menu.addAction(self.i18n['tray.action.exit'])
|
||||||
self.action_exit.triggered.connect(lambda: QCoreApplication.exit())
|
self.action_exit.triggered.connect(lambda: QCoreApplication.exit())
|
||||||
|
|
||||||
self.setContextMenu(self.menu)
|
self.setContextMenu(self.menu)
|
||||||
@@ -71,7 +71,7 @@ class TrayIcon(QSystemTrayIcon):
|
|||||||
self.manage_window = manage_window
|
self.manage_window = manage_window
|
||||||
|
|
||||||
def set_default_tooltip(self):
|
def set_default_tooltip(self):
|
||||||
self.setToolTip('{} ({})'.format(self.locale_keys['manage_window.title'], __app_name__).lower())
|
self.setToolTip('{} ({})'.format(self.i18n['manage_window.title'], __app_name__).lower())
|
||||||
|
|
||||||
def handle_click(self, reason):
|
def handle_click(self, reason):
|
||||||
if reason == self.Trigger:
|
if reason == self.Trigger:
|
||||||
@@ -95,7 +95,8 @@ class TrayIcon(QSystemTrayIcon):
|
|||||||
|
|
||||||
if update_keys.difference(self.last_updates):
|
if update_keys.difference(self.last_updates):
|
||||||
self.last_updates = update_keys
|
self.last_updates = update_keys
|
||||||
msg = '{}: {}'.format(self.locale_keys['notification.new_updates'], len(updates))
|
n_updates = len(updates)
|
||||||
|
msg = self.i18n['notification.update{}'.format('' if n_updates == 1 else 's')].format(n_updates)
|
||||||
self.setToolTip(msg)
|
self.setToolTip(msg)
|
||||||
|
|
||||||
if self.update_notification and notify_user:
|
if self.update_notification and notify_user:
|
||||||
@@ -122,7 +123,7 @@ class TrayIcon(QSystemTrayIcon):
|
|||||||
def show_about(self):
|
def show_about(self):
|
||||||
|
|
||||||
if self.dialog_about is None:
|
if self.dialog_about is None:
|
||||||
self.dialog_about = AboutDialog(self.locale_keys)
|
self.dialog_about = AboutDialog(self.i18n)
|
||||||
|
|
||||||
if self.dialog_about.isHidden():
|
if self.dialog_about.isHidden():
|
||||||
self.dialog_about.show()
|
self.dialog_about.show()
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ class ManageWindow(QWidget):
|
|||||||
signal_user_res = pyqtSignal(bool)
|
signal_user_res = pyqtSignal(bool)
|
||||||
signal_table_update = pyqtSignal()
|
signal_table_update = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager, disk_cache: bool, download_icons: bool,
|
def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager, disk_cache: bool,
|
||||||
screen_size, suggestions: bool, display_limit: int, config: Configuration, context: ApplicationContext, tray_icon=None):
|
download_icons: bool, screen_size, suggestions: bool, display_limit: int, config: Configuration,
|
||||||
|
context: ApplicationContext, notifications: bool, tray_icon=None):
|
||||||
super(ManageWindow, self).__init__()
|
super(ManageWindow, self).__init__()
|
||||||
self.i18n = i18n
|
self.i18n = i18n
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
@@ -61,6 +62,7 @@ class ManageWindow(QWidget):
|
|||||||
self.screen_size = screen_size
|
self.screen_size = screen_size
|
||||||
self.config = config
|
self.config = config
|
||||||
self.context = context
|
self.context = context
|
||||||
|
self.notifications = notifications
|
||||||
|
|
||||||
self.icon_app = QIcon(resource.get_path('img/logo.svg'))
|
self.icon_app = QIcon(resource.get_path('img/logo.svg'))
|
||||||
self.resize(ManageWindow.__BASE_HEIGHT__, ManageWindow.__BASE_HEIGHT__)
|
self.resize(ManageWindow.__BASE_HEIGHT__, ManageWindow.__BASE_HEIGHT__)
|
||||||
@@ -457,7 +459,7 @@ class ManageWindow(QWidget):
|
|||||||
self.checkbox_console.setChecked(True)
|
self.checkbox_console.setChecked(True)
|
||||||
|
|
||||||
def _can_notify_user(self):
|
def _can_notify_user(self):
|
||||||
return self.isHidden() or self.isMinimized()
|
return self.notifications and (self.isHidden() or self.isMinimized())
|
||||||
|
|
||||||
def _finish_downgrade(self, res: dict):
|
def _finish_downgrade(self, res: dict):
|
||||||
self.finish_action()
|
self.finish_action()
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ tray.action.about=About
|
|||||||
tray.action.refreshing=Refreshing
|
tray.action.refreshing=Refreshing
|
||||||
action.info.tooltip=Click here to see information about this application
|
action.info.tooltip=Click here to see information about this application
|
||||||
action.settings.tooltip=Click here to open extra actions
|
action.settings.tooltip=Click here to open extra actions
|
||||||
notification.new_updates=Updates
|
notification.update={} available update
|
||||||
|
notification.updates={} available updates
|
||||||
notification.update_selected.success=app(s) updated successfully
|
notification.update_selected.success=app(s) updated successfully
|
||||||
notification.update_selected.failed=Update failed
|
notification.update_selected.failed=Update failed
|
||||||
notification.install.failed=installation failed
|
notification.install.failed=installation failed
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ tray.action.about=Sobre
|
|||||||
tray.action.refreshing=Recargando
|
tray.action.refreshing=Recargando
|
||||||
action.info.tooltip=Haga clic aquí para ver informaciones sobre este aplicativo
|
action.info.tooltip=Haga clic aquí para ver informaciones sobre este aplicativo
|
||||||
action.settings.tooltip=Haga clic aquí para abrir acciones adicionales
|
action.settings.tooltip=Haga clic aquí para abrir acciones adicionales
|
||||||
notification.new_updates=Actualizaciones
|
notification.update={} actualización disponible
|
||||||
|
notification.updates={} actualizaciones disponibles
|
||||||
notification.update_selected.success=aplicativo(s) actualizado(s) con éxito
|
notification.update_selected.success=aplicativo(s) actualizado(s) con éxito
|
||||||
notification.update_selected.failed=La actualización falló
|
notification.update_selected.failed=La actualización falló
|
||||||
notification.install.failed=la instalación ha fallado
|
notification.install.failed=la instalación ha fallado
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ tray.action.manage=Gerenciar aplicativos
|
|||||||
tray.action.exit=Fechar
|
tray.action.exit=Fechar
|
||||||
tray.action.about=Sobre
|
tray.action.about=Sobre
|
||||||
tray.action.refreshing=Recarregando
|
tray.action.refreshing=Recarregando
|
||||||
notification.new_updates=Atualizações
|
notification.update={} atualização disponível
|
||||||
|
notification.updates={} atualizações disponíveis
|
||||||
notification.update_selected.success=aplicativo(s) atualizado(s) com sucesso
|
notification.update_selected.success=aplicativo(s) atualizado(s) com sucesso
|
||||||
notification.update_selected.failed=Erro ao atualizar
|
notification.update_selected.failed=Erro ao atualizar
|
||||||
notification.install.failed=instalação falhou
|
notification.install.failed=instalação falhou
|
||||||
|
|||||||
Reference in New Issue
Block a user