commit/StationPlaylist: josephsl: Merge branch 'master' into staging

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Thu, 14 Jan 2016 00:02:51 -0000

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/baf7f0d0c531/
Changeset:   baf7f0d0c531
Branch:      staging
User:        josephsl
Date:        2016-01-11 17:51:48+00:00
Summary:     Merge branch 'master' into staging

Affected #:  7 files

diff --git a/addon/appModules/splstudio/__init__.py 
b/addon/appModules/splstudio/__init__.py
index 6559577..2c5cee5 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -1,6 +1,6 @@
 # StationPlaylist Studio
 # An app module and global plugin package for NVDA
-# Copyright 2011, 2013-2015, Geoff Shang, Joseph Lee and others, released 
under GPL.
+# Copyright 2011, 2013-2016, Geoff Shang, Joseph Lee and others, released 
under GPL.
 # The primary function of this appModule is to provide meaningful feedback to 
users of SplStudio
 # by allowing speaking of items which cannot be easily found.
 # Version 0.01 - 7 April 2011:
@@ -67,10 +67,6 @@ libScanT = None
 # Blacklisted versions of Studio where library scanning functionality is 
broken.
 noLibScanMonitor = []
 
-# List of known window style values to check for track items in Studio 5.0x..
-known50styles = (1442938953, 1443987529, 1446084681)
-known51styles = (1443991625, 1446088777)
-
 # Braille and play a sound in response to an alarm or an event.
 def messageSound(wavFile, message):
        nvwave.playWaveFile(wavFile)
@@ -460,8 +456,6 @@ class AppModule(appModuleHandler.AppModule):
        # Keep an eye on library scans in insert tracks window.
        libraryScanning = False
        scanCount = 0
-       # For SPL 5.10: take care of some object child constant changes across 
builds.
-       spl510used = False
        # For 5.0X and earlier: prevent NVDA from announcing scheduled time 
multiple times.
        scheduledTimeCache = ""
        # Track Dial (A.K.A. enhanced arrow keys)
@@ -586,7 +580,7 @@ class AppModule(appModuleHandler.AppModule):
 
        # Perform extra action in specific situations (mic alarm, for example).
        def doExtraAction(self, status):
-               micAlarm = 
int(splconfig.SPLConfig["MicrophoneAlarm"]["MicAlarm"])
+               micAlarm = splconfig.SPLConfig["MicrophoneAlarm"]["MicAlarm"]
                if self.cartExplorer:
                        if status == "Cart Edit On":
                                # Translators: Presented when cart edit mode is 
