コード例 #1
0
ファイル: gui.py プロジェクト: BackupTheBerlios/gtkpacman-svn
    def add_from_local_file(self, widget, data=None):
        main_win = self.gld.get_widget("main_win")
        dlg = local_install_fchooser_dialog(main_win, self.icon)
        if dlg.run() == RESPONSE_ACCEPT:
            main_win.set_sensitive(False)
            fname = dlg.get_filename()
            dlg.destroy()
        else:
            dlg.destroy()
            return
        
        self._statusbar(_("Installing %s" %fname))
        deps, conflicts = self.database.get_local_file_deps(fname)

        install = []
        remove = []
        
        for dep in deps:
            if dep.count(">="):
                dep = dep.split(">=")[0]
            dep_pkg = self.database.get_by_name(dep)
            if dep_pkg and not dep_pkg.installed:
                install.append(dep_pkg)
            continue

        for conflict in conflicts:
            try:
                conflict_pkg = self.database.get_by_name(conflict)
                if conflict_pkg:
                    remove.append(conflict_pkg)
            except NameError:
                pass
            continue

        pacs_queues = { "add": install, "remove": remove }

        local_install_dlg = local_install_dialog( main_win, self.icon, pacs_queues, fname )
        local_install_dlg.connect("destroy", self._refresh_trees_and_queues)
        
        retcode = local_install_dlg.run()        
        if retcode == RESPONSE_YES:
            self._statusbar(_("Installing..."))
            local_install_dlg.set_sensitive(False)
            if self._passwd_dlg_init(local_install_dlg):
                    local_install_dlg.install()
                    local_install_dlg.set_sensitive(True)
            else:
                local_install_dlg.destroy()
                self._statusbar(_("Installation canceled"))
        else:
            local_install_dlg.destroy()
コード例 #2
0
ファイル: gui.py プロジェクト: BackupTheBerlios/gtkpacman-svn
    def add_from_local_file(self, widget, data=None):
        dlg = local_install_fchooser_dialog(self.gld.get_widget("main_win"),
                                            self.icon)
        if dlg.run() == RESPONSE_ACCEPT:
            fname = dlg.get_filename()
            dlg.destroy()
        else:
            dlg.destroy()
            return

        stat_bar = self.gld.get_widget("statusbar")
        stat_bar.pop(self.stat_id)
        stat_bar.push(self.stat_id, _("Installing %s") %fname)
        deps, conflicts = self.database.get_local_file_deps(fname)

        install = []
        remove = []
        
        for dep in deps:
            dep_pkg = self.database.get_by_name(dep)
            if not dep_pkg.installed:
                install.append(dep_pkg)
            continue

        for conflict in conflicts:
            try:
                conflict_pkg = self.database.get_by_name(conflict)
                remove.append(conflict_pkg)
            except NameError:
                pass
            continue

        pacs_queues = { "add": install, "remove": remove }

        retcode = self._local_confirm(fname, pacs_queues)
        if retcode:
            i_dlg = local_install_dialog(fname, pacs_queues, self.icon)
            i_dlg.connect("destroy", self._after_local_install)
            i_dlg.run()