예제 #1
0
    def _my_task_extensions_default(self):
        exts = super(FusionsCO2Plugin, self)._my_task_extensions_default()
        def factory_scan():
            return OpenScannerAction(self._get_manager())
        ext1 = TaskExtension(task_id='pychron.fusions.co2',
                             actions=[
#                                       SchemaAddition(id='fusions_co2_group',
#                                              factory=lambda: MenuSchema(id='FusionsCO2',
#                                                                         name='Fusions CO2'
#                                                                    ),
#                                              path='MenuBar/Extraction'
#                                              ),
                                      SchemaAddition(id='calibration',
                                                   factory=lambda: Group(
                                                                         PowerMapAction(),
                                                                         PowerCalibrationAction(),
                                                                         ),
                                                   path='MenuBar/Laser'
                                                   ),
                                      SchemaAddition(
                                                   factory=TestDegasAction,
                                                   path='MenuBar/Laser'
#                                                    path='MenuBar/Extraction'
                                                   )
                                     ]
                              )

        return exts + [ext1]
예제 #2
0
    def _my_task_extensions_default(self):
        factory = lambda: Group(DeselectAction(), ResetQueuesAction())

        return [
            TaskExtension(
                task_id='pychron.experiment',
                actions=[SchemaAddition(factory=factory,
                                        path='MenuBar/Edit')]),
            TaskExtension(actions=[
                SchemaAddition(id='open_experiment',
                               factory=OpenExperimentQueueAction,
                               path='MenuBar/File/Open'),
                SchemaAddition(id='open_last_experiment',
                               factory=OpenLastExperimentQueueAction,
                               path='MenuBar/File/Open'),
                SchemaAddition(id='test_notify',
                               factory=SendTestNotificationAction,
                               path='MenuBar/File'),
                SchemaAddition(id='new_experiment',
                               factory=NewExperimentQueueAction,
                               path='MenuBar/File/New'),
                SchemaAddition(id='signal_calculator',
                               factory=SignalCalculatorAction,
                               path='MenuBar/Tools'),
                SchemaAddition(id='new_pattern',
                               factory=NewPatternAction,
                               path='MenuBar/File/New'),
                SchemaAddition(id='open_pattern',
                               factory=OpenPatternAction,
                               path='MenuBar/File/Open')
            ])
        ]
예제 #3
0
    def insert(self, index, item):
        """ Insert an item into the manager at the specified index.

        Parameters
        ----------
        index : int
            The position at which to insert the object
        item : string, Group instance or ActionManagerItem instance
            The item to insert.

        Notes
        -----

        If the item is a group, the Group is inserted into the manager's list
        of groups.  It the item is a string, then a group is created with
        the string as the ``id`` and the new group is inserted into the list
        of groups.  If the item is an ActionManagerItem then the item is
        inserted into the manager's defualt group.
        """
        # 1) The item is a 'Group' instance.
        if isinstance(item, Group):
            group = item

            # Insert the group into the manager.
            group.parent = self
            self._groups.insert(index, item)

        # 2) The item is a string.
        elif isinstance(item, basestring):
            # Create a group with that Id.
            group = Group(id=item)

            # Insert the group into the manager.
            group.parent = self
            self._groups.insert(index, group)

        # 3) The item is an 'ActionManagerItem' instance.
        else:
            # Find the default group.
            group = self._get_default_group()

            # Insert the item into the default group.
            group.insert(index, item)

        return group
    def insert(self, index, item):
        """ Insert an item into the manager at the specified index.

        Parameters
        ----------
        index : int
            The position at which to insert the object
        item : string, Group instance or ActionManagerItem instance
            The item to insert.

        Notes
        -----

        If the item is a group, the Group is inserted into the manager's list
        of groups.  It the item is a string, then a group is created with
        the string as the ``id`` and the new group is inserted into the list
        of groups.  If the item is an ActionManagerItem then the item is
        inserted into the manager's defualt group.
        """
        # 1) The item is a 'Group' instance.
        if isinstance(item, Group):
            group = item

            # Insert the group into the manager.
            group.parent = self
            self._groups.insert(index, item)

        # 2) The item is a string.
        elif isinstance(item, str):
            # Create a group with that Id.
            group = Group(id=item)

            # Insert the group into the manager.
            group.parent = self
            self._groups.insert(index, group)

        # 3) The item is an 'ActionManagerItem' instance.
        else:
            # Find the default group.
            group = self._get_default_group()

            # Insert the item into the default group.
            group.insert(index, item)

        return group
