diff --git a/app.py b/app.py index d259460..1efb3e8 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,7 @@ # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. - +import os from PyQt5 import QtCore, QtGui, QtWidgets from pynput.keyboard import Key, Listener @@ -56,6 +56,7 @@ def setupUi(self, MainWindow): self.appBox.addItem("") self.appBox.addItem("") self.appBox.addItem("") + self.appBox.addItem("") self.verticalLayout.addWidget(self.appBox) spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem2) @@ -364,6 +365,7 @@ def retranslateUi(self, MainWindow): self.appBox.setItemText(0, _translate("MainWindow", "Gartic Phone")) self.appBox.setItemText(1, _translate("MainWindow", "Skribbl")) self.appBox.setItemText(2, _translate("MainWindow", "Paint")) + self.appBox.setItemText(3, _translate("MainWindow", "Autre")) self.speedLabel.setText(_translate("MainWindow", "Vitesse")) self.skippedPixelsLabel.setText(_translate("MainWindow", "Pixels ignorés")) self.label_4.setText(_translate("MainWindow", "Moins on en ignore, plus c\'est précis (mais lent)")) @@ -412,13 +414,67 @@ def setBoundsWorker(self): self.height = abs(bounds[0][1] - bounds[1][1]) self.startPosition = (bounds[0][0], bounds[0][1]) self.widthLabel.setText(str(self.width) + ' x ' + str(self.height) + ' px') - + + def displayMouseCoordinates(self): t = threading.Thread(target=self.displayMouseCoordinatesWorker) t.start() def displayMouseCoordinatesWorker(self): - self.MouseCoordinateLabel.setText(str(utils.getNextMouseClickPositionCoordinates())) + initCoordinate = utils.getNextMouseClickPositionCoordinates() + self.MouseCoordinateLabel.setText(str(initCoordinate)) + if(self.app == 0): + self.registerColorPosInGarticFolder(initCoordinate) + elif(self.app == 1): + self.registerColorPosInFolderSkribbl(initCoordinate) + elif(self.app == 2): + self.registerColorPosINFolderPaint(initCoordinate) + + + def initFichierCoordinate(self, coordinate, app): + coordinatesFile = os.path.dirname(os.path.abspath(__file__)) + "\\colorPalettes\\" + app + "Coordinates.txt" + os.remove(coordinatesFile) + for coo in coordinate: + open(coordinatesFile, 'a').write(coo) + + def registerColorPosInGarticFolder(self, firstCoordinates): + x = firstCoordinates[0] + y = firstCoordinates[1] + tmpX = x + coordinate = [] + for line in range(6): + for raw in range(3): + coordinate.append("(" + str(x) + "," + str(y)+") ") + x += 45 + x = tmpX + y += 50 + self.initFichierCoordinate(coordinate, "gartic") + + def registerColorPosInSkribblFolder(self, firstCoordinates): + x = firstCoordinates[0] + y = firstCoordinates[1] + tmpX = x + coordinate = [] + for line in range(2): + for raw in range(11): + coordinate.append("(" + str(x) + "," + str(y)+") ") + x += 26 + x = tmpX + y += 25 + self.initFichierCoordinate(coordinate, "skribbl") + + def registerColorPosInPaintFolder(self, firstCoordinates): + x = firstCoordinates[0] + y = firstCoordinates[1] + tmpX = x + coordinate = [] + for line in range(2): + for raw in range(10): + coordinate.append("(" + str(x) + "," + str(y)+") ") + x += 22 + x = tmpX + y += 22 + self.initFichierCoordinate(coordinate, "paint") def draw(self): if self.url != "" and self.width != 0: diff --git a/colorPalettes/garticCoordinates.txt b/colorPalettes/garticCoordinates.txt index 39d12ee..f55c245 100644 --- a/colorPalettes/garticCoordinates.txt +++ b/colorPalettes/garticCoordinates.txt @@ -1 +1 @@ -(412,394) (459,387) (507,392) (413,443) (457,442) (504,442) (411,495) (461,497) (506,496) (410,544) (457,543) (505,546) (412,597) (459,599) (509,601) (411,648) (459,648) (507,645) \ No newline at end of file +(2801,154) (2846,154) (2891,154) (2801,204) (2846,204) (2891,204) (2801,254) (2846,254) (2891,254) (2801,304) (2846,304) (2891,304) (2801,354) (2846,354) (2891,354) (2801,404) (2846,404) (2891,404) \ No newline at end of file diff --git a/colorPalettes/paintCoordinates.txt b/colorPalettes/paintCoordinates.txt index 19ad46f..2c10516 100644 --- a/colorPalettes/paintCoordinates.txt +++ b/colorPalettes/paintCoordinates.txt @@ -1 +1 @@ -(882,60) (901,58) (924,60) (948,61) (966,59) (995,59) (1013,57) (1034,61) (1054,60) (1077,59) (883,85) (902,81) (928,84) (945,83) (968,84) (991,84) (1014,84) (1034,84) (1056,83) (1079,85) \ No newline at end of file +(2803,155) (2825,155) (2847,155) (2869,155) (2891,155) (2913,155) (2935,155) (2957,155) (2979,155) (3001,155) (2803,177) (2825,177) (2847,177) (2869,177) (2891,177) (2913,177) (2935,177) (2957,177) (2979,177) (3001,177) \ No newline at end of file diff --git a/colorPalettes/skribblCoordinates.txt b/colorPalettes/skribblCoordinates.txt index 1d4162d..44c94b9 100644 --- a/colorPalettes/skribblCoordinates.txt +++ b/colorPalettes/skribblCoordinates.txt @@ -1 +1 @@ -(553,948) (574,947) (602,946) (629,946) (655,946) (683,948) (714,948) (735,946) (759,947) (787,948) (814,946) (552,975) (577,977) (600,973) (631,978) (651,977) (684,974) (707,974) (732,973) (761,973) (785,974) (812,976) \ No newline at end of file +(586,894) (612,894) (638,894) (664,894) (690,894) (716,894) (742,894) (768,894) (794,894) (820,894) (846,894) (586,919) (612,919) (638,919) (664,919) (690,919) (716,919) (742,919) (768,919) (794,919) (820,919) (846,919) \ No newline at end of file diff --git a/drawbot.py b/drawbot.py index 242a30e..aa4fea5 100644 --- a/drawbot.py +++ b/drawbot.py @@ -1,6 +1,5 @@ -from PIL import Image, ImageFilter from pynput.mouse import Controller, Button -from PIL import Image, ImageFilter, UnidentifiedImageError +from PIL import Image, ImageFilter, UnidentifiedImageError import time import sys import requests diff --git a/utils.py b/utils.py index d647c9a..7875d9a 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,4 @@ from pynput.mouse import Controller, Button, Listener -from pynput import keyboard from queue import Queue import os