예제 #1
0
    def __init__(self, argv=[], parent=None):
        if parent is None:
            QtGui.QMainWindow.__init__(self)
        else:
            QtGui.QMainWindow.__init__(self, parent, QtCore.Qt.Window)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        InitializeSettings(self)
        InitializeGui(self)
        self.ui.reductionTable.setUI(self)
        MakeGuiConnections(parent=self)
        RetrieveUserConfiguration(parent=self)

        self.file_loaded_signal.connect(self.file_loaded)
        log_file = os.path.expanduser("~") + '/.refred.log'
        logging.basicConfig(filename=log_file, level=logging.DEBUG)
예제 #2
0
파일: main.py 프로젝트: JeanBilheux/RefRed
    def __init__(self, argv=[], parent=None):
        if parent is None:
            QtGui.QMainWindow.__init__(self)
        else:
            QtGui.QMainWindow.__init__(self, parent, QtCore.Qt.Window)
        self.ui=Ui_MainWindow()
        self.ui.setupUi(self)        
        
        InitializeGui(self)
        self.ui.reductionTable.setUI(self)   
        MakeGuiConnections(parent = self)
        RetrieveUserConfiguration(parent = self)

        log_file = os.path.expanduser("~") + '/.refred.log'
        logging.basicConfig(filename=log_file, level=logging.DEBUG)
