From 545ce0b6ce60be60ce81af39c03f810a70f266d7 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sat, 18 Apr 2020 18:32:06 +0100 Subject: [PATCH] If bools are bistate, remove the "Clear" button from edit medata single --- src/calibre/gui2/custom_column_widgets.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 5646e57ff9..7d941b92ba 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -164,12 +164,13 @@ class Bool(Base): l.addWidget(c) c.clicked.connect(self.set_to_no) - t = _('Clear') - c = QPushButton(t, parent) - width = c.fontMetrics().boundingRect(t).width() + 7 - c.setMaximumWidth(width) - l.addWidget(c) - c.clicked.connect(self.set_to_cleared) + if self.db.prefs.get('bools_are_tristate'): + t = _('Clear') + c = QPushButton(t, parent) + width = c.fontMetrics().boundingRect(t).width() + 7 + c.setMaximumWidth(width) + l.addWidget(c) + c.clicked.connect(self.set_to_cleared) c = QLabel('', parent) c.setMaximumWidth(1)