def __init__(self, parent=None):
        super().__init__(parent)

        self._parent = parent

        self.parameterTypes = getParameterTypes()

        # Widgets
        self.addIndepVarBtn = QPushButton("Add variable")
        self.deleteIndepVarBtn = QPushButton("Delete variable")
        self.varListTblWdg = VariableTableView()
        self.varListModel = VariableListModel(parent=self)
        self.varListTblWdg.setSelectionMode(QAbstractItemView.SingleSelection)
        self.varListTblWdg.setModel(self.varListModel)

        self.varTab = QWidget(self)
        grid = QGridLayout(self.varTab)
        grid.addWidget(self.varListTblWdg, 0, 0, 3, 1)
        grid.addWidget(self.addIndepVarBtn, 0, 1)
        grid.addWidget(self.deleteIndepVarBtn, 1, 1)

        self.paramListTblWdg = ParameterInstanceTableView()
        self.paramListModel = ParameterInstanceListModel(parent=self)
        self.paramListTblWdg.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.paramListTblWdg.setSelectionMode(
            QAbstractItemView.SingleSelection)
        self.paramListTblWdg.setModel(self.paramListModel)

        self.functionTxt = QLineEdit(self)
        self.functionDepPartTxt = QLabel(self)

        self.eqElementsTabs = QTabWidget(self)
        self.eqElementsTabs.addTab(self.varTab, "Equation variables")
        self.eqElementsTabs.addTab(self.paramListTblWdg, "Equation parameters")
        #self.eqElementsTabs.setTabEnabled(1, False)

        #TODO: We need to implement some kind of search to allow the user to select an existing parameter.
        # It need not be from the same annotation, nor even the same paper (in case they took a parameter
        # values from a paper they cite).

        # Signals
        self.addIndepVarBtn.clicked.connect(self.varListModel.addVariable)
        self.deleteIndepVarBtn.clicked.connect(
            self.varListTblWdg.deleteVariable)
        self.varListTblWdg.depTypeSelected.connect(self.setDepText)

        # Layout
        grid = QGridLayout(self)

        grid.addWidget(self.eqElementsTabs, 0, 0, 1, 3)
        grid.addWidget(QLabel("Equation:  "), 2, 0)
        grid.addWidget(self.functionDepPartTxt, 2, 1)
        grid.addWidget(self.functionTxt, 2, 2)
    def __init__(self, parent=None):
        super().__init__(parent)

        self._parent = parent

        self.parameterTypes = getParameterTypes()

        # Widgets        
        self.addIndepVarBtn = QPushButton("Add variable")
        self.deleteIndepVarBtn = QPushButton("Delete variable")
        self.varListTblWdg = VariableTableView()
        self.varListModel = VariableListModel(parent=self)
        self.varListTblWdg.setSelectionMode(QAbstractItemView.SingleSelection)
        self.varListTblWdg.setModel(self.varListModel)

        self.varTab                = QWidget(self)
        grid                       = QGridLayout(self.varTab)
        grid.addWidget(self.varListTblWdg, 0, 0, 3, 1)
        grid.addWidget(self.addIndepVarBtn, 0, 1)
        grid.addWidget(self.deleteIndepVarBtn, 1, 1)

        self.paramListTblWdg       = ParameterInstanceTableView()
        self.paramListModel        = ParameterInstanceListModel(parent=self)
        self.paramListTblWdg.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.paramListTblWdg.setSelectionMode(QAbstractItemView.SingleSelection)
        self.paramListTblWdg.setModel(self.paramListModel)

        self.functionTxt        = QLineEdit(self)
        self.functionDepPartTxt    = QLabel(self)

        self.eqElementsTabs = QTabWidget(self)
        self.eqElementsTabs.addTab(self.varTab,   "Equation variables")
        self.eqElementsTabs.addTab(self.paramListTblWdg, "Equation parameters")
        #self.eqElementsTabs.setTabEnabled(1, False)
        
        #TODO: We need to implement some kind of search to allow the user to select an existing parameter.
        # It need not be from the same annotation, nor even the same paper (in case they took a parameter 
        # values from a paper they cite).

        # Signals
        self.addIndepVarBtn.clicked.connect(self.varListModel.addVariable)
        self.deleteIndepVarBtn.clicked.connect(self.varListTblWdg.deleteVariable)
        self.varListTblWdg.depTypeSelected.connect(self.setDepText)

        # Layout
        grid     = QGridLayout(self)

        grid.addWidget(self.eqElementsTabs, 0, 0, 1, 3)
        grid.addWidget(QLabel("Equation:  "), 2, 0)
        grid.addWidget(self.functionDepPartTxt, 2, 1)
        grid.addWidget(self.functionTxt, 2, 2)