예제 #3
0
파일: main.py 프로젝트: JeanBilheux/RefRed
class MainGui(QtGui.QMainWindow):
    ''' Top class that handles the GUI '''
    
    # default location
    path_ascii = '.'  # ascii file such as scaling factor file
    path_config = '/home/j35/sandbox' # config file of RefRed
    
    full_scaling_factor_file_name = ''
    current_loaded_file = '~/tmp.xml'
    
    o_user_configuration = None # will record the various settings of the GUI defined by the user
    o_stitching_ascii_widget = None # used when loading ascii files in reduced tab

    nbr_row_table_reduction = 30
    nbr_row_table_ascii = 8
    prev_table_reduction_row_selected = -1
    current_table_reduction_row_selected = -1
    reduction_table_check_box_state = np.zeros((nbr_row_table_reduction), dtype=bool)
    loading_nxs_thread = {'thread1': None, 'thread2': None, 'thread3': None, 'thread4': None,
                          'thread5': None, 'thread6': None, 'thread7': None, 'thread8': None,
                          'thread9': None, 'thread10': None, 'thread11': None, 'thread12': None,
                          'thread13': None, 'thread14': None, 'thread15': None, 'thread16': None,
                          'thread17': None, 'thread18': None, 'thread19': None, 'thread20': None,
                          'thread21': None, 'thread22': None, 'thread23': None, 'thread24': None,
                          'thread25': None, 'thread26': None, 'thread27': None, 'thread28': None}
    index_free_thread = 0

    time_click1 = 0 #use by double click of plots

    #[data, norm, lconfig]
    big_table_data = np.empty((nbr_row_table_reduction, 3), dtype=object)

    #Reduced ascii data sets
    #o_stitched_ascii = None

    def __init__(self, argv=[], parent=None):
        if parent is None:
            QtGui.QMainWindow.__init__(self)
        else:
            QtGui.QMainWindow.__init__(self, parent, QtCore.Qt.Window)
        self.ui=Ui_MainWindow()
        self.ui.setupUi(self)        
        
        InitializeGui(self)
        self.ui.reductionTable.setUI(self)   
        MakeGuiConnections(parent = self)
        RetrieveUserConfiguration(parent = self)

        log_file = os.path.expanduser("~") + '/.refred.log'
        logging.basicConfig(filename=log_file, level=logging.DEBUG)

    ## config files from menu
    #def launch_config_file1(self):
        #ConfigFileLauncher(self, 0)
    #def launch_config_file2(self):
        #ConfigFileLauncher(self, 1)
    #def launch_config_file3(self):
        #ConfigFileLauncher(self, 2)
    #def launch_config_file4(self):
        #ConfigFileLauncher(self, 3)
    #def launch_config_file5(self):
        #ConfigFileLauncher(self, 4)
    #def launch_config_file6(self):
        #ConfigFileLauncher(self, 5)
    #def launch_config_file7(self):
        #ConfigFileLauncher(self, 6)
    #def launch_config_file8(self):
        #ConfigFileLauncher(self, 7)
    #def launch_config_file9(self):
        #ConfigFileLauncher(self, 8)
    #def launch_config_file10(self):
        #ConfigFileLauncher(self, 9)
    
    # export plot into ascii files
    def export_ix(self):
        ExportPlotAscii(self, type='ix')
    def export_it(self):
        ExportPlotAscii(self, type='it')
    def export_yt(self):
        ExportPlotAscii(self, type='yt')
    def export_yi(self):
        ExportPlotAscii(self, type='yi')
    def export_stitching_data(self):
        ExportPlotAscii(self, type='stitched')

    # home button of plots
    def home_clicked_yi_plot(self):
        HomePlotButtonClicked(parent = self, plot_type = 'yi')
    def home_clicked_yt_plot(self):
        HomePlotButtonClicked(parent = self, plot_type = 'yt')
    def home_clicked_it_plot(self):
        HomePlotButtonClicked(parent = self, plot_type = 'it')
    def home_clicked_ix_plot(self):
        HomePlotButtonClicked(parent = self, plot_type = 'ix')
    def home_clicked_data_stitching_plot(self):
        HomePlotButtonClicked(parent = self, plot_type = 'stitching')

    # leave figure 
    def leave_figure_yi_plot(self):
        MouseLeavePlot(parent = self, plot_type = 'yi')
    def leave_figure_yt_plot(self):
        MouseLeavePlot(parent = self, plot_type = 'yt')
    def leave_figure_it_plot(self):
        MouseLeavePlot(parent = self, plot_type = 'it')
    def leave_figure_ix_plot(self):
        MouseLeavePlot(parent = self, plot_type = 'ix')
    def leave_figure_data_stitching_plot(self):
        MouseLeavePlot(parent = self, plot_type = 'stitching')

    # single click
    def single_click_data_yi_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'data', plot_type = 'yi')
    def single_click_norm_yi_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'norm', plot_type = 'yi')
    def single_click_norm_yt_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'norm', plot_type = 'yt')
    def single_click_data_yt_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'data', plot_type = 'yt')
    def single_click_norm_it_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'norm', plot_type = 'it')
    def single_click_data_it_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'data', plot_type = 'it')
    def single_click_norm_ix_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'norm', plot_type = 'ix')
    def single_click_data_ix_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'data', plot_type = 'ix')
    def single_click_data_stitching_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type = 'data', plot_type = 'stitching')

    # toggle log
    def logy_toggle_yt_plot(self, checked):
        LogPlotToggle(parent = self,
                      status = checked,
                      plot_type = 'yt',
                      is_y_log = True)
    def logy_toggle_it_plot(self, checked):
        LogPlotToggle(parnt = self,
                      status = checked,
                      plot_type = 'it',
                      is_y_log = True)
    def logy_toggle_ix_plot(self, checked):
        LogPlotToggle(parent = self,
                      status = checked,
                      plot_type = 'ix',
                      is_y_log = True)
    def logx_toggle_yi_plot(self, checked):
        LogPlotToggle(parent = self,
                      status = checked,
                      plot_type = 'yi',
                      is_y_log = False)
    def logx_toggle_data_stitching(self, checked):
        LogPlotToggle(parent = self,
                      status = checked,
                      plot_type = 'stitching',
                      is_y_log = False)
    def logy_toggle_data_stitching(self, checked):
        LogPlotToggle(parent = self,
                      status = checked,
                      plot_type = 'stitching',
                      is_y_log = True)

    # display row checkbox
    def reduction_table_visibility_changed_test(self, state, row):
        ReductionTableCheckBox(parent = self, row_selected = row)
        
    def table_reduction_cell_enter_pressed(self):
        row = self.ui.reductionTable.currentRow()
        col = self.ui.reductionTable.currentColumn()
        item = self.ui.reductionTable.item(row, col)
        if item is None:
            return
        self.select_next_field(current_row=row, current_col=col)
        runs = self.ui.reductionTable.item(row, col).text()
        UpdateReductionTable(parent=self, row=row, col=col, runs=runs)
        
    def select_next_field(self, current_row=-1, current_col=-1):
        # trick to be able to retrieve value in editing mode
        if current_row == self.ui.reductionTable.rowCount()-1:
            self.ui.reductionTable.setCurrentCell(0, 1)
        elif current_col == 1:
            self.ui.reductionTable.setCurrentCell(current_row, current_col+1)
        else:
            self.ui.reductionTable.setCurrentCell(current_row+1, current_col-1)
        
    def data_norm_tab_changed(self, index):
        o_gui_utility = GuiUtility(parent = self)
        _current_table_reduction_row_selected = o_gui_utility.get_current_table_reduction_check_box_checked()
        ReductionTableCheckBox(parent = self,
                               row_selected = _current_table_reduction_row_selected)
        
    @config_file_has_been_modified
    def widget_modified(self, value_changed):
        pass

    @config_file_has_been_modified
    def data_back_spinbox_validation(self):
        DataBackSpinbox(parent = self)
    
    @config_file_has_been_modified
    def data_back_checkbox(self):
        DataBackSpinbox(parent = self)
    
    @config_file_has_been_modified
    def data_peak_spinbox_validation(self):
        DataPeakSpinbox(parent = self)
    
    @config_file_has_been_modified
    def norm_back_spinbox_validation(self):
        NormBackSpinbox(parent = self)
        
    @config_file_has_been_modified
    def norm_back_checkbox(self):
        NormBackSpinbox(parent = self)
    
    @config_file_has_been_modified
    def norm_peak_spinbox_validation(self):
        NormPeakSpinbox(parent = self)

    @config_file_has_been_modified
    def data_low_res_validation(self):
        DataLowResSpinbox(parent = self)
        
    @config_file_has_been_modified
    def norm_low_res_validation(self):
        NormLowResSpinbox(parent = self)
        
    @config_file_has_been_modified
    def data_low_res_checkbox(self):
        DataLowResSpinbox(parent = self)
        
    @config_file_has_been_modified
    def norm_low_res_checkbox(self):
        NormLowResSpinbox(parent = self)
    
    @config_file_has_been_modified
    def clock_validation(self):
        DataClockingSpinbox(parent = self)
    
    @config_file_has_been_modified
    def auto_tof_range_radio_button(self):
        o_auto_tof_range = AutoTofRangeRadioButtonHandler(parent = self)
        o_auto_tof_range.setup()
        o_auto_tof_range.radio_button_handler()

    @config_file_has_been_modified
    def manual_tof_range_line_edit_validation(self):
        o_auto_tof_range = AutoTofRangeRadioButtonHandler(parent = self)
        o_auto_tof_range.setup()
        o_auto_tof_range.line_edit_validation()
        
    @config_file_has_been_modified
    def data_norm_sequence_event(self):
        self.data_sequence_event()
        self.norm_sequence_event()

    @config_file_has_been_modified
    def data_sequence_event(self):
        str_data_input = self.ui.data_sequence_lineEdit.text()
        ReductionTableAutoFill(parent = self,
                               list_of_run_from_input = str_data_input,
                               data_type_selected = 'data')
        self.ui.data_sequence_lineEdit.setText('')
        self.norm_sequence_event()
        
    @config_file_has_been_modified
    def norm_sequence_event(self):
        str_norm_input = self.ui.norm_sequence_lineEdit.text()
        ReductionTableAutoFill(parent = self,
                               list_of_run_from_input = str_norm_input,
                               data_type_selected = 'norm')
        self.ui.norm_sequence_lineEdit.setText('')
        
    def load_configuration(self):
        o_load_config = LoadingConfiguration(parent = self)
        o_load_config.run()
        
    @config_file_modification_reset
    def save_configuration(self):
        o_save_config = SavingConfiguration(parent = self,
                                            filename = self.current_loaded_file)
        o_save_config.run()
        
    def save_as_configuration(self):
        o_save_config = SavingConfiguration(parent = self)
        o_save_config.run()
        
    @config_file_has_been_modified
    def use_scaling_factor_checkbox(self, status):
        o_scaling_factor = ScalingFactorWidgetsHandler(parent = self)
        o_scaling_factor.checkbox(status = status)
        
    @config_file_has_been_modified
    def browse_scaling_factor_button(self):
        o_scaling_factor = ScalingFactorWidgetsHandler(parent = self)
        o_scaling_factor.browse()
        
    def preview_scaling_factor_button(self):
        o_sf_preview = SFPreview(parent=self)
        o_sf_preview.show()
        
    def run_reduction_button(self):
        o_live_reduction = LiveReductionHandler(parent = self)
        o_live_reduction.run()

        #o_reduction = ReductionHandler(parent = self)
        #o_reduction.run()
        #o_reduction.stitch()
        
        #o_reduced_plot = ReducedDataHandler(parent = self)
        #o_reduced_plot.populate_table()
        #o_reduced_plot.plot()

    def export_reduction_script_button(self):
        o_reduction = ReductionHandler(parent = self)
        o_reduction.export()

    def data_stitching_table_manual_spin_box(self):
        o_reduction = ReducedDataHandler(parent = self)
        o_reduction.save_manual_sf()
        self.stitching_sf_radio_button()
    
    def export_stitching_data(self):
        o_export_plot = ExportPlotAscii(parent = self,
                                        data_type = 'stitched')
        o_export_plot.export()
        
    def export_it(self):
        o_export_plot = ExportPlotAscii(parent = self,
                                        data_type = 'it')
        o_export_plot.export()
        
    def export_yi(self):
        o_export_plot = ExportPlotAscii(parent = self,
                                        data_type = 'yi')
        o_export_plot.export()
        
    def export_ix(self):
        o_export_plot = ExportPlotAscii(parent = self,
                                        data_type = 'ix')
        o_export_plot.export()
        
    def export_yt(self):
        o_export_plot = ExportPlotAscii(parent = self,
                                        data_type = 'yt')
        o_export_plot.export()
        
    @config_file_has_been_modified
    def reduction_table_right_click(self, position):
        o_reduction_table_right_click = ReductionTableRightClick(parent = self,
                                                                 position = position)
        o_reduction_table_right_click.run()
        
    def launch_metadata_finder(self):
        _meta_finder = MetadataFinder(parent = self)
        _meta_finder.show()        
        
    def launch_sf_calculator(self):
        o_sf_calculator = SFCalculator()
        o_sf_calculator.show()
        
    def stitching_sf_radio_button(self):
        o_reduced_plot = ReducedDataHandler(parent = self)
        o_reduced_plot.plot()
        
    def stitching_yscale_options_radio_button_1(self):
        '''R vs Q'''
        o_button_handler = StitchingYScaleOptionsRadioButtonHandler(parent = self)
        o_button_handler.set_index_button_clicked(index = 0)
        self.stitching_sf_radio_button()
        
    def stitching_yscale_options_radio_button_2(self):
        '''RQ^4 vs Q'''
        o_button_handler = StitchingYScaleOptionsRadioButtonHandler(parent = self)
        o_button_handler.set_index_button_clicked(index = 1)
        self.stitching_sf_radio_button()

    def stitching_yscale_options_radio_button_3(self):
        '''LogR vs Q'''
        o_button_handler = StitchingYScaleOptionsRadioButtonHandler(parent = self)
        o_button_handler.set_index_button_clicked(index = 2)
        self.stitching_sf_radio_button()
        
    def load_reduced_data_set_button(self):
        o_load_reduced_set = LoadReducedDataSetHandler(parent = self)
        o_load_reduced_set.run()
        
    # display row of reduced ascii table
    def reduced_ascii_data_set_table_visibility_changed(self, state):
        o_load_reduced = LoadReducedDataSetHandler(parent = self)
        o_load_reduced.plot()

    def reduced_ascii_data_set_table_right_click(self, position):
        o_reduced_ascii_right_click = ReducedAsciiDataRightClick(parent = self,
                                                                 position = position)
        o_reduced_ascii_right_click.run()
        
    def closeEvent(self, event=None):
        SaveUserConfiguration(parent = self)
        
        
