Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/NodeGraphQt/base/__pycache__/__init__.cpython-37.pyc
/NodeGraphQt/base/__pycache__/model.cpython-39.pyc
/NodeGraphQt/widgets/__pycache__/viewer.cpython-310.pyc
/NodeGraphQt/base/__pycache__/graph.cpython-310.pyc
Binary file not shown.
32 changes: 20 additions & 12 deletions NodeGraphQt/base/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,16 @@ def runNode(self, graph, node_id):
for key, value in x.items() :
if key == "image":
x["image"] = np.asarray(x["image"],dtype = "uint8")
if x["type"] == "sendData":
print("SEND DATA")
print(graph["nodes"][node_id]["custom"]["URL"])
print(graph["nodes"][node_id]["custom"]["Request"])
r = requests.post(graph["nodes"][node_id]["custom"]["URL"], data=graph["nodes"][node_id]["custom"]["Request"])

if x["type"] == "print":
vars = graph["nodes"][node_id]["custom"]["Variables"]
print(vars.split("_")[1])
print("PRINT")
print(self.global_variables[int(vars.split("_")[1])])
if x["type"] == "OCR":
print("OCR")
cv2.namedWindow("OCR")
Expand All @@ -199,7 +204,7 @@ def runNode(self, graph, node_id):


if x["type"] == "Move Mouse":
pyautogui.moveTo(x["x"], x["y"])
pyautogui.moveTo((graph["nodes"][node_id]["custom"]["X Coordinate"]), (graph["nodes"][node_id]["custom"]["Y Coordinate"]))
if x["type"] == "Left Mouse Lift":
pyautogui.mouseUp()
if x["type"] == "Left Mouse Click":
Expand Down Expand Up @@ -567,7 +572,6 @@ def defineMenu(self):

def _createToolBars(self):
# File toolbar
print("CREATING TOOLBAR44")
current_directory = str(pathlib.Path(__file__).parent.absolute())
path = current_directory + '/OCR.png'
url = 'https://cheatlayer.com/ocr.png'
Expand All @@ -576,25 +580,28 @@ def _createToolBars(self):
pixmap.loadFromData(data)
this_path = os.path.dirname(os.path.abspath(__file__))
icon = os.path.join(this_path, 'examples', 'OCR.png')
self.OCRAction = QAction(QtGui.QIcon(pixmap), "&Copy", self)
self.OCRAction.setText("OCR Scraping")
self.printAction = QAction(QtGui.QIcon(pixmap), "&Paste", self)
self.printAction.setText("Print Data")

self.requestAction = QAction(QtGui.QIcon(pixmap), "C&ut", self)
self.OCRAction = QAction(QtGui.QIcon(pixmap), "OCR Scraping", self)
self.printAction = QAction(QtGui.QIcon(pixmap), "Print Data", self)
self.requestAction = QAction(QtGui.QIcon(pixmap), "Send Data", self)
#self.addTab(self.QMainWindow, "Add Actions")
fileToolBar = self.QMainWindow.addToolBar("File")
# Create the ToolBar
fileToolBar = self.QMainWindow.addToolBar("")

# Position the ToolBar on the left side of the Main Window
self.QMainWindow.addToolBar(QtCore.Qt.LeftToolBarArea, fileToolBar)
fileToolBar.addAction(self.OCRAction)
self.QMainWindow.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)


self.OCRAction.triggered.connect(self.addOCR)

fileToolBar.addAction(self.printAction)
self.printAction.triggered.connect(self.addPrint)

fileToolBar.addAction(self.requestAction)
self.requestAction.triggered.connect(self.playRecording)
self.requestAction.triggered.connect(self.addSendData)

def __init__(self, drawHistory, verified, addOCR, addPrint, addScroll, parent=None, **kwargs):
def __init__(self, drawHistory, verified, addOCR, addPrint, addScroll, addSendData, parent=None, **kwargs):
"""
Args:
parent (object): object parent.
Expand All @@ -607,6 +614,7 @@ def __init__(self, drawHistory, verified, addOCR, addPrint, addScroll, parent=No
self.drawHistory = drawHistory
self.addOCR = addOCR
self.addPrint = addPrint
self.addSendData = addSendData
self.global_variables = []
self.mouse_counter = 0
self.variables = []
Expand Down
Binary file not shown.
12 changes: 11 additions & 1 deletion cheatlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,16 @@ def addScroll():
nodes[len(nodes)-1].create_property('Distance',100, widget_type=NODE_PROP_QLINEEDIT)

nodes[len(nodes)-1].create_property('Data', json.dumps(x, cls=NumpyEncoder), widget_type=NODE_PROP_QLINEEDIT)
graph.auto_layout_nodes()
graph.fit_to_selection()
def addSendData():
global nodes
x = {"type":"sendData", "url":"https://cheatlayer.com/triggers/extension", "data":'{"start":"https://www.google.com", "name": "test inputs", "data":"' + global_variables[0] + '","key":"' + key + '"}'}
nodes.append(graph.create_node('nodes.basic.BasicNodeA', name="Send Data " + str(len(nodes)), data=x))#, color= "#FFFFFF"
nodes[len(nodes)-1].create_property('Data', json.dumps(x, cls=NumpyEncoder), widget_type=NODE_PROP_QLINEEDIT)
nodes[len(nodes)-1].create_property('Request', json.dumps(x, cls=NumpyEncoder), widget_type=NODE_PROP_QLINEEDIT)
nodes[len(nodes)-1].create_property('URL', "https://cheatlayer.com/triggers/extension", widget_type=NODE_PROP_QLINEEDIT)

graph.auto_layout_nodes()
graph.fit_to_selection()
def addPrint():
Expand Down Expand Up @@ -825,7 +835,7 @@ def drawHistory(history):
verified = False


graph = NodeGraph(drawHistory, verified, addOCR, addPrint, addScroll)
graph = NodeGraph(drawHistory, verified, addOCR, addPrint, addScroll, addSendData)
graph.set_acyclic(False)
QApplication.setOverrideCursor(QCursor(Qt.CrossCursor))
# registered example nodes.
Expand Down