merge changes from the 0.1 preparatio branch
[totalopenstation.git] / tops_paramset.py
blobf3d51365df3868d1ca777a6069b7d1a724219a7b
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # filename: tops_interface.py
4 # Copyright 2008 Luca Bianconi<lc.bianconi@googlemail.com> and Stefano Costa <steko@iosa.it>
5 # Under the GNU GPL 3 License
9 from optparse import OptionParser
11 class ParamSet:
13 def __init__(self, progname):
15 usage = "usage: "+progname+" [option] arg1 [option] arg2 ..."
18 self.parser = OptionParser(usage = usage)
20 self.parser.add_option("-i", "--inputfile",action="store", type="string",dest="infile",help="read input FILE", metavar="FILE")
22 self.parser.add_option("-o", "--outputfile", action="store", type="string",dest="outfile",help="write output FILE", metavar="FILE")
24 self.parser.add_option("-t", "--totalstation",action="store", type="string", dest="tsmodel",help="chose total station model STRING",metavar="STRING")
26 self.parser.add_option("-e", "--exportformat",action="store", type="string", dest="exformat",help="chose export format typing the exstension's three chars STRING", metavar="STRING")
28 self.parser.add_option("-g", "--graphs_plugin",action="store_true", dest="graphs_plugin",help="use graphic plugin, normally disabled", default=False)
30 (self.options, self.args) = self.parser.parse_args()
32 if self.options.graphs_plugin == None:
34 self.options.graphs_plugin = False
36 if (self.options.infile == None)or(self.options.outfile == None)or(self.options.tsmodel == None)or(self.options.exformat == None):
37 self.parser.error( """ Insert all the four arguments, please! """ )
43 if __name__ == '__main__':
45 params = ParamSet("Tops")
47 print params.options.infile