예제 #4
0
class MainGui(QtGui.QMainWindow):
    ''' Top class that handles the GUI '''
    file_loaded_signal = QtCore.pyqtSignal()

    # default location
    path_ascii = '.'  # ascii file such as scaling factor file
    path_config = '/home/j35/sandbox'  # config file of RefRed

    full_scaling_factor_file_name = ''
    default_loaded_file = '~/tmp.xml'
    current_loaded_file = '~/tmp.xml'
    browsed_files = {'data': None, 'norm': None}
    current_ipts = ""

    o_user_configuration = None  # will record the various settings of the GUI defined by the user
    o_stitching_ascii_widget = None  # used when loading ascii files in reduced tab

    manual_x_axis_dialog = None
    manual_y_axis_dialog = None

    nbr_row_table_reduction = 39
    nbr_row_table_ascii = 8
    prev_table_reduction_row_selected = -1
    current_table_reduction_row_selected = -1
    reduction_table_check_box_state = np.zeros((nbr_row_table_reduction),
                                               dtype=bool)
    loading_nxs_thread = {
        'thread1': None,
        'thread2': None,
        'thread3': None,
        'thread4': None,
        'thread5': None,
        'thread6': None,
        'thread7': None,
        'thread8': None,
        'thread9': None,
        'thread10': None,
        'thread11': None,
        'thread12': None,
        'thread13': None,
        'thread14': None,
        'thread15': None,
        'thread16': None,
        'thread17': None,
        'thread18': None,
        'thread19': None,
        'thread20': None,
        'thread21': None,
        'thread22': None,
        'thread23': None,
        'thread24': None,
        'thread25': None,
        'thread26': None,
        'thread27': None,
        'thread28': None
    }
    index_free_thread = 0

    time_click1 = 0  #use by double click of plots

    #[data, norm, lconfig]
    big_table_data = np.empty((nbr_row_table_reduction, 3), dtype=object)

    # various metadata such as q_min (for output reduced ascii)
    gui_metadata = {}

    def __init__(self, argv=[], parent=None):
        if parent is None:
            QtGui.QMainWindow.__init__(self)
        else:
            QtGui.QMainWindow.__init__(self, parent, QtCore.Qt.Window)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        InitializeSettings(self)
        InitializeGui(self)
        self.ui.reductionTable.setUI(self)
        MakeGuiConnections(parent=self)
        RetrieveUserConfiguration(parent=self)

        self.file_loaded_signal.connect(self.file_loaded)
        log_file = os.path.expanduser("~") + '/.refred.log'
        logging.basicConfig(filename=log_file, level=logging.DEBUG)

    # home button of plots
    def home_clicked_yi_plot(self):
        HomePlotButtonClicked(parent=self, plot_type='yi')

    def home_clicked_yt_plot(self):
        HomePlotButtonClicked(parent=self, plot_type='yt')

    def home_clicked_it_plot(self):
        HomePlotButtonClicked(parent=self, plot_type='it')

    def home_clicked_ix_plot(self):
        HomePlotButtonClicked(parent=self, plot_type='ix')

    def home_clicked_data_stitching_plot(self):
        HomePlotButtonClicked(parent=self, plot_type='stitching')

    # leave figure
    def leave_figure_yi_plot(self):
        MouseLeavePlot(parent=self, plot_type='yi')

    def leave_figure_yt_plot(self):
        MouseLeavePlot(parent=self, plot_type='yt')

    def leave_figure_it_plot(self):
        MouseLeavePlot(parent=self, plot_type='it')

    def leave_figure_ix_plot(self):
        MouseLeavePlot(parent=self, plot_type='ix')

    def leave_figure_data_stitching_plot(self):
        MouseLeavePlot(parent=self, plot_type='stitching')

    # single click
    def single_click_data_yi_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='data', plot_type='yi')

    def single_click_norm_yi_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='norm', plot_type='yi')

    def single_click_norm_yt_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='norm', plot_type='yt')

    def single_click_data_yt_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='data', plot_type='yt')

    def single_click_norm_it_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='norm', plot_type='it')

    def single_click_data_it_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='data', plot_type='it')

    def single_click_norm_ix_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='norm', plot_type='ix')

    def single_click_data_ix_plot(self, isPanOrZoomActivated):
        SingleClickPlot(self, data_type='data', plot_type='ix')

    def single_click_data_stitching_plot(self, isPanOrZoomActivated,
                                         is_manual_zoom_requested,
                                         is_x_axis_manual_zoom_requested,
                                         mouse_x, mouse_y):
        SingleClickPlot(
            self,
            data_type='data',
            plot_type='stitching',
            is_manual_zoom_requested=is_manual_zoom_requested,
            is_x_axis_manual_zoom_requested=is_x_axis_manual_zoom_requested,
            mouse_x=mouse_x,
            mouse_y=mouse_y)

    # toggle log
    def logy_toggle_yt_plot(self, checked):
        LogPlotToggle(parent=self,
                      status=checked,
                      plot_type='yt',
                      is_y_log=True)

    def logy_toggle_it_plot(self, checked):
        LogPlotToggle(parnt=self,
                      status=checked,
                      plot_type='it',
                      is_y_log=True)

    def logy_toggle_ix_plot(self, checked):
        LogPlotToggle(parent=self,
                      status=checked,
                      plot_type='ix',
                      is_y_log=True)

    def logx_toggle_yi_plot(self, checked):
        LogPlotToggle(parent=self,
                      status=checked,
                      plot_type='yi',
                      is_y_log=False)

    def logx_toggle_data_stitching(self, checked):
        LogPlotToggle(parent=self,
                      status=checked,
                      plot_type='stitching',
                      is_y_log=False)

    def logy_toggle_data_stitching(self, checked):
        LogPlotToggle(parent=self,
                      status=checked,
                      plot_type='stitching',
                      is_y_log=True)

    # display row checkbox
    def reduction_table_visibility_changed_test(self, state, row):
        ReductionTableCheckBox(parent=self, row_selected=row)

    def file_loaded(self):
        """ Event call-back used to re-enable the reduction table after loading """
        self.ui.reductionTable.setEnabled(True)

    def table_reduction_cell_enter_pressed(self):
        """
            Deal with enter being pressed in a cell of the reduction table.
            To ensure that we don't keep unused data in memory, check
            whether we need to removed a run from memory.
        """
        row = self.ui.reductionTable.currentRow()
        col = self.ui.reductionTable.currentColumn()
        item = self.ui.reductionTable.item(row, col)
        if item is None:
            return
        self.select_next_field(current_row=row, current_col=col)
        runs = self.ui.reductionTable.item(row, col).text()
        # The application will dump core if it tries to load two files
        # at the same time, so ensure that this doesn't happen by
        # disabling the reduction table before loading.
        self.ui.reductionTable.setEnabled(False)
        UpdateReductionTable(parent=self, row=row, col=col, runs=runs)

    def select_next_field(self, current_row=-1, current_col=-1):
        # trick to be able to retrieve value in editing mode
        if current_row == self.ui.reductionTable.rowCount() - 1:
            self.ui.reductionTable.setCurrentCell(0, 1)
        elif current_col == 1:
            self.ui.reductionTable.setCurrentCell(current_row, current_col + 1)
        else:
            self.ui.reductionTable.setCurrentCell(current_row + 1,
                                                  current_col - 1)

    def data_norm_tab_changed(self, index):
        o_gui_utility = GuiUtility(parent=self)
        _current_table_reduction_row_selected = o_gui_utility.get_current_table_reduction_check_box_checked(
        )
        ReductionTableCheckBox(
            parent=self, row_selected=_current_table_reduction_row_selected)

    @config_file_has_been_modified
    def widget_modified(self, value_changed):
        pass

    @config_file_has_been_modified
    def data_back_spinbox_validation(self):
        DataBackSpinbox(parent=self)

    @config_file_has_been_modified
    def data_back_checkbox(self):
        DataBackSpinbox(parent=self)

    @config_file_has_been_modified
    def data_peak_spinbox_validation(self):
        DataPeakSpinbox(parent=self)

    @config_file_has_been_modified
    def norm_back_spinbox_validation(self):
        NormBackSpinbox(parent=self)

    @config_file_has_been_modified
    def norm_back_checkbox(self):
        NormBackSpinbox(parent=self)

    @config_file_has_been_modified
    def norm_peak_spinbox_validation(self):
        NormPeakSpinbox(parent=self)

    @config_file_has_been_modified
    def data_low_res_validation(self):
        DataLowResSpinbox(parent=self)

    @config_file_has_been_modified
    def norm_low_res_validation(self):
        NormLowResSpinbox(parent=self)

    @config_file_has_been_modified
    def data_low_res_checkbox(self):
        DataLowResSpinbox(parent=self)

    @config_file_has_been_modified
    def norm_low_res_checkbox(self):
        NormLowResSpinbox(parent=self)

    @config_file_has_been_modified
    def clock_validation(self):
        DataClockingSpinbox(parent=self)

    @config_file_has_been_modified
    def auto_tof_range_radio_button(self):
        o_auto_tof_range = AutoTofRangeRadioButtonHandler(parent=self)
        o_auto_tof_range.setup()
        o_auto_tof_range.radio_button_handler()

    @config_file_has_been_modified
    def manual_tof_range_line_edit_validation(self):
        o_auto_tof_range = AutoTofRangeRadioButtonHandler(parent=self)
        o_auto_tof_range.setup()
        o_auto_tof_range.line_edit_validation()

    @config_file_has_been_modified
    def data_norm_sequence_event(self):
        self.data_sequence_event()
        self.norm_sequence_event()

    @config_file_has_been_modified
    def data_sequence_event(self):
        str_data_input = self.ui.data_sequence_lineEdit.text()
        ReductionTableAutoFill(parent=self,
                               list_of_run_from_input=str_data_input,
                               data_type_selected='data')
        self.ui.data_sequence_lineEdit.setText('')
        self.norm_sequence_event()

    @config_file_has_been_modified
    def data_browse_button(self):
        o_browser = BrowsingRuns(parent=self, data_type='data')
        ReductionTableAutoFill(parent=self,
                               list_of_run_from_input='',
                               data_type_selected='data')
        self.ui.data_sequence_lineEdit.setText('')

    @config_file_has_been_modified
    def norm_sequence_event(self):
        str_norm_input = self.ui.norm_sequence_lineEdit.text()
        ReductionTableAutoFill(parent=self,
                               list_of_run_from_input=str_norm_input,
                               data_type_selected='norm')
        self.ui.norm_sequence_lineEdit.setText('')

    @config_file_has_been_modified
    def norm_browse_button(self):
        o_browser = BrowsingRuns(parent=self, data_type='norm')
        ReductionTableAutoFill(parent=self,
                               list_of_run_from_input='',
                               data_type_selected='norm')
        self.ui.norm_sequence_lineEdit.setText('')

    # Menu buttons
    def action_new(self):
        o_reduction_table_handler = ReductionTableHandler(parent=self)
        o_reduction_table_handler.full_clear()

        o_interface_handler = RefRedInterfaceHandler(parent=self)
        o_interface_handler.full_reset()

    def load_configuration(self):
        o_load_config = LoadingConfiguration(parent=self)
        o_load_config.run()

    @config_file_modification_reset
    def save_configuration(self):
        o_save_config = SavingConfiguration(parent=self,
                                            filename=self.current_loaded_file)
        o_save_config.run()

    def save_as_configuration(self):
        o_save_config = SavingConfiguration(parent=self)
        o_save_config.run()

    def preview_live_config(self):
        o_preview_config = PreviewConfig(parent=self, is_live=True)
        o_preview_config.show()

    def preview_browse_config(self):
        o_preview_config = PreviewConfig(parent=self, is_live=False)
        o_preview_config.show()

    @config_file_has_been_modified
    def use_scaling_factor_checkbox(self, status):
        o_scaling_factor = ScalingFactorWidgetsHandler(parent=self)
        o_scaling_factor.checkbox(status=status)

    @config_file_has_been_modified
    def browse_scaling_factor_button(self):
        o_scaling_factor = ScalingFactorWidgetsHandler(parent=self)
        o_scaling_factor.browse()

    def preview_scaling_factor_button(self):
        o_sf_preview = SFPreview(parent=self)
        o_sf_preview.show()

    def run_reduction_button(self):
        o_live_reduction = LiveReductionHandler(parent=self)
        o_live_reduction.run()

    def launch_template_management(self):
        o_template = TemplateManagement(parent=self)
        o_template.show()
        o_template.load_default_directory()

    def export_reduction_script_button(self):
        o_reduction = LiveReductionHandler(parent=self)
        o_reduction.export()

    def data_stitching_table_manual_spin_box(self):
        o_reduction = ReducedDataHandler(parent=self)
        o_reduction.save_manual_sf()
        self.stitching_sf_radio_button()

    def export_stitching_data(self):
        o_export_plot = ExportPlotAscii(parent=self, data_type='stitched')
        o_export_plot.export()

    def export_it(self):
        o_export_plot = ExportPlotAscii(parent=self, data_type='it')
        o_export_plot.export()

    def export_yi(self):
        o_export_plot = ExportPlotAscii(parent=self, data_type='yi')
        o_export_plot.export()

    def export_ix(self):
        o_export_plot = ExportPlotAscii(parent=self, data_type='ix')
        o_export_plot.export()

    def export_yt(self):
        o_export_plot = ExportPlotAscii(parent=self, data_type='yt')
        o_export_plot.export()

    @config_file_has_been_modified
    def reduction_table_right_click(self, position):
        o_reduction_table_right_click = ReductionTableRightClick(
            parent=self, position=position)
        o_reduction_table_right_click.run()

    def launch_metadata_finder(self):
        _meta_finder = MetadataFinder(parent=self)
        _meta_finder.show()

    def launch_sf_calculator(self):
        """
            Launch the scaling factor calculator
        """
        # We need to keep a reference to the created object for pyqt to properly start it.
        self.sf_calculator = SFCalculator()
        self.sf_calculator.show()

    def stitching_sf_radio_button(self):
        o_reduced_plot = ReducedDataHandler(parent=self)
        o_reduced_plot.plot()

    def stitching_yscale_options_radio_button_1(self):
        '''R vs Q'''
        o_button_handler = StitchingYScaleOptionsRadioButtonHandler(
            parent=self)
        o_button_handler.set_index_button_clicked(index=0)
        self.stitching_sf_radio_button()

    def stitching_yscale_options_radio_button_2(self):
        '''RQ^4 vs Q'''
        o_button_handler = StitchingYScaleOptionsRadioButtonHandler(
            parent=self)
        o_button_handler.set_index_button_clicked(index=1)
        self.stitching_sf_radio_button()

    def load_reduced_data_set_button(self):
        o_load_reduced_set = LoadReducedDataSetHandler(parent=self)
        o_load_reduced_set.run()

    # display row of reduced ascii table
    def reduced_ascii_data_set_table_visibility_changed(self, state):
        o_load_reduced = LoadReducedDataSetHandler(parent=self)
        o_load_reduced.plot()

    def reduced_ascii_data_set_table_right_click(self, position):
        o_reduced_ascii_right_click = ReducedAsciiDataRightClick(
            parent=self, position=position)
        o_reduced_ascii_right_click.run()

    def sf_absolute_normalization_button(self):
        norm_or_stitching_object = NormalizationOrStitchingButtonStatus(
            parent=self)
        norm_or_stitching_object.setWidget(activated_button=0)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def sf_auto_stitching_button(self):
        norm_or_stitching_object = NormalizationOrStitchingButtonStatus(
            parent=self)
        norm_or_stitching_object.setWidget(activated_button=1)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def sf_manual_stitching_button(self):
        norm_or_stitching_object = NormalizationOrStitchingButtonStatus(
            parent=self)
        norm_or_stitching_object.setWidget(activated_button=2)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def sf_button(self):
        first_angle_handler = FirstAngleRangeGuiHandler(parent=self)
        first_angle_handler.setWidgets(is_sf_button_clicked=True)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def first_angle_range_button(self):
        first_angle_handler = FirstAngleRangeGuiHandler(parent=self)
        first_angle_handler.setWidgets(is_sf_button_clicked=False)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def sf_qmin_value_field(self):
        norm_or_stitching_object = NormalizationOrStitchingButtonStatus(
            parent=self)
        norm_or_stitching_object.setWidget(activated_button=0)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def sf_qmax_value_field(self):
        norm_or_stitching_object = NormalizationOrStitchingButtonStatus(
            parent=self)
        norm_or_stitching_object.setWidget(activated_button=0)
        live_reduction = LiveReductionHandler(parent=self)
        live_reduction.recalculate()

    def about_message(self):
        o_about_message = AboutDialog(parent=self)
        o_about_message.display()

    def settings_editor(self):
        o_settings_editor = SettingsEditor(parent=self)
        o_settings_editor.show()

    def closeEvent(self, event=None):
        SaveUserConfiguration(parent=self)