Based on the idea proposed by @jmdaweb. Added the date indication to the available update dialog.

ATTENTION!: It will be needed to add the date field to the json for the updates. With this commit (updates folder) is the format I propose to the string.
This commit is contained in:
Iván Novegil 2016-08-03 18:35:46 +02:00
parent 3fca5c20fb
commit 99bdaca6f0
4 changed files with 6 additions and 3 deletions

View File

@ -28,10 +28,11 @@ def perform_update(endpoint, current_version, app_name='', password=None, update
logger.debug("No update for this architecture") logger.debug("No update for this architecture")
return False return False
available_description = available_update.get('description', None) available_description = available_update.get('description', None)
available_date = available_update.get('date', None)
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]] 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)
donation() donation()
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, date=available_date): #update_available_callback should return a falsy value to stop the process
logger.info("User canceled update.") logger.info("User canceled update.")
return return
base_path = tempfile.mkdtemp() base_path = tempfile.mkdtemp()

View File

@ -5,8 +5,8 @@ import utils
progress_dialog = None progress_dialog = None
def available_update_dialog(version, description): def available_update_dialog(version, description, date):
dialog = wx.MessageDialog(None, _(u"There's a new %s version available. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, application.name, version, description), _(u"New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING) dialog = wx.MessageDialog(None, _(u"There's a new %s version available, released on %s. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, date, application.name, version, description), _(u"New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
if dialog.ShowModal() == wx.ID_YES: if dialog.ShowModal() == wx.ID_YES:
return True return True
else: else:

View File

@ -1,4 +1,5 @@
{"current_version": "10.99", {"current_version": "10.99",
"description": "Changes: Read the changelog from the help menu in the menu bar.", "description": "Changes: Read the changelog from the help menu in the menu bar.",
"date": "day_name_abr month day_numb, 2016",
"downloads": "downloads":
{"Windows32": "http://twblue.es/pubs/twblue_snapshot.zip"}} {"Windows32": "http://twblue.es/pubs/twblue_snapshot.zip"}}

View File

@ -1,5 +1,6 @@
{"current_version": "0.84", {"current_version": "0.84",
"description": "The first version for the new generation of TWBlue.", "description": "The first version for the new generation of TWBlue.",
"date": "day_name_abr month day_numb, 2016",
"downloads": "downloads":
{"Windows32": "http://twblue.es/pubs/twblue_ngen_0.80_x86.zip", {"Windows32": "http://twblue.es/pubs/twblue_ngen_0.80_x86.zip",
"Windows64": "http://twblue.es/pubs/twblue_ngen_0.80_x64.zip"}} "Windows64": "http://twblue.es/pubs/twblue_ngen_0.80_x64.zip"}}