Пример #1
0
	print("Cleaning up!")
	try:
		shutil.rmtree(td)
	except OSError:
		print("Failed to remove temporary directory: "+td+"\n")
		pass

download_urls=cmtkgui.downloads()
# download_urls=['http://www.nitrc.org/frs/download.php/4814/CMTK-2.2.3-CYGWIN-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4812/CMTK-2.2.3-Linux-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4820/CMTK-2.2.3-MacOSX-10.4-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4822/CMTK-2.2.3-MacOSX-10.5-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4824/CMTK-2.2.3-MacOSX-10.6-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4604/CMTK-2.2.1-CYGWIN-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4596/CMTK-2.2.1-Linux-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4608/CMTK-2.2.1-MacOSX-10.4-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4610/CMTK-2.2.1-MacOSX-10.5-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4611/CMTK-2.2.1-MacOSX-10.6-x86_64.tar.gz']
download_files=map(os.path.basename,download_urls)
download_dict=dict(zip(download_files,download_urls))
print cmtkgui.install_dir()

gd = GenericDialogPlus('Install CMTK')
gd.addMessage('Currently installed CMTK version: '+cmtkgui.installed_version())
recommended_file=cmtkgui.recommended_file(download_files)
if recommended_file is None:
	recommended_file = download_files[0]
gd.addChoice("Download file",download_files,recommended_file)
gd.addMessage('By downloading this file you agree to the following (if you '+
	'do not agree to this, please press "Cancel" below):')
gd.addMessage('Core CMTK code is licensed under the GPLv3.\nBundled software'+
	' may be licensed under different terms - see licences/ directory for details')
gd.showDialog()
if gd.wasOKed():
	download_file=gd.getNextChoice()
	# nb url has a suffix to indicate that user agreed to license
	download_url=download_dict[download_file]+'/?i_agree=1&download_now=1'
	print "Downloading "+download_file+' from url '+download_url+' to '+cmtkgui.install_dir()
	cmtkgui.download_and_untar_url(download_url,cmtkgui.install_dir(),untar_binaries,download_file)
Пример #2
0

download_urls = cmtkgui.downloads()
# download_urls=['http://www.nitrc.org/frs/download.php/4814/CMTK-2.2.3-CYGWIN-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4812/CMTK-2.2.3-Linux-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4820/CMTK-2.2.3-MacOSX-10.4-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4822/CMTK-2.2.3-MacOSX-10.5-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4824/CMTK-2.2.3-MacOSX-10.6-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4604/CMTK-2.2.1-CYGWIN-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4596/CMTK-2.2.1-Linux-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4608/CMTK-2.2.1-MacOSX-10.4-i686.tar.gz', 'http://www.nitrc.org/frs/download.php/4610/CMTK-2.2.1-MacOSX-10.5-x86_64.tar.gz', 'http://www.nitrc.org/frs/download.php/4611/CMTK-2.2.1-MacOSX-10.6-x86_64.tar.gz']
download_files = map(os.path.basename, download_urls)
download_dict = dict(zip(download_files, download_urls))
print cmtkgui.install_dir()

gd = GenericDialogPlus('Install CMTK')
gd.addMessage('Currently installed CMTK version: ' +
              cmtkgui.installed_version())
recommended_file = cmtkgui.recommended_file(download_files)
if recommended_file is None:
    recommended_file = download_files[0]
gd.addChoice("Download file", download_files, recommended_file)
gd.addMessage('By downloading this file you agree to the following (if you ' +
              'do not agree to this, please press "Cancel" below):')
gd.addMessage(
    'Core CMTK code is licensed under the GPLv3.\nBundled software' +
    ' may be licensed under different terms - see licences/ directory for details'
)
gd.showDialog()
if gd.wasOKed():
    download_file = gd.getNextChoice()
    # nb url has a suffix to indicate that user agreed to license
    download_url = download_dict[download_file] + '/?i_agree=1&download_now=1'
    print "Downloading " + download_file + ' from url ' + download_url + ' to ' + cmtkgui.install_dir(
    )
    cmtkgui.download_and_untar_url(download_url, cmtkgui.install_dir(),
                                   untar_binaries, download_file)
try:
	download_url='https://github.com/jefferis/fiji-cmtk-gui/tarball/master'
	# check date
	installed_version='NA'
	local_version_info=cmtkgui.gui_local_versioninfo()
	if local_version_info.has_key('date'):
		installed_version=local_version_info['date']
	github_version_info=cmtkgui.gui_github_versioninfo()
	update_available=cmtkgui.gui_update_available(github_version_info)

	gd = GenericDialogPlus('Update CMTK GUI')
	if update_available:
		gd.addMessage('CMTK GUI update available')
		gd.setOKLabel("Download")
	else:
		gd.addMessage('CMTK GUI is up to date')

	gd.addMessage('Currently installed CMTK GUI version: '+installed_version)

	gd.showDialog()
	if gd.wasOKed() and update_available:
		# nb url has a suffix to indicate that user agreed to license
		from ij import IJ
		IJ.showStatus('Downloading CMTK GUI')
		cmtkgui.download_and_untar_url(download_url,cmtkgui.gui_install_dir(),untar_github_archive)
		cmtkgui.gui_write_local_versioninfo(github_version_info)
except SystemExit, e:
	from ij import IJ
	IJ.showStatus(str(e))
try:
    download_url = 'https://github.com/jefferis/fiji-cmtk-gui/tarball/master'
    # check date
    installed_version = 'NA'
    local_version_info = cmtkgui.gui_local_versioninfo()
    if local_version_info.has_key('date'):
        installed_version = local_version_info['date']
    github_version_info = cmtkgui.gui_github_versioninfo()
    update_available = cmtkgui.gui_update_available(github_version_info)

    gd = GenericDialogPlus('Update CMTK GUI')
    if update_available:
        gd.addMessage('CMTK GUI update available')
        gd.setOKLabel("Download")
    else:
        gd.addMessage('CMTK GUI is up to date')

    gd.addMessage('Currently installed CMTK GUI version: ' + installed_version)

    gd.showDialog()
    if gd.wasOKed() and update_available:
        # nb url has a suffix to indicate that user agreed to license
        from ij import IJ
        IJ.showStatus('Downloading CMTK GUI')
        cmtkgui.download_and_untar_url(download_url, cmtkgui.gui_install_dir(),
                                       untar_github_archive)
        cmtkgui.gui_write_local_versioninfo(github_version_info)
except SystemExit, e:
    from ij import IJ
    IJ.showStatus(str(e))