Yes, works fine for me. I find using the object methods makes for more readable code than the pdb functions.
Gimp-wise, a latent problem with your script it that although it takes a layer as a parameter, it makes several assumptions:
1) the layer is the only one in the image (image.flatten() would destroy all other layers)
2) the layer is the size of the canvas and has a (0,0) offset.
Fine if it's for you or a specific person, but if you make it public it will come back to haunt you
There is another problem, it doesn't seem to be re-runnable (Filters>Repeat|Reshow last used). Some of my scripts are like that too, and I never figured out what the problem was.
Pythonically, like you I don't like if's and even more long sequences of if/elif/else but your code can be simplified to:
def celenicorn_auto_mirror(image, drawable, direction = 0) :
image.undo_group_start()
width = image.width
height = image.height
newLayer = drawable.copy()
image.add_layer(newLayer, 0)
dirParms={
0: (1, width, height * 2, 0, height, 0, 0),
1: (1, width, height * 2, 0, 0, 0, height),
2: (0, width * 2, height, width, 0, 0, 0),
3: (0, width * 2, height, 0, 0, width, 0)
}
vhflip, sizex, sizey, ofsx, ofsy, movx, movy=dirParms[direction]
pdb.gimp_image_resize(image, sizex, sizey, ofsx, ofsy)
pdb.gimp_drawable_transform_flip_simple(newLayer, vhflip, True, 0, False)
pdb.gimp_layer_set_offsets(newLayer, movx, movy)
image.flatten()
image.undo_group_end()
Also see
here for a way to avoid hardcoding integer values for user options.