From f7650de369d1dec7e3ee82744b55f292870335f7 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sun, 16 Jan 2011 09:51:03 -0500 Subject: [PATCH] TXT Output GUI widet: Disable markdown options when markdown is not enabled. --- src/calibre/gui2/convert/txt_output.py | 28 ++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/convert/txt_output.py b/src/calibre/gui2/convert/txt_output.py index 21a9e60bed..a16dd68014 100644 --- a/src/calibre/gui2/convert/txt_output.py +++ b/src/calibre/gui2/convert/txt_output.py @@ -4,6 +4,8 @@ __license__ = 'GPL 3' __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' +from PyQt4.Qt import Qt + from calibre.gui2.convert.txt_output_ui import Ui_Form from calibre.gui2.convert import Widget @@ -21,9 +23,27 @@ class PluginWidget(Widget, Ui_Form): ['newline', 'max_line_length', 'force_max_line_length', 'inline_toc', 'markdown_format', 'keep_links', 'keep_image_references', '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: - self.opt_newline.addItem(x) - + self.opt_newline.addItem(x) 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) + \ No newline at end of file