Fix a regression that broke Check Book for some ebook files with inline style attributes

This commit is contained in:
Kovid Goyal 2020-01-23 20:14:39 +05:30
parent 3e238e8ba7
commit 66dde0b75c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -9,6 +9,7 @@ import json
import numbers import numbers
import sys import sys
from collections import namedtuple from collections import namedtuple
from itertools import repeat
try: try:
from PyQt5 import sip from PyQt5 import sip
@ -190,7 +191,7 @@ class Pool(object):
def check_css(self, css_sources): def check_css(self, css_sources):
self.pending = list(enumerate(css_sources)) self.pending = list(enumerate(css_sources))
self.results = list(range(len(css_sources))) self.results = list(repeat(None, len(css_sources)))
self.working = True self.working = True
self.assign_work() self.assign_work()
app = QApplication.instance() app = QApplication.instance()
@ -212,10 +213,10 @@ class Pool(object):
break break
def work_done(self, worker, result): def work_done(self, worker, result):
self.assign_work()
if not isinstance(result, dict): if not isinstance(result, dict):
result = worker.console_messages result = worker.console_messages
self.results[worker.result_idx] = result self.results[worker.result_idx] = result
self.assign_work()
if not self.pending and not [w for w in self.workers if w.working]: if not self.pending and not [w for w in self.workers if w.working]:
self.working = False self.working = False
@ -232,7 +233,7 @@ Job = namedtuple('Job', 'name css line_offset')
def create_job(name, css, line_offset=0, is_declaration=False): def create_job(name, css, line_offset=0, is_declaration=False):
if is_declaration: if is_declaration:
css = 'a{\n' + css + '\n}' css = 'div{\n' + css + '\n}'
line_offset -= 1 line_offset -= 1
return Job(name, css, line_offset) return Job(name, css, line_offset)