- Can be used from the main module
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@232 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
d7e4f64f55
commit
261bd4469f
@ -45,7 +45,8 @@ def printhelp(code=0):
|
||||
print " -v Print version and exits"
|
||||
print " -h Print this help and exits"
|
||||
print " -q Uses QT user interface (default)"
|
||||
print " -c Uses curses user interface"
|
||||
#print " -c Uses curses user interface"
|
||||
print " -r Uses readline user interface"
|
||||
sys.exit(code)
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -61,7 +62,7 @@ if __name__ == "__main__":
|
||||
|
||||
#Getting command line
|
||||
try:
|
||||
switches,files=getopt.getopt(sys.argv[1:],"vhqc")
|
||||
switches,files=getopt.getopt(sys.argv[1:],"vhqr")
|
||||
except:
|
||||
printhelp(1)
|
||||
|
||||
@ -72,7 +73,7 @@ if __name__ == "__main__":
|
||||
printhelp()
|
||||
elif i[0]=='-q':
|
||||
x11=True
|
||||
elif i[0]=='-c':
|
||||
elif i[0]=='-r':
|
||||
x11=False
|
||||
|
||||
if x11:
|
||||
@ -103,5 +104,7 @@ if __name__ == "__main__":
|
||||
|
||||
Form.show()
|
||||
sys.exit(app.exec_())
|
||||
else: #TODO load with curses interface
|
||||
else: #TODO load with readline interface
|
||||
import relational_readline.linegui
|
||||
relational_readline.linegui.main(files)
|
||||
pass
|
||||
|
0
relational_readline/__init__.py
Normal file
0
relational_readline/__init__.py
Normal file
@ -86,6 +86,9 @@ def load_relation(filename,defname=None):
|
||||
|
||||
try:
|
||||
relations[defname]=relation.relation(filename)
|
||||
|
||||
completer.add_completion(defname)
|
||||
print "Loaded relation %s"% defname
|
||||
return defname
|
||||
except Exception, e:
|
||||
print e
|
||||
@ -109,11 +112,7 @@ def exec_line(command):
|
||||
defname=pars[2]
|
||||
else:
|
||||
defname=None
|
||||
defname=load_relation(filename,defname)
|
||||
if defname==None: return
|
||||
|
||||
completer.add_completion(defname)
|
||||
print "Loaded relation %s"% defname
|
||||
load_relation(filename,defname)
|
||||
|
||||
elif command=='UNLOAD ':
|
||||
#//TODO
|
||||
@ -186,6 +185,10 @@ def exec_query(command):
|
||||
print e
|
||||
|
||||
def main(files=[]):
|
||||
|
||||
for i in files:
|
||||
load_relation(i)
|
||||
|
||||
readline.set_completer(completer.complete)
|
||||
|
||||
readline.parse_and_bind('tab: complete')
|
||||
@ -201,5 +204,5 @@ def main(files=[]):
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user