commit/StationPlaylist: 2 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Wed, 24 Jun 2015 03:30:08 -0000

2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/352342e2b33d/
Changeset: 352342e2b33d
Branch: None
User: josephsl
Date: 2015-06-24 02:27:20+00:00
Summary: Merge branch 'master' into 6.0/broadcastProfile

Affected #: 2 files

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index af5b771..2edebf0 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -502,20 +502,23 @@ class AppModule(appModuleHandler.AppModule):
}

# Specific to time scripts using Studio API.
+ # 6.0: Split this into two functions: the announcer (below) and
formatter.
def announceTime(self, t, offset = None):
if t <= 0:
ui.message("00:00")
else:
+ ui.message(self._ms2time(t, offset = offset))
+
+ # Formatter: given time in milliseconds, convert it to human-readable
format.
+ def _ms2time(self, t, offset = None):
+ if t <= 0:
+ return "00:00"
+ else:
tm = (t/1000) if not offset else (t/1000)+offset
- if tm < 60:
- tm1, tm2 = "00", tm
- else:
- tm1, tm2 = divmod(tm, 60)
- if tm1 < 10:
- tm1 = "0" + str(tm1)
- if tm2 < 10:
- tm2 = "0" + str(tm2)
- ui.message("{a}:{b}".format(a = tm1, b = tm2))
+ timeComponents = divmod(tm, 60)
+ tm1 = str(timeComponents[0]).zfill(2)
+ tm2 = str(timeComponents[1]).zfill(2)
+ return ":".join([tm1, tm2])

# Scripts which rely on API.
def script_sayRemainingTime(self, gesture):
@@ -1239,6 +1242,40 @@ class AppModule(appModuleHandler.AppModule):
# Translators: Presented when library scan is already
in progress.
ui.message(_("Scanning is in progress"))

