Exemple #1
0
        opts.append('Create new region...%x2')
    else:
        opts.append(
            'Can\'t create new region - already using maximum of %d regions%%x0'
            % PanelRegionHandler.REGIONCOUNT)
    opts.append('Reload all regions%x3')
elif image and 'panel.' in image.name.lower(
) and '.region' not in image.name.lower():
    opts.append('Create new region...%x2')

if not opts:
    r = Draw.PupMenu('This is not a Panel Texture or Region%t')
else:
    r = Draw.PupMenu('X-Plane panel regions%t|' + ('|'.join(opts)))
    if r == 1:
        h.delRegion(image)
        h.panelimage().makeCurrent()
    elif r == 2:
        maxx = 2**int(log(image.size[0], 2))
        maxy = 2**int(log(image.size[1], 2))
        xoff = Draw.Create(0)
        yoff = Draw.Create(0)
        width = Draw.Create(min(maxx, 1024))
        height = Draw.Create(min(maxy, 1024))
        block = []
        block.append(('Left:', xoff, 0, image.size[0]))
        block.append(('Bottom:', yoff, 0, image.size[1]))
        block.append(('Width:', width, 0, maxx))
        block.append(('Height:', height, 0, maxy))

        while Draw.PupBlock('Create new region', block):
    opts.append('Reload all regions%x3')
elif h.isPanel(image):
    if h.countRegions()<PanelRegionHandler.REGIONCOUNT:
        opts.append('Create new region...%x2')
    else:
        opts.append('Can\'t create new region - already using maximum of %d regions%%x0' % PanelRegionHandler.REGIONCOUNT)
    opts.append('Reload all regions%x3')
elif image and 'panel.' in image.name.lower() and '.region' not in image.name.lower():
    opts.append('Create new region...%x2')

if not opts:
    r=Draw.PupMenu('This is not a Panel Texture or Region%t')
else:
    r=Draw.PupMenu('X-Plane panel regions%t|'+('|'.join(opts)))
    if r==1:
        h.delRegion(image)
        h.panelimage().makeCurrent()
    elif r==2:
        maxx=2**int(log(image.size[0],2))
        maxy=2**int(log(image.size[1],2))
        xoff=Draw.Create(0)
        yoff=Draw.Create(0)
        width=Draw.Create(min(maxx,1024))
        height=Draw.Create(min(maxy,1024))
        block=[]
        block.append(('Left:',   xoff,   0, image.size[0]))
        block.append(('Bottom:', yoff,   0, image.size[1]))
        block.append(('Width:',  width,  0, maxx))
        block.append(('Height:', height, 0, maxy))

        while Draw.PupBlock('Create new region', block):