mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improve performance of log viewer
This commit is contained in:
parent
69f79f163d
commit
568c8067f0
@ -18,13 +18,19 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTextEdit" name="log" >
|
||||
<widget class="QPlainTextEdit" name="log" >
|
||||
<property name="undoRedoEnabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="lineWrapMode" >
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximumBlockCount" >
|
||||
<number>400</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -188,6 +188,6 @@ class DetailView(QDialog, Ui_Dialog):
|
||||
|
||||
|
||||
def update(self):
|
||||
self.log.setHtml(self.job.gui_text())
|
||||
self.log.setPlainText(self.job.gui_text())
|
||||
vbar = self.log.verticalScrollBar()
|
||||
vbar.setValue(vbar.maximum())
|
||||
|
@ -588,11 +588,11 @@ class Job(object):
|
||||
if self.description:
|
||||
if not isinstance(self.description, unicode):
|
||||
self.description = self.description.decode('utf-8', 'replace')
|
||||
ans[0] += u'<b>%s</b>'%self.description
|
||||
ans[0] += u'**%s**'%self.description
|
||||
if self.exception is not None:
|
||||
header = unicode(self.exception.__class__.__name__) if \
|
||||
hasattr(self.exception, '__class__') else u'Error'
|
||||
header = u'<b>%s</b>'%header
|
||||
header = u'**%s**'%header
|
||||
header += u': '
|
||||
try:
|
||||
header += unicode(self.exception)
|
||||
@ -600,15 +600,15 @@ class Job(object):
|
||||
header += unicode(repr(self.exception))
|
||||
ans.append(header)
|
||||
if self.traceback:
|
||||
ans.append(u'<b>Traceback</b>:')
|
||||
ans.append(u'**Traceback**:')
|
||||
ans.extend(self.traceback.split('\n'))
|
||||
if self.log:
|
||||
ans.append(u'<b>Log</b>:')
|
||||
ans.append(u'**Log**:')
|
||||
if isinstance(self.log, str):
|
||||
self.log = unicode(self.log, 'utf-8', 'replace')
|
||||
ans.extend(self.log.split('\n'))
|
||||
|
||||
return '<br>'.join(ans)
|
||||
return '\n'.join(ans)
|
||||
|
||||
|
||||
class ParallelJob(Job):
|
||||
|
Loading…
x
Reference in New Issue
Block a user