commit/StationPlaylist: 2 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Sat, 07 Mar 2015 07:01:16 -0000

2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/37687dd75ed4/
Changeset:   37687dd75ed4
Branch:      None
User:        josephsl
Date:        2015-03-07 06:56:32+00:00
Summary:     Merged master

Affected #:  2 files

diff --git a/addon/appModules/splstudio/__init__.py 
b/addon/appModules/splstudio/__init__.py
index 1426c02..0f2663f 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -271,23 +271,24 @@ class AppModule(appModuleHandler.AppModule):
                if api.getForegroundObject().processID != self.processID and 
not self.backgroundStatusMonitor:
                        nextHandler()
                if obj.windowClassName == "TStatusBar" and not 
obj.name.startswith("  Up time:"):
-                       #tones.beep(512, 200)
                        # Special handling for Play Status
                        if obj.IAccessibleChildID == 1:
+                               # Cache the global config for library scans.
+                               libraryScanProgress = 
splconfig.SPLConfig["LibraryScanAnnounce"]
                                if "Play status" in obj.name:
                                        # Strip off "  Play status: " for 
brevity only in main playlist window.
                                        ui.message(obj.name.split(":")[1][1:])
                                elif "Loading" in obj.name:
-                                       if self.libraryScanProgress > 0:
+                                       if libraryScanProgress != "off":
                                                # If library scan is in 
progress, announce its progress.
                                                self.scanCount+=1
                                                if self.scanCount%100 == 0:
-                                                       
self._libraryScanAnnouncer(obj.name[1:obj.name.find("]")], 
self.libraryScanProgress)
+                                                       
self._libraryScanAnnouncer(obj.name[1:obj.name.find("]")], libraryScanProgress)
                                        if not self.libraryScanning:
                                                if self.productVersion not in 
noLibScanMonitor:
                                                        if not 
self.backgroundStatusMonitor: self.libraryScanning = True
                                elif "match" in obj.name:
-                                       if self.libraryScanProgress:
+                                       if libraryScanProgress != "off":
                                                if 
splconfig.SPLConfig["BeepAnnounce"]: tones.beep(370, 100)
                                                else:
                                                        # 5.0: Store the handle 
only once.
@@ -846,25 +847,26 @@ class AppModule(appModuleHandler.AppModule):
 
        # Library scan announcement
        # Announces progress of a library scan (launched from insert tracks 
dialog by pressing Control+Shift+R or from rescan option from Options dialog).
-       libraryScanProgress = 0 # Announce at the beginning and at the end of a 
scan.
-       libraryScanMessage = 2 # Just announce "scanning".
-       libraryScanNumbers = 3 # Announce number of items scanned.
-
-       # Library scan announcement settings list and the toggle script.
-       libraryProgressSettings=(
-               # Translators: A setting in library scan announcement options.
-               (_("Do not announce library scans")),
-               # Translators: A setting in library scan announcement options.
-               (_("Announce start and end of a library scan")),
-               # Translators: A setting in library scan announcement options.
-               (_("Announce the progress of a library scan")),
-               # Translators: A setting in library scan announcement options.
-               (_("Announce progress and item count of a library scan"))
-       )
 
        def script_setLibraryScanProgress(self, gesture):
