Example #1
0
    def on_apply_clicked(self, widget, box):
        to_add = []
        to_rm = []

        for widget in box.items:
            if widget.get_active():
                to_add.append(widget.pkgname)
            else:
                to_rm.append(widget.pkgname)

        self.package_worker.perform_action(widget.get_toplevel(), to_add, to_rm)
        self.package_worker.update_apt_cache(True)

        done = package_worker.get_install_status(to_add, to_rm)

        if done:
            self.button.set_sensitive(False)
            InfoDialog(_('Update Successful!')).launch()
        else:
            InfoDialog(_('Update Failed!')).launch()
            for widget in box.items:
                widget.reset_active()

        CompizSetting.update_context()
        self.remove_all_children()
        self.create_interface()

        self.show_all()
Example #2
0
def refresh_source(parent):
    dialog = UpdateCacheDialog(parent)
    res = dialog.run()

    new_pkg = []
    for pkg in package_worker.get_new_package():
        if pkg in BUILTIN_APPS:
            new_pkg.append(pkg)

    new_updates = list(package_worker.get_update_package())

    if new_pkg or new_updates:
        updateview = UpdateView()
        updateview.set_headers_visible(False)

        if new_pkg:
            updateview.update_model(new_pkg)

        if new_updates:
            updateview.update_updates(package_worker.get_update_package())

        dialog = QuestionDialog(_('You can install the new applications by selecting them and choose "Yes".\nOr you can install them at Add/Remove by choose "No".'),
            title = _('New applications are available to update'))

        vbox = dialog.vbox
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(-1, 200)
        vbox.pack_start(sw, False, False, 0)
        sw.add(updateview)
        sw.show_all()

        res = dialog.run()
        dialog.destroy()

        if res == gtk.RESPONSE_YES:
            to_rm = updateview.to_rm
            to_add = updateview.to_add
            package_worker.perform_action(parent, to_add, to_rm)

            package_worker.update_apt_cache(True)

            done = package_worker.get_install_status(to_add, to_rm)

            if done:
                InfoDialog(_('Update Successful!')).launch()
            else:
                ErrorDialog(_('Update Failed!')).launch()

        return True
    else:
        dialog = InfoDialog(_("Your system is clean and there's no update yet."),
            title = _('The software information is up-to-date now'))

        dialog.launch()
        return False
Example #3
0
    def on_apply_button_clicked(self, widget, data = None):
        to_rm = self.appview.to_rm
        to_add = self.appview.to_add
        if self.show_changes():
            self.package_worker.perform_action(widget.get_toplevel(), to_add, to_rm)

            package_worker.update_apt_cache(True)

            done = package_worker.get_install_status(to_add, to_rm)

            if done:
                self.apply_button.set_sensitive(False)
                InfoDialog(_('Update Successful!')).launch()
            else:
                ErrorDialog(_('Update Failed!')).launch()

            self.appview.to_add = []
            self.appview.to_rm = []
            self.appview.clear_model()
            self.appview.update_model()