Esempio n. 1
0
    def _get_sudo_pw(self):
        if self._pw is None:
            self._pw = get_sudo_password(
                _("Installing {}").format(self._app["title"]))
            return self._pw is not None

        return True
Esempio n. 2
0
    def _uninstall_cb(self, event):
        confirmation = KanoDialog(
            title_text=_("Removing {}").format(self._app["title"]),
            description_text=_(
                "This application will be uninstalled and "
                "removed from apps. Do you wish to proceed?"
            ),
            button_dict={
                _("YES"): {
                    "return_value": 0
                },
                _("NO"): {
                    "return_value": -1,
                    "color": "red"
                }
            },
            parent_window=self._window
        )
        confirmation.title.description.set_max_width_chars(40)

        rv = confirmation.run()
        del confirmation
        if rv < 0:
            return

        prompt = _("Uninstalling {}").format(self._app["title"])
        pw = get_sudo_password(prompt, self._window)
        if pw is None:
            return

        self._window.blur()
        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
        while Gtk.events_pending():
            Gtk.main_iteration()

        success = uninstall_packages(self._app, pw)
        if success:
            remove_from_desktop(self._app)
            uninstall_link_and_icon(self._app["slug"], pw)

        self._apps.remove_app(self._app)

        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
        self._window.unblur()
Esempio n. 3
0
    def _uninstall_cb(self, event):
        confirmation = KanoDialog(
            title_text=_("Removing {}").format(self._app["title"]),
            description_text=_(
                "This application will be uninstalled and "
                "removed from apps. Do you wish to proceed?"
            ),
            button_dict={
                _("YES"): {
                    "return_value": 0
                },
                _("NO"): {
                    "return_value": -1,
                    "color": "red"
                }
            },
            parent_window=self._window
        )
        confirmation.title.description.set_max_width_chars(40)

        rv = confirmation.run()
        del confirmation
        if rv < 0:
            return

        prompt = _("Uninstalling {}").format(self._app["title"])
        pw = get_sudo_password(prompt, self._window)
        if pw is None:
            return

        self._window.blur()
        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
        while Gtk.events_pending():
            Gtk.main_iteration()

        success = uninstall_packages(self._app, pw)
        if success:
            remove_from_desktop(self._app)
            uninstall_link_and_icon(self._app["slug"], pw)

        self._apps.remove_app(self._app)

        self._window.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
        self._window.unblur()
Esempio n. 4
0
    def _get_sudo_pw(self):
        if self._pw is None:
            self._pw = get_sudo_password("Installing {}".format(self._app["title"]))
            return self._pw is not None

        return True