-               self.libraryScanProgress = (self.libraryScanProgress+1) % 
len(self.libraryProgressSettings)
-               
ui.message(self.libraryProgressSettings[self.libraryScanProgress])
+               libraryScanAnnounce = splconfig.SPLConfig["LibraryScanAnnounce"]
+               if libraryScanAnnounce == "off":
+                       libraryScanAnnounce = "ending"
+                       # Translators: A setting in library scan announcement 
options.
+                       ui.message(_("Announce start and end of a library 
scan"))
+               elif libraryScanAnnounce == "ending":
+                       libraryScanAnnounce = "progress"
+                       # Translators: A setting in library scan announcement 
options.
+                       ui.message(_("Announce the progress of a library scan"))
+               elif libraryScanAnnounce == "progress":
+                       libraryScanAnnounce = "numbers"
+                       # Translators: A setting in library scan announcement 
options.
+                       ui.message(_("Announce progress and item count of a 
library scan"))
+               else:
+                       libraryScanAnnounce = "off"
+                       # Translators: A setting in library scan announcement 
options.
+                       ui.message(_("Do not announce library scans"))
+               splconfig.SPLConfig["LibraryScanAnnounce"] = libraryScanAnnounce
        # Translators: Input help mode message for a command in Station 
Playlist Studio.
        script_setLibraryScanProgress.__doc__=_("Toggles library scan progress 
settings.")
 
@@ -916,10 +918,10 @@ class AppModule(appModuleHandler.AppModule):
                        if countB < 0:
                                break
                        if scanIter%5 == 0:
-                               self._libraryScanAnnouncer(countB, 
self.libraryScanProgress)
+                               self._libraryScanAnnouncer(countB, 
splconfig.SPLConfig["LibraryScanAnnounce"])
                self.libraryScanning = False
                if self.backgroundStatusMonitor: return
-               if self.libraryScanProgress:
+               if splconfig.SPLConfig["LibraryScanAnnounce"] != "off":
                        if splconfig.SPLConfig["BeepAnnounce"]: tones.beep(370, 
100)
                        else:
                                # Translators: Presented after library scan is 
done.
@@ -927,10 +929,10 @@ class AppModule(appModuleHandler.AppModule):
 
        # Take care of library scanning announcement.
        def _libraryScanAnnouncer(self, count, announcementType):
-               if announcementType == self.libraryScanMessage:
+               if announcementType == "progress":
                        # Translators: Presented when library scan is in 
progress.
                        tones.beep(550, 100) if 
splconfig.SPLConfig["BeepAnnounce"] else ui.message(_("Scanning"))
-               elif announcementType == self.libraryScanNumbers:
+               elif announcementType == "numbers":
                        if splconfig.SPLConfig["BeepAnnounce"]:
                                tones.beep(550, 100)
                                # No need to provide translatable string - just 
use index.

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index acc053a..1d16be8 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -24,6 +24,7 @@ SaySongRamp = boolean(default=true)
 SongRampTime = integer(min=1, max=9, default=5)
 BrailleTimer = option("off", "intro", "outro", "both", default="off")
 MicAlarm = integer(min=0, default="0")
+LibraryScanAnnounce = option("off", "ending", "progress", "numbers", 
default="off")
 TrackDial = boolean(default=false)
 SayScheduledFor = boolean(default=true)
 SayListenerCount = boolean(default=true)
@@ -62,6 +63,19 @@ def config4to5():
 def runConfigErrorDialog(errorText, errorType):
        wx.CallAfter(gui.messageBox, errorText, errorType, wx.OK|wx.ICON_ERROR)
 
+# Reset settings to defaults.
+# This will be called when validation fails or when the user asks for it.
+def resetConfig(defaults, intentional=False):
+       global SPLConfig
+       for setting in SPLConfig:
+               SPLConfig[setting] = defaults[setting]
+       SPLConfig.write()
+       if intentional:
+               # Translators: A dialog message shown when settings were reset 
to defaults.
+               wx.CallAfter(gui.messageBox, _("Successfully applied default 
add-on settings."),
+               # Translators: Title of the reset config dialog.
+               _("Reset configuration"), wx.OK|wx.ICON_INFORMATION)
+
 # To be run in app module constructor.
 def initConfig():
        global SPLConfig
@@ -80,8 +94,7 @@ def initConfig():
                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.
-                       for setting in SPLConfig:
-                               SPLConfig[setting] = SPLDefaults[setting]
+                       resetConfig(SPLDefaults)
                        # 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.")
                elif isinstance(configTest, dict):
@@ -104,14 +117,13 @@ class SPLConfigDialog(gui.SettingsDialog):
 
        def makeSettings(self, settingsSizer):
 
-               sizer = wx.BoxSizer(wx.HORIZONTAL)
                # Translators: the label for a setting in SPL add-on settings 
to set status announcement between words and beeps.
                
self.beepAnnounceCheckbox=wx.CheckBox(self,wx.NewId(),label=_("&Beep for status 
announcements"))
                self.beepAnnounceCheckbox.SetValue(SPLConfig["BeepAnnounce"])
-               sizer.Add(self.beepAnnounceCheckbox, border=10,flag=wx.BOTTOM)
+               settingsSizer.Add(self.beepAnnounceCheckbox, 
border=10,flag=wx.TOP)
 
                self.outroSizer = wx.BoxSizer(wx.HORIZONTAL)
-               # Check box hiding method comes from Alberto Buffalino's 
Columns Review add-on.
+               # Check box hiding method comes from Alberto Buffolino's 
Columns Review add-on.
                self.outroCheckBox=wx.CheckBox(self,wx.NewId(),label=_("&Notify 
when end of track is approaching"))
                self.outroCheckBox.SetValue(SPLConfig["SayEndOfTrack"])
                self.outroCheckBox.Bind(wx.EVT_CHECKBOX, self.onCheck)
@@ -136,7 +148,7 @@ class SPLConfigDialog(gui.SettingsDialog):
 
                # Translators: The label for a setting in SPL Add-on settings 
to specify track intro alarm.
                self.introAlarmLabel = wx.StaticText(self, wx.ID_ANY, 
label=_("&Track intro alarm in seconds"))
-               self.introSizer.Add(self.outroAlarmLabel)
+               self.introSizer.Add(self.introAlarmLabel)
                self.songRampAlarm = wx.SpinCtrl(self, wx.ID_ANY, min=1, max=9)
                self.songRampAlarm.SetValue(long(SPLConfig["SongRampTime"]))
                self.introSizer.Add(self.songRampAlarm)
@@ -173,6 +185,25 @@ class SPLConfigDialog(gui.SettingsDialog):
                sizer.Add(self.micAlarm)
                settingsSizer.Add(sizer, border=10, flag=wx.BOTTOM)
 
+               sizer = wx.BoxSizer(wx.HORIZONTAL)
+               # Translators: The label for a setting in SPL add-on dialog to 
control library scan announcement.
+               label = wx.StaticText(self, wx.ID_ANY, label=_("&Library scan 
announcement:"))
+               self.libScanValues=[("off",_("off")),
+               # Translators: One of the braille timer settings.
+               ("ending",_("start and end only")),
+               ("progress",_("scan progress")),
+               ("numbers",_("scan count"))]
+               self.libScanList = wx.Choice(self, wx.ID_ANY, choices=[x[1] for 
x in self.libScanValues])
+               libScanCurValue=SPLConfig["LibraryScanAnnounce"]
+               selection = (x for x,y in enumerate(self.libScanValues) if 
y[0]==libScanCurValue).next()  
+               try:
+                       self.libScanList.SetSelection(selection)
+               except:
+                       pass
+               sizer.Add(label)
+               sizer.Add(self.libScanList)
+               settingsSizer.Add(sizer, border=10, flag=wx.BOTTOM)
+
                # Translators: the label for a setting in SPL add-on settings 
to toggle track dial mode on and off.
                
self.trackDialCheckbox=wx.CheckBox(self,wx.NewId(),label=_("&Track Dial mode"))
                self.trackDialCheckbox.SetValue(SPLConfig["TrackDial"])
@@ -188,6 +219,11 @@ class SPLConfigDialog(gui.SettingsDialog):
                
self.listenerCountCheckbox.SetValue(SPLConfig["SayListenerCount"])
                sizer.Add(self.listenerCountCheckbox, border=10,flag=wx.BOTTOM)
 
+               # 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)
+               sizer.Add(self.resetConfigButton)
+
        def postInit(self):
                self.beepAnnounceCheckbox.SetFocus()
 
@@ -207,6 +243,7 @@ class SPLConfigDialog(gui.SettingsDialog):
                SPLConfig["SongRampTime"] = self.songRampAlarm.Value
                SPLConfig["BrailleTimer"] = 
self.brailleTimerValues[self.brailleTimerList.GetSelection()][0]
                SPLConfig["MicAlarm"] = self.micAlarm.Value
+               SPLConfig["LibraryScanAnnounce"] = 
self.libScanValues[self.libScanList.GetSelection()][0]
                SPLConfig["TrackDial"] = self.trackDialCheckbox.Value
                super(SPLConfigDialog,  self).onOk(evt)
 
@@ -229,6 +266,21 @@ class SPLConfigDialog(gui.SettingsDialog):
                        self.introSizer.Show(self.songRampAlarm)
                self.Fit()
 
+       # Reset settings to defaults.
+       def onResetConfig(self, evt):
+               if gui.messageBox(
+               # Translators: A message to warn about resetting SPL config 
settings to factory defaults.
+               _("Are you sure you wish to reset SPL add-on settings to 
defaults?"),
+               # Translators: The title of the warning dialog.
+               _("Warning"),wx.YES_NO|wx.NO_DEFAULT|wx.ICON_WARNING,self
+               )==wx.YES:
+                       val = Validator()
+                       SPLDefaults = ConfigObj(None, configspec = confspec, 
encoding="UTF-8")
+                       SPLDefaults.validate(val, copy=True)
+                       resetConfig(SPLDefaults, intentional=True)
+                       self.Destroy()
+
+
 # Open the above dialog upon request.
 def onConfigDialog(evt):
        gui.mainFrame._popupSettingsDialog(SPLConfigDialog)


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/0d262a5d4486/
Changeset:   0d262a5d4486
Branch:      bugHunters/multiInstance
User:        josephsl
Date:        2015-03-07 07:00:57+00:00
Summary:     Bug hunters 3: song ramp alarm now follows the same format as end 
of track alarm time.

Affected #:  1 file

diff --git a/addon/appModules/splstudio/__init__.py 
b/addon/appModules/splstudio/__init__.py
index 0f2663f..5724bce 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -538,17 +538,21 @@ class AppModule(appModuleHandler.AppModule):
        # Set song ramp (introduction) time between 1 and 9 seconds.
 
        def script_setSongRampTime(self, gesture):
-               rampVal = long(splconfig.SPLConfig["SongRampTime"])
-               d = splconfig.SPLAlarmDialog(gui.mainFrame, "SongRampTime", 
"SaySongRamp",
-               # Translators: The title of song intro alarm dialog.
-               _("Song intro alarm"),
-               # Translators: A dialog message to set song ramp alarm 
(curRampSec is the current intro monitoring alarm in seconds).
-               _("Enter song &intro alarm time in seconds (currently 
{curRampSec})").format(curRampSec = rampVal),
-               _("&Notify when end of introduction is approaching"), 1, 9)
-               gui.mainFrame.prePopup()
-               d.Raise()
-               d.Show()
-               gui.mainFrame.postPopup()
+               try:
+                       rampVal = long(splconfig.SPLConfig["SongRampTime"])
+                       d = splconfig.SPLAlarmDialog(gui.mainFrame, 
"SongRampTime", "SaySongRamp",
+                       # Translators: The title of song intro alarm dialog.
+                       _("Song intro alarm"),
+                       # Translators: A dialog message to set song ramp alarm 
(curRampSec is the current intro monitoring alarm in seconds).
+                       _("Enter song &intro alarm time in seconds (currently 
{curRampSec})").format(curRampSec = rampVal),
+                       _("&Notify when end of introduction is approaching"), 
1, 9)
+                       gui.mainFrame.prePopup()
+                       d.Raise()
+                       d.Show()
+                       gui.mainFrame.postPopup()
+                       splconfig._alarmDialogOpened = True
+               except RuntimeError:
+                       wx.CallAfter(splconfig._alarmError)
        # Translators: Input help mode message for a command in Station 
Playlist Studio.
        script_setSongRampTime.__doc__=_("sets song intro alarm (default is 5 
seconds).")

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: