- Changed window title

- Added menu!
- Can restore from history



git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@282 014f5005-505e-4b48-8d0a-63407b615a7c
master
LtWorf 2011-03-20 23:23:20 +07:00
parent 4d78540440
commit e563972436
3 changed files with 170 additions and 21 deletions

@ -55,7 +55,10 @@ class relForm(QtGui.QMainWindow):
#self.txtQuery.setText(result)
def resumeHistory(self,item):
print item
itm=str(item.text().toUtf8()).split(' = ',1)
self.ui.txtResult.setText(QtCore.QString.fromUtf8(itm[0]))
self.ui.txtQuery.setText(QtCore.QString.fromUtf8(itm[1]))
def execute(self):
'''Executes the query'''
@ -138,10 +141,7 @@ class relForm(QtGui.QMainWindow):
filename=str(filename.toUtf8()) #Converts QString to string
if (len(filename)==0):#Returns if no file was selected
return
#if (not filename.endswith(".csv")):#Adds extension if needed
# filename+=".csv"
self.selectedRelation.save(filename)
#self.relations[str(self.ui.lstRelations.selectedItems()[0].text().toUtf8())].save(filename)
return
def unloadRelation(self):
for i in self.ui.lstRelations.selectedItems():

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'maingui.ui'
#
# Created: Sun Mar 20 22:33:26 2011
# Created: Mon Mar 21 00:21:36 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
@ -210,10 +210,30 @@ class Ui_MainWindow(object):
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
self.menubar.setObjectName(_fromUtf8("menubar"))
self.menuFile = QtGui.QMenu(self.menubar)
self.menuFile.setObjectName(_fromUtf8("menuFile"))
self.menuAbout = QtGui.QMenu(self.menubar)
self.menuAbout.setObjectName(_fromUtf8("menuAbout"))
self.action = QtGui.QAction(MainWindow)
self.action.setObjectName(_fromUtf8("action"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.actionAbout = QtGui.QAction(MainWindow)
self.actionAbout.setMenuRole(QtGui.QAction.AboutRole)
self.actionAbout.setObjectName(_fromUtf8("actionAbout"))
self.action_Load_relation = QtGui.QAction(MainWindow)
self.action_Load_relation.setObjectName(_fromUtf8("action_Load_relation"))
self.action_Save_relation = QtGui.QAction(MainWindow)
self.action_Save_relation.setObjectName(_fromUtf8("action_Save_relation"))
self.action_Quit = QtGui.QAction(MainWindow)
self.action_Quit.setMenuRole(QtGui.QAction.QuitRole)
self.action_Quit.setObjectName(_fromUtf8("action_Quit"))
self.menuFile.addAction(self.action_Load_relation)
self.menuFile.addAction(self.action_Save_relation)
self.menuFile.addSeparator()
self.menuFile.addAction(self.action_Quit)
self.menuAbout.addAction(self.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuAbout.menuAction())
self.label.setBuddy(self.txtQuery)
self.retranslateUi(MainWindow)
@ -248,6 +268,10 @@ class Ui_MainWindow(object):
QtCore.QObject.connect(self.lstRelations, QtCore.SIGNAL(_fromUtf8("itemClicked(QListWidgetItem*)")), MainWindow.showAttributes)
QtCore.QObject.connect(self.cmdClearQuery, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtQuery.setFocus)
QtCore.QObject.connect(self.lstHistory, QtCore.SIGNAL(_fromUtf8("itemDoubleClicked(QListWidgetItem*)")), MainWindow.resumeHistory)
QtCore.QObject.connect(self.actionAbout, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.showAbout)
QtCore.QObject.connect(self.action_Load_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.loadRelation)
QtCore.QObject.connect(self.action_Save_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.saveRelation)
QtCore.QObject.connect(self.action_Quit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.cmdAbout, self.cmdSurvey)
MainWindow.setTabOrder(self.cmdSurvey, self.cmdProduct)
@ -281,7 +305,7 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.cmdClearQuery, self.cmdExecute)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Relational", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_3.setTitle(QtGui.QApplication.translate("MainWindow", "Menu", None, QtGui.QApplication.UnicodeUTF8))
self.cmdAbout.setText(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))
self.cmdSurvey.setText(QtGui.QApplication.translate("MainWindow", "Survey", None, QtGui.QApplication.UnicodeUTF8))
@ -314,4 +338,13 @@ class Ui_MainWindow(object):
self.label.setText(QtGui.QApplication.translate("MainWindow", "=", None, QtGui.QApplication.UnicodeUTF8))
self.cmdClearQuery.setText(QtGui.QApplication.translate("MainWindow", "", None, QtGui.QApplication.UnicodeUTF8))
self.cmdExecute.setText(QtGui.QApplication.translate("MainWindow", "Execute", None, QtGui.QApplication.UnicodeUTF8))
self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
self.menuAbout.setTitle(QtGui.QApplication.translate("MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8))
self.actionAbout.setText(QtGui.QApplication.translate("MainWindow", "&About", None, QtGui.QApplication.UnicodeUTF8))
self.action_Load_relation.setText(QtGui.QApplication.translate("MainWindow", "&Load relation", None, QtGui.QApplication.UnicodeUTF8))
self.action_Load_relation.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
self.action_Save_relation.setText(QtGui.QApplication.translate("MainWindow", "&Save relation", None, QtGui.QApplication.UnicodeUTF8))
self.action_Save_relation.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
self.action_Quit.setText(QtGui.QApplication.translate("MainWindow", "&Quit", None, QtGui.QApplication.UnicodeUTF8))
self.action_Quit.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Q", None, QtGui.QApplication.UnicodeUTF8))

@ -12,7 +12,7 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Relational</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -429,8 +429,60 @@
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="action_Load_relation"/>
<addaction name="action_Save_relation"/>
<addaction name="separator"/>
<addaction name="action_Quit"/>
</widget>
<widget class="QMenu" name="menuAbout">
<property name="title">
<string>&amp;Help</string>
</property>
<action name=""/>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuAbout"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAbout">
<property name="text">
<string>&amp;About</string>
</property>
<property name="menuRole">
<enum>QAction::AboutRole</enum>
</property>
</action>
<action name="action_Load_relation">
<property name="text">
<string>&amp;Load relation</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="action_Save_relation">
<property name="text">
<string>&amp;Save relation</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="action_Quit">
<property name="text">
<string>&amp;Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
<property name="menuRole">
<enum>QAction::QuitRole</enum>
</property>
</action>
</widget>
<tabstops>
<tabstop>cmdAbout</tabstop>
@ -475,11 +527,11 @@
<hints>
<hint type="sourcelabel">
<x>686</x>
<y>572</y>
<y>591</y>
</hint>
<hint type="destinationlabel">
<x>206</x>
<y>572</y>
<y>591</y>
</hint>
</hints>
</connection>
@ -491,7 +543,7 @@
<hints>
<hint type="sourcelabel">
<x>490</x>
<y>545</y>
<y>563</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
@ -507,7 +559,7 @@
<hints>
<hint type="sourcelabel">
<x>450</x>
<y>580</y>
<y>599</y>
</hint>
<hint type="destinationlabel">
<x>438</x>
@ -523,7 +575,7 @@
<hints>
<hint type="sourcelabel">
<x>732</x>
<y>573</y>
<y>592</y>
</hint>
<hint type="destinationlabel">
<x>592</x>
@ -731,7 +783,7 @@
<hints>
<hint type="sourcelabel">
<x>336</x>
<y>542</y>
<y>560</y>
</hint>
<hint type="destinationlabel">
<x>652</x>
@ -747,11 +799,11 @@
<hints>
<hint type="sourcelabel">
<x>87</x>
<y>571</y>
<y>590</y>
</hint>
<hint type="destinationlabel">
<x>182</x>
<y>571</y>
<y>590</y>
</hint>
</hints>
</connection>
@ -939,11 +991,11 @@
<hints>
<hint type="sourcelabel">
<x>693</x>
<y>580</y>
<y>599</y>
</hint>
<hint type="destinationlabel">
<x>588</x>
<y>578</y>
<y>597</y>
</hint>
</hints>
</connection>
@ -963,6 +1015,70 @@
</hint>
</hints>
</connection>
<connection>
<sender>actionAbout</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>showAbout()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>305</y>
</hint>
</hints>
</connection>
<connection>
<sender>action_Load_relation</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>loadRelation()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>305</y>
</hint>
</hints>
</connection>
<connection>
<sender>action_Save_relation</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>saveRelation()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>305</y>
</hint>
</hints>
</connection>
<connection>
<sender>action_Quit</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>305</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>execute()</slot>