1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#-----------------------------------------------------------------------------
#
# Copyright (c) 2007 by Enthought, Inc.
# All rights reserved.
#
#-----------------------------------------------------------------------------
"""
The model service for the Data plugin.
"""
# Standard library imports.
import logging
import numpy
# Enthought library imports.
from enthought.envisage.api import ApplicationObject
from enthought.naming.unique_name import make_unique_name
from enthought.numerical_modeling.numeric_context.api import NumericContext
from enthought.numerical_modeling.units.unit_array import UnitArray
from enthought.units.api import convert,unit_manager
from enthought.units.mass import gram
from enthought.units.volume import cc
from enthought.units.length import meter
from enthought.units.geo_units import ppg, psi
from enthought.util.wx.clipboard import clipboard
# Data library imports.
# Setup a logger for this module
logger = logging.getLogger(__name__)
class ModelService(ApplicationObject):
"""
The model service for the Dataplugin.
"""
##########################################################################
# 'ModelService' interface
##########################################################################
#### public methods ######################################################
def delete_context_item(self, context, item_name):
""" Deleting an item from a numeric context
Parameters:
-----------
context: NumericContext
item_name: Str
"""
if isinstance(context, NumericContext) and context.has_key(item_name):
context.pop(item_name)
else:
logger.error('Invalid context or data not found in context')
return
#### EOF #####################################################################
|