def npkModeBox(self): label_ = QLabel(self) label_.resize(self.width() // 3, 25) label_.setText("NPK提取模式:") label_.setAlignment(Qt.AlignCenter) label_.setStyleSheet("font-size: 15px") # 选项AB npkYes = QRadioButton(self) npkYes.resize(self.width() // 3, 25) npkYes.move(self.width() // 3, 0) npkYes.setText("提取") npkNo = QRadioButton(self) npkNo.resize(self.width() // 3, 25) npkNo.move(self.width() // 3 * 2, 0) npkNo.setText("不提取") npkNo.setChecked(True) def npkYesFunc(): if not self.mainWin.npkDict: QMessageBox.warning(self, "未设置NPK词典", "未设置NPK词典将不能设置NPK提取", QMessageBox.Yes, QMessageBox.Yes) npkNo.setChecked(True) return False if not self.mainWin.img2Dir: QMessageBox.warning(self, "未设置img2目录", "未设置img2目录将不能设置NPK提取", QMessageBox.Yes, QMessageBox.Yes) npkNo.setChecked(True) return False npkYes.clicked.connect(npkYesFunc) def yes(): self.mainWin.npkMode = True npkYes.toggled.connect(yes) def no(): self.mainWin.npkMode = False npkNo.toggled.connect(no) self.npkModeGroup.setObjectName("npkExtractMode") self.npkModeGroup.addButton(npkYes) self.npkModeGroup.addButton(npkNo)
def allExtractBox(self): label_ = QLabel(self) label_.resize(self.width() // 3, 25) label_.move(0, 25) label_.setText("全部提取模式:") label_.setAlignment(Qt.AlignCenter) label_.setStyleSheet("font-size: 15px") # 选项AB allYes = QRadioButton(self) allYes.resize(self.width() // 3, 25) allYes.move(self.width() // 3, 25) allYes.setText("全部提取") allNo = QRadioButton(self) allNo.resize(self.width() // 3, 25) allNo.move(self.width() // 3 * 2, 25) allNo.setText("单个提取") allNo.setChecked(True) self.allModeGroup.setObjectName("allExtractMode") self.allModeGroup.addButton(allYes) self.allModeGroup.addButton(allNo)