diff --git a/NodeGraphQt/base/__pycache__/graph.cpython-310.pyc b/NodeGraphQt/base/__pycache__/graph.cpython-310.pyc index 492282e..35c13bd 100644 Binary files a/NodeGraphQt/base/__pycache__/graph.cpython-310.pyc and b/NodeGraphQt/base/__pycache__/graph.cpython-310.pyc differ diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 074f68c..8a8a253 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -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") @@ -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": @@ -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' @@ -576,15 +580,18 @@ 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) @@ -592,9 +599,9 @@ def _createToolBars(self): 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. @@ -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 = [] diff --git a/NodeGraphQt/widgets/__pycache__/node_graph.cpython-310.pyc b/NodeGraphQt/widgets/__pycache__/node_graph.cpython-310.pyc index ad852ad..18cd978 100644 Binary files a/NodeGraphQt/widgets/__pycache__/node_graph.cpython-310.pyc and b/NodeGraphQt/widgets/__pycache__/node_graph.cpython-310.pyc differ diff --git a/cheatlayer.py b/cheatlayer.py index 244918e..3f7da0b 100644 --- a/cheatlayer.py +++ b/cheatlayer.py @@ -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(): @@ -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.