# Path: lazylyst/CustomWidgets.py
# class HoverLineEdit(QtWidgets.QLineEdit):
#     hoverOut = QtCore.pyqtSignal()
#     
#     def __init__(self, parent=None):
#         super(HoverLineEdit, self).__init__(parent)   
#         self.changeState=False        
#         self.textChanged.connect(self.updateChangeState)
#         
#     def leaveEvent(self, ev):
#         # Only emit if the text was changed
#         if self.changeState:
#             self.hoverOut.emit()
#             self.changeState=False
#     
#     def updateChangeState(self,ev):
#         self.changeState=True
# 
# class KeyBindLineEdit(QtWidgets.QLineEdit):
#     keyPressed=QtCore.pyqtSignal(str)
#     
#     def __init__(self, parent=None):
#         super(KeyBindLineEdit, self).__init__(parent)    
#         self.MOD_MASK = (Qt.CTRL | Qt.ALT | Qt.SHIFT | Qt.META)
#     
#     # If any usual key bind was pressed, return the human recognizable string
#     def keyPressEvent(self, ev):
#         keyname = keyPressToString(ev)
#         if keyname==None:
#             return
#         self.keyPressed.emit(keyname)
# 
# class KeyListWidget(QtWidgets.QListWidget):       
#     # Return signal if key was pressed while in focus
#     keyPressedSignal = QtCore.pyqtSignal()  
#     
#     def __init__(self, parent=None):
#         super(KeyListWidget, self).__init__(parent)
#     
#     # Update this widgets last pressed key, and return a signal
#     def keyPressEvent(self, ev):
#         self.key=ev.key()
#         if self.key not in [Qt.Key_Delete]:
#             return
#         self.keyPressedSignal.emit()
#         
#     # Deselect all items if in a blank space
#     def mousePressEvent(self, ev):
#         if self.itemAt(ev.pos()) is None:
#             self.clearSelection()
#         QtWidgets.QListWidget.mousePressEvent(self, ev)
#     
#     # Ensure that key presses are sent to the widget which the mouse is hovering over
#     def enterEvent(self,ev):
#         super(KeyListWidget, self).enterEvent(ev)
#         self.setFocus()
# 
#     # Return a lists entries in the order which is appears
#     def visualListOrder(self):
#         txt=np.array([self.item(i).text() for i in range(self.count())])
#         args=np.array([self.indexFromItem(self.item(i)).row() for i in range(self.count())])
#         return list(txt[np.argsort(args)])


from PyQt5 import QtCore, QtGui, QtWidgets
from lazylyst.CustomWidgets import HoverLineEdit, KeyBindLineEdit, KeyListWidget
        self.actTriggerLineEdit = KeyBindLineEdit(actionDialog)
        self.actTriggerLineEdit.setObjectName("actTriggerLineEdit")
        self.actShortInputLayout.addWidget(self.actTriggerLineEdit, 2, 4, 1, 1)
        self.actTagLabel = QtWidgets.QLabel(actionDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.actTagLabel.sizePolicy().hasHeightForWidth())
        self.actTagLabel.setSizePolicy(sizePolicy)
        self.actTagLabel.setBaseSize(QtCore.QSize(0, 0))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.actTagLabel.setFont(font)
        self.actTagLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.actTagLabel.setObjectName("actTagLabel")
        self.actShortInputLayout.addWidget(self.actTagLabel, 0, 1, 1, 1)
        self.actNameLabel = QtWidgets.QLabel(actionDialog)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.actNameLabel.setFont(font)
        self.actNameLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.actNameLabel.setObjectName("actNameLabel")
        self.actShortInputLayout.addWidget(self.actNameLabel, 2, 1, 1, 1)
        self.actPassiveRadio = QtWidgets.QRadioButton(actionDialog)
        self.actPassiveRadio.setChecked(True)
        self.actPassiveRadio.setObjectName("actPassiveRadio")
        self.actShortInputLayout.addWidget(self.actPassiveRadio, 6, 3, 1, 1)
        self.actOptionalsLineEdit = QtWidgets.QLineEdit(actionDialog)

# Path: lazylyst/CustomWidgets.py
# class HoverLineEdit(QtWidgets.QLineEdit):
#     hoverOut = QtCore.pyqtSignal()
#     
#     def __init__(self, parent=None):
#         super(HoverLineEdit, self).__init__(parent)   
#         self.changeState=False        
#         self.textChanged.connect(self.updateChangeState)
#         
#     def leaveEvent(self, ev):
#         # Only emit if the text was changed
#         if self.changeState:
#             self.hoverOut.emit()
#             self.changeState=False
#     
#     def updateChangeState(self,ev):
#         self.changeState=True
# 
# class KeyBindLineEdit(QtWidgets.QLineEdit):
#     keyPressed=QtCore.pyqtSignal(str)
#     
#     def __init__(self, parent=None):
#         super(KeyBindLineEdit, self).__init__(parent)    
#         self.MOD_MASK = (Qt.CTRL | Qt.ALT | Qt.SHIFT | Qt.META)
#     
#     # If any usual key bind was pressed, return the human recognizable string
#     def keyPressEvent(self, ev):
#         keyname = keyPressToString(ev)
#         if keyname==None:
#             return
#         self.keyPressed.emit(keyname)
# 
# class KeyListWidget(QtWidgets.QListWidget):       
#     # Return signal if key was pressed while in focus
#     keyPressedSignal = QtCore.pyqtSignal()  
#     
#     def __init__(self, parent=None):
#         super(KeyListWidget, self).__init__(parent)
#     
#     # Update this widgets last pressed key, and return a signal
#     def keyPressEvent(self, ev):
#         self.key=ev.key()
#         if self.key not in [Qt.Key_Delete]:
#             return
#         self.keyPressedSignal.emit()
#         
#     # Deselect all items if in a blank space
#     def mousePressEvent(self, ev):
#         if self.itemAt(ev.pos()) is None:
#             self.clearSelection()
#         QtWidgets.QListWidget.mousePressEvent(self, ev)
#     
#     # Ensure that key presses are sent to the widget which the mouse is hovering over
#     def enterEvent(self,ev):
#         super(KeyListWidget, self).enterEvent(ev)
#         self.setFocus()
# 
#     # Return a lists entries in the order which is appears
#     def visualListOrder(self):
#         txt=np.array([self.item(i).text() for i in range(self.count())])
#         args=np.array([self.indexFromItem(self.item(i)).row() for i in range(self.count())])
#         return list(txt[np.argsort(args)])


# Path: lazylyst/UI/ActionSetup.py
from PyQt5 import QtCore, QtGui, QtWidgets
from lazylyst.CustomWidgets import HoverLineEdit, KeyBindLineEdit, KeyListWidget

        self.actTriggerLineEdit = KeyBindLineEdit(actionDialog)
        self.actTriggerLineEdit.setObjectName("actTriggerLineEdit")
        self.actShortInputLayout.addWidget(self.actTriggerLineEdit, 2, 4, 1, 1)
        self.actTagLabel = QtWidgets.QLabel(actionDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.actTagLabel.sizePolicy().hasHeightForWidth())
        self.actTagLabel.setSizePolicy(sizePolicy)
        self.actTagLabel.setBaseSize(QtCore.QSize(0, 0))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.actTagLabel.setFont(font)
        self.actTagLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.actTagLabel.setObjectName("actTagLabel")
        self.actShortInputLayout.addWidget(self.actTagLabel, 0, 1, 1, 1)
        self.actNameLabel = QtWidgets.QLabel(actionDialog)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.actNameLabel.setFont(font)
        self.actNameLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.actNameLabel.setObjectName("actNameLabel")
        self.actShortInputLayout.addWidget(self.actNameLabel, 2, 1, 1, 1)
        self.actPassiveRadio = QtWidgets.QRadioButton(actionDialog)
        self.actPassiveRadio.setChecked(True)
        self.actPassiveRadio.setObjectName("actPassiveRadio")
        self.actShortInputLayout.addWidget(self.actPassiveRadio, 6, 3, 1, 1)
        self.actOptionalsLineEdit = QtWidgets.QLineEdit(actionDialog)

        self.actOptionalsLineEdit.setObjectName("actOptionalsLineEdit")