Пример #1
0
    def _handle_extract_device(self, new):
        app = self.window.application
        if new:
            ed = convert_extract_device(new)
            man = app.get_service(ILaserManager, 'name=="{}"'.format(ed))
            if man:
                self.laser_control_client_pane.model = man

        if new == 'Fusions UV':
            if self.active_editor and not isinstance(self.active_editor, UVExperimentEditor):
                editor = UVExperimentEditor()

                ms = self.manager.experiment_factory.queue_factory.mass_spectrometer
                editor.new_queue(mass_spectrometer=ms)
                editor.dirty = False

                #print self.active_editor
                #ask user to copy runs into the new editor
                ans = self.active_editor.queue.cleaned_automated_runs
                if ans:
                    if self.confirmation_dialog('Copy runs to the new UV Editor?'):
                        #editor.queue.executed_runs=self.active_editor.queue.executed_runs
                        editor.queue.automated_runs = self.active_editor.queue.automated_runs

                        #self.warning_dialog('Copying runs not yet implemented')

                self.active_editor.close()

                self._open_editor(editor)
                if not self.manager.executor.isAlive():
                    self.manager.executor.executable = False
Пример #2
0
    def _handle_extract_device(self, new):
        if new:
            if self.window:
                app = self.window.application
                ed = convert_extract_device(new)
                man = app.get_service(ILaserManager, 'name=="{}"'.format(ed))
                if man:
                    if self.laser_control_client_pane:
                        self.laser_control_client_pane.model = man

        if new == 'Fusions UV':
            if self.active_editor and not isinstance(self.active_editor,
                                                     UVExperimentEditor):
                editor = UVExperimentEditor()

                ms = self.manager.experiment_factory.queue_factory.mass_spectrometer
                editor.new_queue(mass_spectrometer=ms)
                editor.dirty = False

                # print self.active_editor
                # ask user to copy runs into the new editor
                ans = self.active_editor.queue.cleaned_automated_runs
                if ans:
                    if self.confirmation_dialog(
                            'Copy runs to the new UV Editor?'):
                        # editor.queue.executed_runs=self.active_editor.queue.executed_runs
                        editor.queue.automated_runs = self.active_editor.queue.automated_runs

                        # self.warning_dialog('Copying runs not yet implemented')

                self.active_editor.close()

                self._open_editor(editor)
                if not self.manager.executor.is_alive():
                    self.manager.executor.executable = False
Пример #3
0
    def _check_for_managers(self, exp):
        nonfound = []
        if self.extraction_line_manager is None:
            nonfound.append('extraction_line')

        if exp.extract_device and exp.extract_device not in (NULL_STR, 'Extract Device'):
            extract_device = convert_extract_device(exp.extract_device)
            #extract_device = exp.extract_device.replace(' ', '_').lower()
            man = None
            if self.application:
                man = self.application.get_service(ILaserManager, 'name=="{}"'.format(extract_device))

            if not man:
                nonfound.append(extract_device)
            elif man.mode == 'client':
                if not man.test_connection():
                    nonfound.append(extract_device)

        needs_spec_man = any([ai.measurement_script
                              for ai in exp.cleaned_automated_runs
                              if ai.state == 'not run'])

        if self.spectrometer_manager is None and needs_spec_man:
            nonfound.append('spectrometer')

        return nonfound
Пример #4
0
    def _check_for_managers(self, exp):
        nonfound = []
        if self.extraction_line_manager is None:
            nonfound.append('extraction_line')

        if exp.extract_device and exp.extract_device not in (NULL_STR,
                                                             'Extract Device'):
            extract_device = convert_extract_device(exp.extract_device)
            #extract_device = exp.extract_device.replace(' ', '_').lower()
            man = None
            if self.application:
                man = self.application.get_service(
                    ILaserManager, 'name=="{}"'.format(extract_device))

            if not man:
                nonfound.append(extract_device)
            elif man.mode == 'client':
                if not man.test_connection():
                    nonfound.append(extract_device)

        needs_spec_man = any([
            ai.measurement_script for ai in exp.cleaned_automated_runs
            if ai.state == 'not run'
        ])

        if self.spectrometer_manager is None and needs_spec_man:
            nonfound.append('spectrometer')

        return nonfound
Пример #5
0
    def _get_patterns(self, ed):
        ps = []
        service_name = convert_extract_device(ed)
        # service_name = ed.replace(' ', '_').lower()
        man = self.application.get_service(ILaserManager, 'name=="{}"'.format(service_name))
        if man:
            ps = man.get_pattern_names()
        else:
            self.debug('No remote patterns. {} ({}) not available'.format(ed, service_name))

        return ps
Пример #6
0
 def make_script_context(self):
     hdn = convert_extract_device(self.extract_device)
     an = self.analysis_type.split('_')[0]
     ctx = dict(tray=self.tray,
                position=self.get_position_list(),
                disable_between_positions=self.disable_between_positions,
                duration=self.duration,
                extract_value=self.extract_value,
                extract_units=self.extract_units,
                cleanup=self.cleanup,
                extract_device=hdn,
                analysis_type=an,
                ramp_rate=self.ramp_rate,
                pattern=self.pattern,
                beam_diameter=self.beam_diameter,
                ramp_duration=self.ramp_duration)
     return ctx
Пример #7
0
    def make_script_context(self):
        hdn = convert_extract_device(self.extract_device)

        an = self.analysis_type.split('_')[0]
        ctx = dict(tray=self.tray,
                   position=self.get_position_list(),
                   disable_between_positions=self.disable_between_positions,
                   duration=self.duration,
                   extract_value=self.extract_value,
                   extract_units=self.extract_units,
                   cleanup=self.cleanup,
                   extract_device=hdn,
                   analysis_type=an,
                   ramp_rate=self.ramp_rate,
                   pattern=self.pattern,
                   beam_diameter=self.beam_diameter,
                   ramp_duration=self.ramp_duration)
        return ctx