Skip to content

Commit

Permalink
Merge branch 'hotfix/0.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
idpaterson committed Mar 6, 2016
2 parents 1f87867 + c2da5d7 commit 145bde0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
Binary file modified Wunderlist.alfredworkflow
Binary file not shown.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfred-wunderlist-workflow",
"version": "0.5.3",
"version": "0.5.4",
"dependencies": {},
"private": true,
"devDependencies": {}
Expand Down
2 changes: 1 addition & 1 deletion lib/alfred-workflow
Submodule alfred-workflow updated 187 files
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfred-wunderlist-workflow",
"version": "0.5.3",
"version": "0.5.4",
"dependencies": {},
"private": true,
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/wunderlist/handlers/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from wunderlist.models.user import User
from wunderlist.models.preferences import Preferences
from wunderlist.util import workflow, parsedatetime_calendar, parsedatetime_constants, format_time, update_prerelease_channel
from wunderlist.util import workflow, parsedatetime_calendar, parsedatetime_constants, format_time
from wunderlist import icons

def _parse_time(phrase):
Expand Down Expand Up @@ -210,7 +210,6 @@ def commit(args):
prefs.prerelease_channel = not prefs.prerelease_channel

# Update the workflow settings and reverify the update data
update_prerelease_channel()
workflow().check_update(True)

if prefs.prerelease_channel:
Expand Down
14 changes: 11 additions & 3 deletions src/wunderlist/models/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
EXPLICIT_KEYWORDS_KEY = 'explicit_keywords'
AUTOMATIC_REMINDERS_KEY = 'automatic_reminders'
REMINDER_TODAY_OFFSET_KEY = 'reminder_today_offset'
PRERELEASE_CHANNEL_KEY = 'prerelease_channel'
PRERELEASES_KEY = '__workflow_prereleases'

class Preferences(object):

Expand Down Expand Up @@ -41,6 +41,14 @@ def current_prefs(cls):
def __init__(self, data):
self._data = data or {}

# Clean up old prerelease preference
if 'prerelease_channel' in self._data:
# Migrate to the alfred-workflow preference
self.prerelease_channel = self._data['prerelease_channel']
del self._data['prerelease_channel']

workflow().store_data('prefs', self._data)

def _set(self, key, value):
self._data[key] = value

Expand Down Expand Up @@ -102,9 +110,9 @@ def automatic_reminders(self, automatic_reminders):

@property
def prerelease_channel(self):
return self._get(PRERELEASE_CHANNEL_KEY, False)
return workflow().settings.get(PRERELEASES_KEY, False)

@prerelease_channel.setter
def prerelease_channel(self, prerelease_channel):
self._set(PRERELEASE_CHANNEL_KEY, prerelease_channel)
workflow().settings[PRERELEASES_KEY] = prerelease_channel

34 changes: 11 additions & 23 deletions src/wunderlist/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,24 @@ def workflow():

if _workflow is None:
version = '__VERSION__'
_update_settings = {
'github_slug': 'idpaterson/alfred-wunderlist-workflow',
'version': version,
# Check for updates daily
# TODO: check less frequently as the workflow becomes more
# stable
'frequency': 1,
# Download pre-release updates if enabled in preferences or if
# a prerelease is currently installed
'prerelease': '-' in version
}

_workflow = Workflow(
capture_args=False,
update_settings=_update_settings
update_settings={
'github_slug': 'idpaterson/alfred-wunderlist-workflow',
'version': version,
# Check for updates daily
# TODO: check less frequently as the workflow becomes more
# stable
'frequency': 1,
# Always download pre-release updates if a prerelease is
# currently installed
'prerelease': '-' in version
}
)

# Check preferences after initializing the workflow since the workflow
# is required for checking preferences
update_prerelease_channel()

return _workflow

def update_prerelease_channel():
from wunderlist.models.preferences import Preferences

prefs = Preferences.current_prefs()

_update_settings['prerelease'] = prefs.prerelease_channel

def parsedatetime_calendar():
from parsedatetime import Calendar, Constants

Expand Down

0 comments on commit 145bde0

Please sign in to comment.