Exemplo n.º 1
0
 def __init__(self, cb=None):
     OpProgress.__init__(self)
     self._id = long(1)
     self.cb = cb
 def __init__(self, pbar):
     OpProgress.__init__(self)
     self.pbar = pbar
 def done(self):
     OpProgress.done(self)
Exemplo n.º 4
0
 def __init__(self, cb=None):
     OpProgress.__init__(self)
     self._id = long(1)
     self.cb = cb
 def __init__(self, pbar):
     OpProgress.__init__(self)
     self.pbar = pbar
 def update(self, percent):
     self.pbar.setValue(int(percent))
     QtGui.qApp.processEvents()
     OpProgress.update(self, percent)
Exemplo n.º 7
0
 def update(self, percent=None):
     """Called to update the percentage done"""
     OpProgress.update(self, percent)
     self.emit("status-changed", self.op, self.percent)
     while self._context.pending():
         self._context.iteration()
Exemplo n.º 8
0
 def update(self, percent=None):
     """Called periodically to update the user interface."""
     BaseOpProgress.update(self, percent)
     statusMessage("UPDATE_OP op:%s  subop:%s  percent:%.1f" % (
           self.op, self.subop, self.percent))
Exemplo n.º 9
0
 def update(self, percent=None):
     """Called periodically to update the user interface."""
     BaseOpProgress.update(self, percent)
     statusMessage("UPDATE_OP op:%s  subop:%s  percent:%.1f" %
                   (self.op, self.subop, self.percent))
Exemplo n.º 10
0
 def done(self):
     """Called once an operation has been completed."""
     BaseOpProgress.done(self)
     statusMessage("DONE_OP")
Exemplo n.º 11
0
 def update(self, percent):
     OpProgress.update(self, percent)
Exemplo n.º 12
0
 def __init__(self):
     OpProgress.__init__(self)
Exemplo n.º 13
0
 def done(self):
     """Called once an operation has been completed."""
     BaseOpProgress.done(self)
     statusMessage("DONE_OP")
 def update(self, percent):
     self.pbar.setValue(int(percent))
     QtGui.qApp.processEvents()
     OpProgress.update(self, percent)
Exemplo n.º 15
0
 def done(self):
     """Called when all operation have finished."""
     OpProgress.done(self)
     self.emit("status-finished")
 def done(self):
     OpProgress.done(self)
Exemplo n.º 17
0
    def _load(self):
        """Regenerates the fake configuration and loads the packages caches."""
        if self.loaded: return True

        # Modify the default configuration to create the fake one.
        apt_pkg.init_system()
        self.cache_dir.preauthChild(
            self.apt_config['Dir::State']).preauthChild(
                self.apt_config['Dir::State::Lists']).remove()
        self.cache_dir.preauthChild(
            self.apt_config['Dir::State']).preauthChild(
                self.apt_config['Dir::State::Lists']).child(
                    'partial').makedirs()
        sources_file = self.cache_dir.preauthChild(
            self.apt_config['Dir::Etc']).preauthChild(
                self.apt_config['Dir::Etc::sourcelist'])
        sources = sources_file.open('w')
        sources_count = 0
        deb_src_added = False
        self.packages.check_files()
        self.indexrecords = {}

        # Create an entry in sources.list for each needed index file
        for f in self.packages:
            # we should probably clear old entries from self.packages and
            # take into account the recorded mtime as optimization
            file = self.packages[f]
            if f.split('/')[-1] == "Release":
                self.addRelease(f, file)
            fake_uri = 'http://apt-p2p' + f
            fake_dirname = '/'.join(fake_uri.split('/')[:-1])
            if f.endswith('Sources'):
                deb_src_added = True
                source_line = 'deb-src ' + fake_dirname + '/ /'
            else:
                source_line = 'deb ' + fake_dirname + '/ /'
            listpath = self.cache_dir.preauthChild(
                self.apt_config['Dir::State']).preauthChild(
                    self.apt_config['Dir::State::Lists']).child(
                        apt_pkg.uri_to_filename(fake_uri))
            sources.write(source_line + '\n')
            log.msg("Sources line: " + source_line)
            sources_count = sources_count + 1

            if listpath.exists():
                #we should empty the directory instead
                listpath.remove()
            os.symlink(file.path, listpath.path)
        sources.close()

        if sources_count == 0:
            log.msg("No Packages files available for %s backend" %
                    (self.cache_dir.path))
            return False

        log.msg("Loading Packages database for " + self.cache_dir.path)
        for key, value in self.apt_config.items():
            apt_pkg.config[key] = value

        self.cache = apt_pkg.Cache(OpProgress())
        self.records = apt_pkg.PackageRecords(self.cache)
        if deb_src_added:
            self.srcrecords = apt_pkg.SourceRecords()
        else:
            self.srcrecords = None

        self.loaded = True
        return True