Exemple #1
0
    def update_selected(self):
        if self.pkgs:
            requires_root = False

            to_update = []

            for app_v in self.pkgs:
                if app_v.update_checked:
                    to_update.append(app_v)

                    if self.manager.requires_root('update', app_v.model):
                        requires_root = True

            if to_update and dialog.ask_confirmation(
                    title=self.i18n['manage_window.upgrade_all.popup.title'],
                    body=self.i18n['manage_window.upgrade_all.popup.body'],
                    locale_keys=self.i18n,
                    widgets=[
                        UpdateToggleButton(
                            None, self, self.i18n, clickable=False)
                    ]):
                pwd = None

                if not is_root() and requires_root:
                    pwd, ok = ask_root_password(self.i18n)

                    if not ok:
                        return

                self._handle_console_option(True)
                self.progress_controll_enabled = len(to_update) == 1
                self._begin_action(self.i18n['manage_window.status.upgrading'])
                self.thread_update.apps_to_update = to_update
                self.thread_update.root_password = pwd
                self.thread_update.start()
Exemple #2
0
    def _save_settings(self):
        success, warnings = self.manager.save_settings(self.settings_model)

        # Configurações alteradas com sucesso, porém algumas delas só surtirão após a reinicialização

        if success:
            if dialog.ask_confirmation(title=self.i18n['warning'].capitalize(),
                                       body="<p>{}</p><p>{}</p>".format(self.i18n['settings.changed.success.warning'],
                                                                        self.i18n['settings.changed.success.reboot']),
                                       i18n=self.i18n):
                util.restart_app(self.window and self.window.isVisible())
            else:
                if isinstance(self.manager, GenericSoftwareManager):
                    self.manager.reset_cache()

                self.manager.prepare()

                if self.window and self.window.isVisible():
                    self.window.verify_warnings()
                    self.window.types_changed = True
                    self.window.refresh_apps()
                self.close()
        else:
            msg = StringIO()
            msg.write("<p>{}</p>".format(self.i18n['settings.error']))

            for w in warnings:
                msg.write('<p style="font-weight: bold">* ' + w + '</p><br/>')

            msg.seek(0)
            dialog.show_message(title="Warning", body=msg.read(), type_=MessageType.WARNING)
Exemple #3
0
 def custom_action():
     if dialog.ask_confirmation(
             title=self.i18n[action.i18_label_key],
             body=self._parag('{} {} ?'.format(
                 self.i18n[action.i18_label_key],
                 self._bold(str(pkg)))),
             i18n=self.i18n):
         self.window.execute_custom_action(pkg, action)
Exemple #4
0
 def _uninstall_app(self, app_v: PackageView):
     if dialog.ask_confirmation(
             title=self.i18n[
                 'manage_window.apps_table.row.actions.uninstall.popup.title'],
             body=self._parag(self.i18n[
                 'manage_window.apps_table.row.actions.uninstall.popup.body']
                              .format(self._bold(str(app_v)))),
             i18n=self.i18n):
         self.window.uninstall_app(app_v)
Exemple #5
0
 def downgrade():
     if dialog.ask_confirmation(
             title=self.i18n[
                 'manage_window.apps_table.row.actions.downgrade'],
             body=self._parag(self.i18n[
                 'manage_window.apps_table.row.actions.downgrade.popup.body']
                              .format(self._bold(str(pkg)))),
             i18n=self.i18n):
         self.window.downgrade(pkg)
Exemple #6
0
 def _uninstall_app(self, app_v: ApplicationView):
     if dialog.ask_confirmation(
             title=self.window.locale_keys[
                 'manage_window.apps_table.row.actions.uninstall.popup.title'],
             body=self.window.locale_keys[
                 'manage_window.apps_table.row.actions.uninstall.popup.body']
             .format(app_v),
             locale_keys=self.window.locale_keys):
         self.window.uninstall_app(app_v)
Exemple #7
0
 def downgrade():
     if dialog.ask_confirmation(
             title=self.window.locale_keys[
                 'manage_window.apps_table.row.actions.downgrade'],
             body=self.window.locale_keys[
                 'manage_window.apps_table.row.actions.downgrade.popup.body']
             .format(app.model.base_data.name),
             locale_keys=self.window.locale_keys):
         self.window.downgrade_app(app)
