mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-04-21 18:20:18 +00:00
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
from traceback import format_exception
|
|
|
|
from PySide6.QtWidgets import QMainWindow
|
|
|
|
from ui.designer.mainwindow_ui import Ui_MainWindow
|
|
from ui.implements.tabs.tabOcr import TabOcr
|
|
|
|
# try:
|
|
# import arcaea_offline_ocr
|
|
|
|
# from ui.implements.tabs.tabOcr import TabOcr
|
|
|
|
# OCR_ENABLED_FLAG = True
|
|
# except Exception as e:
|
|
# from ui.implements.tabs.tabOcrDisabled import TabOcrDisabled
|
|
|
|
# OCR_ENABLED_FLAG = False
|
|
# OCR_ERROR_TEXT = "\n".join(format_exception(e))
|
|
|
|
|
|
class MainWindow(Ui_MainWindow, QMainWindow):
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
self.setupUi(self)
|
|
|
|
currentIndex = self.tabWidget.currentIndex()
|
|
ocrTabIndex = self.tabWidget.indexOf(self.tab_ocr)
|
|
self.tabWidget.removeTab(ocrTabIndex)
|
|
self.tab_ocr.deleteLater()
|
|
# if OCR_ENABLED_FLAG:
|
|
# self.tab_ocr = TabOcr(self.tabWidget)
|
|
# else:
|
|
# self.tab_ocr = TabOcrDisabled(self.tabWidget)
|
|
# self.tab_ocr.contentLabel.setText(OCR_ERROR_TEXT)
|
|
self.tab_ocr = TabOcr(self.tabWidget)
|
|
self.tabWidget.insertTab(ocrTabIndex, self.tab_ocr, "")
|
|
self.tabWidget.setCurrentIndex(currentIndex)
|
|
self.retranslateUi(self)
|