You are here

Python Fu - Extra Parameters on Save not Working

I am making a save plugin using python-fu in order to be able to create maps and tilesets for the original gameboy. My first plugin, for making tilesets, works fine. However my map plugin requires an extra argument, the filename of the tileset used. I have added it, while looking at for reference, however, no dialog box comes up to allow me to choose the tileset. Here is how I register the save handler:

def save_map(image, drawable, filename, rawfilename, tileset):
    tiles = []
    gimp.progress_init("Reading Tileset")
    with open (tileset, 'r') as tile_data_table:
        for tile in xrange(256):

    pr = drawable.get_pixel_rgn(0, 0, 256, 256, False, False)
    gimp.progress_init("Saving as Gameboy Map")
    ps = GimpPixelStore(pr)

    with open(filename, 'w') as outfile:
        for row in xrange(32):
            for column in xrange(32):
                tile_data = gameboy.encode_tile(column*8, row*8, ps)

def register_save_map():
    gimp.register_save_handler("file-gbm-save", "gbm", "")

    "Save a gameboy map in the gbm format",
    "Save a gameboy map in the gbm format",
    "Andrew Marsh",
    "Andrew Marsh",
    "Gameboy Map",
        (PF_IMAGE, "image", "Input image", None),
        (PF_DRAWABLE, "drawable", "Input drawable", None),
        (PF_STRING, "filename", "The name of the file", None),
        (PF_STRING, "raw-filename", "The name of the file", None),
        (PF_FILE, "tileset", "Tileset used by this map", "")

Do not worry about the actual code of the save_map function, I have confirmed it works by editing the function so that it uses a particular tileset. My problem is that a dialog box does not come up allowing me to choose the tileset file.

If anyone wants the rest of the code I could post it up here as an attachment but I'm quite sure that the problem is in one of these sections.

I'd just like to say, the way I am doing it now does not require any extra parameters, I'd still be interested if anyone knows why it was not coming up with a dialog box

Subscribe to Comments for "Python Fu - Extra Parameters on Save not Working"