Update Notifications: Sort release results by published date before iterating

This commit is contained in:
blitzmann
2014-08-28 20:34:16 -04:00
parent d5a701ab31
commit f02be0b0fd
2 changed files with 5 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ class UpdateDialog(wx.Dialog):
mainSizer.Add( versionSizer, 0, wx.EXPAND, 5 )
mainSizer.AddSpacer( ( 0, 5), 0, wx.EXPAND, 5 )
releaseDate = dateutil.parser.parse(self.releaseInfo['created_at'])
releaseDate = dateutil.parser.parse(self.releaseInfo['published_at'])
notesSizer = wx.BoxSizer( wx.HORIZONTAL )
self.notesTextCtrl = wx.TextCtrl( self, wx.ID_ANY, str(releaseDate.date())+":\n\n"+self.releaseInfo['body'], wx.DefaultPosition, wx.DefaultSize, wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY|wx.DOUBLE_BORDER|wx.TRANSPARENT_WINDOW )
@@ -117,4 +117,4 @@ class UpdateDialog(wx.Dialog):
def OnDownload(self, e):
wx.LaunchDefaultBrowser('https://github.com/DarkFenX/Pyfa/releases/tag/'+self.releaseInfo['tag_name'])
self.OnClose(e)
self.OnClose(e)

View File

@@ -23,6 +23,8 @@ import urllib2
import json
import config
import service
import dateutil.parser
import calendar
class CheckUpdateThread(threading.Thread):
def __init__(self, callback):
@@ -37,6 +39,7 @@ class CheckUpdateThread(threading.Thread):
try:
response = network.request('https://api.github.com/repos/DarkFenX/Pyfa/releases', network.UPDATE)
jsonResponse = json.loads(response.read())
jsonResponse.sort(key=lambda x: calendar.timegm(dateutil.parser.parse(x['published_at']).utctimetuple()), reverse=True)
for release in jsonResponse:
# Suppress pre releases