Skip to content

Commit

Permalink
Fix Qt sometimes hanging when manual mode is toggled
Browse files Browse the repository at this point in the history
Add ggst, unist, mbtl config files
  • Loading branch information
nirgoren committed Oct 18, 2021
1 parent bfae71c commit fdcd869
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 9 deletions.
64 changes: 64 additions & 0 deletions configs/ggst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"FPS": 60,

"Symbols": {
"P": "BtnX",
"K": "BtnA",
"S": "BtnY",
"H": "BtnB",
"D": "BtnShoulderR",
"T": "TriggerR",
"select": "BtnBack",
"start": "BtnStart",
"beep": "sounds\\beep.wav",
"beep1": "sounds\\beep_low.wav",
"beep2": "sounds\\beep.wav",
"beep3": "sounds\\beep_high.wav",
"Dash": "TriggerL",
"RC": "BtnShoulderL"
},

"P1_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "left" },
"6": { "Dpad": "right" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_left" },
"3": { "Dpad": "down_right" },
"7": { "Dpad": "up_left" },
"9": { "Dpad": "up_right" }
},

"P2_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "right" },
"6": { "Dpad": "left" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_right" },
"3": { "Dpad": "down_left" },
"7": { "Dpad": "up_right" },
"9": { "Dpad": "up_left" }
},

"Macros": {
"5": "]1[",
"QCF": "2 3 6",
"QCB": "2 1 4",
"DP": "6 2 3",
"HCF": "4 1 2 3 6",
"HCB": "6 3 2 1 4",
"*236": "2 3 6",
"*214": "2 1 4",
"*623": "6 2 3",
"*421": "4 2 1",
"*426": "4 1 2 3 6",
"*624": "6 3 2 1 4",
"*6246": "6 3 2 1 4 6",
"*236236": "2 3 6 2 3 6",
"*214214": "2 1 4 2 1 4",
"SELECT": "select",
"START": "start",
"BEEP": "beep",
"Backdash": "4+Dash"
}
}
59 changes: 59 additions & 0 deletions configs/mbtl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"FPS": 60,

"Symbols": {
"A": "BtnX",
"D": "BtnA",
"B": "BtnY",
"C": "BtnB",
"select": "BtnBack",
"start": "BtnStart",
"beep": "sounds\\beep.wav",
"beep1": "sounds\\beep_low.wav",
"beep2": "sounds\\beep.wav",
"beep3": "sounds\\beep_high.wav"
},

"P1_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "left" },
"6": { "Dpad": "right" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_left" },
"3": { "Dpad": "down_right" },
"7": { "Dpad": "up_left" },
"9": { "Dpad": "up_right" }
},

"P2_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "right" },
"6": { "Dpad": "left" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_right" },
"3": { "Dpad": "down_left" },
"7": { "Dpad": "up_right" },
"9": { "Dpad": "up_left" }
},

"Macros": {
"5": "]1[",
"QCF": "2 3 6",
"QCB": "2 1 4",
"DP": "6 2 3",
"HCF": "4 1 2 3 6",
"HCB": "6 3 2 1 4",
"*236": "2 3 6",
"*214": "2 1 4",
"*623": "6 2 3",
"*421": "4 2 1",
"*426": "4 1 2 3 6",
"*624": "6 3 2 1 4",
"*6246": "6 3 2 1 4 6",
"*236236": "2 3 6 2 3 6",
"*214214": "2 1 4 2 1 4",
"SELECT": "select",
"START": "start",
"BEEP": "beep"
}
}
59 changes: 59 additions & 0 deletions configs/unist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"FPS": 60,

"Symbols": {
"A": "BtnX",
"D": "BtnA",
"B": "BtnY",
"C": "BtnB",
"select": "BtnBack",
"start": "BtnStart",
"beep": "sounds\\beep.wav",
"beep1": "sounds\\beep_low.wav",
"beep2": "sounds\\beep.wav",
"beep3": "sounds\\beep_high.wav"
},

"P1_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "left" },
"6": { "Dpad": "right" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_left" },
"3": { "Dpad": "down_right" },
"7": { "Dpad": "up_left" },
"9": { "Dpad": "up_right" }
},

"P2_directions": {
"2": { "Dpad": "down" },
"4": { "Dpad": "right" },
"6": { "Dpad": "left" },
"8": { "Dpad": "up" },
"1": { "Dpad": "down_right" },
"3": { "Dpad": "down_left" },
"7": { "Dpad": "up_right" },
"9": { "Dpad": "up_left" }
},

"Macros": {
"5": "]1[",
"QCF": "2 3 6",
"QCB": "2 1 4",
"DP": "6 2 3",
"HCF": "4 1 2 3 6",
"HCB": "6 3 2 1 4",
"*236": "2 3 6",
"*214": "2 1 4",
"*623": "6 2 3",
"*421": "4 2 1",
"*426": "4 1 2 3 6",
"*624": "6 3 2 1 4",
"*6246": "6 3 2 1 4 6",
"*236236": "2 3 6 2 3 6",
"*214214": "2 1 4 2 1 4",
"SELECT": "select",
"START": "start",
"BEEP": "beep"
}
}
26 changes: 17 additions & 9 deletions src/gui.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import json

from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPlainTextEdit, QTextEdit, QHBoxLayout, \
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QTextEdit, QHBoxLayout, \
QPushButton, QFileDialog
from PyQt5.QtCore import Qt, QObject, pyqtSignal, QRunnable, pyqtSlot, QThreadPool, QProcess
from PyQt5.QtGui import QPixmap, QTextCursor, QFont, QColor, QTextCharFormat, QBrush, QImage
from PyQt5.QtCore import Qt, QObject, pyqtSignal, QProcess
from PyQt5.QtGui import QPixmap, QTextCursor, QFont, QColor, QTextCharFormat, QBrush
from pynput.keyboard import Listener
import XInput
import sys
import traceback
from worker import Worker
import eddiecontroller

Expand Down Expand Up @@ -154,11 +153,10 @@ def on_press(key):
global manual_mode
if not manual_mode:
print('Manual mode activated (Manual mode is not fit for playing)', file=writer)
w.controller_image.show()
w.toggle_image_signal.emit(True)
else:
print('Manual mode deactivated', file=writer)
w.controller_image.hide()
w.adjustSize()
w.toggle_image_signal.emit(False)
manual_mode = not manual_mode
# manual control with the keyboard
if manual_mode and not eddiecontroller.playing:
Expand Down Expand Up @@ -282,10 +280,11 @@ def set_color(self, color):


class GUI(QWidget):
toggle_image_signal = pyqtSignal(bool)

def __init__(self):
super().__init__()
self.resize(905, 500)
self.toggle_image_signal.connect(self.toggleImage)
self.setMinimumWidth(1050)
self.setAcceptDrops(True)
self.setWindowTitle('Eddienput v1.1')
Expand Down Expand Up @@ -347,13 +346,22 @@ def __init__(self):
h_layout.addWidget(self.text_edit)

self.controller_image = QLabel()
self.controller_image.setPixmap(QPixmap('eddienput_controller.png').scaledToWidth(910))
self.pixmap = QPixmap('eddienput_controller.png').scaledToWidth(700)
self.controller_image.setPixmap(self.pixmap)
self.controller_image.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.controller_image.hide()
v_layout.addWidget(self.controller_image)

self.setLayout(v_layout)
self.process = QProcess(self)

def toggleImage(self, visible):
if visible:
self.controller_image.show()
else:
self.controller_image.hide()
self.adjustSize()

def dragEnterEvent(self, event):
event.accept()

Expand Down

0 comments on commit fdcd869

Please sign in to comment.