diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 607bc8c58..f92560e0c 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -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} diff --git a/service/update.py b/service/update.py index bfb691b63..09af1f20f 100644 --- a/service/update.py +++ b/service/update.py @@ -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: