mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make link in DRM error dialog localized
This commit is contained in:
parent
aa3f34898d
commit
4f6763624b
@ -8,8 +8,9 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
|
|
||||||
from qt.core import QDialog
|
from qt.core import QDialog
|
||||||
|
|
||||||
from calibre.gui2.dialogs.drm_error_ui import Ui_Dialog
|
from calibre.gui2.dialogs.drm_error_ui import Ui_Dialog
|
||||||
from polyglot.builtins import unicode_type
|
from calibre.utils.localization import localize_website_link
|
||||||
|
|
||||||
|
|
||||||
class DRMErrorMessage(QDialog, Ui_Dialog):
|
class DRMErrorMessage(QDialog, Ui_Dialog):
|
||||||
@ -17,7 +18,19 @@ class DRMErrorMessage(QDialog, Ui_Dialog):
|
|||||||
def __init__(self, parent=None, title=None):
|
def __init__(self, parent=None, title=None):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
msg = _('<p>This book is locked by <b>DRM</b>. To learn more about DRM'
|
||||||
|
' and why you cannot read or convert this book in calibre,'
|
||||||
|
' <a href="{0}">click here</a>.'
|
||||||
|
' </p>').format(localize_website_link('https://manual.calibre-ebook.com/drm.html'))
|
||||||
if title is not None:
|
if title is not None:
|
||||||
t = unicode_type(self.msg.text())
|
msg = '<h2>%s</h2>%s'%(title, msg)
|
||||||
self.msg.setText('<h2>%s</h2>%s'%(title, t))
|
self.msg.setText(msg)
|
||||||
self.resize(self.sizeHint())
|
self.resize(self.sizeHint())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from calibre.gui2 import Application
|
||||||
|
app = Application([])
|
||||||
|
d = DRMErrorMessage(title='testing title')
|
||||||
|
d.exec_()
|
||||||
|
del d
|
||||||
|
@ -43,8 +43,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="msg">
|
<widget class="QLabel" name="msg">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><p>This book is locked by <b>DRM</b>. To learn more about DRM and why you cannot read or convert this book in calibre,
|
<string/>
|
||||||
<a href="https://manual.calibre-ebook.com/drm.html">click here</a>.<p></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user