|
|
|
@ -21,17 +21,12 @@
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
import sip
|
|
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
from relational_gui import maingui, about
|
|
|
|
|
import getopt
|
|
|
|
|
from relational import relation, parser
|
|
|
|
|
|
|
|
|
|
version="0.11"
|
|
|
|
|
about.version=version
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
if len (sys.argv) > 1 and sys.argv[1] == "-v":
|
|
|
|
|
|
|
|
|
|
def printver():
|
|
|
|
|
print "Relational"
|
|
|
|
|
print "This program comes with ABSOLUTELY NO WARRANTY."
|
|
|
|
|
print "This is free software, and you are welcome to redistribute it"
|
|
|
|
@ -41,12 +36,51 @@ if __name__ == "__main__":
|
|
|
|
|
print "Version: %s"%version
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
def printhelp(code=0):
|
|
|
|
|
print "Relational"
|
|
|
|
|
print
|
|
|
|
|
print "Usage: %s [options] [files]" % sys.argv[0]
|
|
|
|
|
print
|
|
|
|
|
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"
|
|
|
|
|
sys.exit(code)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
x11=True #Will try to use the x11 interface
|
|
|
|
|
|
|
|
|
|
#Try to run the psyco optimizer
|
|
|
|
|
try:
|
|
|
|
|
import psyco
|
|
|
|
|
psyco.full()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Getting command line
|
|
|
|
|
try:
|
|
|
|
|
switches,files=getopt.getopt(sys.argv[1:],"vhqc")
|
|
|
|
|
except:
|
|
|
|
|
printhelp(1)
|
|
|
|
|
|
|
|
|
|
for i in switches:
|
|
|
|
|
if i[0]=='-v':
|
|
|
|
|
printver()
|
|
|
|
|
elif i[0]=='-h':
|
|
|
|
|
printhelp()
|
|
|
|
|
elif i[0]=='-q':
|
|
|
|
|
x11=True
|
|
|
|
|
elif i[0]=='-c':
|
|
|
|
|
x11=False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if x11:
|
|
|
|
|
import sip
|
|
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
from relational_gui import maingui, about
|
|
|
|
|
about.version=version
|
|
|
|
|
|
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
|
Form = QtGui.QWidget()
|
|
|
|
|
|
|
|
|
@ -56,15 +90,15 @@ if __name__ == "__main__":
|
|
|
|
|
ui = maingui.Ui_Form()
|
|
|
|
|
ui.setupUi(Form)
|
|
|
|
|
|
|
|
|
|
for i in range(1,len(sys.argv)):
|
|
|
|
|
f=sys.argv[i].split('/')
|
|
|
|
|
for i in range(len(files)):
|
|
|
|
|
f=files[i].split('/')
|
|
|
|
|
defname=f[len(f)-1].lower()
|
|
|
|
|
if (defname.endswith(".csv") or defname.endswith(".tlb")): #removes the extension
|
|
|
|
|
defname=defname[:-4]
|
|
|
|
|
print 'Loading file "%s" with name "%s"' % (sys.argv[i],defname)
|
|
|
|
|
ui.loadRelation(sys.argv[i],defname)
|
|
|
|
|
|
|
|
|
|
print 'Loading file "%s" with name "%s"' % (files[i],defname)
|
|
|
|
|
ui.loadRelation(files[i],defname)
|
|
|
|
|
|
|
|
|
|
Form.show()
|
|
|
|
|
|
|
|
|
|
sys.exit(app.exec_())
|
|
|
|
|
else: #TODO load with curses interface
|
|
|
|
|
pass
|
|
|
|
|