# Dialog window set up for BIFS parameters

from PyQt5 import QtCore, QtWidgets

class Param_Fourier_Space_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Parameter Space Function")
        Dialog.resize(200, 200)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.param_spaceSetUp = QtWidgets.QLabel("K-Space Parameter Function", self)
        self.param_spaceBox = QtWidgets.QComboBox(self)
        # self.param_spaceBox.setCurrentIndex(self.parent().param_func)
        self.param_spaceBox.addItems(self.parent().mybifs.param_func_choices)
        self.param_spaceBox.setCurrentIndex(self.parent().mybifs.param_func_choices.index(self.parent().mybifs.param_func_type))
        self.decay_label = QtWidgets.QLabel('Decay Exponent:', self)
        self.decay = QtWidgets.QLineEdit(str(self.parent().mybifs.decay))
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.param_spaceSetUp)
        self.layout.addWidget(self.param_spaceBox)
        self.layout.addWidget(self.decay_label)
        self.layout.addWidget(self.decay)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

class Prior_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Prior Distribution")
        Dialog.resize(200, 200)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.priorSetUp = QtWidgets.QLabel("Prior Distribution", self)
        self.priorBox = QtWidgets.QComboBox(self)
        # self.priorBox.setCurrentIndex(self.parent().param_func)
        self.priorBox.addItems(self.parent().mybifs.prior_choices)
        self.priorBox.setCurrentIndex(self.parent().mybifs.prior_choices.index(self.parent().mybifs.prior))
        self.scale_label = QtWidgets.QLabel('Scale:', self)
        self.scale = QtWidgets.QLineEdit(str(self.parent().mybifs.prior_scale))
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.priorSetUp)
        self.layout.addWidget(self.priorBox)
        self.layout.addWidget(self.scale_label)
        self.layout.addWidget(self.scale)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

class Likelihood_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Likelihood Distribution")
        Dialog.resize(200, 200)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.likelihoodSetUp = QtWidgets.QLabel("Likelihood Distribution", self)
        self.likelihoodBox = QtWidgets.QComboBox(self)
        # self.priorBox.setCurrentIndex(self.parent().param_func)
        self.likelihoodBox.addItems(self.parent().mybifs.likelihood_choices)
        self.likelihoodBox.setCurrentIndex(self.parent().mybifs.likelihood_choices.index(self.parent().mybifs.likelihood))
        self.scale_label = QtWidgets.QLabel('Scale:', self)
        self.scale = QtWidgets.QLineEdit(str(self.parent().mybifs.likelihood_scale))
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.likelihoodSetUp)
        self.layout.addWidget(self.likelihoodBox)
        self.layout.addWidget(self.scale_label)
        self.layout.addWidget(self.scale)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

class Slice3D_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Select 3D Slice to View")
        Dialog.resize(200, 200)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.slice_index_label = QtWidgets.QLabel('Slice Perpendicular to this Axis:', self)
        self.slice_index = QtWidgets.QComboBox()
        for i in range(3):
            self.slice_index.addItem(str(i), i)
        self.slice_index.setCurrentIndex(self.parent().mybifs.view3Dslice[0])
        #self.slice_index = QtWidgets.QLineEdit(str(self.parent().mybifs.view3Dslice[0]))
        self.slice_percent_label = QtWidgets.QLabel('Fraction Along Index:', self)
        self.slice_percent = QtWidgets.QLineEdit(str(self.parent().mybifs.view3Dslice[1]))
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.slice_index_label)
        self.layout.addWidget(self.slice_index)
        self.layout.addWidget(self.slice_percent_label)
        self.layout.addWidget(self.slice_percent)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

class AddBump_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Add K-Space Bump Filter")
        Dialog.resize(300, 300)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.addBumpKeySetUp = QtWidgets.QLabel("Add Bump", self)
        self.addBumpKeyBox = QtWidgets.QComboBox(self)
        self.addBumpKeyBox.addItems(self.parent().mybifs.bump_types)
        self.addBumpKeyBox.setCurrentIndex(self.parent().mybifs.bump_types.index(self.parent().mybifs.bump_default_type))
        self.Position_label = QtWidgets.QLabel('Position,fraction of Kmax:', self)
        self.Position = QtWidgets.QLineEdit()
        self.Amplitude_label = QtWidgets.QLabel('Amplitude,fraction of Pfuncmax:', self)
        self.Amplitude = QtWidgets.QLineEdit()
        self.Width_label = QtWidgets.QLabel('Width,fraction of Kmax:', self)
        self.Width = QtWidgets.QLineEdit()
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.addBumpKeySetUp)
        self.layout.addWidget(self.addBumpKeyBox)
        self.layout.addWidget(self.Position_label)
        self.layout.addWidget(self.Position)
        self.layout.addWidget(self.Amplitude_label)
        self.layout.addWidget(self.Amplitude)
        self.layout.addWidget(self.Width_label)
        self.layout.addWidget(self.Width)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

class DeleteBump_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Delete K-Space Bump Filter")
        Dialog.resize(300, 200)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(150, 250, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.deleteBumpKeySetUp = QtWidgets.QLabel("Delete Bump", self)
        self.deleteBumpKeyBox = QtWidgets.QComboBox(self)
        self.deleteBumpKeyBox.addItems(self.parent().bumplist)
        self.deleteBumpKeyBox.setCurrentIndex(self.parent().bumplist.index(self.parent().bumplist[0]))
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.layout.addWidget(self.deleteBumpKeySetUp)
        self.layout.addWidget(self.deleteBumpKeyBox)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)
