コード例 #1
0
    def notify_updates(self, updates: List[ApplicationUpdate], notify_user: bool = True):

        self.lock_notify.acquire()

        try:
            if len(updates) > 0:
                update_keys = {'{}:{}:{}'.format(up.type, up.id, up.version) for up in updates}

                new_icon = self.icon_update

                if update_keys.difference(self.last_updates):
                    self.last_updates = update_keys
                    msg = '{}: {}'.format(self.locale_keys['notification.new_updates'], len(updates))
                    self.setToolTip(msg)

                    if self.update_notification and notify_user:
                        system.notify_user(msg)

            else:
                self.last_updates.clear()
                new_icon = self.icon_default
                self.set_default_tooltip()

            if self.icon().cacheKey() != new_icon.cacheKey():  # changes the icon if needed
                self.setIcon(new_icon)

        finally:
            self.lock_notify.release()
コード例 #2
0
    def _finish_uninstall(self, app: ApplicationView):
        self.finish_action()

        if app:
            if self._can_notify_user():
                system.notify_user('{} ({}) {}'.format(
                    app.model.base_data.name, app.model.get_type(),
                    self.locale_keys['uninstalled']))

            self.refresh_apps()
        else:
            if self._can_notify_user():
                system.notify_user('{}: {}'.format(
                    app.model.base_data.name,
                    self.locale_keys['notification.uninstall.failed']))

            self.checkbox_console.setChecked(True)
コード例 #3
0
    def _finish_update_selected(self, success: bool, updated: int):
        self.finish_action()

        if success:
            if self._can_notify_user():
                system.notify_user('{} {}'.format(
                    updated,
                    self.locale_keys['notification.update_selected.success']))

            self.refresh_apps()

            if self.tray_icon:
                self.tray_icon.verify_updates()
        else:
            if self._can_notify_user():
                system.notify_user(
                    self.locale_keys['notification.update_selected.failed'])

            self.bt_upgrade.setEnabled(True)
            self.checkbox_console.setChecked(True)
コード例 #4
0
    def _finish_downgrade(self, success: bool):
        self.finish_action()

        if success:
            if self._can_notify_user():
                app = self.table_apps.get_selected_app()
                system.notify_user('{} ({}) {}'.format(
                    app.model.base_data.name, app.model.get_type(),
                    self.locale_keys['downgraded']))

            self.refresh_apps()

            if self.tray_icon:
                self.tray_icon.verify_updates(notify_user=False)
        else:
            if self._can_notify_user():
                system.notify_user(
                    self.locale_keys['notification.downgrade.failed'])

            self.checkbox_console.setChecked(True)