1
2 """
3 upoad 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, re
14
15 from omero.cli import BaseControl, CLI
16
17 import omero
18 import omero.rtypes
19 import omero.util.originalfileutils
20
21 from omero.rtypes import rlong
22 from omero.rtypes import rint
23 from omero.rtypes import rstring
24 from omero.rtypes import rdouble
25 from omero.rtypes import rfloat
26
27
28 try:
29 import hashlib
30 hash_sha1 = hashlib.sha1
31 except:
32 import sha
33 hash_sha1 = sha.new
34
35 HELP = """Upload local files to the OMERO server"""
36 RE = re.compile("\s*upload\s*")
37
39
40 - def _complete(self, text, line, begidx, endidx):
41 """
42 Returns a file after "upload" and otherwise delegates to the BaseControl
43 """
44 m = RE.match(line)
45 if m:
46 return self._complete_file(RE.sub('', line))
47 else:
48 return BaseControl._complete(self, text, line, begidx, endidx)
49
54
65
66 try:
67 register("upload", UploadControl, HELP)
68 except NameError:
69 if __name__ == "__main__":
70 cli = CLI()
71 cli.register("upload", UploadControl, HELP)
72 cli.invoke(sys.argv[1:])
73