Exemplo n.º 1
0
 def save(self, *args, **kwargs):
     if not self.thumbnail:
         fn = export_snapshot(self.stack.uuid, self.layer, self.zoom, 
             self.pixel_x/2.0**self.zoom-400, self.pixel_y/2.0**self.zoom-400, 
             self.pixel_x/2.0**self.zoom+400, self.pixel_y/2.0**self.zoom+400)
         self.thumbnail.save(fn, File(open(settings.MEDIA_ROOT+fn,'rb')))
     super(Annotation, self).save(*args, **kwargs)
Exemplo n.º 2
0
 def save(self, *args, **kwargs):
     if self.name == 'Untitled':
         self.name = self.label(len(Arrow.objects.filter(stack=self.stack))+1)
     if not self.thumbnail:
         fn = export_snapshot(self.stack.uuid, self.layer, self.zoom, 
             self.pixel_x/2.0**self.zoom-100, self.pixel_y/2.0**self.zoom-100, 
             self.pixel_x/2.0**self.zoom+100, self.pixel_y/2.0**self.zoom+100)
         self.thumbnail.save(fn, File(open(settings.MEDIA_ROOT+fn,'rb')))
     super(Annotation, self).save(*args, **kwargs)