Skip to content

Commit

Permalink
[NB] Remove MicroDrop app update check
Browse files Browse the repository at this point in the history
Remove MicroDrop app update check since MicroDrop updating is now
handled by the [MicroDrop Profile Manager][1] package.

[1]: sci-bots/microdrop-launcher#3
  • Loading branch information
cfobel committed Nov 18, 2016
1 parent 1ba76f5 commit 80613ea
Showing 1 changed file with 9 additions and 56 deletions.
65 changes: 9 additions & 56 deletions microdrop/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,58 +347,6 @@ def _update_setting(self):
'check for updates, but ask before installing'
return self.config['microdrop.app']['update_automatically']

def update_check(self):
if self._update_setting() not in ('auto-update',
'check for updates, but ask before '
'installing'):
return

app_update_server_url = self.config.data.get(self.name, {}).get(
'server_url', 'http://microfluidics.utoronto.ca/update')
logger.debug('[APP UPDATE SERVER] server url: %s' % app_update_server_url)
app_repository = AppRepository(app_update_server_url)
current_version = Version.fromstring(self.version)
try:
latest_version = Version(**app_repository.latest_version('microdrop'))
except (JSONRPCException, JSONDecodeException, IOError):
logger.warning('Could not connect to application update server: '
'%s', app_update_server_url)
return
try:
current_version < latest_version
except DifferentVersionTagsError:
logger.info('Current version (%s) has different tags than latest '
'version (%s). Skipping update.', current_version,
latest_version)
return

if current_version < latest_version:
logger.info('Current version: %s. There is a new version '
'available: %s %s' % (current_version, latest_version,
app_repository.server_url +
app_repository
.latest_package_url(
'microdrop')))
response = yesno('''
There is a new version of Microdrop available (%s, current version: %s).
Would you like to download the latest version in your browser?''' %
(latest_version, current_version))
if response == gtk.RESPONSE_YES:
latest_full_url = (app_repository.server_url + app_repository
.latest_package_url('microdrop'))
if webbrowser.open_new_tab(latest_full_url):
logger.info('Closing app after opening browser to latest '
'version (%s).' % latest_version)
try:
self.main_window_controller.on_destroy(None)
except AttributeError:
raise SystemExit, 'Closing app to allow upgrade installation'
else:
logger.info('[SUCCESS] software is up-to-date.\n (installed '
'version: %s, server version: %s)' % (current_version,
latest_version))

def update_plugins(self):
update_setting = self._update_setting()

Expand All @@ -417,15 +365,21 @@ def update_plugins(self):
update = False

if update:
service = plugin_manager.get_service_instance_by_name(
'microdrop.gui.plugin_manager_controller', env='microdrop')
service = \
(plugin_manager
.get_service_instance_by_name('microdrop.gui'
'.plugin_manager_controller',
env='microdrop'))
if service.update_all_plugins(force=force):
logger.warning('Plugins have been updated. The application '
'must be restarted.')
if self.main_window_controller is not None:
self.main_window_controller.on_destroy(None)
else:
raise SystemExit, 'Closing app after plugins auto-upgrade'
logger.info('Closing app after plugins auto-upgrade')
# Use return code of `5` to signal program should be
# restarted.
self.main_window_controller.on_destroy(None, return_code=5)
else:
logger.info('No plugins have been updated')

Expand All @@ -444,7 +398,6 @@ def run(self):
path(self.config['data_dir'])
.joinpath('microdrop.log')})

self.update_check()
plugin_manager.load_plugins(self.config['plugins']['directory'])
self.update_log_file()

Expand Down

0 comments on commit 80613ea

Please sign in to comment.