Skip to content

Commit

Permalink
Correção do node MoveRel
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielguarisa committed Jan 1, 2022
1 parent 7cb3538 commit 1d66274
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
12 changes: 7 additions & 5 deletions gurun/cv/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def __init__(

def __call__(self, *args: Any, **kwargs: Any) -> List[List[int]]:
image = self._source_node(*args, **kwargs)
if self._transformation is None:
return super().__call__(image, *args, **kwargs)

output = super().__call__(image, *args, **kwargs)
self._output = super().__call__(image, *args, **kwargs)

if output is None:
if self._output is None:
self._state = False
return None
elif self._transformation is None:
self._state = True
return self._output

return self._transformation(output)
return self._transformation(self._output)
23 changes: 15 additions & 8 deletions gurun/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(pyautogui.hotkey, *args, **kwargs)


class Move(WrapperNode):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(pyautogui.move, *args, **kwargs)
class MoveRel(Node):
def __init__(
self,
x: int = 0,
y: int = 0,
*args: Any,
**kwargs: Any,
) -> None:
super().__init__(*args, **kwargs)
self._x = x
self._y = y

def __call__(self, *args: Any, **kwargs: Any) -> Any:
pyautogui.moveRel(self._x, self._y, **self._memory)


class MoveTo(WrapperNode):
Expand All @@ -67,11 +78,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(pyautogui.dragRel, *args, **kwargs)


class MoveRel(WrapperNode):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(pyautogui.moveRel, *args, **kwargs)


class MultipleClicks(Click):
def __call__(self, positions: List[List[int]], *args: Any, **kwargs: Any):
for x, y in positions:
Expand All @@ -91,5 +97,6 @@ def __call__(self, *args: Any, **kwargs: Any):

class MultipleNaturalClicks(NaturalClick):
def __call__(self, positions: List[List[int]], *args: Any, **kwargs: Any):
print(positions)
for x, y in positions:
super().__call__(*args, x=x, y=y, **kwargs, **self._memory)

0 comments on commit 1d66274

Please sign in to comment.