- 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 " -v Print version and exits"
|
||||||
print " -h Print this help and exits"
|
print " -h Print this help and exits"
|
||||||
print " -q Uses QT user interface (default)"
|
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)
|
sys.exit(code)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -61,7 +62,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
#Getting command line
|
#Getting command line
|
||||||
try:
|
try:
|
||||||
switches,files=getopt.getopt(sys.argv[1:],"vhqc")
|
switches,files=getopt.getopt(sys.argv[1:],"vhqr")
|
||||||
except:
|
except:
|
||||||
printhelp(1)
|
printhelp(1)
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ if __name__ == "__main__":
|
|||||||
printhelp()
|
printhelp()
|
||||||
elif i[0]=='-q':
|
elif i[0]=='-q':
|
||||||
x11=True
|
x11=True
|
||||||
elif i[0]=='-c':
|
elif i[0]=='-r':
|
||||||
x11=False
|
x11=False
|
||||||
|
|
||||||
if x11:
|
if x11:
|
||||||
@ -103,5 +104,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
Form.show()
|
Form.show()
|
||||||
sys.exit(app.exec_())
|
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
|
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:
|
try:
|
||||||
relations[defname]=relation.relation(filename)
|
relations[defname]=relation.relation(filename)
|
||||||
|
|
||||||
|
completer.add_completion(defname)
|
||||||
|
print "Loaded relation %s"% defname
|
||||||
return defname
|
return defname
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
@ -109,11 +112,7 @@ def exec_line(command):
|
|||||||
defname=pars[2]
|
defname=pars[2]
|
||||||
else:
|
else:
|
||||||
defname=None
|
defname=None
|
||||||
defname=load_relation(filename,defname)
|
load_relation(filename,defname)
|
||||||
if defname==None: return
|
|
||||||
|
|
||||||
completer.add_completion(defname)
|
|
||||||
print "Loaded relation %s"% defname
|
|
||||||
|
|
||||||
elif command=='UNLOAD ':
|
elif command=='UNLOAD ':
|
||||||
#//TODO
|
#//TODO
|
||||||
@ -186,6 +185,10 @@ def exec_query(command):
|
|||||||
print e
|
print e
|
||||||
|
|
||||||
def main(files=[]):
|
def main(files=[]):
|
||||||
|
|
||||||
|
for i in files:
|
||||||
|
load_relation(i)
|
||||||
|
|
||||||
readline.set_completer(completer.complete)
|
readline.set_completer(completer.complete)
|
||||||
|
|
||||||
readline.parse_and_bind('tab: complete')
|
readline.parse_and_bind('tab: complete')
|
||||||
@ -201,5 +204,5 @@ def main(files=[]):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue
Block a user