mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT Output GUI widet: Disable markdown options when markdown is not enabled.
This commit is contained in:
parent
d271747cff
commit
f7650de369
@ -4,6 +4,8 @@ __license__ = 'GPL 3'
|
|||||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from PyQt4.Qt import Qt
|
||||||
|
|
||||||
from calibre.gui2.convert.txt_output_ui import Ui_Form
|
from calibre.gui2.convert.txt_output_ui import Ui_Form
|
||||||
from calibre.gui2.convert import Widget
|
from calibre.gui2.convert import Widget
|
||||||
|
|
||||||
@ -22,8 +24,26 @@ class PluginWidget(Widget, Ui_Form):
|
|||||||
'inline_toc', 'markdown_format', 'keep_links', 'keep_image_references',
|
'inline_toc', 'markdown_format', 'keep_links', 'keep_image_references',
|
||||||
'txt_output_encoding'])
|
'txt_output_encoding'])
|
||||||
self.db, self.book_id = db, book_id
|
self.db, self.book_id = db, book_id
|
||||||
|
|
||||||
for x in get_option('newline').option.choices:
|
for x in get_option('newline').option.choices:
|
||||||
self.opt_newline.addItem(x)
|
self.opt_newline.addItem(x)
|
||||||
|
|
||||||
self.initialize_options(get_option, get_help, db, book_id)
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
|
|
||||||
|
self.opt_markdown_format.stateChanged.connect(self.enable_markdown_format)
|
||||||
|
self.enable_markdown_format(self.opt_markdown_format.checkState())
|
||||||
|
|
||||||
|
def break_cycles(self):
|
||||||
|
Widget.break_cycles(self)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.opt_markdown_format.stateChanged.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def enable_markdown_format(self, state):
|
||||||
|
if state == Qt.Checked:
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
|
self.opt_keep_links.setEnabled(state)
|
||||||
|
self.opt_keep_image_references.setEnabled(state)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user