From e2d4132b6e9e41c01682ecba6319a7366b7471fd Mon Sep 17 00:00:00 2001 From: Ivan Holmes Date: Mon, 4 Nov 2019 18:00:59 +0000 Subject: [PATCH] Correctly set the chord combo box on the block tab if the block clicked has no chord. --- gui.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui.py b/gui.py index 9499e74..6a5bcf0 100755 --- a/gui.py +++ b/gui.py @@ -197,7 +197,8 @@ class DocumentWindow(QMainWindow): def blockClickedAction(self, index): # set the controls to the values from the selected block - self.window.blockChordComboBox.setCurrentText(self.window.blockTableView.model.item(index.row(), 0).text()) + bChord = self.window.blockTableView.model.item(index.row(), 0).text() + self.window.blockChordComboBox.setCurrentText(bChord if bChord else "None") self.window.blockLengthLineEdit.setText(self.window.blockTableView.model.item(index.row(), 1).text()) self.window.blockNotesLineEdit.setText(self.window.blockTableView.model.item(index.row(), 2).text()) @@ -324,7 +325,7 @@ class DocumentWindow(QMainWindow): wantToSave = UnsavedMessageBox().exec() if wantToSave == QMessageBox.Save: - if not (hasattr(self, 'currentFilePath') and self.currentFilePath): + if not (self.currentFilePath): filePath = QFileDialog.getSaveFileName(self.window.tabWidget, 'Save file', str(os.path.expanduser("~")), "Chordsheet ML files (*.xml *.cml)") self.currentFilePath = filePath[0] self.doc.saveXML(self.currentFilePath)