mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
revert: auto switching screenshot lib from #185
need more thought as it is causing fishy to no longer function
This commit is contained in:
parent
0efa8138da
commit
773f05ebae
@ -94,26 +94,11 @@ class D3DShot(IScreenShot):
|
|||||||
def grab(self) -> ndarray:
|
def grab(self) -> ndarray:
|
||||||
return self.d3.screenshot()
|
return self.d3.screenshot()
|
||||||
|
|
||||||
|
|
||||||
LIBS = [PyAutoGUI, MSS, D3DShot]
|
LIBS = [PyAutoGUI, MSS, D3DShot]
|
||||||
|
|
||||||
def create() -> Optional[IScreenShot]:
|
|
||||||
# Initialize a variable to hold the preferred library index
|
|
||||||
preferred_lib_index = config.get("sslib", 0)
|
|
||||||
# Create a list of library indices to try, starting with the preferred one
|
|
||||||
lib_indices = [preferred_lib_index] + [i for i in range(len(LIBS)) if i != preferred_lib_index]
|
|
||||||
|
|
||||||
for index in lib_indices:
|
def create() -> IScreenShot:
|
||||||
lib = LIBS[index]
|
lib = LIBS[config.get("sslib", 0)]
|
||||||
try:
|
logging.debug(f"Using {lib.__name__} screenshot lib")
|
||||||
lib_instance = lib()
|
return lib()
|
||||||
if lib_instance.setup():
|
|
||||||
logging.debug(f"Using {lib.__name__} as the screenshot library.")
|
|
||||||
# testing grab once
|
|
||||||
ss = lib_instance.grab()
|
|
||||||
if ss:
|
|
||||||
return lib_instance
|
|
||||||
except Exception as e:
|
|
||||||
logging.warning(f"Setup failed for {lib.__name__} with error: {str(e)}. Trying next library...")
|
|
||||||
|
|
||||||
logging.error("No suitable screenshot library found. Please check your configuration.")
|
|
||||||
return None
|
|
@ -1 +1 @@
|
|||||||
0.5.24
|
0.5.25
|
||||||
|
Loading…
Reference in New Issue
Block a user