Пример #1
0
    def on_timeout(self):
        self.pulse()
        if not self.downgrade_done:
            line, returncode = proxy.get_cmd_pipe()
            if line != '':
                log.debug("Clean PPA result is: %s, returncode is: %s" % (line, returncode))
                line = line.rstrip()

                if '.deb' in line:
                    try:
                        package = line.split('.../')[1].split('_')[0]
                        self.set_progress_text(_('Downgrading...%s') % package)
                    except Exception, e:
                        log.error(e)
                else:
                    package = self.search_for_download_package(line)

                    if package:
                        self.set_progress_text(_('Downloading...%s') % package)

                if line:
                    self.terminal.insert(line)
                else:
                    self.terminal.insert('\n')

            # TODO if returncode isn't 0?
            if returncode.isdigit() and int(returncode) > 1:
                self.error = line
            elif returncode != 'None':
                log.debug("downgrade_done, returncode is: %s" % returncode)
                self.downgrade_done = True
    def clean_cruft(self, cruft_list=[], parent=None):
        for index, cruft in enumerate(cruft_list):
            log.debug('Cleaning...%s' % cruft.get_name())
            proxy.clean_configs(cruft.get_name())
            line, returncode = proxy.get_cmd_pipe()
            while returncode == 'None':
                log.debug('output: %s, returncode: %s' % (line, returncode))
                time.sleep(0.2)
                line, returncode = proxy.get_cmd_pipe()

            if returncode != '0':
                self.emit('clean_error', returncode)
                break
            else:
                self.emit('object_cleaned', cruft, index + 1)

        self.emit('all_cleaned', True)
    def clean_cruft(self, cruft_list=[], parent=None):
        for index, cruft in enumerate(cruft_list):
            log.debug('Cleaning...%s' % cruft.get_name())
            proxy.clean_configs(cruft.get_name())
            line, returncode = proxy.get_cmd_pipe()
            while returncode == 'None':
                log.debug('output: %s, returncode: %s' % (line, returncode))
                time.sleep(0.2)
                line, returncode = proxy.get_cmd_pipe()

            if returncode != '0':
                self.emit('clean_error', returncode)
                break
            else:
                self.emit('object_cleaned', cruft, index + 1)

        self.emit('all_cleaned', True)
    def on_timeout(self):
        self.pulse()

        line, returncode = proxy.get_cmd_pipe()
        log.debug("Clean config result is: %s, returncode: %s" % (line, returncode))
        if line != '':
            line = line.rstrip()
            if line:
                self.set_progress_text(line)
                self.terminal.insert(line)
            else:
                self.terminal.insert('\n')

        if returncode != 'None':
            self.done = True
            if returncode != '0':
                self.emit('error', returncode)

        if not self.done:
            log.debug("Not done, return True")
            return True
        else:
            self.destroy()