More work on update notification. Displays debug popup now.
This commit is contained in:
@@ -163,8 +163,11 @@ class MainFrame(wx.Frame):
|
||||
|
||||
#Check for updates
|
||||
self.sUpdate = service.Update.getInstance()
|
||||
self.sUpdate.CheckUpdate()
|
||||
self.sUpdate.CheckUpdate(self.ShowUpdateBox)
|
||||
|
||||
def ShowUpdateBox(self):
|
||||
wx.MessageBox('ZOMG UPDATE', 'Info', wx.OK | wx.ICON_INFORMATION)
|
||||
|
||||
def LoadMainFrameAttribs(self):
|
||||
|
||||
mainFrameDefaultAttribs = {"wnd_width":1000, "wnd_height": 700, "wnd_maximized": False}
|
||||
|
||||
@@ -25,17 +25,12 @@ import config
|
||||
|
||||
from service.settings import SettingsProvider
|
||||
|
||||
class Update():
|
||||
instance = None
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def CheckUpdate(self):
|
||||
print "Checking for Updates"
|
||||
t=threading.Thread(target=self.__CheckUpdate)
|
||||
t.start()
|
||||
|
||||
def __CheckUpdate(self):
|
||||
class CheckUpdateThread(threading.Thread):
|
||||
def __init__(self, callback):
|
||||
threading.Thread.__init__(self)
|
||||
self.callback = callback
|
||||
|
||||
def run(self):
|
||||
print "In the thread"
|
||||
try:
|
||||
response = urllib2.urlopen('https://api.github.com/repos/DarkFenX/Pyfa/releases')
|
||||
@@ -43,9 +38,20 @@ class Update():
|
||||
responseVersion = jsonResponse[0]['tag_name'].replace('v', '', 1)
|
||||
if responseVersion != config.version:
|
||||
print "New version!"
|
||||
wx.CallAfter(self.callback)
|
||||
except:
|
||||
pass
|
||||
|
||||
class Update():
|
||||
instance = None
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def CheckUpdate(self, callback):
|
||||
print "Checking for Updates"
|
||||
thread = CheckUpdateThread(callback)
|
||||
thread.start()
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls.instance == None:
|
||||
|
||||
Reference in New Issue
Block a user