Exemple #1
0
    def setup_layout(self, load_last=False):
        """
            Sets up the instrument-specific part of the UI layout
        """
        # Clean up the widgets that have already been created
        self.tabWidget.clear()
        self.progress_bar.hide()

        if self._instrument == '' or self._instrument is None:
            return self._change_instrument()

        self._update_file_menu()

        if self._interface is not None:
            self._interface.destroy()

        self.general_settings.instrument_name = self._instrument
        # Find corresponding facility
        if self._facility is None:
            for facility in INSTRUMENT_DICT.keys():
                if self._instrument in INSTRUMENT_DICT[facility].keys():
                    self._facility = facility
                    break
        if self._facility is None:
            self._facility = ConfigService.Instance().getFacility().name()

        self.general_settings.facility_name = self._facility
        self._interface = instrument_factory(self._instrument, settings=self.general_settings)

        if self._interface is not None:
            tab_list = self._interface.get_tabs()
            for tab in tab_list:
                self.tabWidget.addTab(tab[1], tab[0])
            self._set_window_title()

            # Show the "advanced interface" check box if needed
            if self._interface.has_advanced_version():
                self.interface_chk.show()
            else:
                self.interface_chk.hide()

            # Show the parallel reduction button if enabled
            if self._interface.is_cluster_enabled() and IS_IN_MANTIDPLOT \
            and CLUSTER_ENABLED:
                config = ConfigService.Instance()
                if config.hasProperty("cluster.submission") \
                and config.getString("cluster.submission").lower()=='on':
                    self.cluster_button.show()
                    self.connect(self.cluster_button, QtCore.SIGNAL("clicked()"), self.cluster_clicked)
            else:
                self.cluster_button.hide()

            if load_last:
                self._interface.load_last_reduction()
        else:
            print "Could not generate an interface for instrument %s" % self._instrument
            self.close()

        return True
            def __init__(self, instrument_list=None):
                QDialog.__init__(self)
                self.ui = load_ui(__file__, 'ui/instrument_dialog.ui', baseinstance=self)
                self.instrument_list = instrument_list
                self.instr_combo.clear()
                self.facility_combo.clear()
                instruments = sorted(INSTRUMENT_DICT.keys())
                instruments.reverse()
                for facility in instruments:
                    self.facility_combo.addItem(facility)

                self._facility_changed(instruments[0])
                self.facility_combo.activated.connect(self._facility_changed)
            def __init__(self, instrument_list=None):
                QtGui.QDialog.__init__(self)
                self.instrument_list = instrument_list
                self.setupUi(self)
                self.instr_combo.clear()
                self.facility_combo.clear()
                instruments = sorted(INSTRUMENT_DICT.keys())
                instruments.reverse()
                for facility in instruments:
                    self.facility_combo.addItem(QtGui.QApplication.translate("Dialog", facility, None, QtGui.QApplication.UnicodeUTF8))

                self._facility_changed(instruments[0])
                self.connect(self.facility_combo, QtCore.SIGNAL("activated(QString)"), self._facility_changed)
            def __init__(self, instrument_list=None):
                QtGui.QDialog.__init__(self)
                self.instrument_list = instrument_list
                self.setupUi(self)
                self.instr_combo.clear()
                self.facility_combo.clear()
                instruments = sorted(INSTRUMENT_DICT.keys())
                instruments.reverse()
                for facility in instruments:
                    self.facility_combo.addItem(QtGui.QApplication.translate("Dialog", facility, None, QtGui.QApplication.UnicodeUTF8))

                self._facility_changed(instruments[0])
                self.connect(self.facility_combo, QtCore.SIGNAL("activated(QString)"), self._facility_changed)
    def setup_layout(self, load_last=False):
        """
            Sets up the instrument-specific part of the UI layout
        """
        # Clean up the widgets that have already been created
        self.tabWidget.clear()
        self.progress_bar.hide()

        if self._instrument == '' or self._instrument is None:
            return self._change_instrument()

        self._update_file_menu()

        if self._interface is not None:
            self._interface.destroy()

        self.general_settings.instrument_name = self._instrument
        # Find corresponding facility
        if self._facility is None:
            for facility in INSTRUMENT_DICT.keys():
                if self._instrument in INSTRUMENT_DICT[facility].keys():
                    self._facility = facility
                    break
        if self._facility is None:
            self._facility = ConfigService.Instance().getFacility().name()

        self.general_settings.facility_name = self._facility
        self._interface = instrument_factory(self._instrument,
                                             settings=self.general_settings)

        if self._interface is not None:
            tab_list = self._interface.get_tabs()
            for tab in tab_list:
                self.tabWidget.addTab(tab[1], tab[0])
            self._set_window_title()

            # Show the "advanced interface" check box if needed
            if self._interface.has_advanced_version():
                self.interface_chk.show()
            else:
                self.interface_chk.hide()

            if load_last:
                self._interface.load_last_reduction()
        else:
            print("Could not generate an interface for instrument %s" %
                  self._instrument)
            self.close()

        return True
            def __init__(self, instrument_list=None):
                QDialog.__init__(self)
                self.ui = load_ui(__file__, 'ui/instrument_dialog.ui', baseinstance=self)
                self.instrument_list = instrument_list
                self.instr_combo.clear()
                self.facility_combo.clear()
                facilities = sorted([fac for fac in INSTRUMENT_DICT.keys() if
                                     any([inst in INSTRUMENT_DICT[fac] for inst in instrument_list])])
                facilities.reverse()
                for facility in facilities:
                    self.facility_combo.addItem(facility)

                self._facility_changed(facilities[0])
                self.facility_combo.activated.connect(self._facility_changed)
    def setup_layout(self, load_last=False):
        """
            Sets up the instrument-specific part of the UI layout
        """
        # Clean up the widgets that have already been created
        self.tabWidget.clear()
        self.progress_bar.hide()

        if self._instrument == '' or self._instrument is None:
            return self._change_instrument()

        self._update_file_menu()

        if self._interface is not None:
            self._interface.destroy()

        self.general_settings.instrument_name = self._instrument
        # Find corresponding facility
        if self._facility is None:
            for facility in INSTRUMENT_DICT.keys():
                if self._instrument in INSTRUMENT_DICT[facility].keys():
                    self._facility = facility
                    break
        if self._facility is None:
            self._facility = ConfigService.Instance().getFacility().name()

        self.general_settings.facility_name = self._facility
        self._interface = instrument_factory(self._instrument, settings=self.general_settings)

        if self._interface is not None:
            tab_list = self._interface.get_tabs()
            for tab in tab_list:
                self.tabWidget.addTab(tab[1], tab[0])
            self._set_window_title()

            # Show the "advanced interface" check box if needed
            if self._interface.has_advanced_version():
                self.interface_chk.show()
            else:
                self.interface_chk.hide()

            if load_last:
                self._interface.load_last_reduction()
        else:
            print("Could not generate an interface for instrument %s" % self._instrument)
            self.close()

        return True
    def setup_layout(self, load_last=False):
        """
            Sets up the instrument-specific part of the UI layout
        """
        # Clean up the widgets that have already been created
        self.tabWidget.clear()
        self.progress_bar.hide()

        if self._instrument == '' or self._instrument is None:
            self._change_instrument()
            return

        # Commented out to solve a bug where setting ARCS as your default
        # instrument means you get the DGS interface when clicking ORNL_SANS..
#        if self._instrument == '' or self._instrument is None:
#            if IS_IN_MANTIDPLOT:
#                from mantid.kernel import ConfigService
#                c = ConfigService.Instance()
#                facility = str(c.getFacility())
#                if facility in INSTRUMENT_DICT.keys():
#                    instr = str(c.getFacility().instrument(""))
#                    instr = instr.replace("-","")
#                    if instr in INSTRUMENT_DICT[facility].keys():
#                        self._instrument = instr
#                        
#                # If we still can't find an instrument, show the
#                # instrument selection dialog
#                if self._instrument == '' or self._instrument is None:
#                    self._change_instrument()
#                    return
#            else:
#                self._change_instrument()
#                return
#                
#        if self._instrument == '' or self._instrument is None:
#            self.close()
#            self._quit_asap = True
#            return
        
        self._update_file_menu()

        if self._interface is not None:
            self._interface.destroy()
            
        self.general_settings.instrument_name = self._instrument
        # Find corresponding facility
        if self._facility is None:
            for facility in INSTRUMENT_DICT.keys():
                if self._instrument in INSTRUMENT_DICT[facility].keys():
                    self._facility = facility
                    break
        if self._facility is None:
            self._facility = str(c.facility().name())
                
        self.general_settings.facility_name = self._facility
        self._interface = instrument_factory(self._instrument, settings=self.general_settings)
        
        if self._interface is not None:
            tab_list = self._interface.get_tabs()
            for tab in tab_list:
                self.tabWidget.addTab(tab[1], tab[0])
            self._set_window_title()
            
            # Show the "advanced interface" check box if needed
            if self._interface.has_advanced_version():
                self.interface_chk.show()
            else:
                self.interface_chk.hide()
            
            if load_last:
                self._interface.load_last_reduction()
        else:
            self.close()