Disable "Add Block" button when no block is named

This commit is contained in:
David Vierra 2017-07-03 13:44:38 -10:00
parent 0cf53710d8
commit 1001597464

View File

@ -273,6 +273,8 @@ class ConfigureBlocksDialog(QtGui.QDialog, Ui_configureBlocks):
self.blocksView.clicked.connect(self.currentBlockClicked) self.blocksView.clicked.connect(self.currentBlockClicked)
self.internalNameBox.textChanged.connect(self.nameTextChanged)
self.addBlockButton.clicked.connect(self.addBlock) self.addBlockButton.clicked.connect(self.addBlock)
self.removeBlockButton.clicked.connect(self.removeBlock) self.removeBlockButton.clicked.connect(self.removeBlock)
@ -344,6 +346,8 @@ class ConfigureBlocksDialog(QtGui.QDialog, Ui_configureBlocks):
self.modelNameBox.setCurrentIndex(row) self.modelNameBox.setCurrentIndex(row)
self.modelNameChanged(row) self.modelNameChanged(row)
def nameTextChanged(self, text):
self.addBlockButton.setEnabled(len(text) > 0)
def modelNameChanged(self, row): def modelNameChanged(self, row):
blockIndex = self.blocksView.currentIndex() blockIndex = self.blocksView.currentIndex()