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 colorxhtml.py 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): tiles.append(tile_data_table.read(16)) 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) outfile.write(struct.pack('B',tiles.index(tile_data))) def register_save_map(): gimp.register_save_handler("file-gbm-save", "gbm", "") register( "file-gbm-save", "Save a gameboy map in the gbm format", "Save a gameboy map in the gbm format", "Andrew Marsh", "Andrew Marsh", "2010", "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", "") ], , save_map, on_query=register_save_map, menu="<Save>" )
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.