# Path: src/holder/Singleton.py
# class Singleton(object):
#     __instance = None
#    
#     def __new__(cls, *args, **kwargs):
#         if cls.__instance is None:
#             cls.__instance = object.__new__(cls)
#         return cls.__instance
# 
# Path: window/window_progress.py
# class window_progress(QWidget):
#     def __init__(self, parent=None, isolate=True):
#         if not isolate:
#             super(window_progress, self).__init__(parent)
#         else:
#             super(window_progress, self).__init__(None)
#         self.ui = Ui_Progress()
#         self.ui.setupUi(self)
# 
#     def cancel(self):
#         sys.exit()
# 
#     def setval(self, barId: ProgressBar, val: int) -> bool:
#         if type(val) != int:
#             return False
#         bar = self.getBar(barId)
#         if bar is None:
#             return False
#         bar.setValue(val)
#         QApplication.processEvents()
#         return True
# 
#     def getVal(self, barId: ProgressBar) -> Optional[int]:
#         bar = self.getBar(barId)
#         if bar is None:
#             return None
#         return bar.value()
# 
#     def finish(self):
#         QApplication.quit()
# 
#     def select_file_path(self) -> List[str]:
#         path = QFileDialog.getOpenFileNames(self, "ファイルを選択", None, "ACB,AWBファイル(*.acb *acb.txt *.awb *awb.txt);;すべてのファイル(*.*)")[0]
#         retval: List[str] = []
#         for file in path:
#             retval.append(file.replace("/", "\\"))
#         return retval
# 
#     def select_dir_path(self) -> str:
#         path = QFileDialog.getExistingDirectory(self, "フォルダを選択")
#         path = path.replace("/", "\\")
#         return path
# 
#     def getBar(self, barId: ProgressBar) -> Optional[QProgressBar]:
#         if barId == ProgressBar.ALL:
#             return self.ui.progress_all
#         elif barId == ProgressBar.CURRENT:
#             return self.ui.progress_now
#         else:
#             return None
# 
# Path: src/enum/ProgressBar.py
# class ProgressBar(Enum):
#     """
#     file types
#     """
#     CURRENT = auto()
#     ALL = auto()


from src.holder.Singleton import Singleton
from window.window_progress import window_progress
from src.enum.ProgressBar import ProgressBar
# -*- coding: utf-8 -*-

class ProgressWindowHolder(Singleton):
    """
    docstring
    """
    __window: window_progress

    def setWindow(self, window: window_progress):
        self.__window = window

    def getWindow(self):
        return self.__window

    def setProgress(self, barId: ProgressBar, level: int):
        """
        set progress by given barId
        """
        self.__window.setval(barId=barId, val=level)


# Path: src/holder/Singleton.py
# class Singleton(object):
#     __instance = None
#    
#     def __new__(cls, *args, **kwargs):
#         if cls.__instance is None:
#             cls.__instance = object.__new__(cls)
#         return cls.__instance
# 
# Path: window/window_progress.py
# class window_progress(QWidget):
#     def __init__(self, parent=None, isolate=True):
#         if not isolate:
#             super(window_progress, self).__init__(parent)
#         else:
#             super(window_progress, self).__init__(None)
#         self.ui = Ui_Progress()
#         self.ui.setupUi(self)
# 
#     def cancel(self):
#         sys.exit()
# 
#     def setval(self, barId: ProgressBar, val: int) -> bool:
#         if type(val) != int:
#             return False
#         bar = self.getBar(barId)
#         if bar is None:
#             return False
#         bar.setValue(val)
#         QApplication.processEvents()
#         return True
# 
#     def getVal(self, barId: ProgressBar) -> Optional[int]:
#         bar = self.getBar(barId)
#         if bar is None:
#             return None
#         return bar.value()
# 
#     def finish(self):
#         QApplication.quit()
# 
#     def select_file_path(self) -> List[str]:
#         path = QFileDialog.getOpenFileNames(self, "ファイルを選択", None, "ACB,AWBファイル(*.acb *acb.txt *.awb *awb.txt);;すべてのファイル(*.*)")[0]
#         retval: List[str] = []
#         for file in path:
#             retval.append(file.replace("/", "\\"))
#         return retval
# 
#     def select_dir_path(self) -> str:
#         path = QFileDialog.getExistingDirectory(self, "フォルダを選択")
#         path = path.replace("/", "\\")
#         return path
# 
#     def getBar(self, barId: ProgressBar) -> Optional[QProgressBar]:
#         if barId == ProgressBar.ALL:
#             return self.ui.progress_all
#         elif barId == ProgressBar.CURRENT:
#             return self.ui.progress_now
#         else:
#             return None
# 
# Path: src/enum/ProgressBar.py
# class ProgressBar(Enum):
#     """
#     file types
#     """
#     CURRENT = auto()
#     ALL = auto()


# Path: src/holder/ProgressWindowHolder.py
from src.holder.Singleton import Singleton
from window.window_progress import window_progress
from src.enum.ProgressBar import ProgressBar

# -*- coding: utf-8 -*-

class ProgressWindowHolder(Singleton):
    """
    docstring
    """
    __window: window_progress

    def setWindow(self, window: window_progress):
        self.__window = window

    def getWindow(self):
        return self.__window

    def setProgress(self, barId: ProgressBar, level: int):
        """
        set progress by given barId
        """
        self.__window.setval(barId=barId, val=level)


    def getProgress(self, barId: ProgressBar) -> int: