Exemplo n.º 1
0
    def load(self, path, save_as):
        yd = None
        if path:
            root, name = os.path.split(path)
            p = get_path(root, name, ('.yaml', '.yml'))
            if p:
                if not save_as:
                    self.path = p

                with open(p, 'r') as rfile:
                    yd = yaml.load(rfile)

        if 'pre_run_terminations' in self.group_names:
            grp = self._group_factory(yd, EPreRunGroup, name='pre_run_terminations',
                                      label='PreRunTerminations',
                                      editable=True)
            grp.available_attrs = self.detectors

        for name, klass, cklass, label in (('actions', ActionGroup, ActionConditional, 'Actions'),
                                           ('truncations', TruncationGroup, TruncationConditional, 'Truncations'),
                                           ('cancelations', CancelationGroup, CancelationConditional, 'Cancelations'),
                                           ('terminations', TerminationGroup, TerminationConditional, 'Terminations'),
                                           ('post_run_terminations', EPostRunGroup, TerminationConditional,
                                            'PostRunTerminations')):
            if name in self.group_names:
                grp = self._group_factory(yd, klass, conditional_klass=cklass, name=name, label=label, editable=True)
                if name == 'post_run_terminations':
                    grp.available_attrs = self.detectors
                    # setattr(self, '{}_group'.format(name), grp)
                    # self.pre_run_terminations_group = grp

        self.selected_group = self.groups[0]
Exemplo n.º 2
0
    def load(self, path, save_as):

        root, name = os.path.split(path)
        p = get_path(root, name, ('.yaml', '.yml'))
        yd = None
        if p:
            if not save_as:
                self.path = p

            with open(p, 'r') as fp:
                yd = yaml.load(fp)

        for name, klass, cklass in (('actions', ConditionalGroup, ActionConditional),
                                    ('truncations', ConditionalGroup, TruncationConditional),
                                    ('cancelations', ConditionalGroup, CancelationConditional),
                                    ('terminations', ConditionalGroup, TerminationConditional),
                                    ('post_run_terminations', PostRunGroup, TerminationConditional)):
            if name in self.group_names:
                grp = self._group_factory(yd, name, klass, cklass)
                setattr(self, '{}_group'.format(name), grp)

        if 'pre_run_terminations' in self.group_names:
            grp = self._group_factory(yd, 'pre_run_terminations', PreRunGroup)
            grp.available_attrs = self.detectors
            self.pre_run_terminations_group = grp
Exemplo n.º 3
0
    def perform(self, event):
        from pychron.experiment.conditional.conditionals_edit_view import edit_conditionals

        task = event.task
        dnames = None
        spec = task.application.get_service(
            'pychron.spectrometer.base_spectrometer_manager.BaseSpectrometerManager')
        if spec:
            dnames = spec.spectrometer.detector_names

        p = get_path(paths.spectrometer_dir, '.*conditionals', ('.yaml','.yml'))
        if p:
            edit_conditionals(p, detectors=dnames, app=task.application)
        else:
            warning(None, 'No system conditionals file at {}'.format(p))
Exemplo n.º 4
0
    def load(self, path, save_as):
        yd = None
        if path:
            root, name = os.path.split(path)
            p = get_path(root, name, ('.yaml', '.yml'))
            if p:
                if not save_as:
                    self.path = p

                with open(p, 'r') as rfile:
                    yd = yaml.load(rfile)

        if 'pre_run_terminations' in self.group_names:
            grp = self._group_factory(yd,
                                      EPreRunGroup,
                                      name='pre_run_terminations',
                                      label='PreRunTerminations',
                                      editable=True)
            grp.available_attrs = self.detectors

        for name, klass, cklass, label in (('actions', ActionGroup,
                                            ActionConditional, 'Actions'),
                                           ('truncations', TruncationGroup,
                                            TruncationConditional,
                                            'Truncations'),
                                           ('cancelations', CancelationGroup,
                                            CancelationConditional,
                                            'Cancelations'),
                                           ('terminations', TerminationGroup,
                                            TerminationConditional,
                                            'Terminations'),
                                           ('post_run_terminations',
                                            EPostRunGroup,
                                            TerminationConditional,
                                            'PostRunTerminations')):
            if name in self.group_names:
                grp = self._group_factory(yd,
                                          klass,
                                          conditional_klass=cklass,
                                          name=name,
                                          label=label,
                                          editable=True)
                if name == 'post_run_terminations':
                    grp.available_attrs = self.detectors
                    # setattr(self, '{}_group'.format(name), grp)
                    # self.pre_run_terminations_group = grp

        self.selected_group = self.groups[0]
Exemplo n.º 5
0
    def perform(self, event):
        from pychron.experiment.conditional.conditionals_edit_view import edit_conditionals

        task = event.task
        dnames = None
        spec = task.application.get_service(
            'pychron.spectrometer.base_spectrometer_manager.BaseSpectrometerManager'
        )
        if spec:
            dnames = spec.spectrometer.detector_names

        p = get_path(paths.spectrometer_dir, '.*conditionals',
                     ('.yaml', '.yml'))
        if p:
            edit_conditionals(p, detectors=dnames, app=task.application)
        else:
            warning(None, 'No system conditionals file at {}'.format(p))