Exemple #8
0
    def _install_app(self, pkgv: PackageView):

        if dialog.ask_confirmation(
                title=self.i18n[
                    'manage_window.apps_table.row.actions.install.popup.title'],
                body=self._parag(self.i18n[
                    'manage_window.apps_table.row.actions.install.popup.body'].
                                 format(self._bold(str(pkgv)))),
                locale_keys=self.i18n):

            self.window.install(pkgv)
Exemple #9
0
        def custom_action():
            if action.i18n_confirm_key:
                body = self.i18n[action.i18n_confirm_key].format(
                    bold(pkg.model.name))
            else:
                body = '{} ?'.format(self.i18n[action.i18n_label_key])

            if dialog.ask_confirmation(title=self.i18n[action.i18n_label_key],
                                       body=self._parag(body),
                                       i18n=self.i18n):
                self.window.begin_execute_custom_action(pkg, action)
Exemple #10
0
    def _install_app(self, pkgv: PackageView):

        body = self.i18n['manage_window.apps_table.row.actions.install.popup.body'].format(self._bold(str(pkgv)))

        warning = self.i18n.get('gem.{}.install.warning'.format(pkgv.model.get_type().lower()))

        if warning:
            body += '<br/><br/> {}'.format('<br/>'.join(('{}.'.format(phrase) for phrase in warning.split('.') if phrase)))

        if dialog.ask_confirmation(
                title=self.i18n['manage_window.apps_table.row.actions.install.popup.title'],
                body=self._parag(body),
                i18n=self.i18n):

            self.window.install(pkgv)
Exemple #11
0
    def change_style(self, idx: int):

        if dialog.ask_confirmation(
                self.i18n['style.change.title'],
                self.i18n['style.change.question'].format(bold(__app_name__)),
                self.i18n):
            self.last_index = idx
            style = self.styles[idx]

            user_config = config.read()
            user_config.style = style
            config.save(user_config)

            util.restart_app(self.show_panel_after_restart)
        else:
            self.blockSignals(True)
            self.setCurrentIndex(self.last_index)
            self.blockSignals(False)
Exemple #12
0
    def _save_settings(self):
        success, warnings = self.manager.save_settings(self.settings_model)

        if success:
            if not self.window:
                dialog.show_message(
                    title=self.i18n['success'].capitalize(),
                    body=self.i18n['settings.changed.success.warning'],
                    type_=MessageType.INFO)
                QCoreApplication.exit()
            elif dialog.ask_confirmation(
                    title=self.i18n['warning'].capitalize(),
                    body="<p>{}</p><p>{}</p>".format(
                        self.i18n['settings.changed.success.warning'],
                        self.i18n['settings.changed.success.reboot']),
                    i18n=self.i18n):
                self.close()
                util.restart_app()
            else:
                if isinstance(self.manager, GenericSoftwareManager):
                    self.manager.reset_cache()

                self.manager.prepare(task_manager=None,
                                     root_password=None,
                                     internet_available=None)

                if self.window and self.window.isVisible():
                    self.window.update_custom_actions()
                    self.window.verify_warnings()
                    self.window.types_changed = True
                    self.window.refresh_packages()
                self.close()
        else:
            msg = StringIO()
            msg.write("<p>{}</p>".format(self.i18n['settings.error']))

            for w in warnings:
                msg.write('<p style="font-weight: bold">* ' + w + '</p><br/>')

            msg.seek(0)
            dialog.show_message(title="Warning",
                                body=msg.read(),
                                type_=MessageType.WARNING)
Exemple #13
0
    def update_selected(self):
        if self.apps:

            to_update = [
                app_v for app_v in self.apps
                if app_v.visible and app_v.update_checked
            ]

            if to_update:
                if dialog.ask_confirmation(
                        title=self.
                        locale_keys['manage_window.upgrade_all.popup.title'],
                        body=self.
                        locale_keys['manage_window.upgrade_all.popup.body'],
                        locale_keys=self.locale_keys):
                    self._handle_console_option(True)

                    self._begin_action(
                        self.locale_keys['manage_window.status.upgrading'])
                    self.thread_update.apps_to_update = to_update
                    self.thread_update.start()