Commit a0edc42e0082fa1c3b1e840cb8e04cb3bb20c750

Authored by Thiago Franco de Moraes
1 parent 8ac676ad

Only checking for update if invesalius/config.cfg has a id_random

Showing 1 changed file with 35 additions and 35 deletions   Show diff stats
invesalius/utils.py
... ... @@ -71,8 +71,8 @@ def debug(error_str):
71 71 """
72 72 from session import Session
73 73 session = Session()
74   - if session.debug:
75   - print >> sys.stderr, error_str
  74 + #if session.debug:
  75 + print >> sys.stderr, error_str
76 76  
77 77 def next_copy_name(original_name, names_list):
78 78 """
... ... @@ -386,38 +386,38 @@ def UpdateCheck():
386 386 if session.ReadRandomId():
387 387 random_id = session.GetRandomId()
388 388  
389   - # Fetch update data from server
390   - import constants as const
391   - url = "http://www.cti.gov.br/dt3d/invesalius/update/checkupdate.php"
392   - headers = { 'User-Agent' : 'Mozilla/5.0 (compatible; MSIE 5.5; Windows NT)' }
393   - data = {'update_protocol_version' : '1',
394   - 'invesalius_version' : const.INVESALIUS_VERSION,
395   - 'platform' : sys.platform,
396   - 'architecture' : platform.architecture()[0],
397   - 'language' : lang,
398   - 'random_id' : random_id }
399   - data = urllib.urlencode(data)
400   - req = urllib2.Request(url, data, headers)
401   - try:
402   - response = urllib2.urlopen(req)
403   - except:
404   - return
405   - last = response.readline().rstrip()
406   - url = response.readline().rstrip()
407   - if (last!=const.INVESALIUS_VERSION):
408   - print " ...New update found!!! -> version:", last #, ", url=",url
409   - from time import sleep
410   - sleep(2)
411   - import wx
412   - app=wx.App()
413   - import i18n
414   - _ = i18n.InstallLanguage(lang)
415   - msg=_("A new version of InVesalius is available. Do you want to open the download website now?")
416   - title=_("Invesalius Update")
417   - msgdlg = wx.MessageDialog(None,msg,title, wx.YES_NO | wx.ICON_INFORMATION)
418   - if (msgdlg.ShowModal()==wx.ID_YES):
419   - wx.LaunchDefaultBrowser(url)
420   - msgdlg.Destroy()
421   - app.MainLoop()
  389 + # Fetch update data from server
  390 + import constants as const
  391 + url = "http://www.cti.gov.br/dt3d/invesalius/update/checkupdate.php"
  392 + headers = { 'User-Agent' : 'Mozilla/5.0 (compatible; MSIE 5.5; Windows NT)' }
  393 + data = {'update_protocol_version' : '1',
  394 + 'invesalius_version' : const.INVESALIUS_VERSION,
  395 + 'platform' : sys.platform,
  396 + 'architecture' : platform.architecture()[0],
  397 + 'language' : lang,
  398 + 'random_id' : random_id }
  399 + data = urllib.urlencode(data)
  400 + req = urllib2.Request(url, data, headers)
  401 + try:
  402 + response = urllib2.urlopen(req)
  403 + except:
  404 + return
  405 + last = response.readline().rstrip()
  406 + url = response.readline().rstrip()
  407 + if (last!=const.INVESALIUS_VERSION):
  408 + print " ...New update found!!! -> version:", last #, ", url=",url
  409 + from time import sleep
  410 + sleep(2)
  411 + import wx
  412 + app=wx.App()
  413 + import i18n
  414 + _ = i18n.InstallLanguage(lang)
  415 + msg=_("A new version of InVesalius is available. Do you want to open the download website now?")
  416 + title=_("Invesalius Update")
  417 + msgdlg = wx.MessageDialog(None,msg,title, wx.YES_NO | wx.ICON_INFORMATION)
  418 + if (msgdlg.ShowModal()==wx.ID_YES):
  419 + wx.LaunchDefaultBrowser(url)
  420 + msgdlg.Destroy()
  421 + app.MainLoop()
422 422  
423 423  
... ...