def im(self, trafo, id): if len(trafo) == 2: trafo = Translation(trafo) else: trafo = apply(Trafo, trafo) if self.id_dict[id] is not None: self.append_object(image.Image(self.id_dict[id], trafo=trafo))
def CreateImage(self, sysfilename=None): if not sysfilename: initialdir = config.preferences.dir_for_bitmap_import filename, sysfilename = dialogman.getImportBMFilename( initialdir=initialdir, initialfile='') if sysfilename: try: self.canvas.commands.ForceRedraw fileptr = open(sysfilename, 'r') is_eps = eps.IsEpsFileStart(fileptr.read(256)) fileptr.close() dir, name = os.path.split(filename) config.preferences.dir_for_bitmap_import = dir if is_eps: imageobj = eps.EpsImage(filename=sysfilename) else: imageobj = image.Image(imagefile=sysfilename) self.canvas.PlaceObject(imageobj) except IOError, value: if type(value) == TupleType: value = value[1] self.application.MessageBox(title=_("Load Image"), message=_("Cannot load %(filename)s:\n" "%(message)s") \ % {'filename':`os.path.split(filename)[1]`, 'message':value})