mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only print timing info in debug mode
This commit is contained in:
parent
4c8e216f5f
commit
6420da0d6e
@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import time
|
||||
from threading import Thread
|
||||
from future_builtins import map
|
||||
from operator import itemgetter
|
||||
@ -24,6 +25,7 @@ from PyQt5.Qt import (
|
||||
QFontDatabase, QComboBox)
|
||||
|
||||
from calibre import human_readable, fit_image
|
||||
from calibre.constants import DEBUG
|
||||
from calibre.ebooks.oeb.polish.report import gather_data, CSSEntry, CSSFileMatch, MatchLocation
|
||||
from calibre.gui2 import error_dialog, question_dialog, choose_save_file
|
||||
from calibre.gui2.tweak_book import current_container, tprefs, dictionaries
|
||||
@ -944,7 +946,11 @@ class ReportsWidget(QWidget):
|
||||
def __call__(self, data):
|
||||
jump.clear()
|
||||
for i in xrange(self.stack.count()):
|
||||
st = time.time()
|
||||
self.stack.widget(i)(data)
|
||||
if DEBUG:
|
||||
category = self.reports.item(i).data(Qt.DisplayRole)
|
||||
print ('Widget time for %12s: %.2fs seconds' % (category, time.time() - st))
|
||||
|
||||
def save(self):
|
||||
save_state('splitter-state', bytearray(self.splitter.saveState()))
|
||||
@ -1042,11 +1048,9 @@ class Reports(Dialog):
|
||||
'Failed to gather data for the report. Click "Show details" for more'
|
||||
' information.'), det_msg=data, show=True)
|
||||
data, timing = data
|
||||
try:
|
||||
if DEBUG:
|
||||
for x, t in sorted(timing.iteritems(), key=itemgetter(1)):
|
||||
print ('Time for %6s data: %.3f seconds' % (x, t))
|
||||
except Exception:
|
||||
pass
|
||||
self.reports(data)
|
||||
|
||||
def accept(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user