commit/StationPlaylist: 2 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Fri, 03 Jul 2015 08:25:23 -0000

2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/a28244c6351c/
Changeset: a28244c6351c
Branch: None
User: josephsl
Date: 2015-07-03 08:21:25+00:00
Summary: 5.2: Officially leave 4.x config format behind.

Affected #: 1 file

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index 01e3869..e99ae6b 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -32,36 +32,6 @@ SayListenerCount = boolean(default=true)
confspec.newlines = "\r\n"
SPLConfig = None

-# List of values to be converted manually.
-# This will be called only once: when upgrading from prior versions to 5.0, to
be removed in 5.1.
-configConversions=("EndOfTrackTime", "SongRampTime")
-
-# The accompanying function for config conversion.
-# Returns config=false if errors occur, to be checked in the app module
constructor.
-def config4to5(config):
- migrationFailure = 0
- for setting in configConversions:
- try:
- oldValue = str(config[setting])
- except KeyError:
- continue
- if oldValue.isdigit():
- continue
- # If the old value doesn't conform to below conditions, start
from a fresh config spec.
- try:
- if (len(oldValue) == 5
- and oldValue.startswith("00:")
- and oldValue.split(":")[1].isdigit()):
- newValue = config[setting].split(":")[1]
- config[setting] = int(newValue)
- else:
- migrationFailure+=1
- continue
- except IndexError, ValueError:
- migrationFailure += 1
- continue
- return True if not migrationFailure else False
-
# Display an error dialog when configuration validation fails.
def runConfigErrorDialog(errorText, errorType):
wx.CallAfter(gui.messageBox, errorText, errorType, wx.OK|wx.ICON_ERROR)
@@ -90,9 +60,7 @@ def initConfig():
# 6.0: Unlock (load) profiles from files.
def unlockConfig(path):
SPLConfigCheckpoint = ConfigObj(path, configspec = confspec,
encoding="UTF-8")
- # 5.0 only: migrate 4.x format to 5.0, to be removed in 5.1.
- migrated = config4to5(SPLConfigCheckpoint)
- # 5.1 and later: check to make sure all values are correct.
+ # 5.2 and later: check to make sure all values are correct.
val = Validator()
configTest = SPLConfigCheckpoint.validate(val, copy=True)
if configTest != True:
@@ -101,9 +69,8 @@ def unlockConfig(path):
SPLDefaults.validate(val, copy=True)
# Translators: Standard error title for configuration error.
title = _("Studio add-on Configuration error")
- if not configTest or not migrated:
- # Case 1: restore settings to defaults.
- # This may happen when 4.x config had parsing issues or
5.x config validation has failed on all values.
+ if not configTest:
+ # Case 1: restore settings to defaults when 5.x config
validation has failed on all values.
resetConfig(SPLDefaults, SPLConfigCheckpoint)
# Translators: Standard dialog message when Studio
configuration has problems and was reset to defaults.
errorMessage = _("Your Studio add-on configuration has
errors and was reset to factory defaults.")


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/3fea8e44a5c4/
Changeset: 3fea8e44a5c4
Branch: master
User: josephsl
Date: 2015-07-03 08:25:12+00:00
Summary: Merged 5.2 work

Affected #: 1 file

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index fee1610..1b332d4 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -37,36 +37,6 @@ SPLConfig = None
# A pool of broadcast profiles.
SPLConfigPool = []

-# List of values to be converted manually.
-# This will be called only once: when upgrading from prior versions to 5.0, to
be removed in 5.1.
-configConversions=("EndOfTrackTime", "SongRampTime")
-
-# The accompanying function for config conversion.
-# Returns config=false if errors occur, to be checked in the app module
constructor.
-def config4to5(config):
- migrationFailure = 0
- for setting in configConversions:
- try:
- oldValue = str(config[setting])
- except KeyError:
- continue
- if oldValue.isdigit():
- continue
- # If the old value doesn't conform to below conditions, start
from a fresh config spec.
- try:
- if (len(oldValue) == 5
- and oldValue.startswith("00:")
- and oldValue.split(":")[1].isdigit()):
- newValue = config[setting].split(":")[1]
- config[setting] = int(newValue)
- else:
- migrationFailure+=1
- continue
- except IndexError, ValueError:
- migrationFailure += 1
- continue
- return True if not migrationFailure else False
-
# Display an error dialog when configuration validation fails.
def runConfigErrorDialog(errorText, errorType):
wx.CallAfter(gui.messageBox, errorText, errorType, wx.OK|wx.ICON_ERROR)
@@ -122,18 +92,17 @@ def initConfig():
def unlockConfig(path, profileName=None):
global _configLoadStatus # To be mutated only during unlock routine.
SPLConfigCheckpoint = ConfigObj(path, configspec = confspec,
encoding="UTF-8")
- # 5.0 only: migrate 4.x format to 5.0, to be removed in 5.1.
- migrated = config4to5(SPLConfigCheckpoint)
- # 5.1 and later: check to make sure all values are correct.
+ # 5.2 and later: check to make sure all values are correct.
val = Validator()
configTest = SPLConfigCheckpoint.validate(val, copy=True)
if configTest != True:
# Hack: have a dummy config obj handy just for storing default
values.
SPLDefaults = ConfigObj(None, configspec = confspec,
encoding="UTF-8")
SPLDefaults.validate(val, copy=True)
- if not configTest or not migrated:
- # Case 1: restore settings to defaults.
- # This may happen when 4.x config had parsing issues or
5.x config validation has failed on all values.
+ # Translators: Standard error title for configuration error.
+ title = _("Studio add-on Configuration error")
+ if not configTest:
+ # Case 1: restore settings to defaults when 5.x config
validation has failed on all values.
resetConfig(SPLDefaults, SPLConfigCheckpoint)
_configLoadStatus[profileName] = 0
elif isinstance(configTest, dict):

Repository URL: https://bitbucket.org/nvdaaddonteam/stationplaylist/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts: