mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-01-09 05:04:12 +01:00
Here is the first batch of modules, which are needed for converting several formats to LRF. Some of the logic has been change, more cleanups will follow.
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
|
__docformat__ = 'restructuredtext en'
|
|
|
|
from ebook_converter.polyglot.builtins import native_string_type
|
|
|
|
|
|
class ConversionUserFeedBack(Exception):
|
|
|
|
def __init__(self, title, msg, level='info', det_msg=''):
|
|
''' Show a simple message to the user
|
|
|
|
:param title: The title (very short description)
|
|
:param msg: The message to show the user
|
|
:param level: Must be one of 'info', 'warn' or 'error'
|
|
:param det_msg: Optional detailed message to show the user
|
|
'''
|
|
import json
|
|
Exception.__init__(self, json.dumps({'msg':msg, 'level':level,
|
|
'det_msg':det_msg, 'title':title}))
|
|
self.title, self.msg, self.det_msg = title, msg, det_msg
|
|
self.level = level
|
|
|
|
|
|
# Ensure exception uses fully qualified name as this is used to detect it in
|
|
# the GUI.
|
|
ConversionUserFeedBack.__name__ = native_string_type('ebook_converter.ebooks.conversion.ConversionUserFeedBack')
|