From 9334bf348228c129c539b8314993d625c6fa4dda Mon Sep 17 00:00:00 2001 From: ThePromidius Date: Wed, 28 Feb 2024 17:00:35 +0100 Subject: [PATCH] unified pool --- .../Extensions/WebpConverter/WebpConverter.py | 13 ++++++++++++- MangaManager/MangaManager/ProcessingPool.py | 14 -------------- MangaManager/tests/common.py | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 MangaManager/MangaManager/ProcessingPool.py diff --git a/MangaManager/Extensions/WebpConverter/WebpConverter.py b/MangaManager/Extensions/WebpConverter/WebpConverter.py index 3f90e7c..93d4d68 100644 --- a/MangaManager/Extensions/WebpConverter/WebpConverter.py +++ b/MangaManager/Extensions/WebpConverter/WebpConverter.py @@ -6,16 +6,27 @@ import pathlib import tkinter import tkinter.ttk as ttk +from concurrent.futures import ProcessPoolExecutor from tkinter import filedialog from Extensions.IExtensionApp import IExtensionApp from Extensions.WebpConverter.processing import convert from MangaManager.Common.utils import ShowPathTreeAsDict from MangaManager.MetadataManager.GUI.widgets import ScrolledFrameWidget, ProgressBarWidget -from MangaManager.ProcessingPool import ProcessingPool from MangaManager.Settings.Settings import Settings logger = logging.getLogger() +class ProcessingPool(object): + _instance = None + + def __new__(cls, *args, **kwargs): + if cls._instance is None: + cls._instance = object.__new__(cls) + cls._instance.pool = ProcessPoolExecutor() + return cls._instance + + def submit(self, func, *args, **kwargs): + return self.pool.submit(func, *args, **kwargs) class WebpConverter(IExtensionApp): diff --git a/MangaManager/MangaManager/ProcessingPool.py b/MangaManager/MangaManager/ProcessingPool.py deleted file mode 100644 index d0777a1..0000000 --- a/MangaManager/MangaManager/ProcessingPool.py +++ /dev/null @@ -1,14 +0,0 @@ -from concurrent.futures import ProcessPoolExecutor - - -class ProcessingPool(object): - _instance = None - - def __new__(cls, *args, **kwargs): - if cls._instance is None: - cls._instance = object.__new__(cls) - cls._instance.pool = ProcessPoolExecutor() - return cls._instance - - def submit(self, func, *args, **kwargs): - return self.pool.submit(func, *args, **kwargs) diff --git a/MangaManager/tests/common.py b/MangaManager/tests/common.py index 7c8a1e1..d74e9b6 100644 --- a/MangaManager/tests/common.py +++ b/MangaManager/tests/common.py @@ -188,7 +188,7 @@ def is_valid_xml(xml:str) -> bool: xml_file = etree.fromstring(xml.encode("utf-8"),parser=etree.XMLParser(encoding='utf-8')) except ValueError: print("dasd") - xsd_schema = etree.parse('common/models/ComicInfo.xds') + xsd_schema = etree.parse('MangaManager/Common/models/ComicInfo.xds') # Create a validator object xml_validator = etree.XMLSchema(xsd_schema)