Ejemplo n.º 1
0
    def __init__(self, target=None, validating=False):
        if not compas.is_ironpython():
            raise Exception(
                'CLRXMLTreeParser can only be used from IronPython')

        settings = XmlReaderSettings()
        settings.IgnoreComments = True
        settings.IgnoreProcessingInstructions = True
        settings.IgnoreWhitespace = True
        if not validating:
            settings.DtdProcessing = DtdProcessing.Ignore
            settings.ValidationType = getattr(ValidationType, 'None')
        else:
            settings.DtdProcessing = DtdProcessing.Parse
            settings.ValidationType = ValidationType.DTD
        self.settings = settings
        self._target = (target if (target is not None) else ET.TreeBuilder())
        self._buffer = []
        self._document_encoding = 'UTF-8'  # default
Ejemplo n.º 2
0
class XMLReader(object):
    """Reads XML files and strings.

    Parameters
    ----------
    root : :class:`xml.etree.ElementTree.Element`
        Root XML element

    """
    def __init__(self, root):
        self.root = root

    @classmethod
    def from_file(cls, source, tree_parser=None):
        tree_parser = tree_parser or DefaultXMLTreeParser
        tree = ET.parse(source, tree_parser())
        return cls(tree.getroot())

    @classmethod
    def from_string(cls, text, tree_parser=None):
        tree_parser = tree_parser or DefaultXMLTreeParser
        root = ET.fromstring(text, tree_parser())
        return cls(root)


if compas.is_ironpython():
    from compas.files.xml_cli import CLRXMLTreeParser as DefaultXMLTreeParser
else:
    DefaultXMLTreeParser = ET.XMLParser
Ejemplo n.º 3
0
from __future__ import division

import compas
from compas_rhino.forms import Form

try:
    import scriptcontext as sc
    import System
    from System.Drawing import Size
    from System.Drawing import Point
    from System.Drawing import Color
    from System.Windows.Forms import TextBox
    from System.Windows.Forms import TrackBar

except ImportError:
    if compas.is_ironpython() and compas.is_windows():
        raise

__all__ = ['SliderForm']


class SliderForm(Form):
    """"""
    def __init__(self, minval, maxval, step, value):
        self.minval = minval
        self.maxval = maxval
        self.step = step
        self.value = value
        super(SliderForm, self).__init__()

    def init(self):
Ejemplo n.º 4
0
    RosValidationError
    VrepError


Interfaces
----------

For details about integrating new backends, check
the :ref:`architecture` documentation.

"""

import compas

from .exceptions import *  # noqa: F401,F403
from .tasks import *  # noqa: F401,F403
from .ros.client import *  # noqa: F401,F403
from .ros.exceptions import *  # noqa: F401,F403
from .ros.fileserver_loader import *  # noqa: F401,F403
from .ros.planner import *  # noqa: F401,F403
from .vrep.client import *  # noqa: F401,F403
from .vrep.helpers import *  # noqa: F401,F403
from .vrep.planner import *  # noqa: F401,F403

if not compas.is_ironpython():
    from .pybullet.client import *  # noqa: F401,F403
    from .pybullet.exceptions import *  # noqa: F401,F403
    from .pybullet.planner import *  # noqa: F401,F403

__all__ = [name for name in dir() if not name.startswith('_')]