New way of checking for new versions

master
Salvo 'LtWorf' Tomaselli 2013-12-27 00:16:12 +07:00
parent c637890795
commit 5e4a703f56
6 changed files with 105 additions and 83 deletions

@ -2,6 +2,8 @@
- Better tokenizer, gives more indicative errors - Better tokenizer, gives more indicative errors
- Parser gives more indicative errors - Parser gives more indicative errors
- Improved select_union_intersect_subtract optimization to avoid parenthesis whenever possible - Improved select_union_intersect_subtract optimization to avoid parenthesis whenever possible
- Moved feedback service, and added the code for it
- Different way of checking the latest version
1.1 1.1
- Incorrect relational operations now raise an exception instead of returning None - Incorrect relational operations now raise an exception instead of returning None

@ -1,7 +1,7 @@
application: feedback-ltworf application: feedback-ltworf
version: 2 version: 1
runtime: python27 runtime: python27
api_version: 1 api_version: 3
threadsafe: true threadsafe: true
handlers: handlers:

@ -9,6 +9,12 @@ application = micro_webapp2.WSGIApplication()
def m(request, *args, **kwargs): def m(request, *args, **kwargs):
return "" return ""
@application.route("/version/<id>")
def show_version(request, *args, **kwargs):
if kwargs["id"] == "relational":
return "1.2"
return "No version"
@application.route('/feedback/<id>') @application.route('/feedback/<id>')
def mail_sender(request, *args, **kwargs): def mail_sender(request, *args, **kwargs):

@ -48,21 +48,16 @@ def check_latest_version():
'''Returns the latest version available. '''Returns the latest version available.
Heavely dependent on server and server configurations Heavely dependent on server and server configurations
not granted to work forever.''' not granted to work forever.'''
connection = httplib.HTTPConnection('galileo.dmi.unict.it') connection = httplib.HTTPConnection('feedback-ltworf.appspot.com')
connection.request("GET","/svn/relational/tags/") connection.request("GET","/version/relational")
r=connection.getresponse() r=connection.getresponse()
#html #html
s=r.read() s=r.read()
if len(s)==0: if len(s)==0:
return None return None
return s.strip()
l= s[s.find('<ul>')+4:s.find('</ul>')].split('\n')
l.sort()
a=l[len(l)-1]
s=a.find('"')+1
return a[s:a.find('"',s)-1]
class interface (object): class interface (object):
'''It is used to provide services to the user interfaces, in order to '''It is used to provide services to the user interfaces, in order to
@ -98,4 +93,3 @@ class interface (object):
relname is not None, adds the result to the relname is not None, adds the result to the
dictionary, with the name given in relname.''' dictionary, with the name given in relname.'''
pass pass

@ -112,6 +112,8 @@ if __name__ == "__main__":
guihandler.version=version guihandler.version=version
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
app.setOrganizationName('None');
app.setApplicationName('relational');
ui = maingui.Ui_MainWindow() ui = maingui.Ui_MainWindow()
Form = guihandler.relForm(ui) Form = guihandler.relForm(ui)
@ -120,6 +122,7 @@ if __name__ == "__main__":
Form.setFont(QtGui.QFont("Dejavu Sans Bold")) Form.setFont(QtGui.QFont("Dejavu Sans Bold"))
ui.setupUi(Form) ui.setupUi(Form)
Form.restore_settings()
for i in range(len(files)): for i in range(len(files)):
if not os.path.isfile(files[i]): if not os.path.isfile(files[i]):

@ -16,21 +16,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# author Salvo "LtWorf" Tomaselli <tiposchi@tiscali.it> # author Salvo "LtWorf" Tomaselli <tiposchi@tiscali.it>
import sys
import os
import pickle
try: try:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
except: except:
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
from relational import relation, parser, optimizer,rtypes from relational import relation, parser, optimizer,rtypes
import sys
import about import about
import survey import survey
import os
import surveyForm import surveyForm
import maingui import maingui
import compatibility import compatibility
class relForm(QtGui.QMainWindow): class relForm(QtGui.QMainWindow):
def __init__(self,ui): def __init__(self,ui):
@ -42,6 +47,9 @@ class relForm(QtGui.QMainWindow):
self.selectedRelation=None self.selectedRelation=None
self.ui=ui self.ui=ui
self.qcounter=1 #Query counter self.qcounter=1 #Query counter
self.settings = QtCore.QSettings()
def checkVersion(self): def checkVersion(self):
from relational import maintenance from relational import maintenance
online=maintenance.check_latest_version() online=maintenance.check_latest_version()
@ -204,7 +212,16 @@ class relForm(QtGui.QMainWindow):
self.updateRelations() self.updateRelations()
def closeEvent(self, event):
self.save_settings()
event.accept()
def save_settings(self):
#self.settings.setValue("width",)
pass
def restore_settings(self):
#self.settings.value('session_name','default').toString()
pass
def showSurvey(self): def showSurvey(self):
if self.Survey==None: if self.Survey==None:
@ -214,6 +231,7 @@ class relForm(QtGui.QMainWindow):
ui.setupUi(self.Survey) ui.setupUi(self.Survey)
self.Survey.setDefaultValues() self.Survey.setDefaultValues()
self.Survey.show() self.Survey.show()
def showAbout(self): def showAbout(self):
if self.About==None: if self.About==None:
self.About = QtGui.QDialog() self.About = QtGui.QDialog()
@ -294,4 +312,3 @@ class relForm(QtGui.QMainWindow):
def addSymbolInQuery(self,symbol): def addSymbolInQuery(self,symbol):
self.ui.txtQuery.insert(symbol) self.ui.txtQuery.insert(symbol)
self.ui.txtQuery.setFocus() self.ui.txtQuery.setFocus()