From 942832999ef2c04004c37b4eecfd556026581aba Mon Sep 17 00:00:00 2001 From: Ninnjah <45268461+Ninnjah@users.noreply.github.com> Date: Sat, 2 Jan 2021 16:05:59 +0300 Subject: [PATCH] Now sundpood loads dynamically with launcher --- data/keys.py | 42 ++++ data/main.py | 536 +++++++++++++++++++++++++++++++++++++++++ data/ui_hotkeys.py | 188 +++++++++++++++ data/ui_overlay.py | 42 ++++ data/ui_preferences.py | 214 ++++++++++++++++ data/ui_sundpood.py | 212 ++++++++++++++++ 6 files changed, 1234 insertions(+) create mode 100644 data/keys.py create mode 100644 data/main.py create mode 100644 data/ui_hotkeys.py create mode 100644 data/ui_overlay.py create mode 100644 data/ui_preferences.py create mode 100644 data/ui_sundpood.py diff --git a/data/keys.py b/data/keys.py new file mode 100644 index 0000000..490631b --- /dev/null +++ b/data/keys.py @@ -0,0 +1,42 @@ + +forbidden = [ + 'Key.esc', 'Key.cmd', 'Key.cmd_r', 'Key.menu', + 'Key.pause', 'Key.scroll_lock', 'Key.print_screen', + 'Key.enter', 'Key.space', 'Key.backspace', 'Key.ctrl_l', + 'Key.ctrl_r', 'Key.alt_l', 'Key.alt_gr', 'Key.caps_lock', + 'Key.num_lock', 'Key.tab', 'Key.shift', 'Key.shift_r', + 'Key.insert', 'Key.delete', 'Key.home', 'Key.end', + 'Key.page_up', 'Key.page_down', '/' +] + +dict_ = { + ' ':' ', + 'Key.f1' : 'F1', + 'Key.f2' : 'F2', + 'Key.f3' : 'F3', + 'Key.f4' : 'F4', + 'Key.f5' : 'F5', + 'Key.f6' : 'F6', + 'Key.f7' : 'F7', + 'Key.f8' : 'F8', + 'Key.f9' : 'F9', + 'Key.f10' : 'F10', + 'Key.f11' : 'F11', + 'Key.f12' : 'F12', + '<96>' : 'Num 0', + '<97>' : 'Num 1', + '<98>' : 'Num 2', + '<99>' : 'Num 3', + '<100>' : 'Num 4', + '<101>' : 'Num 5', + '<102>' : 'Num 6', + '<103>' : 'Num 7', + '<104>' : 'Num 8', + '<105>' : 'Num 9', + '<110>' : 'Num .', + 'Key.up' : 'Up', + 'Key.down' : 'Down', + 'Key.left' : 'Left', + 'Key.right' : 'Right', + '\\\\' : '\\' +} diff --git a/data/main.py b/data/main.py new file mode 100644 index 0000000..d63a246 --- /dev/null +++ b/data/main.py @@ -0,0 +1,536 @@ +#\ SundPood version 0201 /# + +import os +import sys +import json +from time import time +import pygame as pg +import sounddevice as sd +from pynput.keyboard import Listener +from cryptography.fernet import Fernet +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 +import themes +import key + + +###! UI !### +class OverlayUi(QtWidgets.QMainWindow, ui_overlay.Ui_MainWindow): + def __init__(self, parent=None): + super().__init__(parent) + self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) + self.setGeometry(QtCore.QRect(0, 0, 250, 20)) + self.setupUi(self) + + def keyPressEvent(self, e): + if e.key() == QtCore.Qt.Key_F1: + self.hide() + win.show() + +class PreferencesUi(QtWidgets.QMainWindow, ui_preferences.Ui_MainWindow): + def __init__(self, parent=None): + super().__init__(parent) + self.setWindowFlags(QtCore.Qt.FramelessWindowHint) + self.setupUi(self) + + def mousePressEvent(self, event): + self.offset = event.pos() + + def mouseMoveEvent(self, event): + x = event.globalX() + y = event.globalY() + x_w = self.offset.x() + y_w = self.offset.y() + self.move(x-x_w, y-y_w) + + def closeEvent(self, event): + save() + +class HotkeysUi(QtWidgets.QMainWindow, ui_hotkeys.Ui_MainWindow): + def __init__(self, parent=None): + super().__init__(parent) + self.setWindowFlags(QtCore.Qt.FramelessWindowHint) + self.setupUi(self) + + def mousePressEvent(self, event): + self.offset = event.pos() + + def mouseMoveEvent(self, event): + x = event.globalX() + y = event.globalY() + x_w = self.offset.x() + y_w = self.offset.y() + self.move(x-x_w, y-y_w) + +class MainUi(QtWidgets.QMainWindow, ui_sundpood.Ui_MainWindow): + def __init__(self, parent=None): + super().__init__(parent) + self.setWindowFlags(QtCore.Qt.FramelessWindowHint) + self.setupUi(self) + self.volume_slider.valueChanged[int].connect(change_volume) + + def mousePressEvent(self, event): + self.offset = event.pos() + + def mouseMoveEvent(self, event): + try: + x = event.globalX() + y = event.globalY() + x_w = self.offset.x() + y_w = self.offset.y() + self.move(x-x_w, y-y_w) + except AttributeError: + pass + + def keyPressEvent(self, e): + if e.key() == QtCore.Qt.Key_F1: + pref.close() + self.hide() + over.show() + + def closeEvent(self, event): + save() + if os.path.exists('.play'): + os.remove('.play') + hotk.close() + pref.close() + + +###! JSON !### +def jsonread(file): + ''' + Чтение JSON файла file + file - имя JSON файла, может содержать полный или относительный путь + ''' + with open(file, "r", encoding='utf-8') as read_file: + data = json.load(read_file) + return data + +def jsonwrite(file, data): + ''' + Запись в JSON файл file данные data + file - имя JSON файла, может содержать полный или относительный путь + data - данные, может быть словарем/списком/кортежем/строкой/числом + ''' + with open(file, 'w', encoding='utf-8') as write_file: + write_file.write(json.dumps(data)) + + +###! FUNCTIONS !### +def toggle_stylesheet(path): + ''' + Toggle the stylesheet to use the desired path in the Qt resource + system (prefixed by `:/`) or generically (a path to a file on + system). + + :path: A full path to a resource or file on system + ''' + + # get the QApplication instance, or crash if not set + app = QApplication.instance() + if app is None: + raise RuntimeError("No Qt Application found.") + + path = os.path.join('themes', path) + file = QFile(path) + file.open(QFile.ReadOnly | QFile.Text) + stream = QTextStream(file) + theme = stream.readAll() + + pref.setStyleSheet(theme) + win.setStyleSheet(theme) + hotk.setStyleSheet(theme) + +def find_device(): + ''' + Ищем устройство device и возвращаем его индекс + ''' + + list_ = list(sd.query_devices()) # Список устройств вывода звука + device = ["CABLE Input (VB-Audio Virtual Cable)", + "VoiceMeeter Input (VB-Audio VoiceMeeter VAIO)"]# Имя искомого устройства + + msg = QtWidgets.QMessageBox() # Окно ошибки (Устройство не найдено) + msg.setIcon(QtWidgets.QMessageBox.Critical) + msg.setText("You don't install VoiceMeeter") + msg.setInformativeText('install VoiceMetter from "redist" folder or download it from \nvb-audio.com/Voicemeeter') + msg.setWindowTitle('Error') + + for i in list_: + for d in device: + if d in i['name']: + return i['name'] + + msg.exec_() + exit() + +def get_files(dir_, config): + ''' + Сбор всех аудифайлов + dir_ - Путь к папке со звуками + config - Имя файла настроек + ''' + msg = QtWidgets.QMessageBox() # Окно ошибки (Не найдены файлы в папке 'sound') + msg.setIcon(QtWidgets.QMessageBox.Critical) + msg.setText("You don't have any sounds in 'sound' folder") + msg.setInformativeText('download sound in .wav / .mp3 / .m4a format') + msg.setWindowTitle('Error') + + if os.path.exists(dir_): + if len(os.listdir(dir_)) == 0: + msg.exec_() + + sounds = [] # Все аудио файлы + sounds_list = [f'{dir_}\\'] # Начальная категория + + for i in os.listdir(dir_): + if os.path.isfile(os.path.join(dir_, i)): + name = os.path.join(dir_, i) + if name == None: + sounds_list.append(i) + elif os.path.splitext(i)[1] in ['.mp3', '.m4a', '.wav']: + sounds_list.append(i) + else: + sounds_list_cat = [os.path.join(dir_, i)] + for x in os.listdir(os.path.join(dir_, i)): + if os.path.isfile(os.path.join(dir_, i, x)): + if name == None: + sounds_list_cat.append(x) + elif os.path.splitext(x)[1] in ['.mp3', '.m4a', '.wav']: + sounds_list_cat.append(x) + sounds.append(sounds_list_cat) + sounds.append(sounds_list) + + if os.path.exists(config): + hotkeys = jsonread(config)['hotkeys'] + theme = jsonread(config)['Theme'] + KEYS_CMD = jsonread(config)['KEYS_CMD'] + sounds_list = { 'hotkeys':hotkeys, + 'sounds':sounds, + 'Theme':theme, + 'KEYS_CMD':KEYS_CMD} + else: + sounds_list = { 'hotkeys':{}, + 'sounds':sounds, + 'Theme':'None', + 'KEYS_CMD':{ + 'select_move_up' :' ',# вверх + 'select_move_down' :' ',# вниз + 'select_move_left' :' ',# влево + 'select_move_right' :' ',# вправо + 'play_sound' :' ',# Играть + 'stop_sound' :' ',# Остановить + }} + + jsonwrite(config, sounds_list) + else: + sounds_list = { 'hotkeys':{}, + 'sounds':'', + 'Theme':'None', + 'KEYS_CMD':{ + 'select_move_up' :' ',# вверх + 'select_move_down' :' ',# вниз + 'select_move_left' :' ',# влево + 'select_move_right' :' ',# вправо + 'play_sound' :' ',# Играть + 'stop_sound' :' ',# Остановить + }} + jsonwrite(config, sounds_list) + os.mkdir(dir_) + msg.exec_() + +def change_volume(value): + pg.mixer.music.set_volume(value/100) + +def play_sound(*argv): + if False in argv: + try: + sound = os.path.join(win.soundList.item(0).text(), + win.soundList.currentItem().text()) + except AttributeError: + return False + else: + sound = argv[0] + try: + pg.mixer.music.load(sound) + pg.mixer.music.play() + pg.event.wait() + except RuntimeError: + pass + +def cat_select(cat): + win.soundList.clear() + for i in menu: + if 'sound' + cat == i[0]: + win.soundList.addItems(i) + +def hotkey_remap(): + ''' + Переназначение хоткея + btn - индекс кнопки хоткея в списке HOTKEYS + ''' + def check(key): + key = str(key).replace("'",'') + try: + sound = os.path.join(win.soundList.item(0).text(), + win.soundList.currentItem().text()) + except AttributeError: + win.hkset.setEnabled(True) + return False + + if key not in keys.forbidden: + hotkeys.update({key:sound}) + elif key == 'Key.backspace': + del hotkeys[find_key(hotkeys, sound)] + + save() + hotk.hotkeyList.clear() + for i in sound_get_dict['sounds']: + for x in i: + x = os.path.join(i[0], x) + if x in hotkeys.values(): + hotk.hotkeyList.addItem(f'{find_key(hotkeys, x)}\t:{x}') + + win.hkset.setEnabled(True) + return False + + win.hkset.setEnabled(False) + + hotkey_remap_Listener = Listener( + on_release=check) + hotkey_remap_Listener.start() + +def hotkey_delete(): + key = hotk.hotkeyList.currentItem().text().split(':')[0].replace('\t', '') + hotkeys.pop(key) + + save() + hotk.hotkeyList.clear() + for i in sound_get_dict['sounds']: + for x in i: + x = os.path.join(i[0], x) + if x in hotkeys.values(): + hotk.hotkeyList.addItem(f'{find_key(hotkeys, x)}\t:{x}') + +def pref_remap(btn, func_): + ''' + Переназначение клавиши в окно Preference + btn - PyQt5 кнопка + func_ - строковое значени функции из словаря KEYS_CMD + ''' + def check(key): + ''' + Проверка кнопки btn на не участие + в списке запрещенных клавиш keys.forbidden + если это клавиша 'Key.backspace' то стираем значение + key - pynput код клавиши + ''' + key = str(key).replace("'",'') + if key not in keys.forbidden: + KEYS_CMD.update({find_key(COMMAND_DICT, func_) : key}) + btn.setText(keys.dict_[key]) + elif key == 'Key.backspace': + KEYS_CMD.update({find_key(COMMAND_DICT, func_) : ' '}) + btn.setText(' ') + for i in PREF_BTN: + i.setEnabled(True) + save() + return False + + for i in PREF_BTN: + i.setEnabled(False) + + hotkey_remap_Listener = Listener( + on_release=check) + hotkey_remap_Listener.start() + +def find_key(dict, val): + ''' + Поиск ключа в словаре dict по значению val + dict - словарь + val - значение + ''' + return next((key for key, value in dict.items() if value == val), None) + +def check_update(): + 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') + + file_ = decrypt(os.path.join('data', 'sundpood-runtime.sr') , key.KEY) + version = '' + for i in file_: + if i != '/': + version += i + else: + break + print(VERSION) + return version.split(' ')[3] + +def save(): + ''' + Сохранение настроек оверлея и глобальных хоткеев + ''' + sounds = jsonread(config)['sounds']# Все аудиофайлы + + KEYS_JSON = {} # Настроенные клавиши + for i in KEYS_CMD.keys(): + KEYS_JSON.setdefault(COMMAND_DICT[i], KEYS_CMD[i]) + + try: + theme = pref.themesList.currentItem().text() + except AttributeError: + theme = jsonread(config)['Theme'] + + sounds_list = {'sounds':sounds, 'hotkeys':hotkeys, 'Theme':theme, 'KEYS_CMD':KEYS_JSON} + jsonwrite(config, sounds_list) + +###! CONTROL !### +def select_move(mode): + ''' + Перемешение по оверлейному меню + mode - кортеж из двух цифр + (смещение по категории, смещение по списку) + ''' + select[0] += mode[0] # Категории + select[1] += mode[1] # Файлы в категории + if select[0] > len(menu)-1 or select[0] < -len(menu)+1: + select[0] = 0 + if select[1] > len(menu[select[0]])-1 or select[1] < -len(menu[select[0]])+1: + select[1] = 0 + if mode[0] != 0: + select[1] = 0 + over.label.setText(menu[select[0]][select[1]]) + win.select_label.setText(menu[select[0]][select[1]]) + +def key_check(key): + key = str(key).replace("'",'') # Преобразование кода в строку + key_n = '' # Переведенное значение клавиши + try: + key_n = keys.dict_[key] + except KeyError: + pass + if key in hotkeys.keys(): + play_sound(hotkeys[key]) + elif key in KEYS_CMD.values(): + find_key(KEYS_CMD, key)() + +def main(): + key_check_Listener = Listener( + on_release=key_check) + key_check_Listener.start() + + win.exit_button.clicked.connect(win.close) + win.min_button.clicked.connect(win.showMinimized) + pref.exit_button.clicked.connect(pref.close) + pref.min_button.clicked.connect(pref.showMinimized) + hotk.exit_button.clicked.connect(hotk.close) + hotk.min_button.clicked.connect(hotk.showMinimized) + + win.hkset.clicked.connect(hotkey_remap) + win.pref_button.clicked.connect(pref.show) + win.hotkeys_button.clicked.connect(hotk.show) + win.catList.currentTextChanged.connect(cat_select) + win.stop_button.clicked.connect(lambda: sd.stop()) + win.play_button.clicked.connect(play_sound) + + pref.play_sound.clicked.connect( + lambda: pref_remap(pref.play_sound, 'play_sound')) + pref.stop_sound.clicked.connect( + lambda: pref_remap(pref.stop_sound, 'stop_sound')) + pref.select_move_up.clicked.connect( + lambda: pref_remap(pref.select_move_up, 'select_move_up')) + pref.select_move_down.clicked.connect( + lambda: pref_remap(pref.select_move_down, 'select_move_down')) + pref.select_move_left.clicked.connect( + lambda: pref_remap(pref.select_move_left, 'select_move_left')) + pref.select_move_right.clicked.connect( + lambda: pref_remap(pref.select_move_right, 'select_move_right')) + pref.themesList.currentTextChanged.connect(toggle_stylesheet) + pref.update_button.clicked.connect(check_update) + + hotk.delete_button.clicked.connect(hotkey_delete) + + win.show() + + +if __name__ == '__main__': + ### Создание окна ### + app = QApplication([]) # Приложение + over = OverlayUi() # Окно оверлея + pref = PreferencesUi() # Окно настроек + hotk = HotkeysUi() # Окно хоткеев + win = MainUi() # Основное окно + + PREF_BTN = [ # Список кнопок настроек клавиш в pref + pref.select_move_up, + pref.select_move_down, + pref.select_move_left, + pref.select_move_right, + pref.play_sound, + pref.stop_sound,] + + ### Поиск устроства ввода ### + pg.mixer.pre_init(44100, -16, 2, 2048) # setup mixer to avoid sound lag + pg.mixer.init(devicename=find_device()) # Установка устройства вывода по умолчанию + + ### Глобальные переменные ### + VERSION = 102 + dir_ = 'sound' + config = 'settings.json' + get_files(dir_, config) # Сбор всех аудиофайлов + sound_get_dict = jsonread(config) # Загрузка данных + hotkeys = sound_get_dict['hotkeys'] # Загрузка словаря хоткеев + theme = sound_get_dict['Theme'] # Загрузка темы + menu = sound_get_dict['sounds'] # Загрузка оверлейного меню + select = [0, 0] # Установка курсора оверлея в нулевую позицию + + if theme != 'None': + toggle_stylesheet(theme) + pref.themesList.addItems(os.listdir('themes')) + + for i in sound_get_dict['sounds']: + win.catList.addItem(i[0].replace('sound', '')) + + for x in i: + x = os.path.join(i[0], x) + if x in hotkeys.values(): + hotk.hotkeyList.addItem(f'{find_key(hotkeys, x)}\t: {x}') + + + COMMAND_DICT = { # Словарь функций к строковому значению + lambda: select_move((0, -1)):'select_move_up', # вверх + lambda: select_move((0, 1)) :'select_move_down', # вниз + lambda: select_move((-1, 0)):'select_move_left', # влево + lambda: select_move((1, 0)) :'select_move_right', # вправо + lambda: play_sound(os.path.join(menu[select[0]][0], + menu[select[0]][select[1]])):'play_sound', # Играть + lambda: sd.stop() :'stop_sound', # Остановить + } + KEYS_JSON = sound_get_dict['KEYS_CMD']# Загрузка настроенных клавиш + KEYS_CMD = COMMAND_DICT.copy() # Настроенные клавиши + + ### Установка настроенных клавиш ### + for i in KEYS_CMD.keys(): + KEYS_CMD.update({i:KEYS_JSON[COMMAND_DICT[i]]}) + KEYS_JSON = None + + combo = 0 + for i in KEYS_CMD.values(): + PREF_BTN[combo].setText(keys.dict_[i]) + combo += 1 + + main() + + sys.exit(app.exec()) \ No newline at end of file diff --git a/data/ui_hotkeys.py b/data/ui_hotkeys.py new file mode 100644 index 0000000..d084511 --- /dev/null +++ b/data/ui_hotkeys.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'hotkeys.ui' +# +# Created by: PyQt5 UI code generator 5.15.0 +# +# 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. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(420, 468) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + MainWindow.setMinimumSize(QtCore.QSize(420, 468)) + MainWindow.setMaximumSize(QtCore.QSize(420, 468)) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + MainWindow.setWindowIcon(icon) + MainWindow.setStyleSheet("QWidget{\n" +" background: rgb(44, 44, 44); \n" +" font: 25 14pt \"Calibri Light\";\n" +"}\n" +"\n" +"QLabel{\n" +" background: none\n" +"}\n" +"\n" +"QPushButton{\n" +" background: rgb(58, 58, 58);\n" +" border: none;\n" +"}\n" +"\n" +"QPushButton:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"\n" +"QListWidget{\n" +" margin: 4px;\n" +" border: none;\n" +"}\n" +"QListWidget::item[Custom=\"true\"]{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"QListWidget::item:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"QListWidget::item:selected{\n" +" background: rgb(48, 48, 48);\n" +" color: black;\n" +"}\n" +"\n" +"QScrollBar:vertical{\n" +" border: 1px transparent rgb(58, 58, 58);\n" +" border-radius: 4px;\n" +" background: rgb(48, 48, 48);\n" +" width: 16px;\n" +"}\n" +"QScrollBar::handle:vertical{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"QScrollBar::sub-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"QScrollBar::add-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"\n" +"#background{\n" +" background:rgb(48, 48, 48);\n" +"}\n" +"\n" +"#exit_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#exit_button:hover{\n" +" color: black;\n" +" background: rgba(254, 119, 122, 128);\n" +"}\n" +"\n" +"#min_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#min_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#pref_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#pref_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#hotkeys_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#hotkeys_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#select_label{\n" +" background: black;\n" +" color: white;\n" +"}\n" +"\n" +"#catList::item{\n" +" padding: 6px;\n" +"}\n" +"\n" +"QSlider::groove:horizontal {\n" +" border: none;\n" +" height: 40px;\n" +" margin: 0px;\n" +"}\n" +"QSlider::handle:horizontal {\n" +" background-color: rgb(53, 53, 53);\n" +" border: none;\n" +" height: 40px;\n" +" width: 40px;\n" +" margin: -15px 0px;\n" +"}\n" +"QSlider::sub-page:horizontal {\n" +" border: none;\n" +" height: 40px;\n" +" margin: 1px;\n" +" background: rgb(63, 63, 63);\n" +"}\n" +"\n" +"#update_button:hover{\n" +" background:rgba(10, 128, 179, 128);\n" +"}") + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.exit_button = QtWidgets.QPushButton(self.centralwidget) + self.exit_button.setGeometry(QtCore.QRect(380, 0, 41, 31)) + self.exit_button.setStyleSheet("") + self.exit_button.setObjectName("exit_button") + self.min_button = QtWidgets.QPushButton(self.centralwidget) + self.min_button.setGeometry(QtCore.QRect(340, 0, 41, 31)) + self.min_button.setStyleSheet("") + self.min_button.setObjectName("min_button") + self.Hotkeys = QtWidgets.QLabel(self.centralwidget) + self.Hotkeys.setGeometry(QtCore.QRect(20, 40, 291, 20)) + self.Hotkeys.setStyleSheet("background: none;\n" +"") + self.Hotkeys.setObjectName("Hotkeys") + self.background = QtWidgets.QWidget(self.centralwidget) + self.background.setGeometry(QtCore.QRect(0, 0, 421, 71)) + self.background.setStyleSheet("") + self.background.setObjectName("background") + self.hotkeyList = QtWidgets.QListWidget(self.centralwidget) + self.hotkeyList.setGeometry(QtCore.QRect(0, 70, 421, 351)) + self.hotkeyList.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.hotkeyList.setObjectName("hotkeyList") + self.delete_button = QtWidgets.QPushButton(self.centralwidget) + self.delete_button.setGeometry(QtCore.QRect(0, 420, 101, 51)) + self.delete_button.setStyleSheet("") + self.delete_button.setObjectName("delete_button") + self.background.raise_() + self.exit_button.raise_() + self.min_button.raise_() + self.Hotkeys.raise_() + self.hotkeyList.raise_() + self.delete_button.raise_() + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "Hotkeys")) + self.exit_button.setText(_translate("MainWindow", "X")) + self.min_button.setText(_translate("MainWindow", "-")) + self.Hotkeys.setText(_translate("MainWindow", "Hotkeys")) + self.delete_button.setText(_translate("MainWindow", "Delete")) diff --git a/data/ui_overlay.py b/data/ui_overlay.py new file mode 100644 index 0000000..1715103 --- /dev/null +++ b/data/ui_overlay.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'overlay.ui' +# +# Created by: PyQt5 UI code generator 5.15.0 +# +# 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. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(300, 30) + MainWindow.setMinimumSize(QtCore.QSize(300, 30)) + MainWindow.setMaximumSize(QtCore.QSize(300, 30)) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + MainWindow.setWindowIcon(icon) + MainWindow.setWindowOpacity(0.5) + MainWindow.setToolTipDuration(5) + MainWindow.setStyleSheet("\n" +"font: 75 14pt \"Calibri\";\n" +"color: white;\n" +"background-color: black;") + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.label = QtWidgets.QLabel(self.centralwidget) + self.label.setGeometry(QtCore.QRect(0, 0, 301, 31)) + self.label.setObjectName("label") + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.label.setText(_translate("MainWindow", "")) diff --git a/data/ui_preferences.py b/data/ui_preferences.py new file mode 100644 index 0000000..d8df477 --- /dev/null +++ b/data/ui_preferences.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'preferences.ui' +# +# Created by: PyQt5 UI code generator 5.15.2 +# +# 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. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(420, 500) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + MainWindow.setMinimumSize(QtCore.QSize(420, 500)) + MainWindow.setMaximumSize(QtCore.QSize(420, 500)) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + MainWindow.setWindowIcon(icon) + MainWindow.setStyleSheet("QWidget{\n" +" background: rgb(44, 44, 44); \n" +" font: 25 14pt \"Calibri Light\";\n" +"}\n" +"\n" +"QLabel{\n" +" background: none\n" +"}\n" +"\n" +"QPushButton{\n" +" background: rgb(58, 58, 58);\n" +" border: none;\n" +"}\n" +"\n" +"QPushButton:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"\n" +"QListWidget{\n" +" margin: 4px;\n" +" border: none;\n" +"}\n" +"\n" +"QListWidget::item[Custom=\"true\"]{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"\n" +"QListWidget::item:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"\n" +"QListWidget::item:selected{\n" +" background: rgb(48, 48, 48);\n" +" color: black;\n" +"}\n" +"\n" +"QScrollBar:vertical{\n" +" border: 1px transparent rgb(58, 58, 58);\n" +" border-radius: 4px;\n" +" background: rgb(48, 48, 48);\n" +" width: 16px;\n" +"}\n" +"\n" +"QScrollBar::handle:vertical{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"\n" +"QScrollBar::sub-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"\n" +"QScrollBar::add-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"\n" +"#background{\n" +" background:rgb(48, 48, 48);\n" +"}\n" +"\n" +"#exit_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"\n" +"#exit_button:hover{\n" +" color: black;\n" +" background: rgba(254, 119, 122, 128);\n" +"}\n" +"\n" +"#min_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"\n" +"#min_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#update_button:hover{\n" +" background:rgba(10, 128, 179, 128);\n" +"}") + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.exit_button = QtWidgets.QPushButton(self.centralwidget) + self.exit_button.setGeometry(QtCore.QRect(380, 0, 41, 31)) + self.exit_button.setStyleSheet("") + self.exit_button.setObjectName("exit_button") + self.min_button = QtWidgets.QPushButton(self.centralwidget) + self.min_button.setGeometry(QtCore.QRect(340, 0, 41, 31)) + self.min_button.setStyleSheet("") + self.min_button.setObjectName("min_button") + self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) + self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 70, 391, 211)) + self.gridLayoutWidget.setObjectName("gridLayoutWidget") + self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setHorizontalSpacing(6) + self.gridLayout.setObjectName("gridLayout") + self.label_8 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_8.setStyleSheet("background:none") + self.label_8.setObjectName("label_8") + self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1) + self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_5.setObjectName("label_5") + self.gridLayout.addWidget(self.label_5, 5, 0, 1, 1) + self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) + self.select_move_down = QtWidgets.QPushButton(self.gridLayoutWidget) + self.select_move_down.setObjectName("select_move_down") + self.gridLayout.addWidget(self.select_move_down, 2, 1, 1, 1) + self.select_move_right = QtWidgets.QPushButton(self.gridLayoutWidget) + self.select_move_right.setObjectName("select_move_right") + self.gridLayout.addWidget(self.select_move_right, 4, 1, 1, 1) + self.select_move_up = QtWidgets.QPushButton(self.gridLayoutWidget) + self.select_move_up.setObjectName("select_move_up") + self.gridLayout.addWidget(self.select_move_up, 1, 1, 1, 1) + self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) + self.stop_sound = QtWidgets.QPushButton(self.gridLayoutWidget) + self.stop_sound.setObjectName("stop_sound") + self.gridLayout.addWidget(self.stop_sound, 6, 1, 1, 1) + self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_6.setObjectName("label_6") + self.gridLayout.addWidget(self.label_6, 6, 0, 1, 1) + self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget) + self.label_4.setObjectName("label_4") + self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1) + self.select_move_left = QtWidgets.QPushButton(self.gridLayoutWidget) + self.select_move_left.setObjectName("select_move_left") + self.gridLayout.addWidget(self.select_move_left, 3, 1, 1, 1) + self.label = QtWidgets.QLabel(self.gridLayoutWidget) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 1, 0, 1, 1) + self.play_sound = QtWidgets.QPushButton(self.gridLayoutWidget) + self.play_sound.setObjectName("play_sound") + self.gridLayout.addWidget(self.play_sound, 5, 1, 1, 1) + self.background = QtWidgets.QWidget(self.centralwidget) + self.background.setGeometry(QtCore.QRect(0, 0, 421, 71)) + self.background.setStyleSheet("") + self.background.setObjectName("background") + self.label_7 = QtWidgets.QLabel(self.background) + self.label_7.setGeometry(QtCore.QRect(10, 10, 161, 41)) + self.label_7.setStyleSheet("") + self.label_7.setObjectName("label_7") + self.label_9 = QtWidgets.QLabel(self.centralwidget) + self.label_9.setGeometry(QtCore.QRect(10, 290, 201, 31)) + self.label_9.setObjectName("label_9") + self.themesList = QtWidgets.QListWidget(self.centralwidget) + self.themesList.setGeometry(QtCore.QRect(10, 330, 401, 131)) + self.themesList.setObjectName("themesList") + self.update_button = QtWidgets.QPushButton(self.centralwidget) + self.update_button.setGeometry(QtCore.QRect(10, 460, 181, 31)) + self.update_button.setObjectName("update_button") + self.background.raise_() + self.exit_button.raise_() + self.min_button.raise_() + self.gridLayoutWidget.raise_() + self.label_9.raise_() + self.themesList.raise_() + self.update_button.raise_() + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "Preferences")) + self.exit_button.setText(_translate("MainWindow", "X")) + self.min_button.setText(_translate("MainWindow", "-")) + self.label_8.setText(_translate("MainWindow", "Overlay control")) + self.label_5.setText(_translate("MainWindow", "Overlay play sound")) + self.label_2.setText(_translate("MainWindow", "Overlay menu down")) + self.select_move_down.setText(_translate("MainWindow", "PushButton")) + self.select_move_right.setText(_translate("MainWindow", "PushButton")) + self.select_move_up.setText(_translate("MainWindow", "PushButton")) + self.label_3.setText(_translate("MainWindow", "Overlay menu left")) + self.stop_sound.setText(_translate("MainWindow", "PushButton")) + self.label_6.setText(_translate("MainWindow", "Overlay stop sound")) + self.label_4.setText(_translate("MainWindow", "Overlay menu right")) + self.select_move_left.setText(_translate("MainWindow", "PushButton")) + self.label.setText(_translate("MainWindow", "Overlay menu up")) + self.play_sound.setText(_translate("MainWindow", "PushButton")) + self.label_7.setText(_translate("MainWindow", "Preferences")) + self.label_9.setText(_translate("MainWindow", "Themes")) + self.update_button.setText(_translate("MainWindow", "Check for update")) diff --git a/data/ui_sundpood.py b/data/ui_sundpood.py new file mode 100644 index 0000000..8950290 --- /dev/null +++ b/data/ui_sundpood.py @@ -0,0 +1,212 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'sundpood.ui' +# +# Created by: PyQt5 UI code generator 5.15.2 +# +# 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. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(640, 480) + MainWindow.setMinimumSize(QtCore.QSize(640, 480)) + MainWindow.setMaximumSize(QtCore.QSize(640, 480)) + MainWindow.setStyleSheet("QWidget{\n" +" background: rgb(44, 44, 44); \n" +" font: 25 14pt \"Calibri Light\";\n" +"}\n" +"\n" +"QLabel{\n" +" background: none\n" +"}\n" +"\n" +"QPushButton{\n" +" background: rgb(58, 58, 58);\n" +" border: none;\n" +"}\n" +"\n" +"QPushButton:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"\n" +"QListWidget{\n" +" margin: 4px;\n" +" border: none;\n" +"}\n" +"QListWidget::item[Custom=\"true\"]{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"QListWidget::item:hover{\n" +" background: rgb(53, 53, 53);\n" +"}\n" +"QListWidget::item:selected{\n" +" background: rgb(48, 48, 48);\n" +" color: black;\n" +"}\n" +"\n" +"QScrollBar:vertical{\n" +" border: 1px transparent rgb(58, 58, 58);\n" +" border-radius: 4px;\n" +" background: rgb(48, 48, 48);\n" +" width: 16px;\n" +"}\n" +"QScrollBar::handle:vertical{\n" +" background: rgb(48, 48, 48);\n" +"}\n" +"QScrollBar::sub-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"QScrollBar::add-page:vertical{\n" +" background: rgb(58, 58, 58);\n" +"}\n" +"\n" +"#background{\n" +" background:rgb(48, 48, 48);\n" +"}\n" +"\n" +"#exit_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#exit_button:hover{\n" +" color: black;\n" +" background: rgba(254, 119, 122, 128);\n" +"}\n" +"\n" +"#min_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#min_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#pref_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#pref_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#hotkeys_button{\n" +" margin-bottom: 1px;\n" +"}\n" +"#hotkeys_button:hover{\n" +" color: black;\n" +" background: rgba(194, 213, 254, 128);\n" +"}\n" +"\n" +"#select_label{\n" +" background: black;\n" +" color: white;\n" +"}\n" +"\n" +"#catList::item{\n" +" padding: 6px;\n" +"}\n" +"\n" +"QSlider::groove:horizontal {\n" +" border: none;\n" +" height: 40px;\n" +" margin: 0px;\n" +"}\n" +"QSlider::handle:horizontal {\n" +" background-color: rgb(53, 53, 53);\n" +" border: none;\n" +" height: 40px;\n" +" width: 40px;\n" +" margin: -15px 0px;\n" +"}\n" +"QSlider::sub-page:horizontal {\n" +" border: none;\n" +" height: 40px;\n" +" margin: 1px;\n" +" background: rgb(63, 63, 63);\n" +"}\n" +"\n" +"#update_button:hover{\n" +" background:rgba(10, 128, 179, 128);\n" +"}") + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.background = QtWidgets.QWidget(self.centralwidget) + self.background.setGeometry(QtCore.QRect(0, 0, 641, 481)) + self.background.setStyleSheet("") + self.background.setObjectName("background") + self.min_button = QtWidgets.QPushButton(self.background) + self.min_button.setGeometry(QtCore.QRect(560, 0, 41, 31)) + self.min_button.setStyleSheet("") + self.min_button.setObjectName("min_button") + self.exit_button = QtWidgets.QPushButton(self.background) + self.exit_button.setGeometry(QtCore.QRect(600, 0, 41, 31)) + self.exit_button.setStyleSheet("") + self.exit_button.setObjectName("exit_button") + self.pref_button = QtWidgets.QPushButton(self.background) + self.pref_button.setGeometry(QtCore.QRect(0, 0, 111, 31)) + self.pref_button.setObjectName("pref_button") + self.hotkeys_button = QtWidgets.QPushButton(self.background) + self.hotkeys_button.setGeometry(QtCore.QRect(110, 0, 111, 31)) + self.hotkeys_button.setObjectName("hotkeys_button") + self.stop_button = QtWidgets.QPushButton(self.background) + self.stop_button.setGeometry(QtCore.QRect(0, 120, 171, 41)) + self.stop_button.setObjectName("stop_button") + self.hkset = QtWidgets.QPushButton(self.background) + self.hkset.setGeometry(QtCore.QRect(0, 200, 171, 41)) + self.hkset.setObjectName("hkset") + self.soundList = QtWidgets.QListWidget(self.background) + self.soundList.setGeometry(QtCore.QRect(170, 60, 471, 421)) + self.soundList.setFrameShape(QtWidgets.QFrame.StyledPanel) + self.soundList.setFrameShadow(QtWidgets.QFrame.Raised) + self.soundList.setObjectName("soundList") + self.catList = QtWidgets.QListWidget(self.background) + self.catList.setGeometry(QtCore.QRect(0, 280, 171, 201)) + self.catList.setStyleSheet("") + self.catList.setObjectName("catList") + self.label = QtWidgets.QLabel(self.background) + self.label.setGeometry(QtCore.QRect(6, 253, 161, 31)) + font = QtGui.QFont() + font.setFamily("Calibri Light") + font.setPointSize(14) + font.setBold(False) + font.setItalic(False) + font.setWeight(3) + self.label.setFont(font) + self.label.setAlignment(QtCore.Qt.AlignCenter) + self.label.setObjectName("label") + self.volume_slider = QtWidgets.QSlider(self.background) + self.volume_slider.setGeometry(QtCore.QRect(10, 170, 151, 20)) + self.volume_slider.setMaximum(100) + self.volume_slider.setProperty("value", 70) + self.volume_slider.setOrientation(QtCore.Qt.Horizontal) + self.volume_slider.setObjectName("volume_slider") + self.play_button = QtWidgets.QPushButton(self.centralwidget) + self.play_button.setGeometry(QtCore.QRect(0, 70, 171, 41)) + self.play_button.setObjectName("play_button") + self.select_label = QtWidgets.QLabel(self.centralwidget) + self.select_label.setGeometry(QtCore.QRect(0, 30, 641, 31)) + self.select_label.setStyleSheet("") + self.select_label.setText("") + self.select_label.setAlignment(QtCore.Qt.AlignCenter) + self.select_label.setObjectName("select_label") + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.min_button.setText(_translate("MainWindow", "-")) + self.exit_button.setText(_translate("MainWindow", "X")) + self.pref_button.setText(_translate("MainWindow", "Settings")) + self.hotkeys_button.setText(_translate("MainWindow", "Hotkeys")) + self.stop_button.setText(_translate("MainWindow", "Stop")) + self.hkset.setText(_translate("MainWindow", "Set hotkey")) + self.label.setText(_translate("MainWindow", "Categories")) + self.play_button.setText(_translate("MainWindow", "Play"))