def radio_button_changed(self):

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
        QApplication.processEvents()

        ipts_widgets_status = False
        run_widgets_status = True
        if self.ui.ipts_radio_button.isChecked():
            ipts_widgets_status = True
            run_widgets_status = False
            if str(self.ui.ipts_lineedit.text()).strip() != "":
                self.ipts_text_return_pressed()
            else:
                self.ipts_selection_changed()
        else:
            self.ui.error_message.setVisible(False)
            self.run_number_return_pressed()

        self.ui.ipts_combobox.setEnabled(ipts_widgets_status)
        self.ui.ipts_lineedit.setEnabled(ipts_widgets_status)
        self.ui.ipts_label.setEnabled(ipts_widgets_status)
        self.ui.clear_ipts_button.setEnabled(ipts_widgets_status)

        self.ui.run_number_lineedit.setEnabled(run_widgets_status)
        self.ui.run_number_label.setEnabled(run_widgets_status)
        self.ui.clear_run_button.setEnabled(run_widgets_status)

        GuiHandler.check_import_button(self)

        QApplication.restoreOverrideCursor()
        QApplication.processEvents()
    def refresh_preview_table_of_runs(self):
        """using either the IPTS number selected or the runs defined, this will use the ONCat template to
        retrieve all the information from the template and populate the preview table """

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
        QApplication.processEvents()

        o_import = ImportTableFromOncat(parent=self)
        try:
            o_import.from_oncat_template()
            nexus_json = self.nexus_json_from_template
            self.nexus_json_all_infos = nexus_json

            enabled_widgets = False
            if not (nexus_json == {}):
                enabled_widgets = True

            GuiHandler.preview_widget_status(self.ui, enabled_widgets=enabled_widgets)
            self.refresh_preview_table(nexus_json=copy.deepcopy(nexus_json))

            QApplication.restoreOverrideCursor()
            QApplication.processEvents()

        except pyoncat.InvalidRefreshTokenError:

            QApplication.restoreOverrideCursor()
            QApplication.processEvents()

            OncatAuthenticationHandler(parent=self.parent,
                                       next_function=self.refresh_preview_table_of_runs)
 def toolbox_changed(self, index):
     if index == 0:
         self.nexus_json = {}
         self.ui.import_button.setText("Import All Listed Runs")
     elif index == 1:
         self.ui.import_button.setText("Import Filtered Runs")
         self.refresh_filter_page()
     GuiHandler.check_import_button(self)
 def add_criteria_clicked(self):
     nbr_row = self.ui.tableWidget.rowCount()
     o_table_handler = TableWidgetRuleHandler(parent=self)
     o_table_handler.add_row(row=nbr_row)
     self.check_rule_widgets()
     self.update_global_rule(row=nbr_row, is_added=True)
     self.update_rule_filter()
     GuiHandler.check_import_button(self)
 def remove_criteria_clicked(self):
     _select = self.ui.tableWidget.selectedRanges()
     if not _select:
         return
     row = _select[0].topRow()
     _randome_key = str(self.ui.tableWidget.item(row, 0).text())
     self.list_ui.pop(_randome_key, None)
     self.update_global_rule(row=row, is_removed=True)
     self.ui.tableWidget.removeRow(row)
     self.check_all_filter_widgets()
     self.refresh_global_rule(full_reset=True)
     self.update_rule_filter()
     GuiHandler.check_import_button(self)
    def ipts_text_changed(self, ipts_text):
        if ipts_text.strip() != "":
            str_ipts = "IPTS-{}".format(ipts_text.strip())

            ipts_exist = False
            if str_ipts in self.list_ipts:
                ipts_exist = True
                index = self.ui.ipts_combobox.findText(str_ipts)
                self.ui.ipts_combobox.blockSignals(True)
                self.ui.ipts_combobox.setCurrentIndex(index)
                self.ui.ipts_combobox.blockSignals(False)
        else:
            ipts_exist = True  # we will use the combobox IPTS

        self.ipts_exist = ipts_exist
        GuiHandler.check_import_button(self)
    def refresh_filter_page(self):

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
        QApplication.processEvents()

        if self.ui.import_button.isEnabled():
            o_import = ImportTableFromOncat(parent=self)
            o_import.from_oncat_config(insert_in_table=False)

        nexus_json = self.nexus_json

        enabled_widgets = False
        if not (nexus_json == {}):
            enabled_widgets = True

        GuiHandler.filter_widget_status(self.ui, enabled_widgets=enabled_widgets)
        self.refresh_filter_table(nexus_json=copy.deepcopy(nexus_json))
        self.update_rule_filter()

        QApplication.restoreOverrideCursor()
        QApplication.processEvents()
 def search_return_pressed(self):
     new_text = str(self.ui.name_search.text())
     self.search_text_changed(new_text)
     GuiHandler.check_import_button(self)
 def run_number_text_changed(self, text):
     GuiHandler.check_import_button(self)
 def list_item_changed(self, index, key):
     """this method is reached when the user changes the name of the variable he wants to filter"""
     o_table = TableWidgetRuleHandler(parent=self)
     o_table.update_list_value_of_given_item(index=index, key=key)
     self.update_rule_filter()
     GuiHandler.check_import_button(self)
 def list_criteria_changed(self, value, key):
     self.update_rule_filter()
     GuiHandler.check_import_button(self)
 def list_argument_index_changed(self, value, key):
     self.update_rule_filter()
     GuiHandler.check_import_button(self)