Esempio n. 1
0
    def add_to_install_queue(self, widget, data=None):
        tree = self.gld.get_widget("pacs_tree")
        model, l_iter = tree.get_selection().get_selected()
        
        try:
            name = model.get_value(l_iter, 2)
        except TypeError:
            return
        
        if name in self.queues["add"]:
            return
        
        image = model.get_value(l_iter, 0)
        
        if name in self.database.ignorePkg and image == 'green':
            dlg = ignorepkg_dialog(name, self.icon)
            res = dlg.run()
            dlg.destroy()
            if res == RESPONSE_NO:
                return
            
        if name in self.queues["remove"]:
            self.queues["remove"].remove(name)

        self.queues["add"].append(name)
        if image == "red":
            model.set_value(l_iter, 1, STOCK_ADD)
        else:
            model.set_value(l_iter, 1, STOCK_GO_UP)
        return
Esempio n. 2
0
    def upgrade_system(self, widget, data=None):
        to_upgrade = []
        
        for repo in self.database.values():
            for pac in repo:
                if pac.isold:
                    to_upgrade.append(pac)
                continue
            continue
        
        # Jump in if there are packages to upgrade
        if to_upgrade:
            self.gld.get_widget("main_win").set_sensitive(False)
            b_list = self._blacklist( to_upgrade, 0x01)
            if b_list:
                dlg = ignorepkg_dialog( b_list, self.icon)
                res = dlg.run()
                dlg.destroy()
                if res == RESPONSE_NO:
                    self._done(None)
                    return
            
            upgrade_dlg = upgrade_dialog( self.gld.get_widget("main_win"), self.icon, to_upgrade)
            upgrade_dlg.connect("destroy", self._refresh_trees_and_queues)
        
            resp = upgrade_dlg.run()
            if resp == RESPONSE_YES:
                self._statusbar(_("Refreshing database..."))
                upgrade_dlg.set_sensitive(False)
                if self._passwd_dlg_init(upgrade_dlg):
                    upgrade_dlg.install()
                    upgrade_dlg.set_sensitive(True)
                else:
                    upgrade_dlg.destroy()
                    self._statusbar(_("Upgrade canceled"))
                    self.gld.get_widget("main_win").set_sensitive(True)
                    
            elif resp == RESPONSE_NO:
                upgrade_dlg.destroy()
                self._statusbar(_("Upgrade canceled"))
                self.gld.get_widget("main_win").set_sensitive(True)
            else:
                print 'else'

        # Else nothing to upgrade
        else:
            self._statusbar(_("There are no packages to upgrade"))
            self.gld.get_widget("main_win").set_sensitive(True)
        return
Esempio n. 3
0
    def add_to_install_queue(self, widget, data=None):
        tree = self.gld.get_widget("pacs_tree")
        model, l_iter = tree.get_selection().get_selected()

        name = model.get_value(l_iter, 2)
        if name in self.queues["add"]:
            return
        if name in self.database.holdPkg:
           dlg = holdpkg_dialog(name, self.icon)
           res = dlg.run()
           dlg.destroy()
           if res == RESPONSE_OK:
               pacs_queues = { "add": [self.database.get_by_name(name)], "remove": [] }
               retcode = self._confirm(pacs_queues)
               if retcode:
                   stat_bar = self.gld.get_widget("statusbar")
                   stat_bar.pop(self.stat_id)
                   stat_bar.push(self.stat_id, _("Executing queued operations"))
                   dlg = do_dialog(pacs_queues, self.icon)
                   dlg.run()
           return
        if name in self.database.ignorePkg:
            dlg = ignorepkg_dialog(name, self.icon)
            res = dlg.run()
            dlg.destroy()
            if res is RESPONSE_NO:
                return
            
        if name in self.queues["remove"]:
            self.queues["remove"].remove(name)

        self.queues["add"].append(name)

        image = model.get_value(l_iter, 0)
        if image == "red":
            model.set_value(l_iter, 1, STOCK_ADD)
        else:
            model.set_value(l_iter, 1, STOCK_GO_UP)
        return
Esempio n. 4
0
    def execute(self, widget=None, data=None):
        pacs_queues = { "add": [], "remove": [] }
        deps = []
        req_pacs = []
        
        if self.queues['add']:
            pacs_queues['add'] = self._execute_queue_add()
            # Check if packages are listed as ignorePkg
            b_list = self._blacklist( pacs_queues['add'], 0x01)
            if b_list:
                dlg = ignorepkg_dialog( b_list, self.icon)
                res = dlg.run()
                dlg.destroy()
                if res == RESPONSE_NO:
                    self._done(None)
                    return
            
        if self.queues['remove']:
            pacs_queues['remove'], req_pacs = self._execute_queue_remove()
            #pacs_queues["remove"] = self._execute_queue_remove()
            # Check if packages are listed as holdPkg
            b_list = self._blacklist( pacs_queues['remove'], 0x02)
            if b_list:
                dlg = holdpkg_dialog( b_list, self.icon)
                res = dlg.run()
                dlg.destroy()
                if res == RESPONSE_NO:
                    self._done(None)
                    return
            
        if not (pacs_queues["add"] or pacs_queues["remove"]):
            self._refresh_trees_and_queues()
            return
        
        self.gld.get_widget("main_win").set_sensitive(False)
        if req_pacs:
            dlg = warning_dialog(self.gld.get_widget("main_win"),
                             req_pacs, self.icon)
            if dlg.run() == RESPONSE_YES:
                pacs_queues["remove"].extend(req_pacs)
                dlg.destroy()
            else:
                dlg.destroy()

        # Open new dialog and execute commands ie. install/remove packages
        do_dlg = do_dialog( self.gld.get_widget("main_win"), self.icon, pacs_queues)
        do_dlg.connect("destroy", self._refresh_trees_and_queues)
        
        resp = do_dlg.run()
        if resp == RESPONSE_YES:
            self._statusbar(_("Executing queued operations..."))
            do_dlg.set_sensitive(False)
            if self._passwd_dlg_init(do_dlg):
                do_dlg.install()
                do_dlg.set_sensitive(True)
            # User clicked cancel
            else:
                do_dlg.destroy()
                self.queues["add"] = []
                self.queues["remove"] = []
                self._statusbar(_("Upgrade canceled"))
                self.gld.get_widget("main_win").set_sensitive(True)
                
        elif resp == RESPONSE_NO:
            do_dlg.destroy()
            self.queues["add"] = []
            self.queues["remove"] = []
            self._statusbar(_("Upgrade canceled"))
            self.gld.get_widget("main_win").set_sensitive(True)