When adding a relation, the file must be choosen 1st, and then the default relation's name is the same as the filename

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@49 014f5005-505e-4b48-8d0a-63407b615a7c
master
LtWorf 2008-11-05 17:07:38 +07:00
parent 0883285a48
commit 772eb4f156
2 changed files with 17 additions and 3 deletions

@ -37,4 +37,5 @@
0.7
- Added README
- Expressions between quotes aren't parsed anymore
- Expressions between quotes aren't parsed anymore
- When adding a relation, the file must be choosen 1st, and then the default relation's name is the same as the filename

@ -21,6 +21,7 @@ import relation
import parser
import sys
import about
import os
class Ui_Form(object):
def __init__(self):
@ -93,10 +94,21 @@ class Ui_Form(object):
self.About.show()
def loadRelation(self):
res=QtGui.QInputDialog.getText(None, QtGui.QApplication.translate("Form", "New relation"),QtGui.QApplication.translate("Form", "Insert the name for the new relation"))
#Asking for file to load
filename = QtGui.QFileDialog.getOpenFileName(None,QtGui.QApplication.translate("Form", "Load Relation"),"",QtGui.QApplication.translate("Form", "Relations (*.tlb);;Text Files (*.txt);;All Files (*)"))
#Default relation's name
f=str(filename.toUtf8()).split(os.sep) #Split the full path
defname=f[len(f)-1].lower() #Takes only the lowercase filename
if (defname.endswith(".tlb")): #removes the extension
defname=defname[:-4]
res=QtGui.QInputDialog.getText(self.Form, QtGui.QApplication.translate("Form", "New relation"),QtGui.QApplication.translate("Form", "Insert the name for the new relation"),
QtGui.QLineEdit.Normal,defname)
if res[1]==False:
return
filename = QtGui.QFileDialog.getOpenFileName(None,QtGui.QApplication.translate("Form", "Load Relation"),"",QtGui.QApplication.translate("Form", "Relations (*.tlb);;Text Files (*.txt);;All Files (*)"))
self.relations[str(res[0].toUtf8())]=relation.relation(filename)
self.updateRelations()
@ -138,6 +150,7 @@ class Ui_Form(object):
self.txtQuery.setFocus()
def setupUi(self, Form):
self.Form=Form
Form.setObjectName("Form")
Form.resize(932,592)
Form.setMinimumSize(QtCore.QSize(100,50))