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
This commit is contained in:
parent
0883285a48
commit
772eb4f156
@ -38,3 +38,4 @@
|
|||||||
0.7
|
0.7
|
||||||
- Added README
|
- 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
|
17
maingui.py
17
maingui.py
@ -21,6 +21,7 @@ import relation
|
|||||||
import parser
|
import parser
|
||||||
import sys
|
import sys
|
||||||
import about
|
import about
|
||||||
|
import os
|
||||||
|
|
||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -93,10 +94,21 @@ class Ui_Form(object):
|
|||||||
self.About.show()
|
self.About.show()
|
||||||
|
|
||||||
def loadRelation(self):
|
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:
|
if res[1]==False:
|
||||||
return
|
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.relations[str(res[0].toUtf8())]=relation.relation(filename)
|
||||||
self.updateRelations()
|
self.updateRelations()
|
||||||
|
|
||||||
@ -138,6 +150,7 @@ class Ui_Form(object):
|
|||||||
self.txtQuery.setFocus()
|
self.txtQuery.setFocus()
|
||||||
|
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
|
self.Form=Form
|
||||||
Form.setObjectName("Form")
|
Form.setObjectName("Form")
|
||||||
Form.resize(932,592)
|
Form.resize(932,592)
|
||||||
Form.setMinimumSize(QtCore.QSize(100,50))
|
Form.setMinimumSize(QtCore.QSize(100,50))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user