- Can perform survey from command line interface too
- Module to send survey directly - Can check the latest version from the svn repository git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@311 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
@@ -37,6 +37,19 @@ class relForm(QtGui.QMainWindow):
|
||||
self.selectedRelation=None
|
||||
self.ui=ui
|
||||
self.qcounter=1 #Query counter
|
||||
def checkVersion(self):
|
||||
from relational import maintenance
|
||||
online=maintenance.check_latest_version()
|
||||
|
||||
if online>version:
|
||||
r=QtGui.QApplication.translate("Form", "New version available online: %s." % online)
|
||||
elif online==version:
|
||||
r=QtGui.QApplication.translate("Form", "Latest version installed.")
|
||||
else:
|
||||
r=QtGui.QApplication.translate("Form", "You are using an unstable version.")
|
||||
|
||||
QtGui.QMessageBox.information(self,QtGui.QApplication.translate("Form", "Version"),r)
|
||||
|
||||
|
||||
def load_query(self,*index):
|
||||
self.ui.txtQuery.setText(self.savedQ.itemData(index[0]).toString())
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'maingui.ui'
|
||||
#
|
||||
# Created: Mon Mar 21 00:21:36 2011
|
||||
# Created: Tue Jun 14 18:13:03 2011
|
||||
# by: PyQt4 UI code generator 4.8.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@@ -227,11 +227,14 @@ class Ui_MainWindow(object):
|
||||
self.action_Quit = QtGui.QAction(MainWindow)
|
||||
self.action_Quit.setMenuRole(QtGui.QAction.QuitRole)
|
||||
self.action_Quit.setObjectName(_fromUtf8("action_Quit"))
|
||||
self.actionCheck_for_new_versions = QtGui.QAction(MainWindow)
|
||||
self.actionCheck_for_new_versions.setObjectName(_fromUtf8("actionCheck_for_new_versions"))
|
||||
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.menuAbout.addAction(self.actionCheck_for_new_versions)
|
||||
self.menubar.addAction(self.menuFile.menuAction())
|
||||
self.menubar.addAction(self.menuAbout.menuAction())
|
||||
self.label.setBuddy(self.txtQuery)
|
||||
@@ -272,6 +275,7 @@ class Ui_MainWindow(object):
|
||||
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.QObject.connect(self.actionCheck_for_new_versions, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.checkVersion)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
MainWindow.setTabOrder(self.cmdAbout, self.cmdSurvey)
|
||||
MainWindow.setTabOrder(self.cmdSurvey, self.cmdProduct)
|
||||
@@ -347,4 +351,5 @@ class Ui_MainWindow(object):
|
||||
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))
|
||||
self.actionCheck_for_new_versions.setText(QtGui.QApplication.translate("MainWindow", "Check for new versions", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
|
@@ -444,6 +444,7 @@
|
||||
</property>
|
||||
<action name=""/>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionCheck_for_new_versions"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuAbout"/>
|
||||
@@ -483,6 +484,11 @@
|
||||
<enum>QAction::QuitRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheck_for_new_versions">
|
||||
<property name="text">
|
||||
<string>Check for new versions</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cmdAbout</tabstop>
|
||||
@@ -1079,9 +1085,26 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionCheck_for_new_versions</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>checkVersion()</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>
|
||||
<slot>checkVersion()</slot>
|
||||
<slot>showAbout()</slot>
|
||||
<slot>showSurvey()</slot>
|
||||
<slot>addProduct()</slot>
|
||||
|
@@ -18,8 +18,7 @@
|
||||
# author Salvo "LtWorf" Tomaselli <tiposchi@tiscali.it>
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
import httplib
|
||||
import urllib
|
||||
from relational import maintenance
|
||||
import platform
|
||||
import locale
|
||||
|
||||
@@ -53,16 +52,17 @@ class surveyForm (QtGui.QWidget):
|
||||
pass
|
||||
def send(self):
|
||||
'''Sends the data inserted in the form'''
|
||||
#Creates the string
|
||||
post="Relational algebra\n"
|
||||
post+="version: " + version + "\n"
|
||||
post+="system:" + str(self.ui.txtSystem.text().toUtf8())+ "\n"
|
||||
post+="country:" + str(self.ui.txtCountry.text().toUtf8())+ "\n"
|
||||
post+="school:" + str(self.ui.txtSchool.text().toUtf8())+ "\n"
|
||||
post+="age:" + str(self.ui.txtAge.text().toUtf8())+ "\n"
|
||||
post+="find:" + str(self.ui.txtFind.text().toUtf8())+ "\n"
|
||||
post+="email:" + str(self.ui.txtEmail.text().toUtf8())+"\n"
|
||||
post+="comments:" + str(self.ui.txtComments.toPlainText().toUtf8())
|
||||
|
||||
post={}
|
||||
post['software']="Relational algebra"
|
||||
post["version"]= version
|
||||
post["system"]= str(self.ui.txtSystem.text().toUtf8())
|
||||
post["country"]= str(self.ui.txtCountry.text().toUtf8())
|
||||
post["school"]= str(self.ui.txtSchool.text().toUtf8())
|
||||
post["age"] = str(self.ui.txtAge.text().toUtf8())
|
||||
post["find"] = str(self.ui.txtFind.text().toUtf8())
|
||||
post["email"] =str(self.ui.txtEmail.text().toUtf8())
|
||||
post["comments"] = str(self.ui.txtComments.toPlainText().toUtf8())
|
||||
|
||||
#Clears the form
|
||||
self.ui.txtSystem.clear()
|
||||
@@ -72,13 +72,9 @@ class surveyForm (QtGui.QWidget):
|
||||
self.ui.txtFind.clear()
|
||||
self.ui.txtEmail.clear()
|
||||
self.ui.txtComments.clear()
|
||||
|
||||
response=maintenance.send_survey(post)
|
||||
|
||||
#sends the string
|
||||
params = urllib.urlencode({'survey':post})
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
|
||||
connection = httplib.HTTPConnection('galileo.dmi.unict.it')
|
||||
connection.request("POST","/~ltworf/survey.php",params,headers)
|
||||
response=connection.getresponse()
|
||||
if response.status!=200:
|
||||
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"),QtGui.QApplication.translate("Form", "Unable to send the data!") )
|
||||
else:
|
||||
|
Reference in New Issue
Block a user