toggled on while cart explorer is on.
@@ -788,7 +782,7 @@ class AppModule(appModuleHandler.AppModule):
                        wx.CallAfter(gui.messageBox, _("The add-on settings 
dialog is opened. Please close the settings dialog first."), _("Error"), 
wx.OK|wx.ICON_ERROR)
                        return
                try:
-                       rampVal = 
long(splconfig.SPLConfig["IntroOutroAlarms"]["SongRampTime"])
+                       rampVal = 
splconfig.SPLConfig["IntroOutroAlarms"]["SongRampTime"]
                        d = splconfig.SPLAlarmDialog(gui.mainFrame, 
"SongRampTime", "SaySongRamp",
                        # Translators: The title of song intro alarm dialog.
                        _("Song intro alarm"),
@@ -907,7 +901,6 @@ class AppModule(appModuleHandler.AppModule):
        # Column is a list of columns to be searched (if none, it'll be artist 
and title).
        def _trackLocator(self, text, obj=api.getFocusObject(), 
directionForward=True, columns=None):
                nextTrack = "next" if directionForward else "previous"
-               t = time.time()
                while obj is not None:
                        # Do not use column content attribute, because 
sometimes NVDA will say it isn't a track item when in fact it is.
                        # If this happens, use the module level version of 
column content getter.

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index 045df1d..f388544 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -168,8 +168,6 @@ def initConfig():
                # Save add-on update related keys and instant profile signature 
from death.
                # Necessary since the old-style config file contains newer 
information about update package size, last installed date and records instant 
profile name.
                tempConfig = ConfigObj(SPLIni, configspec = confspec, 
encoding="UTF-8")
-               if "PSZ" in tempConfig: splupdate.SPLAddonSize = 
tempConfig["PSZ"]
-               if "PDT" in tempConfig: splupdate.SPLAddonCheck = 
tempConfig["PDT"]
                if "InstantProfile" in tempConfig: curInstantProfile = 
tempConfig["InstantProfile"]
                os.remove(SPLIni)
                os.rename(os.path.join(globalVars.appArgs.configPath, 
"splstudio7.ini"), SPLIni)
@@ -190,10 +188,6 @@ def initConfig():
        SPLConfig = dict(SPLConfigPool[0])
        SPLConfig["ActiveIndex"] = 0 # Holds settings from normal profile.
        if curInstantProfile != "": SPLConfig["InstantProfile"] = 
curInstantProfile
-       # 7.0: Store add-on installer size in case one wishes to check for 
updates (default size is 0 or no update checked attempted).
-       # Same goes to update check time and date (stored as Unix time stamp).
-       if "PSZ" in SPLConfig: splupdate.SPLAddonSize = SPLConfig["PSZ"]
-       if "PDT" in SPLConfig: splupdate.SPLAddonCheck = float(SPLConfig["PDT"])
        # Locate instant profile.
        if "InstantProfile" in SPLConfig:
                try:
@@ -219,6 +213,8 @@ def initConfig():
                runConfigErrorDialog("\n".join(messages), title)
        # Fire up profile triggers.
        initProfileTriggers()
+       # Let the update check begin.
+       splupdate.initialize()
 
 # Unlock (load) profiles from files.
 def unlockConfig(path, profileName=None, prefill=False):
@@ -256,6 +252,16 @@ def unlockConfig(path, profileName=None, prefill=False):
        _extraInitSteps(SPLConfigCheckpoint, profileName=profileName)
        # Only run when loading profiles other than normal profile.
        if not prefill: _discardGlobalSettings(SPLConfigCheckpoint)
+       # Conversely:
+       else:
+               if "PSZ" in SPLConfigCheckpoint:
+                       splupdate.SPLAddonSize = 
hex(int(SPLConfigCheckpoint["PSZ"], 16))
+                       try: del SPLConfigCheckpoint["PSZ"]
+                       except KeyError: pass
+               if "PDT" in SPLConfigCheckpoint:
+                       splupdate.SPLAddonCheck = 
float(SPLConfigCheckpoint["PDT"])
+                       try: del SPLConfigCheckpoint["PDT"]
+                       except KeyError: pass
        SPLConfigCheckpoint.name = profileName
        # 7.0 optimization: Store an online backup.
        # This online backup is used to prolong SSD life (no need to save a 
config if it is same as this copy).
@@ -351,15 +357,12 @@ def nextTimedProfile(current=None):
                triggerTime = datetime.datetime(entry[1], entry[2], entry[3], 
entry[4], entry[5])
                # Hopefully the trigger should be ready before the show, but 
sometimes it isn't.
                if current > triggerTime:
-                       print "time passed"
                        profileTriggers[profile] = setNextTimedProfile(profile, 
entry[0], datetime.time(entry[4], entry[5]), date=current)
                        if (current-triggerTime).seconds < entry[6]*60:
                                shouldBeSwitched = True
                possibleTriggers.append((triggerTime, profile, 
shouldBeSwitched))
        if len(possibleTriggers):
                d = min(possibleTriggers)[0] - current
-               print d.days
-               print d.seconds
        return min(possibleTriggers) if len(possibleTriggers) else None
 
 # Some helpers used in locating next air date/time.
@@ -530,14 +533,6 @@ def _preSave(conf):
                                del conf["InstantProfile"]
                        except KeyError:
                                pass
-               # 7.0: Check if updates are pending.
-               if (("PSZ" in conf and splupdate.SPLAddonSize != conf["PSZ"])
-               or ("PSZ" not in conf and splupdate.SPLAddonSize != 0x0)):
-                       conf["PSZ"] = splupdate.SPLAddonSize
-               # Same goes to update check time and date.
-               if (("PDT" in conf and splupdate.SPLAddonCheck != conf["PDT"])
-               or ("PDT" not in conf and splupdate.SPLAddonCheck != 0)):
-                       conf["PDT"] = splupdate.SPLAddonCheck
        # For other profiles, remove global settings before writing to disk.
        else:
                # 6.1: Make sure column order and inclusion aren't same as 
default values.
@@ -563,7 +558,6 @@ def shouldSave(profile):
                if isinstance(profile[section], dict):
                        for key in profile[section]:
                                if profile[section][key] != 
_SPLCache[tree][section][key]:
-                                       print key
                                        return True # Setting modified.
        return False
 
@@ -577,34 +571,27 @@ def saveConfig():
        splupdate._SPLUpdateT = None
        # Close profile triggers dictionary.
        saveProfileTriggers()
+       # Save update check state.
+       splupdate.terminate()
        # Save profile-specific settings to appropriate dictionary if this is 
the case.
        activeIndex = SPLConfig["ActiveIndex"]
        del SPLConfig["ActiveIndex"]
        if activeIndex > 0:
                applySections(activeIndex)
        # 7.0: Save normal profile first.
-       # Step 1: temporarily merge normal profile.
+       # Temporarily merge normal profile.
        mergeSections(0)
-       # Step 2: Perform presave routine.
        _preSave(SPLConfigPool[0])
-       # Step 3: global flags, be gone.
+       # Global flags, be gone.
        if "Reset" in SPLConfigPool[0]:
                del SPLConfigPool[0]["Reset"]
-       # Step 4: Convert keys back to 5.x format.
+       # Convert keys back to 5.x format.
        for section in SPLConfigPool[0].keys():
                if isinstance(SPLConfigPool[0][section], dict):
                        for key in SPLConfigPool[0][section]:
                                SPLConfigPool[0][key] = 
SPLConfigPool[0][section][key]
-       # Step 5: Disk write optimization check please.
-       # Convert a few keys.
-       if "PDT" in _SPLCache[None]:
-               _SPLCache[None]["PDT"] = float(_SPLCache[None]["PDT"])
-       # Until update check dictionary is separated...
-       updateChecked = False
-       if ((splupdate.SPLAddonSize != SPLConfigPool[0]["PSZ"])
-       or (splupdate.SPLAddonCheck != SPLConfigPool[0]["PDT"])):
-               updateChecked = True
-       if shouldSave(SPLConfigPool[0]) or updateChecked:
+       # Disk write optimization check please.
+       if shouldSave(SPLConfigPool[0]):
                SPLConfigPool[0].write()
        del SPLConfigPool[0]
        # Now save broadcast profiles.
@@ -1131,7 +1118,6 @@ class SPLConfigDialog(gui.SettingsDialog):
                # It also causes NVDA to display wrong label for switch button.
                if self.switchProfile is None:
                        SPLPrevProfile = None
-               global _configDialogOpened
                _configDialogOpened = False
                # 7.0: Perform extra action such as restarting auto update 
timer.
                self.onCloseExtraAction()
@@ -1158,8 +1144,7 @@ class SPLConfigDialog(gui.SettingsDialog):
                        # Return to normal profile by merging the first profile 
in the config pool.
                        mergeSections(0)
                _configDialogOpened = False
-               #super(SPLConfigDialog,  self).onCancel(evt)
-               self.Destroy()
+               super(SPLConfigDialog,  self).onCancel(evt)
 
        # Perform extra action when closing this dialog such as restarting 
update timer.
        def onCloseExtraAction(self):

diff --git a/addon/appModules/splstudio/splupdate.py 
b/addon/appModules/splstudio/splupdate.py
index a7715ed..eee980d 100755
--- a/addon/appModules/splstudio/splupdate.py
+++ b/addon/appModules/splstudio/splupdate.py
@@ -7,11 +7,13 @@
 import urllib
 import os # Essentially, update download is no different than file downloads.
 from calendar import month_abbr # Last modified date formatting.
+import cPickle
 import gui
 import wx
 import tones
 import time
 import addonHandler
+import globalVars
 
 # Add-on manifest routine (credit: various add-on authors including Noelia 
Martinez).
 # Do not rely on using absolute path to open to manifest, as installation 
directory may change in a future NVDA Core version (highly unlikely, but...).
@@ -22,6 +24,8 @@ SPLAddonVersion = 
addonHandler.Addon(_addonDir).manifest['version']
 SPLAddonSize = "0x0"
 # The Unix time stamp for add-on check time.
 SPLAddonCheck = 0
+# Update metadata storage.
+SPLAddonState = {}
 # Update URL (the only way to change it is installing a different version from 
a different branch).
 SPLUpdateURL = "http://www.nvda-kr.org/spl/get.php?file=spl-try";
 # Update check timer.
@@ -30,6 +34,26 @@ _SPLUpdateT = None
 _updateInterval = 86400
 # Set if a socket error occurs.
 _retryAfterFailure = False
+# Stores update state.
+_updatePickle = os.path.join(globalVars.appArgs.configPath, "splupdate.pickle")
+
+# Come forth, update check routines.
+def initialize():
+       global SPLAddonState, SPLAddonSize, SPLAddonCheck
+       try:
+               SPLAddonState = cPickle.load(file(_updatePickle, "r"))
+               SPLAddonCheck = SPLAddonState["PDT"]
+               SPLAddonSize = SPLAddonState["PSZ"]
+       except IOError:
+               pass
+
+def terminate():
+       global SPLAddonState
+       SPLAddonState["PSZ"] = SPLAddonSize
+       SPLAddonState["PDT"] = SPLAddonCheck
+       cPickle.dump(SPLAddonState, file(_updatePickle, "wb"))
+       SPLAddonState = None
+
 
 def _versionFromURL(url):
        filename = url.split("/")[-1]

diff --git a/addon/appModules/tracktool.py b/addon/appModules/tracktool.py
index e649eb7..419a58b 100755
--- a/addon/appModules/tracktool.py
+++ b/addon/appModules/tracktool.py
@@ -1,6 +1,6 @@
 # StationPlaylist Track Tool
 # An app module for NVDA
-# Copyright 2014-2015 Joseph Lee and contributors, released under gPL.
+# Copyright 2014-2016 Joseph Lee and contributors, released under gPL.
 # Functionality is based on JFW scripts for SPL Track Tool by Brian Hartgen.
 
 import appModuleHandler

diff --git a/addon/globalPlugins/SPLStudioUtils/__init__.py 
b/addon/globalPlugins/SPLStudioUtils/__init__.py
index 5cec1ee..f1d1fa7 100755
--- a/addon/globalPlugins/SPLStudioUtils/__init__.py
+++ b/addon/globalPlugins/SPLStudioUtils/__init__.py
@@ -1,6 +1,6 @@
 # StationPlaylist Utilities
 # Author: Joseph Lee
-# Copyright 2013-2015, released under GPL.
+# Copyright 2013-2016, released under GPL.
 # Adds a few utility features such as switching focus to the SPL Studio window 
and some global scripts.
 # For encoder support, see the encoders package.
 

diff --git a/addon/globalPlugins/SPLStudioUtils/encoders.py 
b/addon/globalPlugins/SPLStudioUtils/encoders.py
index 5a9d874..42af2f8 100755
--- a/addon/globalPlugins/SPLStudioUtils/encoders.py
+++ b/addon/globalPlugins/SPLStudioUtils/encoders.py
@@ -1,6 +1,6 @@
 # StationPlaylist encoders support
 # Author: Joseph Lee
-# Copyright 2015, released under GPL.
+# Copyright 2015-2016, released under GPL.
 # Split from main global plugin in 2015.
 
 import threading

diff --git a/readme.md b/readme.md
index d111428..7faccb9 100755
--- a/readme.md
+++ b/readme.md
@@ -164,12 +164,21 @@ If you are using Studio on a touchscreen computer running 
Windows 8 or later and
 * Changes to SPL Assistant commands, including playlist duration (D), 
reassignment of hour selection duration from Shift+H to Shift+S and Shift+H now 
used to announce duration of remaining tracks for the current hour slot.
 * It is now possible to invoke track finder via SPL Assistant (F).
 * It is now possible to use a different screen reader command layout for SPL 
Assistant commands. Go to advanced options dialog from add-on settings to 
configure this option between NVDA, JAWS and Window-Eyes layouts. See the SPL 
Assistant commands above for details.
+* NVDA can be configured to switch to a specific broadcast profile at a 
specific day and time. Use the new triggers dialog in add-on settings to 
configure this.
 * Entries in profiles combo box in add-on settings dialog now shows profile 
flags such as active, whether it is an instant switch profile and so on.
 * In add-on settings dialog, the controls used to toggle announcement of 
scheduled time, listener count, cart name and track name has been moved to a 
dedicated status announcements dialog (select status announcement button to 
open this dialog).
 * It is no longer required to stay in the playlist viewer window in order to 
obtain time announcements such as remaining time for the track and broadcaster 
time.
 * In encoders, pressing Control+NVDA+0 will present encoder settings dialog 
for configuring various options such as stream label, focusing to Studio when 
connected and so on.
 * In encoders, it is now possible to turn off connection progress tone 
(configurable from encoder settings dialog).
 
+## Changes for 6.2
+
+* Fixed an issue with playlist remainder command (SPL Assistant, D (R if 
compatibility mode is on)) where the duration for the current hour was 
announced as opposed to the entire playlist (the behavior of this command can 
be configured from advanced settings found in add-on settings dialog).
+* NvDA can now announce name of the currently playing track while using 
another program (configurable from add-on settings).
+* The setting used to let SPL Controller command invoke SPL Assistant is now 
honored (previously it was enabled at all times).
+* In SAM encoders, Control+F9 and Control+F10 commands now works correctly.
+* In encoders, when an encoder is first focused and if this encoder is 
configured to be monitored in the background, NVDA will now start the 
background monitor automatically.
+
 ## Changes for 6.1
 
 * Column announcement order and inclusion, as well as metadata streaming 
settings are now profile-specific settings.

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: