fix: repeat tab initialization

This commit is contained in:
283375 2023-09-01 04:06:02 +08:00
parent 93bea4b88a
commit 2898e99cdf

View File

@ -23,16 +23,16 @@ class MainWindow(Ui_MainWindow, QMainWindow):
super().__init__(parent) super().__init__(parent)
self.setupUi(self) self.setupUi(self)
currentIndex = self.tabWidget.currentIndex() # currentIndex = self.tabWidget.currentIndex()
ocrTabIndex = self.tabWidget.indexOf(self.tab_ocr) # ocrTabIndex = self.tabWidget.indexOf(self.tab_ocr)
self.tabWidget.removeTab(ocrTabIndex) # self.tabWidget.removeTab(ocrTabIndex)
self.tab_ocr.deleteLater() # self.tab_ocr.deleteLater()
# if OCR_ENABLED_FLAG: # if OCR_ENABLED_FLAG:
# self.tab_ocr = TabOcr(self.tabWidget) # self.tab_ocr = TabOcr(self.tabWidget)
# else: # else:
# self.tab_ocr = TabOcrDisabled(self.tabWidget) # self.tab_ocr = TabOcrDisabled(self.tabWidget)
# self.tab_ocr.contentLabel.setText(OCR_ERROR_TEXT) # self.tab_ocr.contentLabel.setText(OCR_ERROR_TEXT)
self.tab_ocr = TabOcrEntry(self.tabWidget) # self.tab_ocr = TabOcrEntry(self.tabWidget)
self.tabWidget.insertTab(ocrTabIndex, self.tab_ocr, "") # self.tabWidget.insertTab(ocrTabIndex, self.tab_ocr, "")
self.tabWidget.setCurrentIndex(currentIndex) # self.tabWidget.setCurrentIndex(currentIndex)
self.retranslateUi(self) # self.retranslateUi(self)