commit/StationPlaylist: josephsl: Readme for encoder hive and SPL Con passthrough

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Tue, 11 Aug 2015 08:26:38 -0000

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/83f3404a9e97/
Changeset: 83f3404a9e97
Branch: master
User: josephsl
Date: 2015-08-11 08:25:15+00:00
Summary: Readme for encoder hive and SPL Con passthrough

Affected #: 4 files

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index fcdc980..f601348 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -288,9 +288,9 @@ class AppModule(appModuleHandler.AppModule):
global _SPLWin
_SPLWin = hwnd

- # 5.0/Experimental: allow SPL Controller layer command to invoke SPL
Assistant.
- # For now, this needs to be enabled from Python Console and may or may
not make it into 5.0.
- SPLConPassthrough = False
+ # Let the global plugin know if SPLController passthrough is allowed.
+ def SPLConPassthrough(self):
+ return splconfig.SPLConfig["SPLConPassthrough"]

def event_NVDAObject_init(self, obj):
# Radio button group names are not recognized as grouping, so
work around this.

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index 40eb12a..7eb558a 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -36,6 +36,7 @@ IncludedColumns =
string_list(default=list("Artist","Title","Duration","Intro","
SayScheduledFor = boolean(default=true)
SayListenerCount = boolean(default=true)
SayPlayingCartName = boolean(default=true)
+SPLConPassthrough = boolean(default=false)
"""), encoding="UTF-8", list_values=False)
confspec.newlines = "\r\n"
SPLConfig = None
@@ -376,6 +377,12 @@ class SPLConfigDialog(gui.SettingsDialog):
self.cartNameCheckbox.SetValue(SPLConfig["SayPlayingCartName"])
settingsSizer.Add(self.cartNameCheckbox,
border=10,flag=wx.BOTTOM)

+ # Translators: The label of a button to open advanced options
such as using SPL Controller command to invoke Assistant layer.
+ item = advancedOptButton = wx.Button(self, label=_("&Advanced
options..."))
+ item.Bind(wx.EVT_BUTTON, self.onAdvancedOptions)
+ self.splConPassthrough = SPLConfig["SPLConPassthrough"]
+ settingsSizer.Add(item)
+
# Translators: The label for a button in SPL add-on
configuration dialog to reset settings to defaults.
self.resetConfigButton = wx.Button(self, wx.ID_ANY,
label=_("Reset settings"))
self.resetConfigButton.Bind(wx.EVT_BUTTON,self.onResetConfig)
@@ -413,6 +420,7 @@ class SPLConfigDialog(gui.SettingsDialog):
SPLConfig["SayScheduledFor"] = self.scheduledForCheckbox.Value
SPLConfig["SayListenerCount"] = self.listenerCountCheckbox.Value
SPLConfig["SayPlayingCartName"] = self.cartNameCheckbox.Value
+ SPLConfig["SPLConPassthrough"] = self.splConPassthrough
SPLActiveProfile = SPLConfig.name
SPLSwitchProfile = self.switchProfile
# Without nullifying prev profile while switch profile is
undefined, NVDA will assume it can switch back to that profile when it can't.
@@ -569,6 +577,12 @@ class SPLConfigDialog(gui.SettingsDialog):
self.Disable()
ColumnAnnouncementsDialog(self).Show()

+ # Advanced options.
+ # See advanced options class for more details.
+ def onAdvancedOptions(self, evt):
+ self.Disable()
+ AdvancedOptionsDialog(self).Show()
+
# Reset settings to defaults.
# This affects the currently selected profile.
def onResetConfig(self, evt):
@@ -778,6 +792,43 @@ class ColumnAnnouncementsDialog(wx.Dialog):
self.trackColumns.Select(selIndex+1)
self.onColumnSelection(None)

+# Advanced options
+# This dialog houses advanced options such as using SPL Controller command to
invoke SPL Assistant.
+# More options will be added in Project Rainbow.
+class AdvancedOptionsDialog(wx.Dialog):
+
+ def __init__(self, parent):
+ super(AdvancedOptionsDialog, self).__init__(parent,
title="Advanced options")
+
+ mainSizer = wx.BoxSizer(wx.VERTICAL)
+
+ sizer = wx.BoxSizer(wx.HORIZONTAL)
+ # Translators: A checkbox to toggle if SPL Controller command
can be used to invoke Assistant layer.
+
self.splConPassthroughCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Allow SPL
C&ontroller command to invoke SPL Assistant layer"))
+
self.splConPassthroughCheckbox.SetValue(SPLConfig["SPLConPassthrough"])
+ sizer.Add(self.splConPassthroughCheckbox, border=10,flag=wx.TOP)
+ mainSizer.Add(sizer, border=10, flag=wx.BOTTOM)
+
+ mainSizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL))
+ self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
+ self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
+ mainSizer.Fit(self)
+ self.Sizer = mainSizer
+ self.splConPassthroughCheckbox.SetFocus()
+ self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+
+ def onOk(self, evt):
+ parent = self.Parent
+ parent.splConPassthrough = self.splConPassthroughCheckbox.Value
+ parent.profiles.SetFocus()
+ parent.Enable()
+ self.Destroy()
+ return
+
+ def onCancel(self, evt):
+ self.Parent.Enable()
+ self.Destroy()
+
# Additional configuration dialogs

# A common alarm dialog

diff --git a/addon/globalPlugins/SPLStudioUtils/encoders.py
b/addon/globalPlugins/SPLStudioUtils/encoders.py
index 273dc46..166f245 100755
--- a/addon/globalPlugins/SPLStudioUtils/encoders.py
+++ b/addon/globalPlugins/SPLStudioUtils/encoders.py
@@ -47,7 +47,7 @@ streamLabels = None

# Load stream labels (and possibly other future goodies) from a file-based
database.
def loadStreamLabels():
- global streamLabels, SAMStreamLabels, SPLStreamLabels
+ global streamLabels, SAMStreamLabels, SPLStreamLabels, SPLFocusToStudio
streamLabels = ConfigObj(os.path.join(globalVars.appArgs.configPath,
"splStreamLabels.ini"))
# Read stream labels.
try:
@@ -58,6 +58,10 @@ def loadStreamLabels():
SPLStreamLabels = dict(streamLabels["SPLEncoders"])
except KeyError:
SPLStreamLabels = {}
+ # Read other settings.
+ if "FocusToStudio" in streamLabels:
+ SPLFocusToStudio = set(streamLabels["FocusToStudio"])
+

# Report number of encoders being monitored.
# 6.0: Refactor the below function to use the newer encoder config format.
@@ -118,6 +122,13 @@ class Encoder(IAccessible):
playAfterConnecting = False # When connected, the first track will be
played.
backgroundMonitor = False # Monitor this encoder for connection status
changes.

+ # Some helper functions
+
+ # Get the encoder identifier.
+ # This consists of two or three letter abbreviations for the encoder
and the child ID.
+ def getEncoderId(self):
+ return " ".join([self.encoderType,
str(self.IAccessibleChildID)])
+
# Format the status message to prepare for monitoring multiple encoders.
def encoderStatusMessage(self, message, id):
if encoderMonCount[self.encoderType] > 1:
@@ -126,6 +137,23 @@ class Encoder(IAccessible):
else:
ui.message(message)

+ # A master flag setter.
+ # Set or clear a given flag for the encoder given its ID, flag and flag
container (currently a feature set).
+ # Also take in the flag key for storing it into the settings file.
+ # The flag will then be written to the configuration file.
+ def _set_Flags(self, encoderId, flag, flagMap, flagKey):
+ if flag and not encoderId in flagMap:
+ flagMap.add(encoderId)
+ elif not flag and encoderId in flagMap:
+ flagMap.remove(encoderId)
+ # No need to store an empty flag map.
+ if len(flagMap): streamLabels[flagKey] = list(flagMap)
+ else: del streamLabels[flagKey]
+ streamLabels.write()
+
+ # Now the flag configuration scripts.
+ # Project Rainbow: a new way to configure these will be created.
+
def script_toggleFocusToStudio(self, gesture):
if not self.focusToStudio:
self.focusToStudio = True
@@ -232,7 +260,7 @@ class Encoder(IAccessible):
def initOverlayClass(self):
# Load stream labels upon request.
if not streamLabels: loadStreamLabels()
- encoderIdentifier = " ".join([self.encoderType,
str(self.IAccessibleChildID)])
+ encoderIdentifier = self.getEncoderId()
# Can I switch to Studio when connected to a streaming server?
try:
self.focusToStudio = encoderIdentifier in
SPLFocusToStudio
@@ -352,26 +380,17 @@ class SAMEncoder(Encoder):
# Translators: Presented when SAM Encoder is disconnecting from
a streaming server.
ui.message(_("Disconnecting..."))

+ # The following mutators will be removed as part of Project Rainbow.
+ # These will be kept in 6.0 for backwards compatibility.
+
def _set_FocusToStudio(self):
- SAMIdentifier = " ".join([self.encoderType,
str(self.IAccessibleChildID)])
- if self.focusToStudio and not SAMIdentifier in SPLFocusToStudio:
- SPLFocusToStudio.add(SAMIdentifier)
- elif not self.focusToStudio and SAMIdentifier in
SPLFocusToStudio:
- SPLFocusToStudio.remove(SAMIdentifier)
+ self._set_Flags(self.getEncoderId(), self.focusToStudio,
SPLFocusToStudio, "FocusToStudio")

def setPlayAfterConnecting(self):
- SAMIdentifier = " ".join([self.encoderType,
str(self.IAccessibleChildID)])
- if self.playAfterConnecting and not SAMIdentifier in
SPLPlayAfterConnecting:
- SPLPlayAfterConnecting.add(SAMIdentifier)
- elif not self.playAfterConnecting and SAMIdentifier in
SPLPlayAfterConnecting:
- SPLPlayAfterConnecting.remove(SAMIdentifier)
+ self._set_Flags(self.getEncoderId(), self.playAfterConnecting,
SPLPlayAfterConnecting, "PlayAfterConnecting")

def setBackgroundMonitor(self):
- SAMIdentifier = " ".join([self.encoderType,
str(self.IAccessibleChildID)])
- if self.backgroundMonitor and not SAMIdentifier in
SPLBackgroundMonitor:
- SPLBackgroundMonitor.add(SAMIdentifier)
- elif not self.backgroundMonitor and SAMIdentifier in
SPLBackgroundMonitor:
- SPLBackgroundMonitor.remove(SAMIdentifier)
+ self._set_Flags(self.getEncoderId(), self.backgroundMonitor,
SPLBackgroundMonitor, "BackgroundMonitor")
return SAMMonitorThreads



diff --git a/readme.md b/readme.md
index a5ce9bd..36c8234 100755
--- a/readme.md
+++ b/readme.md
@@ -150,6 +150,8 @@ If you are using Studio on a touchscreen computer running
Windows 8 or later and
* You can now ask NVDA to report total length of a range of tracks via track
time analysis feature. Press SPL Assistant, F9 to mark current track as start
marker, move to end of track range and press SPL Assistant, F10. These commands
can be reassigned so one doesn't have to invoke SPL Assistant layer to perform
track time analysis.
* Added a column search dialog (command unassigned) to find text in specific
columns such as artist or part of file name.
* Added ability to reorder track column announcement and to suppress
announcement of specific columns if "use screen order" is unchecked from add-on
settings dialog. Use "manage column announcement" dialog to reorder columns.
+* In SAM Encoders, settings such as focusing to Studio when connected is now
remembered.
+* Added ability to use SPL Controller layer command to invoke SPL Assistant
layer.

## Changes for 5.2

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:

  • » commit/StationPlaylist: josephsl: Readme for encoder hive and SPL Con passthrough - commits-noreply