Commit d4c86486b21d8f797049003aecd60eb908cd2509

Authored by ruppert
1 parent 79788fa3

FIX: update fixed but still commented on control.py

invesalius/control.py
@@ -39,6 +39,8 @@ import session as ses @@ -39,6 +39,8 @@ import session as ses
39 39
40 import utils 40 import utils
41 import gui.dialogs as dialogs 41 import gui.dialogs as dialogs
  42 +import subprocess
  43 +import sys
42 44
43 DEFAULT_THRESH_MODE = 0 45 DEFAULT_THRESH_MODE = 0
44 46
@@ -57,8 +59,8 @@ class Controller(): @@ -57,8 +59,8 @@ class Controller():
57 59
58 Publisher.sendMessage('Load Preferences') 60 Publisher.sendMessage('Load Preferences')
59 61
60 - #utils.CheckForUpdate()  
61 - 62 + # Check for updates
  63 + #subprocess.Popen([sys.executable, 'update.py' ,ses.Session().language])
62 64
63 def __bind_events(self): 65 def __bind_events(self):
64 Publisher.subscribe(self.OnImportMedicalImages, 'Import directory') 66 Publisher.subscribe(self.OnImportMedicalImages, 'Import directory')
@@ -82,7 +84,6 @@ class Controller(): @@ -82,7 +84,6 @@ class Controller():
82 Publisher.subscribe(self.OnOpenProject, 'Open project') 84 Publisher.subscribe(self.OnOpenProject, 'Open project')
83 Publisher.subscribe(self.OnOpenRecentProject, 'Open recent project') 85 Publisher.subscribe(self.OnOpenRecentProject, 'Open recent project')
84 Publisher.subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog') 86 Publisher.subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog')
85 - #Publisher.subscribe(self.OnShowUpdateDialog, 'Show update dialog')  
86 87
87 88
88 def OnCancelImport(self, pubsub_evt): 89 def OnCancelImport(self, pubsub_evt):
@@ -628,6 +629,4 @@ class Controller(): @@ -628,6 +629,4 @@ class Controller():
628 629
629 630
630 631
631 - def OnShowUpdateDialog(self, pubsub_evt):  
632 - dialogs.UpdateDialog(pubsub_evt.data[0], pubsub_evt.data[1])  
633 632
invesalius/gui/dialogs.py
@@ -1276,21 +1276,6 @@ class SurfaceMethodPanel(wx.Panel): @@ -1276,21 +1276,6 @@ class SurfaceMethodPanel(wx.Panel):
1276 1276
1277 1277
1278 1278
1279 -  
1280 -  
1281 -def UpdateDialog(last,url):  
1282 - """  
1283 - Show update dialog  
1284 - """  
1285 - #try:  
1286 - msg=_("A new version of InVesalius is available. Do you want to open the download website now?")  
1287 - title=_("Invesalius Update")  
1288 - msgdlg = wx.MessageDialog(None,msg,title, wx.YES_NO | wx.ICON_INFORMATION)  
1289 - if (msgdlg.ShowModal()==wx.ID_YES):  
1290 - wx.LaunchDefaultBrowser(url)  
1291 - msgdlg.Destroy()  
1292 - #except:  
1293 - # return  
1294 1279
1295 1280
1296 1281
invesalius/utils.py
@@ -365,27 +365,5 @@ def get_system_encoding(): @@ -365,27 +365,5 @@ def get_system_encoding():
365 return 'utf-8' 365 return 'utf-8'
366 366
367 367
368 -def CheckForUpdate():  
369 - from threading import Thread  
370 - thr=Thread(target=UpdateChecker, args=())  
371 - thr.start()  
372 -  
373 -  
374 -def UpdateChecker():  
375 - import urllib2  
376 - #try:  
377 - URL = "http://www.cti.gov.br/dt3d/invesalius/update/checkupdate_"+sys.platform+"_"+platform.architecture()[0]+".php"  
378 - response = urllib2.urlopen(URL,timeout=5)  
379 - last = response.readline().rstrip()  
380 - url = response.readline().rstrip()  
381 - print last, url  
382 - if (last!="3.0 beta 32"):  
383 - print "New update found!!! -> version:", last, ", url=",url  
384 - from time import sleep  
385 - sleep(5)  
386 - from wx.lib.pubsub import pub as Publisher  
387 - Publisher.sendMessage("Show update dialog", (last,url))  
388 - #except:  
389 - #return  
390 368
391 369