The updater system is executed at the startup

This commit is contained in:
Manuel Cortez 2015-02-22 11:38:22 -06:00
parent e906d04f18
commit 88d7898dba
10 changed files with 30 additions and 26 deletions

View File

@ -1,16 +1,16 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
name = 'TW Blue' name = 'TWBlue'
snapshot = False snapshot = True
if snapshot == False: if snapshot == False:
version = "0.80" version = "0.80"
update_url = 'http://twblue.es/updates/tw_blue.json' update_url = 'http://twblue.es/updates/twblue_ngen.json'
else: else:
version = "7" version = "7"
update_url = 'http://twblue.es/updates/snapshots.json' update_url = 'http://twblue.es/updates/snapshots_ngen.json'
author = u"Manuel Cortéz" author = u"Manuel Cortéz"
authorEmail = "info@twblue.com.mx" authorEmail = "manuel@manuelcortez.net"
copyright = u"copyright (C) 2013-2014, Manuel cortéz" copyright = u"copyright (C) 2013-2015, Manuel cortéz"
description = u"TW Blue is an app designed to use Twitter in a simple and fast way and avoiding, as far as possible, the consumtion of excessive resources of the machine where its running. With this app youll have access to most twitter features." description = u"TW Blue is an app designed to use Twitter in a simple and fast way and avoiding, as far as possible, the consumtion of excessive resources of the machine where its running. With this app youll have access to most twitter features."
translators = [u"Bryner Villalobos (English)", u"Mohammed Al Shara (Arabic)", u"Salva Doménech, Juan Carlos Rivilla(Catalan)", u"Manuel cortéz(Spanish)", u"Sukil Etxenike Arizaleta(Basque)", u"Jani Kinnunen(finnish)", u"Javier Currás, José Manuel Delicado, Alba Quinteiro(Galician)", u"Robert Osztolykan(Hungarian)", u"Paweł Masarczyk(Polish)", u"Odenilton Júnior Santos(Portuguese)", u"Alexander Jaszyn(Russian)", u"Burak (Turkish)"] translators = [u"Bryner Villalobos (English)", u"Mohammed Al Shara (Arabic)", u"Joan Rabat, Juan Carlos Rivilla (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Alba Quinteiro (Galician)", u"Steffen Schultz (German)", u"Robert Osztolykan (Hungarian)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Alexander Jaszyn (Russian)", u"Burak (Turkish)"]
url = u"http://twblue.com.mx" url = u"http://twblue.es"
report_bugs_url = "http://twblue.com.mx/errores/api/soap/mantisconnect.php?wsdl" report_bugs_url = "http://twblue.es/bugs/api/soap/mantisconnect.php?wsdl"

View File

@ -464,7 +464,7 @@ class Controller(object):
msg = messages.viewTweet(non_tweet, False) msg = messages.viewTweet(non_tweet, False)
def open_timeline(self, *args, **kwargs): def open_timeline(self, *args, **kwargs):
buff = self.get_current_buffer() buff = self.get_best_buffer()
if not hasattr(buff, "get_right_tweet"): return if not hasattr(buff, "get_right_tweet"): return
tweet = buff.get_right_tweet() tweet = buff.get_right_tweet()
if buff.type != "people": if buff.type != "people":

View File

@ -23,3 +23,4 @@ class soundsTutorialDialog(widgetUtils.BaseDialog):
sizer.Add(listBox) sizer.Add(listBox)
sizer.Add(btnBox) sizer.Add(btnBox)
panel.SetSizer(sizer) panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())

View File

@ -12,6 +12,7 @@ import platform
import application import application
import keys import keys
from mysc.thread_utils import call_threaded from mysc.thread_utils import call_threaded
from update import updater
log = logging.getLogger("main") log = logging.getLogger("main")
def setup(): def setup():
@ -19,7 +20,7 @@ def setup():
config.setup() config.setup()
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0])) log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
log.debug("Application path is %s" % (paths.app_path(),)) log.debug("Application path is %s" % (paths.app_path(),))
log.debug("Data path is %s" % (paths.data_path(),)) log.debug("config path is %s" % (paths.config_path(),))
sound.setup() sound.setup()
output.setup() output.setup()
languageHandler.setLanguage(config.app["app-settings"]["language"]) languageHandler.setLanguage(config.app["app-settings"]["language"])
@ -27,6 +28,7 @@ def setup():
from controller import mainController from controller import mainController
from sessionmanager import sessionManager from sessionmanager import sessionManager
app = wx.App() app = wx.App()
updater.do_update()
sm = sessionManager.sessionManagerController() sm = sessionManager.sessionManagerController()
sm.fill_list() sm.fill_list()
if len(sm.sessions) == 0: sm.show() if len(sm.sessions) == 0: sm.show()

View File

@ -18,12 +18,14 @@ def perform_update(endpoint, current_version, app_name='', password=None, update
requests_session = create_requests_session(app_name=app_name, version=current_version) requests_session = create_requests_session(app_name=app_name, version=current_version)
available_update = find_update(endpoint, requests_session=requests_session) available_update = find_update(endpoint, requests_session=requests_session)
if not available_update: if not available_update:
logger.debug("No update available")
return return
available_version = available_update['current_version'] available_version = available_update['current_version']
if not str(available_version) > str(current_version) or platform.system() not in available_update['downloads']: if not str(available_version) > str(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']:
logger.debug("No update for this architecture")
return return
available_description = available_update.get('description', None) available_description = available_update.get('description', None)
update_url = available_update ['downloads'][platform.system()] update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
logger.info("A new update is available. Version %s" % available_version) logger.info("A new update is available. Version %s" % available_version)
if callable(update_available_callback) and not update_available_callback(version=available_version, description=available_description): #update_available_callback should return a falsy value to stop the process if callable(update_available_callback) and not update_available_callback(version=available_version, description=available_description): #update_available_callback should return a falsy value to stop the process
logger.info("User canceled update.") logger.info("User canceled update.")

11
src/update/updater.py Normal file
View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
import application
import update
import platform
from wxUpdater import *
def do_update():
# try:
update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
# except:
# pass

View File

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
import application
import update
import platform
#if platform.system() == "Windows":
from wxUpdater import *
def do_update():
try:
update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
except:
pass