gui/log: print messages in tooltips

This helps reading long messages in small log windows.
This commit is contained in:
Sebastien Bourdeauducq 2018-08-17 13:21:36 +08:00
parent 2463e5667d
commit 1ba12e1cdb
1 changed files with 6 additions and 1 deletions

View File

@ -161,8 +161,13 @@ class _Model(QtCore.QAbstractItemModel):
return v[3][item.row+1] return v[3][item.row+1]
elif role == QtCore.Qt.ToolTipRole: elif role == QtCore.Qt.ToolTipRole:
v = self.entries[msgnum] v = self.entries[msgnum]
if item.parent is self:
lineno = 0
else:
lineno = item.row + 1
return (log_level_to_name(v[0]) + ", " + return (log_level_to_name(v[0]) + ", " +
time.strftime("%m/%d %H:%M:%S", time.localtime(v[2]))) time.strftime("%m/%d %H:%M:%S", time.localtime(v[2])) +
"\n" + v[3][lineno])
class LogDock(QDockWidgetCloseDetect): class LogDock(QDockWidgetCloseDetect):