mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
SHow timestamp and username in details of annotation
This commit is contained in:
parent
21f3348ab7
commit
f259c9bd7e
@ -18,6 +18,16 @@ from calibre.ebooks.metadata import authors_to_string, fmt_sidx
|
|||||||
from calibre.gui2 import Application, config, gprefs
|
from calibre.gui2 import Application, config, gprefs
|
||||||
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
||||||
from calibre.gui2.widgets2 import Dialog
|
from calibre.gui2.widgets2 import Dialog
|
||||||
|
from calibre.utils.iso8601 import parse_iso8601
|
||||||
|
|
||||||
|
|
||||||
|
def friendly_username(user_type, user):
|
||||||
|
key = user_type, user
|
||||||
|
if key == ('web', '*'):
|
||||||
|
return _('Anonymous Content server user')
|
||||||
|
if key == ('local', 'viewer'):
|
||||||
|
return _('Local viewer user')
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
def current_db():
|
def current_db():
|
||||||
@ -193,11 +203,7 @@ class Restrictions(QWidget):
|
|||||||
tb.clear()
|
tb.clear()
|
||||||
tb.addItem(' ', ' ')
|
tb.addItem(' ', ' ')
|
||||||
for user_type, user in db.all_annotation_users():
|
for user_type, user in db.all_annotation_users():
|
||||||
q = display_name = '{}: {}'.format(user_type, user)
|
display_name = friendly_username(user_type, user)
|
||||||
if q == 'web: *':
|
|
||||||
display_name = _('Anonymous content server users')
|
|
||||||
elif q == 'local: viewer':
|
|
||||||
display_name = _('Local viewer users')
|
|
||||||
tb.addItem(display_name, '{}:{}'.format(user_type, user))
|
tb.addItem(display_name, '{}:{}'.format(user_type, user))
|
||||||
if before:
|
if before:
|
||||||
row = tb.findData(before)
|
row = tb.findData(before)
|
||||||
@ -394,17 +400,21 @@ class DetailsPanel(QWidget):
|
|||||||
stext = stext[:-3]
|
stext = stext[:-3]
|
||||||
annot_text += '<div style="text-align:left">' + stext + '</div><div> </div>'
|
annot_text += '<div style="text-align:left">' + stext + '</div><div> </div>'
|
||||||
|
|
||||||
|
date = parse_iso8601(annot['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
text = '''
|
text = '''
|
||||||
<h2 style="text-align: center">{title} [{book_format}]</h2>
|
<h2 style="text-align: center">{title} [{book_format}]</h2>
|
||||||
<div style="text-align: center">{authors}</div>
|
<div style="text-align: center">{authors}</div>
|
||||||
<div style="text-align: center">{series}</div>
|
<div style="text-align: center">{series}</div>
|
||||||
<div> </div>
|
<div> </div>
|
||||||
<div> </div>
|
<div> </div>
|
||||||
|
<div>{dt}: {date}</div>
|
||||||
|
<div>{ut}: {user}</div>
|
||||||
<h2 style="text-align: left">{atype}</h2>
|
<h2 style="text-align: left">{atype}</h2>
|
||||||
{text}
|
{text}
|
||||||
'''.format(
|
'''.format(
|
||||||
title=a(title), authors=a(authors), series=a(series_text), book_format=a(book_format),
|
title=a(title), authors=a(authors), series=a(series_text), book_format=a(book_format),
|
||||||
atype=a(atype), text=annot_text
|
atype=a(atype), text=annot_text, dt=_('Date'), date=date, ut=_('User'),
|
||||||
|
user=friendly_username(r['user_type'], r['user'])
|
||||||
)
|
)
|
||||||
self.text_browser.setHtml(text)
|
self.text_browser.setHtml(text)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user