Esempio n. 3
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.parameterTypes = getParameterTypes()

        # Widgets        
        self.varListTblWdg = VariableTableView(self)
        self.varListModel = VariableListModel(parent=self)
        self.varListTblWdg.setSelectionMode(QAbstractItemView.SingleSelection)
        self.varListTblWdg.setSelectionBehavior(QAbstractItemView.SelectItems)
        self.varListTblWdg.setModel(self.varListModel)

        selection = self.varListTblWdg.selectionModel()
        selection.selectionChanged.connect(self.varSelectionChanged)
        
        self.varListTblWdg.depTypeSelected.connect(self.newParamSelected)
        
        self.addIndepVarBtn    = QPushButton("Add indep. variable")
        self.addDepVarCompBtn  = QPushButton("Add a component to the dep. var.")
        self.deleteIndepVarBtn = QPushButton("Delete variable")
        self.addSample         = QPushButton("Add sample")
        self.deleteSample      = QPushButton("Delete sample")
        self.loadCSV           = QPushButton("Load CSV")
        self.loadCSV.setVisible(False)  # FIXME

        self.deleteSample.setDisabled(True)
        self.deleteIndepVarBtn.setDisabled(True)
        
        # Signals
        self.addIndepVarBtn.clicked.connect(self.varListModel.addVariable)
        self.addDepVarCompBtn.clicked.connect(self.varListModel.addDepCompnent)
        self.deleteIndepVarBtn.clicked.connect(self.varListTblWdg.deleteVariable)
        self.addSample.clicked.connect(self.varListModel.addSample)
        self.deleteSample.clicked.connect(self.varListTblWdg.deleteSample)
        self.varListTblWdg.depTypeSelected.connect(self.depVarSelected)

        # Layout
        grid = QGridLayout(self)
        grid.addWidget(self.varListTblWdg, 0, 0, 7, 1)
        grid.addWidget(self.addIndepVarBtn, 0, 1)
        grid.addWidget(self.addDepVarCompBtn, 1, 1)
        grid.addWidget(self.deleteIndepVarBtn, 2, 1)
        grid.addWidget(self.addSample, 3, 1)
        grid.addWidget(self.deleteSample, 4, 1)
        grid.addWidget(self.loadCSV, 5, 1)

        self.varListTblWdg.clicked.connect(self.tableClicked)
Esempio n. 4
0
    def __init__(self):
        super(Window, self).__init__()


        self.interfaceSetup = False
        self.sourceRef = None
        self.setupMenus()
        self.setupWindowsUI()
        self.dbPath = '/home/oreilly/Dropbox/code/curator/DB/'
        self.parameterTypes = getParameterTypes()
        #self.currentModelingParam = None
        self.projectSetup = None
        
        self.noUpdatePropositionSelection = False

        self.editPreferences()

        self.gitMng = GitManager(self.settings.config["GIT"])

        self.dbPath   = os.path.abspath(self.settings.config["GIT"]["local"])        
        self.compiledCorpus = CompiledCorpus(os.path.join(self.dbPath, "annotations.bin"))    
        self.compiledCorpus.compileCorpus(pathDB=self.dbPath)
        self.searcher = ParameterSearch(pathDB=self.dbPath, compiledCorpus=self.compiledCorpus)
                          QAbstractTableModel)
from PyQt5.QtWidgets import (QTableView, QMessageBox, QLabel, QGridLayout,
                             QTabWidget, QLineEdit, QAbstractItemView, QWidget,
                             QPushButton)

from nat.annotation import getParametersForPub
from nat.modelingParameter import (getParameterTypes, ParameterTypeTree,
                                   getParameterTypeNameFromID)
from nat.paramDesc import ParamDescFunction, InvalidEquation, ParamRef
from nat.parameterInstance import ParameterInstance
from nat.utils import Id2FileName
from .itemDelegates import CheckBoxDelegate
from .variableTableWgt import VariableTableView, VariableListModel

parameterTypeTree = ParameterTypeTree.load()
parameterTypes = getParameterTypes()


class ParamFunctionWgt(QWidget):

    paramTypeSelected = pyqtSignal(str)

    def __init__(self, parent=None):
        super().__init__(parent)

        self._parent = parent

        self.parameterTypes = getParameterTypes()

        # Widgets
        self.addIndepVarBtn = QPushButton("Add variable")
from PyQt5.QtWidgets import (QTableView, QMessageBox, QLabel, QGridLayout,
                             QTabWidget, QLineEdit, QAbstractItemView, QWidget,
                             QPushButton)

from nat.annotation import getParametersForPub
from nat.modelingParameter import (getParameterTypes, ParameterTypeTree,
                                   getParameterTypeNameFromID)
from nat.paramDesc import ParamDescFunction, InvalidEquation, ParamRef
from nat.parameterInstance import ParameterInstance
from nat.utils import Id2FileName
from .itemDelegates import CheckBoxDelegate
from .variableTableWgt import VariableTableView, VariableListModel


parameterTypeTree = ParameterTypeTree.load()
parameterTypes = getParameterTypes()


class ParamFunctionWgt(QWidget):

    paramTypeSelected = pyqtSignal(str)
    
    def __init__(self, parent=None):
        super().__init__(parent)

        self._parent = parent

        self.parameterTypes = getParameterTypes()

        # Widgets        
        self.addIndepVarBtn = QPushButton("Add variable")