Add use default label checkbox

This commit is contained in:
RegisWANG 2017-05-23 23:27:31 +08:00
parent 8edbfb63d9
commit 4a25352dbe

View File

@ -133,9 +133,17 @@ class MainWindow(QMainWindow, WindowMixin):
self.diffcButton.setChecked(False) self.diffcButton.setChecked(False)
self.diffcButton.stateChanged.connect(self.btnstate) self.diffcButton.stateChanged.connect(self.btnstate)
#Add Use Default Checkbox
self.useDefautLabel = QCheckBox("use default label")
self.useDefautLabel.setChecked(False)
self.defaultLabel = QLineEdit()
self.labelListContainer = QWidget() self.labelListContainer = QWidget()
self.labelListContainer.setLayout(listLayout) self.labelListContainer.setLayout(listLayout)
listLayout.addWidget(self.editButton) # , 0, Qt.AlignCenter) listLayout.addWidget(self.editButton) # , 0, Qt.AlignCenter)
listLayout.addWidget(self.useDefautLabel)
listLayout.addWidget(self.defaultLabel)
# Add chris # Add chris
listLayout.addWidget(self.diffcButton) listLayout.addWidget(self.diffcButton)
listLayout.addWidget(self.labelList) listLayout.addWidget(self.labelList)
@ -753,11 +761,15 @@ class MainWindow(QMainWindow, WindowMixin):
position MUST be in global coordinates. position MUST be in global coordinates.
""" """
if len(self.labelHist) > 0: if not self.useDefautLabel.isChecked() or not self.defaultLabel.text():
self.labelDialog = LabelDialog( if len(self.labelHist) > 0:
parent=self, listItem=self.labelHist) self.labelDialog = LabelDialog(
parent=self, listItem=self.labelHist)
text = self.labelDialog.popUp(text=self.prevLabelText)
else:
text = self.defaultLabel.text()
text = self.labelDialog.popUp(text=self.prevLabelText)
# Add Chris # Add Chris
self.diffcButton.setChecked(False) self.diffcButton.setChecked(False)
if text is not None: if text is not None: