예제 #1
0
    def import_file(my,
                    node_name,
                    path,
                    instantiation='import',
                    use_namespace=True):

        naming = XSINodeNaming(node_name)

        # if there is no node_name name, then just import without namespaces
        if not naming.has_instance():
            # import file into namespace
            if instantiation == 'reference':
                created_node = my.app.import_reference(path)
            else:
                created_node = my.app.import_file(path)

        else:
            # import file into namespace
            if instantiation == 'reference':
                created_node = my.app.import_reference(path, node_name)
            else:
                created_node = my.app.import_file(path, node_name)

        # FIXME: created node name is not always node_name
        # select newly created node
        my.app.select(created_node)

        return created_node
예제 #2
0
    def import_file(self, node_name, path, instantiation='import', use_namespace=True):

        naming = XSINodeNaming(node_name)

        # if there is no node_name name, then just import without namespaces
        if not naming.has_instance():
            # import file into namespace
            if instantiation == 'reference':
                created_node = self.app.import_reference(path)
            else:
                created_node = self.app.import_file(path)

        else:
            # import file into namespace
            if instantiation == 'reference':
                created_node = self.app.import_reference(path,node_name)
            else:
                created_node = self.app.import_file(path,node_name)

        # FIXME: created node name is not always node_name
        # select newly created node
        self.app.select(created_node)

        return created_node