mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
py3: misc fixes to get the editor to start
This commit is contained in:
parent
683212da39
commit
601c5ca255
@ -1030,6 +1030,6 @@ class FileListWidget(QWidget):
|
|||||||
return self.file_list.current_name
|
return self.file_list.current_name
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name in self.forwarded_signals:
|
if name in object.__getattribute__(self, 'forwarded_signals'):
|
||||||
return getattr(self.file_list, name)
|
return getattr(self.file_list, name)
|
||||||
return QWidget.__getattr__(self, name)
|
return QWidget.__getattr__(self, name)
|
||||||
|
@ -46,7 +46,10 @@ def get_data(name):
|
|||||||
|
|
||||||
def parse_html(raw):
|
def parse_html(raw):
|
||||||
root = parse(raw, decoder=lambda x:x.decode('utf-8'), line_numbers=True, linenumber_attribute='data-lnum')
|
root = parse(raw, decoder=lambda x:x.decode('utf-8'), line_numbers=True, linenumber_attribute='data-lnum')
|
||||||
return serialize(root, 'text/html').encode('utf-8')
|
ans = serialize(root, 'text/html')
|
||||||
|
if not isinstance(ans, bytes):
|
||||||
|
ans = ans.encode('utf-8')
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
class ParseItem(object):
|
class ParseItem(object):
|
||||||
|
@ -525,9 +525,9 @@ class ZipExtFile(io.BufferedIOBase):
|
|||||||
|
|
||||||
if self._compress_type == ZIP_DEFLATED:
|
if self._compress_type == ZIP_DEFLATED:
|
||||||
self._decompressor = zlib.decompressobj(-15)
|
self._decompressor = zlib.decompressobj(-15)
|
||||||
self._unconsumed = ''
|
self._unconsumed = b''
|
||||||
|
|
||||||
self._readbuffer = ''
|
self._readbuffer = b''
|
||||||
self._offset = 0
|
self._offset = 0
|
||||||
|
|
||||||
self._universal = 'U' in mode
|
self._universal = 'U' in mode
|
||||||
@ -555,7 +555,7 @@ class ZipExtFile(io.BufferedIOBase):
|
|||||||
|
|
||||||
if not self._universal and limit < 0:
|
if not self._universal and limit < 0:
|
||||||
# Shortcut common case - newline found in buffer.
|
# Shortcut common case - newline found in buffer.
|
||||||
i = self._readbuffer.find('\n', self._offset) + 1
|
i = self._readbuffer.find(b'\n', self._offset) + 1
|
||||||
if i > 0:
|
if i > 0:
|
||||||
line = self._readbuffer[self._offset: i]
|
line = self._readbuffer[self._offset: i]
|
||||||
self._offset = i
|
self._offset = i
|
||||||
@ -613,7 +613,7 @@ class ZipExtFile(io.BufferedIOBase):
|
|||||||
"""Read and return up to n bytes.
|
"""Read and return up to n bytes.
|
||||||
If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
|
If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
|
||||||
"""
|
"""
|
||||||
buf = ''
|
buf = b''
|
||||||
if n is None:
|
if n is None:
|
||||||
n = -1
|
n = -1
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user