Beispiel #1
0
def get_test_window_confirm_remove():
    # test real remove dialog
    icons = get_test_gtk3_icon_cache()
    db = get_test_db()
    app = application.Application("", "p7zip-full")
    return dependency_dialogs.confirm_remove(None,
        app, db, icons)
    def request_action(self, app, addons_install, addons_remove, action):
        """callback when an app action is requested from the appview,
           if action is "remove", must check if other dependencies have to be
           removed as well and show a dialog in that case
        """
        #~ LOG.debug("on_application_action_requested: '%s' %s"
        #~ % (app, action))
        appdetails = app.get_details(self.db)
        if action == AppActions.REMOVE:
            if not dependency_dialogs.confirm_remove(None, self.datadir, app,
                                                     self.db, self.icons):
                # craft an instance of TransactionFinishedResult to send
                # with the transaction-stopped signal
                result = TransactionFinishedResult(None, False)
                result.pkgname = app.pkgname
                self.backend.emit("transaction-stopped", result)
                return
        elif action == AppActions.INSTALL:
            # If we are installing a package, check for dependencies that will
            # also be removed and show a dialog for confirmation
            # generic removal text (fixing LP bug #554319)
            if not dependency_dialogs.confirm_install(None, self.datadir, app,
                                                      self.db, self.icons):
                # craft an instance of TransactionFinishedResult to send
                # with the transaction-stopped signal
                result = TransactionFinishedResult(None, False)
                result.pkgname = app.pkgname
                self.backend.emit("transaction-stopped", result)
                return

        # this allows us to 'upgrade' deb files
        if (action == AppActions.UPGRADE and app.request
                and isinstance(app, DebFileApplication)):
            action = AppActions.INSTALL

        # action_func is one of:
        #     "install", "remove", "upgrade", "apply_changes"
        action_func = getattr(self.backend, action)
        if action == AppActions.INSTALL:
            # the package.deb path name is in the request
            if app.request and isinstance(app, DebFileApplication):
                debfile_name = app.request
            else:
                debfile_name = None

            action_func(app, appdetails.icon, debfile_name, addons_install,
                        addons_remove)
        elif callable(action_func):
            action_func(app,
                        appdetails.icon,
                        addons_install=addons_install,
                        addons_remove=addons_remove)
Beispiel #3
0
    def request_action(self, app, addons_install, addons_remove, action):
        """callback when an app action is requested from the appview,
           if action is "remove", must check if other dependencies have to be
           removed as well and show a dialog in that case
        """
        #~ LOG.debug("on_application_action_requested: '%s' %s"
            #~ % (app, action))
        appdetails = app.get_details(self.db)
        if action == AppActions.REMOVE:
            if not dependency_dialogs.confirm_remove(
                        None, self.datadir, app, self.db, self.icons):
                    # craft an instance of TransactionFinishedResult to send
                    # with the transaction-stopped signal
                    result = TransactionFinishedResult(None, False)
                    result.pkgname = app.pkgname
                    self.backend.emit("transaction-stopped", result)
                    return
        elif action == AppActions.INSTALL:
            # If we are installing a package, check for dependencies that will
            # also be removed and show a dialog for confirmation
            # generic removal text (fixing LP bug #554319)
            if not dependency_dialogs.confirm_install(
                        None, self.datadir, app, self.db, self.icons):
                    # craft an instance of TransactionFinishedResult to send
                    # with the transaction-stopped signal
                    result = TransactionFinishedResult(None, False)
                    result.pkgname = app.pkgname
                    self.backend.emit("transaction-stopped", result)
                    return

        # this allows us to 'upgrade' deb files
        if (action == AppActions.UPGRADE and app.request and
            isinstance(app, DebFileApplication)):
            action = AppActions.INSTALL

        # action_func is one of:
        #     "install", "remove", "upgrade", "apply_changes"
        action_func = getattr(self.backend, action)
        if action == AppActions.INSTALL:
            # the package.deb path name is in the request
            if app.request and isinstance(app, DebFileApplication):
                debfile_name = app.request
            else:
                debfile_name = None

            action_func(app, appdetails.icon,
                        debfile_name, addons_install, addons_remove)
        elif callable(action_func):
            action_func(app, appdetails.icon,
                        addons_install=addons_install,
                        addons_remove=addons_remove)
Beispiel #4
0
 def test_removing_dependency_dialog_warning_on_non_ud(self, mock):
     app = Application("Some random app", "meep")
     self.db._aptcache["meep"] = Mock()
     confirm_remove(self.parent, app, self.db, self.icons)
     self.assertFalse(mock.called)
Beispiel #5
0
 def test_removing_dependency_dialog_warning_on_ud(self, mock):
     app = Application("", "ubuntu-desktop")
     self.db._aptcache["ubuntu-desktop"] = Mock()
     confirm_remove(self.parent, app, self.db, self.icons)
     self.assertTrue(mock.called)
Beispiel #6
0
 def test_removing_dependency_dialog_warning_on_non_ud(self, mock):
     app = Application("Some random app", "meep")
     self.db._aptcache["meep"] = Mock()
     confirm_remove(self.parent, app, self.db, self.icons)
     self.assertFalse(mock.called)
Beispiel #7
0
 def test_removing_dependency_dialog_warning_on_ud(self, mock):
     app = Application("", "ubuntu-desktop")
     self.db._aptcache["ubuntu-desktop"] = Mock()
     confirm_remove(self.parent, app, self.db, self.icons)
     self.assertTrue(mock.called)