예제 #5
0
    def __init__(self, *args, **traits):
        """ Creates a new action manager.

        Parameters
        ----------
        args : collection of strings, Group instances, or ActionManagerItem instances
            Positional arguments are interpreted as Items or Groups managed
            by the action manager.

        Notes
        -----

        If a Group is passed as a positional agrument then it is added to the
        manager and any subsequent Items arguments are appended to the Group
        until another Group is encountered.

        If a string is passed, a Group is created with id set to the string.
        """
        # Base class constructor.
        super(ActionManager, self).__init__(**traits)

        # The last group in every manager is the group with Id 'additions'.
        #
        # fixme: The side-effect of this is to ensure that the 'additions'
        # group has been created.  Is the 'additions' group even a good idea?
        group = self._get_default_group()

        # Add all items to the manager.
        for arg in args:
            # We allow a group to be defined by simply specifying a string (its
            # Id).
            if isinstance(arg, six.string_types):
                # Create a group with the specified Id.
                arg = Group(id=arg)

            # If the item is a group then add it just before the default group
            # (ie. we always keep the default group as the last group in the
            # manager).
            if isinstance(arg, Group):
                self.insert(-1, arg)
                group = arg

            # Otherwise, the item is an action manager item so add it to the
            # current group.
            else:
                ##                 # If no group has been created then add one.  This is only
                ##                 # relevant when using the 'shorthand' way to define menus.
                ##                 if group is None:
                ##                     group = Group(id='__first__')
                ##                     self.insert(-1, group)

                group.append(arg)
예제 #6
0
    def _prepare_item(self, item):
        """ Prepare an item to be added to this ActionManager.

        Parameters
        ----------
        item : string, Group instance or ActionManagerItem instance
            The item to be added to this ActionManager

        Returns
        -------
        item : Group or ActionManagerItem
            Modified item
        """
        # 1) The item is a 'Group' instance.
        if isinstance(item, Group):
            item.parent = self

        # 2) The item is a string.
        elif isinstance(item, six.string_types):
            # Create a group with that Id.
            item = Group(id=item)
            item.parent = self

        return item
예제 #7
0
    def _prepare_item(self, item):
        """ Prepare an item to be added to this ActionManager.

        Parameters
        ----------
        item : string, Group instance or ActionManagerItem instance
            The item to be added to this ActionManager

        Returns
        -------
        item : Group or ActionManagerItem
            Modified item
        """
        # 1) The item is a 'Group' instance.
        if isinstance(item, Group):
            item.parent = self

        # 2) The item is a string.
        elif isinstance(item, six.string_types):
            # Create a group with that Id.
            item = Group(id=item)
            item.parent = self

        return item
    def _get_default_group(self):
        """ Returns the manager's default group.

        This will create this group if it doesn't already exist.

        Returns
        -------
        group : Group instance
            The manager's default group.
        """
        group = self.find_group(self.DEFAULT_GROUP)
        if group is None:
            group = Group(id=self.DEFAULT_GROUP)
            self.append(group)

        return group
예제 #9
0
    def _task_extensions_default(self):
        exts = super(FusionsCO2Plugin, self)._task_extensions_default()

        ext1 = TaskExtension(
            task_id='pychron.fusions.co2',
            actions=[
                SchemaAddition(id='calibration',
                               factory=lambda: Group(PowerMapAction(),
                                                     PowerCalibrationAction()),
                               path='MenuBar/Laser'),
                SchemaAddition(
                    factory=lambda: ExecutePatternAction(self._get_manager()),
                    path='MenuBar/Laser'),
                # SchemaAddition(factory=TestDegasAction,
                #                path='MenuBar/Laser')
            ])

        return exts + [ext1]
예제 #10
0
 def interpreted_group():
     return Group(SetInterpretedAgeAction(), OpenInterpretedAgeAction(),
                  OpenInterpretedAgeGroupAction(),
                  DeleteInterpretedAgeGroupAction(),
                  MakeGroupFromFileAction())
예제 #11
0
 def reduction_group():
     return Group(IsotopeEvolutionAction(), BlankEditAction(),
                  ICFactorAction(), DiscriminationAction(),
                  FluxAction())
예제 #12
0
 def grouping_group():
     return Group(GroupSelectedAction(), GroupbyAliquotAction(),
                  GroupbyLabnumberAction(), ClearGroupAction())
예제 #13
0
 def figure_group():
     return Group(SpectrumAction(), IdeogramAction(),
                  InverseIsochronAction(), SeriesAction())
예제 #14
0
 def easy_group():
     return Group(EasyImportAction(), EasyFiguresAction(),
                  EasyTablesAction(), EasySensitivityAction())