Sundpood/launcher.py
2021-01-02 18:05:18 +03:00

34 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from cryptography.fernet import Fernet
import key
### Добавь здесь модули нужные твоей программе ###
import pygame
import sounddevice as sd
from pynput.keyboard import Listener
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import QFile, QTextStream
from PyQt5.QtWidgets import QApplication
from data import ui_preferences
from data import ui_hotkeys
from data import ui_sundpood
from data import ui_overlay
from data import keys
### ^^^ ^^^ ###
def decrypt(filename, key):
# Расшифруем файл и записываем его
f = Fernet(key)
with open(filename, 'rb') as file:
encrypted_data = file.read()
decrypted_data = f.decrypt(encrypted_data)
return decrypted_data.decode('utf-8')
if os.path.exists(os.path.join('data', 'main.py')):
with open(os.path.join('data', 'main.py'), 'r', encoding='utf-8') as f:
exec(f.read())
else:
exec(decrypt(os.path.join('data', 'sundpood-runtime.sr') , key.KEY))