Commit d6cdcaded8b4b1295ded96b3c3db889a4dd772df
1 parent
d4c86486
Exists in
master
and in
65 other branches
ADD: updater ok
Showing
2 changed files
with
63 additions
and
0 deletions
Show diff stats
.gitattributes
| @@ -850,6 +850,7 @@ invesalius/gui/import_network_panel.py -text | @@ -850,6 +850,7 @@ invesalius/gui/import_network_panel.py -text | ||
| 850 | invesalius/gui/preferences.py -text | 850 | invesalius/gui/preferences.py -text |
| 851 | invesalius/net/__init__.py -text | 851 | invesalius/net/__init__.py -text |
| 852 | invesalius/net/dicom.py -text | 852 | invesalius/net/dicom.py -text |
| 853 | +invesalius/update.py -text | ||
| 853 | locale/cs/LC_MESSAGES/invesalius.mo -text | 854 | locale/cs/LC_MESSAGES/invesalius.mo -text |
| 854 | locale/de/LC_MESSAGES/invesalius.mo -text | 855 | locale/de/LC_MESSAGES/invesalius.mo -text |
| 855 | locale/el/LC_MESSAGES/invesalius.mo -text | 856 | locale/el/LC_MESSAGES/invesalius.mo -text |
| @@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
| 1 | +#!/usr/local/bin/python | ||
| 2 | +#-------------------------------------------------------------------------- | ||
| 3 | +# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas | ||
| 4 | +# Copyright: (C) 2001 Centro de Pesquisas Renato Archer | ||
| 5 | +# Homepage: http://www.softwarepublico.gov.br | ||
| 6 | +# Contact: invesalius@cti.gov.br | ||
| 7 | +# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) | ||
| 8 | +#-------------------------------------------------------------------------- | ||
| 9 | +# Este programa e software livre; voce pode redistribui-lo e/ou | ||
| 10 | +# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme | ||
| 11 | +# publicada pela Free Software Foundation; de acordo com a versao 2 | ||
| 12 | +# da Licenca. | ||
| 13 | +# | ||
| 14 | +# Este programa eh distribuido na expectativa de ser util, mas SEM | ||
| 15 | +# QUALQUER GARANTIA; sem mesmo a garantia implicita de | ||
| 16 | +# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM | ||
| 17 | +# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais | ||
| 18 | +# detalhes. | ||
| 19 | +#------------------------------------------------------------------------- | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +import wx | ||
| 23 | +import urllib2 | ||
| 24 | +import sys | ||
| 25 | +import platform | ||
| 26 | +import i18n | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +if (len(sys.argv)>2): | ||
| 30 | + print "Usage: python update.py <language>" | ||
| 31 | + sys.exit() | ||
| 32 | + | ||
| 33 | +if (len(sys.argv)==1): | ||
| 34 | + print "No language specified. Assuming english (en)." | ||
| 35 | + lang = 'en' | ||
| 36 | +else: | ||
| 37 | + lang = sys.argv[1] | ||
| 38 | + | ||
| 39 | +print lang | ||
| 40 | +# Check if there is a language set (if session file exists | ||
| 41 | +_ = i18n.InstallLanguage(lang) | ||
| 42 | + | ||
| 43 | +print "Checking updates..." | ||
| 44 | +URL = "http://www.cti.gov.br/dt3d/invesalius/update/checkupdate_"+sys.platform+"_"+platform.architecture()[0]+".php" | ||
| 45 | +#URL = "http://home.ruppert.com.br/aaa.php" | ||
| 46 | +response = urllib2.urlopen(URL,timeout=5) | ||
| 47 | +last = response.readline().rstrip() | ||
| 48 | +url = response.readline().rstrip() | ||
| 49 | +if (last!="3.0 beta 3"): | ||
| 50 | + print " ...New update found!!! -> version:", last #, ", url=",url | ||
| 51 | + from time import sleep | ||
| 52 | + sleep(1) | ||
| 53 | + app=wx.App() | ||
| 54 | + msg=_("A new version of InVesalius is available. Do you want to open the download website now?") | ||
| 55 | + title=_("Invesalius Update") | ||
| 56 | + msgdlg = wx.MessageDialog(None,msg,title, wx.YES_NO | wx.ICON_INFORMATION) | ||
| 57 | + if (msgdlg.ShowModal()==wx.ID_YES): | ||
| 58 | + wx.LaunchDefaultBrowser(url) | ||
| 59 | + msgdlg.Destroy() | ||
| 60 | + app.MainLoop() | ||
| 61 | + | ||
| 62 | + |