added table manager, to manage tables and handle the treeview

This commit is contained in:
UpstreamData
2022-05-05 15:53:13 -06:00
parent 26c6e47f1e
commit 725b14e583
7 changed files with 166 additions and 87 deletions

View File

@@ -42,17 +42,19 @@ from settings import (
)
class MinerFactory:
_instance = None
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
class MinerFactory(metaclass=Singleton):
def __init__(self):
self.miners = {}
def __new__(cls):
if not cls._instance:
cls._instance = super(MinerFactory, cls).__new__(cls)
return cls._instance
async def get_miner_generator(self, ips: list):
"""
Get Miner objects from ip addresses using an async generator.