Browse Source

fix crash on add block with no sections

master
Ivan Holmes 4 years ago
parent
commit
b340c1e64d
  1. 24
      gui.py

24
gui.py

@ -181,6 +181,9 @@ class DocumentWindow(QMainWindow):
self.window.sectionTableView.clicked.connect(self.sectionClickedAction)
self.window.blockTableView.clicked.connect(self.blockClickedAction)
# Set the tab widget to Overview tab
self.window.tabWidget.setCurrentIndex(0)
def UIInitDocument(self):
"""
Fills the window's fields with the values from its document.
@ -755,7 +758,9 @@ class DocumentWindow(QMainWindow):
"""
Update the block list by reading the table.
"""
if section is None:
BlockMustHaveSectionWarningMessageBox().exec()
else:
blockTableList = []
for i in range(self.window.blockTableView.model.rowCount()):
blockLength = float(
@ -947,6 +952,23 @@ class SectionNameWarningMessageBox(QMessageBox):
self.setDefaultButton(QMessageBox.Ok)
class BlockMustHaveSectionWarningMessageBox(QMessageBox):
"""
Message box to warn the user that a block must belong to a section
"""
def __init__(self):
super().__init__()
self.setIcon(QMessageBox.Warning)
self.setWindowTitle("No sections found")
self.setText("Each block must belong to a section, but no sections have yet been created.")
self.setInformativeText(
"Please create a section before adding blocks.")
self.setStandardButtons(QMessageBox.Ok)
self.setDefaultButton(QMessageBox.Ok)
class VoicingWarningMessageBox(QMessageBox):
"""
Message box to warn the user that the voicing entered could not be parsed

Loading…
Cancel
Save