From 31357a8838d0ace2ccad87939cc660b34e13657f Mon Sep 17 00:00:00 2001 From: Balazs Birtalan Date: Wed, 17 May 2023 10:39:02 +0000 Subject: [PATCH] Notepad++ generated in local folder (no need) --- sightfactory.py.bak | 79 --------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 sightfactory.py.bak diff --git a/sightfactory.py.bak b/sightfactory.py.bak deleted file mode 100644 index d9823f5..0000000 --- a/sightfactory.py.bak +++ /dev/null @@ -1,79 +0,0 @@ -import base -import random -from sight import Sight - -class SightFactory(): - def __init__(self): - self.list = {} - self.data = {} #Global data(s) for the sight(s) - - def create(self, id, type): - print("----- "+type+"-"+str(id)+"-------") - - if str(id) == "main" and self.checkKey(id): - print("The 'main' window already exist! You can't create more than one 'main' type window!") - return None - - if base.data["sight_mode"] == "single": - if len(id) == 0: - print("No ID was given! In single mode need declare an ID to the Sight in advance!") - return None - if self.checkKey(id): - print("This ['"+type+"'-'"+str(id)+"'] already exist!") - return None - if base.data["sight_mode"] == "multiple": - if len(id) == 0: - id = self.createUniqueId() - if len(id) > 0 and self.checkKey(id) and str(id) != "main": - id = self.createUniqueId() - - self.list[id] = Sight(id,type) - print("The ['"+type+"'-'"+str(id)+"'] is created now!") - return id - - def show(self, id): - if self.checkKey(id): - self.list[id].show() - print("The '"+str(id)+"' sight is showed!") - return True - print("This '"+str(id)+"' id isn't exist to show!") - return False - - def get(self, id): - if self.checkKey(id): - return self.list[id] - print("This '"+str(id)+"' id isn't exist to get!") - - def close(self, id): - if self.checkKey(id): - if id == "main": - print("Program Exit!") - base.app.exit(0) - self.list[id].close() - self.list[id].destroy() - del self.list[id] - print("The '"+str(id)+"' is closed now!") - return True - else: - print("The '"+str(id)+"' isn't exist'") - return False - - def processes(self): - print(self.list) - - def checkKey(self, id): - if id in self.list: - return True - return False - def addGlobalData(self, key, value): - self.data[key] = value - def getGlobalData(self, key): - if key in self.data: - return self.data[key] - return None - - def createUniqueId(self): - new_id = str(random.randint(1000, 9999)) - if self.checkKey(new_id): - self.createUniqueId() - return new_id \ No newline at end of file