+ # Track time analysis: return total length of the selected tracks upon
request.
+ # Analysis command will be assignable.
+ _analysisMarker = None
+
+ def script_markTrackForAnalysis(self, gesture):
+ focus = api.getFocusObject()
+ if focus.role == controlTypes.ROLE_LIST:
+ ui.message("No tracks were added, cannot perform track
time analysis")
+ return
+ if scriptHandler.getLastScriptRepeatCount() == 0:
+ self._analysisMarker = focus.IAccessibleChildID-1
+ ui.message("Track time analysis activated")
+ else:
+ self._analysisMarker = None
+ ui.message("Track time analysis deactivated")
+
+ def script_trackTimeAnalysis(self, gesture):
+ if self._analysisMarker is None:
+ ui.message("No track selected as start of analysis
marker, cannot perform time analysis")
+ return
+ trackPos = api.getFocusObject().IAccessibleChildID-1
+ if self._analysisMarker == trackPos:
+ filename = statusAPI(self._analysisMarker, 211,
ret=True)
+ statusAPI(filename, 30, func=self.announceTime)
+ else:
+ analysisBegin = min(self._analysisMarker, trackPos)
+ analysisEnd = max(self._analysisMarker, trackPos)
+ analysisRange = analysisEnd-analysisBegin+1
+ totalLength = 0
+ for track in xrange(analysisBegin, analysisEnd+1):
+ filename = statusAPI(track, 211, ret=True)
+ totalLength+=statusAPI(filename, 30, ret=True)
+ ui.message("Tracks: {numberOfSelectedTracks}, totaling
{totalTime}".format(numberOfSelectedTracks = analysisRange, totalTime =
self._ms2time(totalLength)))
+
def script_layerHelp(self, gesture):
# Translators: The title for SPL Assistant help dialog.
wx.CallAfter(gui.messageBox, SPLAssistantHelp, _("SPL Assistant
help"))
@@ -1262,6 +1299,8 @@ class AppModule(appModuleHandler.AppModule):
"kb:s":"sayScheduledTime",
"kb:shift+p":"sayTrackPitch",
"kb:shift+r":"libraryScanMonitor",
+ "kb:f9":"markTrackForAnalysis",
+ "kb:f10":"trackTimeAnalysis",
"kb:f1":"layerHelp",
}


diff --git a/buildVars.py b/buildVars.py
index bddf221..47dbea9 100755
--- a/buildVars.py
+++ b/buildVars.py
@@ -20,7 +20,7 @@ addon_info = {
"addon_description" : _("""Enhances support for Station Playlist Studio.
In addition, adds global commands for the studio from everywhere."""),
# version
- "addon_version" : "5.0-dev",
+ "addon_version" : "6.0-dev",
# Author(s)
"addon_author" : u"Geoff Shang, Joseph Lee and other contributors",
# URL for the add-on documentation support


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/a9ed15899689/
Changeset: a9ed15899689
Branch: 6.0/broadcastProfile
User: josephsl
Date: 2015-06-24 03:29:15+00:00
Summary: Broadcast Profiles (6.0-dev): Never again pop up multiple config
errors, plus broadcast profile will now be focused when config dialog is opened.

Due to the fact that 5.x and earlier was concerned with what's now called
normal profile, the config error dialog was opened multiple times, one per
invalid profile. This has been corrected - once a profile is found to have
errors, the error code will be stored in the load status map to be retrieved by
the init function. Also, the output of the config error dialog is such that
each line will be of the format 'config name: error message'.
Also broadcast profile combo box will now be focused when config dialog is
opened.

Affected #: 1 file

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index 62b7ad7..44cfd03 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -82,13 +82,21 @@ def resetConfig(defaults, activeConfig, intentional=False):
# Translators: Title of the reset config dialog.
_("Reset configuration"), wx.OK|wx.ICON_INFORMATION)

+# In case one or more profiles had config issues, look up the error message
form the following map.
+_configErrors = (
+ ("All settings reset to defaults"),
+ ("Some settings reset to defaults")
+)
+
# To be run in app module constructor.
# With the load function below, load the config upon request.
# 6.0: The below init function is really a vehicle that traverses through
config profiles in a loop.
+# Prompt the config error dialog only once.
+_configLoadStatus = {} # Key = filename, value is pass or no pass.
+
def initConfig():
- #if not os.path.exists(SPLProfiles):
# Load the default config from a list of profiles.
- global SPLConfig, SPLConfigPool
+ global SPLConfig, SPLConfigPool, _configLoadStatus
if SPLConfigPool is None: SPLConfigPool = []
SPLConfigPool.append(unlockConfig(SPLIni, profileName="Normal profile"))
try:
@@ -98,9 +106,20 @@ def initConfig():
except WindowsError:
pass
SPLConfig = SPLConfigPool[0]
+ if len(_configLoadStatus):
+ # Translators: Standard error title for configuration error.
+ title = _("Studio add-on Configuration error")
+ messages = []
+ messages.append("One or more broadcast profiles had
issues:\n\n")
+ for profile in _configLoadStatus:
+ error = _configErrors[_configLoadStatus[profile]]
+ messages.append("{profileName}:
{errorMessage}".format(profileName = profile, errorMessage = error))
+ _configLoadStatus.clear()
+ runConfigErrorDialog("\n".join(messages), title)

# 6.0: Unlock (load) profiles from files.
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)
@@ -111,26 +130,18 @@ def unlockConfig(path, profileName=None):
# 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)
- # 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.
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.")
+ _configLoadStatus[profileName] = 0
elif isinstance(configTest, dict):
# Case 2: For 5.x and later, attempt to reconstruct the
failed values.
for setting in configTest:
if not configTest[setting]:
SPLConfigCheckpoint[setting] =
SPLDefaults[setting]
- # Translators: Standard dialog message when some Studio
configuration settings were reset to defaults.
- errorMessage = _("Errors were found in some of your
Studio configuration settings. The affected settings were reset to defaults.")
SPLConfigCheckpoint.write()
- try:
- runConfigErrorDialog(errorMessage, title)
- except AttributeError:
- pass
+ _configLoadStatus[profileName] = 1
SPLConfigCheckpoint.name = profileName
return SPLConfigCheckpoint

@@ -298,7 +309,7 @@ class SPLConfigDialog(gui.SettingsDialog):
sizer.Add(self.resetConfigButton)

def postInit(self):
- self.beepAnnounceCheckbox.SetFocus()
+ self.profiles.SetFocus()

def onOk(self, evt):
if not self.micAlarm.Value.isdigit():

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: