• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

# Prototype definition file written out by PataPata version Version 0.2.02
from PataPataSupport import *
 
def define_prototype(world):
    """returns a world of morphs"""
 
    world.worldLibraries = [world.newWorldFromFile("WorldCommon.py")]
 
    # THE WORLD ITSELF
    class world("World"):
        __metaclass__ = world.buildPrototype
        changeUnfinishedWarning = 1
        sourceFileName = 'WorldExample.py'
        widget = None
        worldPreambleCodeForImports = 'from PataPataSupport import *\n'
        writer = None
 
    # WORLD GLOBALS
    # No Globals
 
    # WORLD MORPHS
    class proto1("Morph"):
        __metaclass__ = world.buildPrototype
        position = (191, 63)
        widget = None
        backgroundColor = "blue"
        foregroundColor = "green"
 
    class proto2("Rectangle"):
        __metaclass__ = world.buildPrototype
        position = (191, 108)
        widget = None
 
    class proto3("StaticLine"):
        __metaclass__ = world.buildPrototype
        position = (154, 94)
        widget = None
 
    class proto5("Rectangle"):
        __metaclass__ = world.buildPrototype
        position = (60, 53)
        widget = None
 
    class proto6("StaticLine"):
        __metaclass__ = world.buildPrototype
        position = (29, 154)
        widget = None
 
    class proto7("StaticText"):
        __metaclass__ = world.buildPrototype
        position = (41, 110)
        size = (-1, -1)
        widget = None
 
    class proto4("Panel"):
        __metaclass__ = world.buildPrototype
        morphs = []
        position = (272, 41)
        widget = None
    proto4.addMorph(proto5)
    proto4.addMorph(proto6)
    proto4.addMorph(proto7)
 
    class proto8("TextArea"):
        __metaclass__ = world.buildPrototype
        position = (33, 173)
        text = 'sample text'
        widget = None
 
    class proto9("TextField"):
        __metaclass__ = world.buildPrototype
        _textvariable = None
        position = (73, 342)
        text = 'sample text'
        widget = None
 
    class proto10("CheckBox"):
        __metaclass__ = world.buildPrototype
        checked = 0
        position = (72, 317)
        widget = None
 
    class proto11("StaticText"):
        __metaclass__ = world.buildPrototype
        position = (76, 296)
        size = (-1, -1)
        widget = None
 
    class proto12("Button"):
        __metaclass__ = world.buildPrototype
        position = (13, 42)
        size = (-1, -1)
        text = 'Test'
        widget = None
        def mouseClick(self):
            print "test"
 
    class proto14("List"):
        __metaclass__ = world.buildPrototype
        items = ['one', 'two', 'three', 'four', 'five', 'six', 'Prototypes are really cool.']
        position = (278, 270)
        selectionMode = 'extended'
        size = (176, 105)
        widget = None
 
    class proto15("ImageWithCursor"):
        __metaclass__ = world.buildPrototype
        cursorImagePosition = (91, 103)
        position = (295, 415)
        widget = None
        def mouseDown(self, event):
            self.cursorImagePosition = (event.x, event.y)
 
        def mouseDrag(self, event):
            self.cursorImagePosition = (event.x, event.y)
 
        def mouseUp(self, event):
            self.cursorImagePosition = (event.x, event.y)
 
 
    class proto17("TextArea"):
        __metaclass__ = world.buildPrototype
        position = (0, 0)
        size = (247, 216)
        text = 'sample text'
        widget = None
 
    class proto18("InspectorTree"):
        __metaclass__ = world.buildPrototype
        position = (0, 226)
        rootNode = None
        size = (247, 227)
        widget = None
        def onSelection(self, node):
            if node:
                print node
                #print dir(node)
                #print node.item
                #print dir(node.item)
                print node.item.GetText()
 
    class proto16("SplitterPanel"):
        __metaclass__ = world.buildPrototype
        morphs = []
        position = (493, 129)
        size = (253, 456)
        splitterPosition = 216
        widget = None
    proto16.addMorph(proto17)
    proto16.addMorph(proto18)
 
    class proto19("StaticText"):
        __metaclass__ = world.buildPrototype
        position = (91, 10)
        text = 'ALT-LeftClick to drag morphs; ALT-RightClick for menu'
        widget = None
 
    class proto20("Image"):
        __metaclass__ = world.buildPrototype
        file = 'images/dandelion.gif'
        position = (563, 6)
        widget = None
        def mouseUp(self, event):
            self.containingWindow().OnMenuOpenInNewWindow("WorldDandelionGarden.py")
 
 
    class proto21("StaticText"):
        __metaclass__ = world.buildPrototype
        position = (507, 105)
        text = 'Click dandelion for garden window.'
        widget = None
 
    class proto0("Window"):
        __metaclass__ = world.buildPrototype
        _layoutNeedsUpdating = 0
        currentPosition = Point(586, 474)
        downPosition = Point(586, 474)
        draggedMorph = None
        draggedWindow = None
        font = ('helvetica', 12)
        inspectorWorld = None
        isMetaEvent = 0
        morphs = []
        oldCursor = ''
        originalDraggedMorphOffset = Point(498, 378)
        originalSizeForWidgetBeingResized = (200, 100)
        position = (0, 0)
        previousPosition = Point(586, 474)
        size = (771, 600)
        upPosition = Point(586, 474)
        widget = None
        widgetBeingResized = None
    proto0.addMorph(proto1)
    proto0.addMorph(proto2)
    proto0.addMorph(proto3)
    proto0.addMorph(proto4)
    proto0.addMorph(proto8)
    proto0.addMorph(proto9)
    proto0.addMorph(proto10)
    proto0.addMorph(proto11)
    proto0.addMorph(proto12)
    proto0.addMorph(proto14)
    proto0.addMorph(proto15)
    proto0.addMorph(proto16)
    proto0.addMorph(proto19)
    proto0.addMorph(proto20)
    proto0.addMorph(proto21)
    world.addMorph(proto0)
 
    return world