import os
from PyQt5 import QtWidgets
from .qtd import Ui_MainWindow
from version import __version__
from utils import SpinBoxFixStyle


class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    """
    Main window
    """

    def __init__(self, parent=None):
        # initialization of the superclass
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)  # setup the GUI --> function generated by pyuic5
        env = os.environ['CONDA_DEFAULT_ENV']
        self.setWindowTitle("JCPDSTools ver. " + str(__version__) + " on " + env)
        #
        self.build_ui()
        #self.connect_channel()

    def build_ui(self):
        self.pushButton_WriteDioptasJCPDS.setDisabled(True)
        self.doubleSpinBox_CellParamA.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamA.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamB.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamB.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamC.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamC.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamAlpha.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamAlpha.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamBeta.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamBeta.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamGamma.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamGamma.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0p.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_MinDsp.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_MinInt.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0.setKeyboardTracking(False)
        self.doubleSpinBox_K0p.setKeyboardTracking(False)
        self.doubleSpinBox_MinDsp.setKeyboardTracking(False)
        self.doubleSpinBox_MinInt.setKeyboardTracking(False)

    def closeEvent(self, event):
        self.deleteLater()
        event.accept()

import os
from PyQt5 import QtWidgets
from .qtd import Ui_MainWindow
from version import __version__
from utils import SpinBoxFixStyle


class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    """
    Main window
    """

    def __init__(self, parent=None):
        # initialization of the superclass
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)  # setup the GUI --> function generated by pyuic5
        env = os.environ['CONDA_DEFAULT_ENV']
        self.setWindowTitle("JCPDSTools ver. " + str(__version__) + " on " + env)
        #
        self.build_ui()
        #self.connect_channel()

    def build_ui(self):
        self.pushButton_WriteDioptasJCPDS.setDisabled(True)
        self.doubleSpinBox_CellParamA.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamA.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamB.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamB.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamC.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamC.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamAlpha.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamAlpha.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamBeta.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamBeta.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_CellParamGamma.setKeyboardTracking(False)
        self.doubleSpinBox_CellParamGamma.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0p.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_MinDsp.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_MinInt.setStyle(SpinBoxFixStyle())
        self.doubleSpinBox_K0.setKeyboardTracking(False)
        self.doubleSpinBox_K0p.setKeyboardTracking(False)
        self.doubleSpinBox_MinDsp.setKeyboardTracking(False)
        self.doubleSpinBox_MinInt.setKeyboardTracking(False)

    def closeEvent(self, event):
        self.deleteLater()
        event.accept()

Main window # initialization of the superclass # setup the GUI --> function generated by pyuic5 # #self.connect_channel()