Пример #1
0
    def __init__(self):
        QDialog.__init__(self)
        # Setup the user interface from designer
        self.setupUi(self)
        self.retInt = returnIntegralsDev.workupODNP(
            self)  # Initialize the workup script

        # variable definitions#{{{
        self.EPRFile = False
        self.ODNPFile = False
        self.T1File = False
        self.dataBase = False
        self.dataDirFile = 'datadir.txt'
        self.DataDir = None
        self.calSaveFile = 'calFile.txt'
        self.EPRCalFile = False
        self.dataBaseList = ['Select Value', 'Yes', 'No']  #}}}

        # Find data directory and EPR calibration file#{{{
        # Locate the Data Directory
        if os.path.isfile(self.dataDirFile):
            opened = open(self.dataDirFile, 'r')
            self.DataDir = opened.readline()
            self.DataDirDisplay.setText(
                _translate("Form", str(self.DataDir), None))
        # Locate the calibration file
        if os.path.isfile(self.calSaveFile):
            opened = open(self.calSaveFile, 'r')
            self.EPRCalFile = opened.readline()
            self.EPRCalFileDisplay.setText(
                _translate("Form", str(self.EPRCalFile), None))  #}}}

        # load the database combo box with choices and make it editable#{{{
        self.databaseComboBox.addItems(self.dataBaseList)
        self.databaseComboBox.setEditable(True)  #}}}

        # Links for the gui manipulatable options#{{{
        self.DataDirOpenBrowser.clicked.connect(self.DataDirOpened)
        self.ODNPOpenBrowser.clicked.connect(self.ODNPOpened)
        self.T1OpenBrowser.clicked.connect(self.T1Opened)
        self.EPROpenBrowser.clicked.connect(self.EPROpened)
        self.EPRCalOpenBrowser.clicked.connect(self.EPRCalOpened)
        # Links to saving the data directory, exiting the GUI, or running the workup.
        self.saveDirButton.clicked.connect(self.saveDataDir)
        self.saveCalButton.clicked.connect(self.saveCalFile)
        self.exitButton.clicked.connect(self.exitProgram)
        self.runButton.clicked.connect(self.runProgram)
        self.databaseComboBox.currentIndexChanged.connect(
            self.dbComboChanged)  #}}}
Пример #2
0
def create_new_cell_item_table_widget(table_widget, idx_row, idx_column,
                                      value):
    """
    Create a cell item in row to column specify of table widget chosen
    :param table_widget: table qt
    :type table_widget: QtGui.QTableWidget
    :param idx_row: index of row
    :type idx_row: int
    :param idx_column: index of column
    :type idx_column: int
    :param value: value to display in cell
    :type value: str
    :return: None
    """
    # create new row
    cell = ValueTableItem.ValueTableItem()
    # we don't want user can change value of cell in table QtCore.Qt.ItemIsEditable
    cell.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)

    value = value if value is not None else ""
    if idx_column > 1:
        cell.setTextAlignment(QtCore.Qt.AlignRight + QtCore.Qt.AlignVCenter)

    cell.setText(_translate("MainWindow", str(value), None))
    table_widget.setItem(idx_row, idx_column, cell)
Пример #3
0
 def refreshDisplay(self):  #{{{
     """ Reset all display stuff for another go """
     self.runButton.setEnabled(True)
     self.databaseComboBox.clear()
     self.databaseComboBox.addItems(self.dataBaseList)
     self.databaseComboBox.setEditable(True)
     self.dataBase = False
     self.EPRFile = False
     self.ODNPFile = False
     self.T1File = False
     self.textBrowser.clear()
     self.ODNPDisplay.setText(
         _translate("Form", str("Enter File Name"), None))
     self.T1Display.setText(_translate("Form", str("Enter File Name"),
                                       None))
     self.EPRFileDisplay.setText(
         _translate("Form", str("Enter File Name"), None))  #}}}
Пример #4
0
 def T1Opened(self):  #{{{
     """ Handling for the T1 file browser button """
     if self.DataDir:
         self.T1File = str(
             QtGui.QFileDialog.getExistingDirectory(self, 'Open file',
                                                    self.DataDir))
     else:
         self.T1File = str(
             QtGui.QFileDialog.getExistingDirectory(self, 'Open file',
                                                    os.getcwd()))
     self.T1Display.setText(_translate("Form", str(self.T1File),
                                       None))  #}}}
Пример #5
0
 def EPRCalOpened(self):  #{{{
     """ Handling for the EPR Calibration file browser button """
     if self.DataDir:
         self.EPRCalFile = str(
             QtGui.QFileDialog.getOpenFileName(self, 'Open file',
                                               self.DataDir))
     else:
         self.EPRCalFile = str(
             QtGui.QFileDialog.getOpenFileName(self, 'Open file',
                                               os.getcwd()))
     self.EPRCalFile = os.path.abspath(self.EPRCalFile)
     self.EPRCalFileDisplay.setText(
         _translate("Form", str(self.EPRCalFile), None))  #}}}
Пример #6
0
 def DataDirOpened(self):  #{{{
     """ Handling to open the file browser to choose the data directory """
     self.DataDir = QtGui.QFileDialog.getExistingDirectory(
         self, 'Open file', os.getcwd())
     self.DataDirDisplay.setText(_translate("Form", str(self.DataDir),
                                            None))  #}}}