2023-05-17 10:16:15 +00:00
|
|
|
import sys
|
|
|
|
|
import os
|
2023-10-27 13:14:49 +00:00
|
|
|
import platform
|
2023-05-17 10:16:15 +00:00
|
|
|
import configparser
|
|
|
|
|
from mouseevents import MouseEvents
|
|
|
|
|
from pynput import mouse
|
|
|
|
|
from sightfactory import SightFactory
|
|
|
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
|
from pynput.mouse import Controller
|
|
|
|
|
|
|
|
|
|
def init():
|
|
|
|
|
global data, sights, mousectrl, app
|
|
|
|
|
#init the basic values
|
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
|
mousectrl = Controller()
|
|
|
|
|
sights = SightFactory()
|
|
|
|
|
data = {}
|
|
|
|
|
data["move"] = False
|
|
|
|
|
data["active_sight"] = "main"
|
2023-10-27 13:14:49 +00:00
|
|
|
data["platform"] = {}
|
|
|
|
|
data["platform"]["system"] = platform.system()
|
2023-05-17 10:16:15 +00:00
|
|
|
data["sight_processes"] = {}
|
|
|
|
|
data["mouse_distance_x"] = 0
|
|
|
|
|
data["mouse_distance_y"] = 0
|
|
|
|
|
data["base_dir"]=os.path.abspath(os.getcwd())+os.path.sep
|
|
|
|
|
data["template_dir"]=data["base_dir"]+"place"+os.path.sep+"templates"+os.path.sep
|
|
|
|
|
#LOAD the template config content
|
|
|
|
|
loadConfigTemplate()
|
|
|
|
|
#Events
|
|
|
|
|
mouseevent = MouseEvents()
|
|
|
|
|
start()
|
|
|
|
|
|
|
|
|
|
def loadConfigTemplate():
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
|
config.sections()
|
|
|
|
|
config.read(data["template_dir"]+"config.ini")
|
|
|
|
|
if "DEFAULT" in config:
|
|
|
|
|
data["default_template"] = config["DEFAULT"]["default_template"]
|
2023-10-27 13:14:49 +00:00
|
|
|
data["default_template_page"] = config["DEFAULT"]["default_template_page"]
|
2023-05-17 10:16:15 +00:00
|
|
|
data["default_template_dir"] = data["template_dir"]+data["default_template"]+os.path.sep
|
|
|
|
|
data["sight_mode"] = config["DEFAULT"]["sight_mode"]
|
|
|
|
|
print("Template config is loaded!")
|
|
|
|
|
else:
|
|
|
|
|
print("Missing 'DEFAULT' data from the templates config.ini folder. It can't start!")
|
|
|
|
|
|
|
|
|
|
def start():
|
|
|
|
|
# Creating the main Sight
|
2023-10-27 13:14:49 +00:00
|
|
|
sights.create("main", data["default_template_page"]);
|
2023-05-17 10:16:15 +00:00
|
|
|
sights.processes();
|
|
|
|
|
sights.show("main");
|
|
|
|
|
|
|
|
|
|
app.exec()
|