Package omero :: Package plugins :: Module download
[hide private]
[frames] | no frames]

Source Code for Module omero.plugins.download

 1  #!/usr/bin/env python 
 2  """ 
 3     download plugin 
 4   
 5     Plugin read by omero.cli.Cli during initialization. The method(s) 
 6     defined here will be added to the Cli class for later use. 
 7   
 8     Copyright 2007 Glencoe Software, Inc. All rights reserved. 
 9     Use is subject to license terms supplied in LICENSE.txt 
10   
11  """ 
12   
13  import sys 
14  from omero.cli import BaseControl, CLI 
15   
16  HELP = """Download the given file id to the given filename""" 
17   
18 -class DownloadControl(BaseControl):
19
20 - def _configure(self, parser):
21 parser.add_argument("id", help="OriginalFile id") 22 parser.add_argument("filename", help="Local filename to be saved to") 23 parser.set_defaults(func=self.__call__)
24
25 - def __call__(self, args):
26 from omero_model_OriginalFileI import OriginalFileI as OFile 27 28 orig_file = OFile(long(args.id)) 29 target_file = str(args.filename) 30 31 client = self.ctx.conn(args) 32 client.download(orig_file, target_file)
33 34 try: 35 register("download", DownloadControl, HELP) 36 except NameError: 37 if __name__ == "__main__": 38 cli = CLI() 39 cli.register("download", DownloadControl, HELP) 40 cli.invoke(sys.argv[1:]) 41