commit/StationPlaylist: 2 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Mon, 25 Jan 2016 05:55:09 -0000

2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/078a987404ca/
Changeset:   078a987404ca
Branch:      None
User:        josephsl
Date:        2016-01-25 04:40:07+00:00
Summary:     Time-based profile switching (7.0-dev): Handle a subtle case where 
time-based profile could be deleted by accident by preventing deletion 
operation.

While broadcasting a show, it might not be desirable to let profiles be 
deleted, including the very profile (time-based one) the broadcaster is using. 
Thus while a show is broadcasting, deletion operation will not be allowed (once 
broadcasting is done, then deletion will be allowed).
This is a temporary workaround. A more elegant solution that allows 
broadcasters to delete currently active time-based profile will be added in 
future commits.

Affected #:  3 files

diff --git a/addon/appModules/splstudio/__init__.py 
b/addon/appModules/splstudio/__init__.py
index 0877619..38137a7 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -1605,7 +1605,7 @@ class AppModule(appModuleHandler.AppModule):
        script_trackTimeAnalysis.__doc__=_("Announces total length of tracks 
between analysis start marker and the current track")
 
        def script_switchProfiles(self, gesture):
-               splconfig.triggerProfileSwitch() if 
splconfig._SPLTriggerEndTimer.IsRunning() else splconfig.instantProfileSwitch()
+               splconfig.triggerProfileSwitch() if 
splconfig._triggerProfileActive else splconfig.instantProfileSwitch()
 
        def script_setPlaceMarker(self, gesture):
                obj = api.getFocusObject()

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index 8df36ae..29384db 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -690,9 +690,11 @@ def instantProfileSwitch():
 # The triggers version of the above function.
 # 7.0: Try consolidating this into one or some more functions.
 _SPLTriggerEndTimer = None
+# Record if time-based profile is active or not.
+_triggerProfileActive = False
 
 def triggerProfileSwitch():
-       global SPLPrevProfile, SPLConfig, SPLActiveProfile, triggerTimer, 
_SPLTriggerEndTimer
+       global SPLPrevProfile, SPLConfig, SPLActiveProfile, triggerTimer, 
_SPLTriggerEndTimer, _triggerProfileActive
        if _configDialogOpened:
                # Translators: Presented when trying to switch profiles when 
add-on settings dialog is active.
                ui.message(_("Add-on settings dialog is open, cannot switch 
profiles"))
@@ -712,6 +714,8 @@ def triggerProfileSwitch():
                        SPLPrevProfile = getProfileIndexByName(SPLActiveProfile)
                        # Pass in the prev profile, which will be None for 
instant profile switch.
                        switchProfile(SPLPrevProfile, triggerProfileIndex)
+                       # Set the global trigger flag to inform various 
subsystems such as add-on settings dialog.
+                       _triggerProfileActive = True
                        # Translators: Presented when switch to instant switch 
profile was successful.
                        ui.message(_("Switching profiles"))
                        # Pause automatic update checking.
@@ -727,6 +731,7 @@ def triggerProfileSwitch():
                                _SPLTriggerEndTimer.Start(triggerSettings[6] * 
60 * 1000, True)
                else:
                        switchProfile(None, SPLPrevProfile)
+                       _triggerProfileActive = False
                        SPLPrevProfile = None
                        # Translators: Presented when switching from instant 
switch profile to a previous profile.
                        ui.message(_("Returning to previous profile"))
@@ -1322,6 +1327,13 @@ class SPLConfigDialog(gui.SettingsDialog):
                self.profiles.SetFocus()
 
        def onDelete(self, evt):
+               # Prevent profile deletion in the midst of a broadcast, 
otherwise time-based profile switching flag will become inconsistent.
+               # 7.1: Find a way to safely proceed via two-step verification 
if trying to delete currently active time-based profile.
+               global _SPLTriggerEndTimer, _triggerProfileActive
+               if (_SPLTriggerEndTimer is not None and 
_SPLTriggerEndTimer.IsRunning()) or _triggerProfileActive:
+                       gui.messageBox(_("Are you currently broadcasting a 
show? If so, please press SPL Assistant, F12 to switch back to a previously 
active profile before opening add-on settings to delete a profile."),
+                               _("Midst of a broadcast"), wx.OK | 
wx.ICON_ERROR, self)
+                       return
                index = self.profiles.Selection
                name = self.profiles.GetStringSelection().split(" <")[0]
                configPos = getProfileIndexByName(name)
@@ -1348,6 +1360,8 @@ class SPLConfigDialog(gui.SettingsDialog):
                self.profiles.Delete(index)
                del self.profileNames[profilePos]
                del _SPLCache[name]
+                               if name in self._profileTriggersConfig:
+                       del self._profileTriggersConfig[name]
                # 6.3: Select normal profile if the active profile is gone.
                # 7.0: Consult profile names instead.
                try:

diff --git a/addon/appModules/splstudio/splmisc.py 
b/addon/appModules/splstudio/splmisc.py
index 8462ea7..8ef3962 100755
--- a/addon/appModules/splstudio/splmisc.py
+++ b/addon/appModules/splstudio/splmisc.py
@@ -332,7 +332,7 @@ class SPLCountdownTimer(object):
                        ui.message("Timer complete")
                        if self.func is not None:
                                self.func()
-                       self.stop()
+                       self.Stop()
                elif 0 < self.duration <= self.threshold:
                        ui.message(str(self.duration))
 


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/01de7443cc9d/
Changeset:   01de7443cc9d
Branch:      master
User:        josephsl
Date:        2016-01-25 05:54:35+00:00
Summary:     Time-based profile switching (7.0-dev): Fixed inconsistency seen 
when broadcaster switches to another profile in the midst of broadcasting a 
show.

If a time-based profile is active and if a new profile becomes active, the prev 
profile was nullified. This creates inconsistency between prev profile flag and 
trigger flag (trigger flag is on yet prev profile is null). To solve this, onOK 
handler checks to make sure trigger flag is off before nullifying the prev 
profile (this is done when switch profile stirng from add-on settings dialog is 
no more).
Some GUI commits to come later (mostly to finish time-based switching code and 
to borrow triggers dialog design from NVDA Core). In the meantime, the master 
branch will focus on tweaks and fixes/enhancements.

Affected #:  1 file

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index 29384db..a9ba9ad 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -1119,7 +1119,7 @@ class SPLConfigDialog(gui.SettingsDialog):
                self.profiles.SetFocus()
 
        def onOk(self, evt):
-               global SPLConfig, SPLActiveProfile, _configDialogOpened, 
SPLSwitchProfile, SPLPrevProfile, profileTriggers
+               global SPLConfig, SPLActiveProfile, _configDialogOpened, 
SPLSwitchProfile, SPLPrevProfile, profileTriggers, _triggerProfileActive
                selectedProfile = self.profiles.GetStringSelection().split(" 
<")[0]
                profileIndex = getProfileIndexByName(selectedProfile)
                SPLConfig["General"]["BeepAnnounce"] = 
self.beepAnnounceCheckbox.Value
@@ -1155,7 +1155,8 @@ class SPLConfigDialog(gui.SettingsDialog):
                SPLActiveProfile = selectedProfile
                SPLSwitchProfile = self.switchProfile
                # Make sure to nullify prev profile if instant switch profile 
is gone.
-               if self.switchProfile is None:
+               # 7.0: Don't do the following in the midst of a broadcast.
+               if self.switchProfile is None and not _triggerProfileActive:
                        SPLPrevProfile = None
                _configDialogOpened = False
                # 7.0: Perform extra action such as restarting auto update 
timer.
@@ -1360,7 +1361,7 @@ class SPLConfigDialog(gui.SettingsDialog):
                self.profiles.Delete(index)
                del self.profileNames[profilePos]
                del _SPLCache[name]
-                               if name in self._profileTriggersConfig:
+               if name in self._profileTriggersConfig:
                        del self._profileTriggersConfig[name]
                # 6.3: Select normal profile if the active profile is gone.
                # 7.0: Consult profile names instead.

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: