# Path: Linker.py
# class Ui_MainWindow(object):
#     def setupUi(self, MainWindow):
#         MainWindow.setObjectName("MainWindow")
#         MainWindow.resize(1372, 701)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
#         MainWindow.setSizePolicy(sizePolicy)
#         self.centralwidget = QtWidgets.QWidget(MainWindow)
#         self.centralwidget.setObjectName("centralwidget")
#         self.tableView = QtWidgets.QTableView(self.centralwidget)
#         self.tableView.setGeometry(QtCore.QRect(10, 50, 835, 351))
#         font = QtGui.QFont()
#         font.setFamily("Arial")
#         font.setPointSize(10)
#         self.tableView.setFont(font)
#         self.tableView.setObjectName("tableView")
#         self.OKButton = QtWidgets.QPushButton(self.centralwidget)
#         self.OKButton.setGeometry(QtCore.QRect(260, 400, 90, 25))
#         self.OKButton.setObjectName("OKButton")
#         self.CancelButton = QtWidgets.QPushButton(self.centralwidget)
#         self.CancelButton.setGeometry(QtCore.QRect(390, 400, 90, 25))
#         self.CancelButton.setObjectName("CancelButton")
#         self.targetLexCombo = QtWidgets.QComboBox(self.centralwidget)
#         self.targetLexCombo.setGeometry(QtCore.QRect(160, 10, 361, 29))
#         font = QtGui.QFont()
#         font.setPointSize(10)
#         self.targetLexCombo.setFont(font)
#         self.targetLexCombo.setLayoutDirection(QtCore.Qt.LeftToRight)
#         self.targetLexCombo.setObjectName("targetLexCombo")
#         self.ShowOnlyUnlinkedCheckBox = QtWidgets.QCheckBox(self.centralwidget)
#         self.ShowOnlyUnlinkedCheckBox.setGeometry(QtCore.QRect(550, 10, 121, 27))
#         self.ShowOnlyUnlinkedCheckBox.setObjectName("ShowOnlyUnlinkedCheckBox")
#         self.label = QtWidgets.QLabel(self.centralwidget)
#         self.label.setGeometry(QtCore.QRect(10, 10, 151, 23))
#         self.label.setObjectName("label")
#         self.HideProperNounsCheckBox = QtWidgets.QCheckBox(self.centralwidget)
#         self.HideProperNounsCheckBox.setGeometry(QtCore.QRect(710, 10, 121, 27))
#         self.HideProperNounsCheckBox.setObjectName("HideProperNounsCheckBox")
#         MainWindow.setCentralWidget(self.centralwidget)
#         self.menubar = QtWidgets.QMenuBar(MainWindow)
#         self.menubar.setGeometry(QtCore.QRect(0, 0, 1372, 21))
#         self.menubar.setObjectName("menubar")
#         MainWindow.setMenuBar(self.menubar)
#         self.statusbar = QtWidgets.QStatusBar(MainWindow)
#         self.statusbar.setObjectName("statusbar")
#         MainWindow.setStatusBar(self.statusbar)
# 
#         self.retranslateUi(MainWindow)
#         QtCore.QMetaObject.connectSlotsByName(MainWindow)
# 
#     def retranslateUi(self, MainWindow):
#         _translate = QtCore.QCoreApplication.translate
#         MainWindow.setWindowTitle(_translate("MainWindow", "FLExTrans Sense Linker Tool"))
#         self.OKButton.setText(_translate("MainWindow", "OK"))
#         self.CancelButton.setText(_translate("MainWindow", "Cancel"))
#         self.targetLexCombo.setToolTip(_translate("MainWindow", "After selecting the desired sense here, double-click in the target head word column for the desired row to copy it."))
#         self.ShowOnlyUnlinkedCheckBox.setText(_translate("MainWindow", "Show Only Unlinked"))
#         self.label.setText(_translate("MainWindow", "All Target Senses:"))
#         self.HideProperNounsCheckBox.setText(_translate("MainWindow", "Hide Proper Nouns"))


import re
import sys
import unicodedata
import ReadConfig
import Utils
from fuzzywuzzy import fuzz
from System import Guid
from System import String
from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QMainWindow, QApplication
from FTModuleClass import *                                                 
from FTModuleClass import FlexToolsModuleClass
from SIL.LCModel import *                                                   
from SIL.LCModel.Core.KernelInterfaces import ITsString, ITsStrBldr         
from SIL.LCModel.DomainServices import SegmentServices
from flexlibs.FLExProject import FLExProject, GetProjectNames
from Linker import Ui_MainWindow
        elif index.column() == 4:
            
            val = val | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable 
            
        return val
    
    def setData(self, index, value, role = QtCore.Qt.EditRole):
        
        col = index.column()

        if role == QtCore.Qt.CheckStateRole and col == 0:
            
            row = index.row()
            
            if value == QtCore.Qt.Checked: 
                
                self.__localData[row].linkIt = True
                self.__localData[row].modified = True
            else:
                self.__localData[row].linkIt = False
                self.__localData[row].modified = True
                
        return True
            
class Main(QMainWindow):

    def __init__(self, myData, headerData, comboData):
        QMainWindow.__init__(self)
        self.showOnlyUnlinked = False
        self.hideProperNouns = False

# Path: Linker.py
# class Ui_MainWindow(object):
#     def setupUi(self, MainWindow):
#         MainWindow.setObjectName("MainWindow")
#         MainWindow.resize(1372, 701)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
#         MainWindow.setSizePolicy(sizePolicy)
#         self.centralwidget = QtWidgets.QWidget(MainWindow)
#         self.centralwidget.setObjectName("centralwidget")
#         self.tableView = QtWidgets.QTableView(self.centralwidget)
#         self.tableView.setGeometry(QtCore.QRect(10, 50, 835, 351))
#         font = QtGui.QFont()
#         font.setFamily("Arial")
#         font.setPointSize(10)
#         self.tableView.setFont(font)
#         self.tableView.setObjectName("tableView")
#         self.OKButton = QtWidgets.QPushButton(self.centralwidget)
#         self.OKButton.setGeometry(QtCore.QRect(260, 400, 90, 25))
#         self.OKButton.setObjectName("OKButton")
#         self.CancelButton = QtWidgets.QPushButton(self.centralwidget)
#         self.CancelButton.setGeometry(QtCore.QRect(390, 400, 90, 25))
#         self.CancelButton.setObjectName("CancelButton")
#         self.targetLexCombo = QtWidgets.QComboBox(self.centralwidget)
#         self.targetLexCombo.setGeometry(QtCore.QRect(160, 10, 361, 29))
#         font = QtGui.QFont()
#         font.setPointSize(10)
#         self.targetLexCombo.setFont(font)
#         self.targetLexCombo.setLayoutDirection(QtCore.Qt.LeftToRight)
#         self.targetLexCombo.setObjectName("targetLexCombo")
#         self.ShowOnlyUnlinkedCheckBox = QtWidgets.QCheckBox(self.centralwidget)
#         self.ShowOnlyUnlinkedCheckBox.setGeometry(QtCore.QRect(550, 10, 121, 27))
#         self.ShowOnlyUnlinkedCheckBox.setObjectName("ShowOnlyUnlinkedCheckBox")
#         self.label = QtWidgets.QLabel(self.centralwidget)
#         self.label.setGeometry(QtCore.QRect(10, 10, 151, 23))
#         self.label.setObjectName("label")
#         self.HideProperNounsCheckBox = QtWidgets.QCheckBox(self.centralwidget)
#         self.HideProperNounsCheckBox.setGeometry(QtCore.QRect(710, 10, 121, 27))
#         self.HideProperNounsCheckBox.setObjectName("HideProperNounsCheckBox")
#         MainWindow.setCentralWidget(self.centralwidget)
#         self.menubar = QtWidgets.QMenuBar(MainWindow)
#         self.menubar.setGeometry(QtCore.QRect(0, 0, 1372, 21))
#         self.menubar.setObjectName("menubar")
#         MainWindow.setMenuBar(self.menubar)
#         self.statusbar = QtWidgets.QStatusBar(MainWindow)
#         self.statusbar.setObjectName("statusbar")
#         MainWindow.setStatusBar(self.statusbar)
# 
#         self.retranslateUi(MainWindow)
#         QtCore.QMetaObject.connectSlotsByName(MainWindow)
# 
#     def retranslateUi(self, MainWindow):
#         _translate = QtCore.QCoreApplication.translate
#         MainWindow.setWindowTitle(_translate("MainWindow", "FLExTrans Sense Linker Tool"))
#         self.OKButton.setText(_translate("MainWindow", "OK"))
#         self.CancelButton.setText(_translate("MainWindow", "Cancel"))
#         self.targetLexCombo.setToolTip(_translate("MainWindow", "After selecting the desired sense here, double-click in the target head word column for the desired row to copy it."))
#         self.ShowOnlyUnlinkedCheckBox.setText(_translate("MainWindow", "Show Only Unlinked"))
#         self.label.setText(_translate("MainWindow", "All Target Senses:"))
#         self.HideProperNounsCheckBox.setText(_translate("MainWindow", "Hide Proper Nouns"))


# Path: LinkSenseTool.py
import re
import sys
import unicodedata
import ReadConfig
import Utils
from fuzzywuzzy import fuzz
from System import Guid
from System import String
from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QMainWindow, QApplication
from FTModuleClass import *                                                 
from FTModuleClass import FlexToolsModuleClass
from SIL.LCModel import *                                                   
from SIL.LCModel.Core.KernelInterfaces import ITsString, ITsStrBldr         
from SIL.LCModel.DomainServices import SegmentServices
from flexlibs.FLExProject import FLExProject, GetProjectNames
from Linker import Ui_MainWindow

        elif index.column() == 4:
            
            val = val | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable 
            
        return val
    
    def setData(self, index, value, role = QtCore.Qt.EditRole):
        
        col = index.column()

        if role == QtCore.Qt.CheckStateRole and col == 0:
            
            row = index.row()
            
            if value == QtCore.Qt.Checked: 
                
                self.__localData[row].linkIt = True
                self.__localData[row].modified = True
            else:
                self.__localData[row].linkIt = False
                self.__localData[row].modified = True
                
        return True
            
class Main(QMainWindow):

    def __init__(self, myData, headerData, comboData):
        QMainWindow.__init__(self)
        self.showOnlyUnlinked = False
        self.hideProperNouns = False

        self.ui = Ui_MainWindow()