removed some useless code

This commit is contained in:
Adam Saudagar 2023-03-07 15:46:06 +05:30
parent 5141ae9c2d
commit 19a5fe9b7f
2 changed files with 5 additions and 7 deletions

View File

@ -65,7 +65,7 @@ class IEngine:
# noinspection PyBroadException # noinspection PyBroadException
def _crash_safe(self): def _crash_safe(self):
logging.debug(f"starting {self.name} engine thread") logging.debug(f"starting {self.name} engine thread")
self.window = WindowClient(color=cv2.COLOR_RGB2GRAY, show_name=f"{self.name} debug") self.window = WindowClient()
self.gui.bot_started(True) self.gui.bot_started(True)
try: try:
self.run() self.run()

View File

@ -14,16 +14,15 @@ from fishy.helper.config import config
class WindowClient: class WindowClient:
clients: List['WindowClient'] = [] clients: List['WindowClient'] = []
def __init__(self, crop=None, color=None, scale=None, show_name=None): def __init__(self):
""" """
create a window instance with these pre process create a window instance with these pre process
:param crop: [x1,y1,x2,y2] array defining the boundaries to crop :param crop: [x1,y1,x2,y2] array defining the boundaries to crop
:param color: color to use example cv2.COLOR_RGB2HSV :param color: color to use example cv2.COLOR_RGB2HSV
:param scale: scaling the window :param scale: scaling the window
""" """
self.color = color self.crop = None
self.crop = crop self.scale = None
self.scale = scale
self.show_name = f"window client {len(WindowClient.clients)}" self.show_name = f"window client {len(WindowClient.clients)}"
WindowClient.clients.append(self) WindowClient.clients.append(self)
@ -80,8 +79,7 @@ class WindowClient:
if temp_img is None or temp_img.size == 0: if temp_img is None or temp_img.size == 0:
return None return None
if self.color is not None: temp_img = cv2.cvtColor(temp_img, cv2.COLOR_RGB2GRAY)
temp_img = cv2.cvtColor(temp_img, self.color)
if self.crop is not None: if self.crop is not None:
temp_img = temp_img[self.crop[1]:self.crop[3], self.crop[0]:self.crop[2]] temp_img = temp_img[self.crop[1]:self.crop[3], self.crop[0]:self.crop[2]]