Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueegg committed Aug 4, 2015
1 parent 81b1808 commit bcd5e1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 1 addition & 11 deletions workflow/src/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from src import icons
from src.lib.requests.exceptions import SSLError

from src.lib.workflow import (PasswordNotFound, __version__)
from src.lib.workflow import PasswordNotFound
from src.lib.workflow.background import run_in_background
from src.lib.workflow.background import is_running

Expand Down Expand Up @@ -44,16 +44,6 @@ def build_bamboo_facade():
return BambooFacade(bamboo_host, bamboo_user, bamboo_pw, verify_cert)


def notify_if_upgrade_available():
if workflow().update_available:
v = workflow().cached_data('__workflow_update_status', max_age=0)['version']
workflow().add_item('An update is available!',
'Update the workflow from version {} to {}'.format(__version__, v),
arg=':config update',
valid=True,
icon=icons.UPDATE)


def _notify_if_cache_update_in_progress():
# Notify the user if the cache is being updated
if is_running(SYNC_JOB_NAME):
Expand Down
15 changes: 13 additions & 2 deletions workflow/src/routing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from src.actions import notify_if_upgrade_available, HOST_URL
from src import icons, __version__
from src.actions import HOST_URL
from src.actions.branches import BranchesWorkflowAction
from src.actions.configure import ConfigureWorkflowAction
from src.actions.help import HelpWorkflowAction
Expand Down Expand Up @@ -35,5 +36,15 @@ def route(args): # e.g., args = ":config sethost http://localhost,--exec"
handler().execute(command, cmd_pressed='--cmd' in args, shift_pressed='--shift' in args)
else: # show menu
handler().menu(command)
notify_if_upgrade_available()
_notify_if_upgrade_available()
workflow().send_feedback()


def _notify_if_upgrade_available():
if workflow().update_available:
new_version = workflow().cached_data('__workflow_update_status', max_age=0)['version']
workflow().add_item('An update is available!',
'Update the workflow from version {} to {}'.format(__version__, new_version),
arg=':config update',
valid=True,
icon=icons.UPDATE)

0 comments on commit bcd5e1f

Please sign in to comment.