Commit 888a5a067527f700ae225cc74bfdafd59872c7b3
1 parent
c4e615c4
Exists in
master
and in
67 other branches
ENH: added updater
Showing
1 changed file
with
27 additions
and
0 deletions
Show diff stats
invesalius/utils.py
| ... | ... | @@ -363,3 +363,30 @@ def get_system_encoding(): |
| 363 | 363 | return locale.getdefaultlocale()[1] |
| 364 | 364 | else: |
| 365 | 365 | return 'utf-8' |
| 366 | + | |
| 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 31"): | |
| 383 | + print "New update found!!! -> version:", last, ", url=",url | |
| 384 | + from time import sleep | |
| 385 | + sleep(5) | |
| 386 | + from gui.dialogs import UpdateDialog | |
| 387 | + UpdateDialog(last,url) | |
| 388 | + #except: | |
| 389 | + # return | |
| 390 | + | |
| 391 | + | |
| 392 | + | ... | ... |