Beispiel #1
0
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================

# ============= enthought library imports =======================
from pychron.pyscripts.extraction_line_pyscript import ExtractionPyScript
from pychron.pyscripts.pyscript import verbose_skip, makeRegistry
from pychron.lasers.laser_managers.ilaser_manager import ILaserManager
# ============= standard library imports ========================
# ============= local library imports  ==========================
command_register = makeRegistry()


class UVExtractionPyScript(ExtractionPyScript):
    def get_command_register(self):
        cm = super(UVExtractionPyScript, self).get_command_register()
        return command_register.commands.items() + cm

    def set_default_context(self):
        super(UVExtractionPyScript, self).set_default_context()
        self.setup_context(reprate=0, mask=0, attenuator=0)

    @property
    def reprate(self):
        return self.get_context()['reprate']
#============= local library imports  ==========================
from pychron.pyscripts.pyscript import verbose_skip, makeRegistry
from pychron.lasers.laser_managers.ilaser_manager import ILaserManager
# from pychron.lasers.laser_managers.extraction_device import ILaserManager
from pychron.pyscripts.valve_pyscript import ValvePyScript
from pychron.pychron_constants import EXTRACTION_COLOR

ELPROTOCOL = 'pychron.extraction_line.extraction_line_manager.ExtractionLineManager'

'''
    make a registry to hold all the commands exposed by ExtractionPyScript
    used when building the context
    see PyScript.get_context and get_command_register
    
'''
command_register = makeRegistry()


class RecordingCTX(object):
    def __init__(self, script, name):
        self._script = script
        self._name = name

    def __enter__(self, *args, **kw):
        self._script.start_video_recording(self._name)

    def __exit__(self, *args, **kw):
        self._script.stop_video_recording()


class Ramper(object):