import bpy
from bpy.props import (StringProperty, IntProperty)

from . import linden
from .run import LSystemRunOperator


bpy.types.Scene.lsystem_lsystem = StringProperty(
    name="L-System",
    description="Choose an L-System",
    default = "BarnFern()",
    )

bpy.types.Scene.lsystem_iterations = IntProperty(
    name="Iterations",
    min = 1,
    default = 6
)

bpy.types.Scene.lsystem_turtle = StringProperty(
    name="Turtle",
    description="Choose a Turtle",
    default = "RPTurtle()",
    )

class LSystemPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        scene = context.scene
        row = layout.row()
        # Create a simple row.
        layout.label(text=" 3D modeling with L-Systems")

       
        row = layout.row()
        row.prop(scene, "lsystem_lsystem")
        row = layout.row()
        row.prop(scene, "lsystem_iterations")
        row = layout.row()
        row.prop(scene, "lsystem_turtle")
        # Big render button
        # layout.label(text="Big Button:")
        row = layout.row()
        row.scale_y = 3.0
        row.operator("lsystem.run")

classes = (
    LSystemPanel,
    )

def register():
    bpy.types.Scene.my_str = StringProperty(
        name="Write the code",
        description="A string property",
        default = "bf = RotBarnFern()\nbf.iterate(8)\nbf.add_to_scene()"
        )
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)


def unregister():
    from bpy.utils import unregister_class
    for cls in classes:
        unregister_class(cls)
    del bpy.types.Scene.my_str


if __name__ == "__main__":
    register()
 
