commit/StationPlaylist: 3 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Sun, 29 Nov 2015 23:06:13 -0000

3 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/4c8240cba175/
Changeset: 4c8240cba175
Branch: None
User: josephsl
Date: 2015-11-28 16:26:22+00:00
Summary: Merged master

Affected #: 1 file

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index cc37c48..d3b34c4 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -86,7 +86,9 @@ def resetAllConfig():
profile.reset()
profile.filename = profilePath
for setting in _SPLDefaults:
- profile[setting] = _SPLDefaults[setting]
+ # Convert certain settings to a different format.
+ if setting == "IncludedColumns":
profile["IncludedColumns"] = set(_SPLDefaults["IncludedColumns"])
+ else: profile[setting] = _SPLDefaults[setting]
# 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.
@@ -567,7 +569,7 @@ class SPLConfigDialog(gui.SettingsDialog):
pass
sizer.Add(label)
sizer.Add(self.metadataList)
- self.metadataStreams = SPLConfig["MetadataEnabled"]
+ self.metadataStreams = list(SPLConfig["MetadataEnabled"])
# Translators: The label of a button to manage column
announcements.
item = manageMetadataButton = wx.Button(self,
label=_("Configure metadata &streaming connection options..."))
item.Bind(wx.EVT_BUTTON, self.onManageMetadata)
@@ -578,7 +580,8 @@ class SPLConfigDialog(gui.SettingsDialog):

self.columnOrderCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Announce columns
in the &order shown on screen"))

self.columnOrderCheckbox.SetValue(SPLConfig["UseScreenColumnOrder"])
self.columnOrder = SPLConfig["ColumnOrder"]
- self.includedColumns = SPLConfig["IncludedColumns"]
+ # Without manual conversion below, it produces a rare bug where
clicking cancel after changing column inclusion causes new set to be retained.
+ self.includedColumns = set(SPLConfig["IncludedColumns"])
settingsSizer.Add(self.columnOrderCheckbox,
border=10,flag=wx.BOTTOM)
# Translators: The label of a button to manage column
announcements.
item = manageColumnsButton = wx.Button(self, label=_("&Manage
track column announcements..."))
@@ -662,6 +665,7 @@ class SPLConfigDialog(gui.SettingsDialog):

def onCancel(self, evt):
global _configDialogOpened, SPLActiveProfile, SPLSwitchProfile,
SPLConfig
+ self.includedColumns.clear()
SPLActiveProfile = self.activeProfile
if self.switchProfileRenamed or self.switchProfileDeleted:
SPLSwitchProfile = self.switchProfile
@@ -981,7 +985,7 @@ class MetadataStreamingDialog(wx.Dialog):
streaming = func(0, 36, ret=True)
if streaming == -1: streaming += 1
checkedDSP.SetValue(streaming)
- else: checkedDSP.SetValue(SPLConfig["MetadataEnabled"][0])
+ else: checkedDSP.SetValue(self.Parent.metadataStreams[0])
self.checkedStreams.append(checkedDSP)
# Now the rest.
for url in xrange(1, 5):
@@ -990,7 +994,7 @@ class MetadataStreamingDialog(wx.Dialog):
streaming = func(url, 36, ret=True)
if streaming == -1: streaming += 1
checkedURL.SetValue(streaming)
- else:
checkedURL.SetValue(SPLConfig["MetadataEnabled"][url])
+ else:
checkedURL.SetValue(self.Parent.metadataStreams[url])
self.checkedStreams.append(checkedURL)

mainSizer = wx.BoxSizer(wx.VERTICAL)
@@ -1169,7 +1173,7 @@ class AdvancedOptionsDialog(wx.Dialog):
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"])
+
self.splConPassthroughCheckbox.SetValue(self.Parent.splConPassthrough)
sizer.Add(self.splConPassthroughCheckbox, border=10,flag=wx.TOP)
mainSizer.Add(sizer, border=10, flag=wx.BOTTOM)



https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/5524cc271b7d/
Changeset: 5524cc271b7d
Branch: None
User: josephsl
Date: 2015-11-28 16:49:03+00:00
Summary: Auto update check (7.0-dev): The UI for configuring this setting
now lives in Advanced options dialog.

Affected #: 1 file

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index d3b34c4..ade2162 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -613,6 +613,7 @@ class SPLConfigDialog(gui.SettingsDialog):
item.Bind(wx.EVT_BUTTON, self.onAdvancedOptions)
self.splConPassthrough = SPLConfig["SPLConPassthrough"]
self.compLayer = SPLConfig["CompatibilityLayer"]
+ self.autoUpdateCheck = SPLConfig["AutoUpdateCheck"]
settingsSizer.Add(item)

# Translators: The label for a button in SPL add-on
configuration dialog to reset settings to defaults.
@@ -653,6 +654,7 @@ class SPLConfigDialog(gui.SettingsDialog):
SPLConfig["SayPlayingTrackName"] =
str(self.playingTrackNameCheckbox.Value)
SPLConfig["SPLConPassthrough"] = self.splConPassthrough
SPLConfig["CompatibilityLayer"] = self.compLayer
+ SPLConfig["AutoUpdateCheck"] = self.autoUpdateCheck
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.
@@ -1162,7 +1164,8 @@ class ColumnAnnouncementsDialog(wx.Dialog):

# 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.
+# More options will be added in 7.0.
+# 7.0: Auto update check will be configurable from this dialog.
class AdvancedOptionsDialog(wx.Dialog):

def __init__(self, parent):
@@ -1171,6 +1174,14 @@ class AdvancedOptionsDialog(wx.Dialog):
mainSizer = wx.BoxSizer(wx.VERTICAL)

sizer = wx.BoxSizer(wx.HORIZONTAL)
+ self.autoUpdateCheck
+ # Translators: A checkbox to toggle automatic add-on updates.
+
self.autoUpdateCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Automatically
check for add-on &updates"))
+ self.autoUpdateCheckbox.SetValue(self.Parent.autoUpdateCheck)
+ sizer.Add(self.autoUpdateCheckbox, border=10,flag=wx.TOP)
+ mainSizer.Add(sizer, border=10, flag=wx.BOTTOM)
+
+ 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(self.Parent.splConPassthrough)
@@ -1198,13 +1209,14 @@ class AdvancedOptionsDialog(wx.Dialog):
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
mainSizer.Fit(self)
self.Sizer = mainSizer
- self.splConPassthroughCheckbox.SetFocus()
+ self.autoUpdateCheckbox.SetFocus()
self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)

def onOk(self, evt):
parent = self.Parent
parent.splConPassthrough = self.splConPassthroughCheckbox.Value
parent.compLayer =
self.compatibilityLayouts[self.compatibilityList.GetSelection()][0]
+ parent.autoUpdateCheck = self.autoUpdateCheckbox.Value
parent.profiles.SetFocus()
parent.Enable()
self.Destroy()


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/a960530c276c/
Changeset: a960530c276c
Branch: 7.0/silverAutoUpdate
User: josephsl
Date: 2015-11-29 23:05:35+00:00
Summary: Auto update check (7.0-dev): Automatic update check is now
available.

Added a new timer which calls the update check routine. Due to limitations, a
proxy is used (the timer constructor does not allow arguments).
The update checker gains a new keyword argument that takes a copy of the auto
update key from add-on configuration. This is used to tell if the timer should
resume. Also, regardless of check type, the check time will always be updated
whenever the update check happens (thus, PDT is now package update time).
So far, auto update is working (will be checked every 24 hours). The next step
is disabling the auto checker in specific cases such as when an instant switch
profile is active.

Affected #: 3 files

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index 819399b..4a3273a 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -39,8 +39,6 @@ import splupdate
import addonHandler
addonHandler.initTranslation()

-def update():
- splupdate._updateCheckEx()

# The finally function for status announcement scripts in this module (source:
Tyler Spivey's code).
def finally_(func, final):
@@ -384,10 +382,8 @@ class AppModule(appModuleHandler.AppModule):
threading.Thread(target=self._locateSPLHwnd).start()
# Check for add-on update if told to do so.
if splconfig.SPLConfig["AutoUpdateCheck"]:
- # 7.0 alpha: Let the user know about auto update
checking routine.
- time.sleep(2)
- queueHandler.queueFunction(queueHandler.eventQueue,
ui.message, "Checking for add-on updates...")
- splupdate.updateCheck(auto=True)
+ # 7.0: Have a timer call the update function indirectly.
+ queueHandler.queueFunction(queueHandler.eventQueue,
splconfig.updateInit)

# Locate the handle for main window for caching purposes.
def _locateSPLHwnd(self):
@@ -1616,7 +1612,8 @@ class AppModule(appModuleHandler.AppModule):

os.startfile("https://bitbucket.org/nvdaaddonteam/stationplaylist/wiki/SPLDevAddonGuide";)

def script_updateCheck(self, gesture):
- splupdate.updateCheck()
+ if splupdate._SPLUpdateT is not None and
splupdate._SPLUpdateT.IsRunning(): splupdate._SPLUpdateT.Stop()
+
splupdate.updateCheck(continuous=splconfig.SPLConfig["AutoUpdateCheck"])


__SPLAssistantGestures={

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index ade2162..bb7cd24 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -9,6 +9,7 @@ from cStringIO import StringIO
from configobj import ConfigObj
from validate import Validator
import weakref
+import time
import globalVars
import ui
import api
@@ -126,7 +127,7 @@ def initConfig():
# 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 = SPLConfig["PDT"]
+ if "PDT" in SPLConfig: splupdate.SPLAddonCheck = float(SPLConfig["PDT"])
# Locate instant profile.
if "InstantProfile" in SPLConfig:
try:
@@ -276,6 +277,9 @@ def _preSave(conf):
def saveConfig():
# Save all config profiles.
global SPLConfig, SPLConfigPool, SPLActiveProfile, SPLPrevProfile,
SPLSwitchProfile
+ # 7.0: Turn off auto update check timer.
+ if splupdate._SPLUpdateT is not None and
splupdate._SPLUpdateT.IsRunning(): splupdate._SPLUpdateT.Stop()
+ splupdate._SPLUpdateT = None
# Apply any global settings changed in profiles to normal configuration.
if SPLConfigPool.index(SPLConfig) > 0:
for setting in SPLConfig:
@@ -338,6 +342,30 @@ def instantProfileSwitch():

api.getFocusObject().appModule._metadataAnnouncer(reminder=True)


+# Automatic update checker.
+
+# The function below is called as part of the update check timer.
+# Its only job is to call the update check function (splupdate) with the auto
check enabled.
+# The update checker will not be engaged if an instant switch profile is
active or it is not time to check for it yet (check will be done every 24
hours).
+def autoUpdateCheck():
+ ui.message("Checking for add-on updates...")
+ splupdate.updateCheck(auto=True,
continuous=SPLConfig["AutoUpdateCheck"])
+
+# The timer itself.
+# A bit simpler than NVDA Core's auto update checker.
+def updateInit():
+ currentTime = time.time()
+ nextCheck = splupdate.SPLAddonCheck+86400.0
+ if splupdate.SPLAddonCheck < currentTime < nextCheck:
+ interval = int(nextCheck - currentTime)
+ elif splupdate.SPLAddonCheck < nextCheck < currentTime:
+ interval = 86400
+ # Call the update check now.
+ splupdate.updateCheck(auto=True) # No repeat here.
+ splupdate._SPLUpdateT = wx.PyTimer(autoUpdateCheck)
+ splupdate._SPLUpdateT.Start(interval * 1000, True)
+
+
# Configuration dialog.
_configDialogOpened = False

@@ -1174,7 +1202,6 @@ class AdvancedOptionsDialog(wx.Dialog):
mainSizer = wx.BoxSizer(wx.VERTICAL)

sizer = wx.BoxSizer(wx.HORIZONTAL)
- self.autoUpdateCheck
# Translators: A checkbox to toggle automatic add-on updates.

self.autoUpdateCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Automatically
check for add-on &updates"))
self.autoUpdateCheckbox.SetValue(self.Parent.autoUpdateCheck)

diff --git a/addon/appModules/splstudio/splupdate.py
b/addon/appModules/splstudio/splupdate.py
index e19fc49..5e6840f 100755
--- a/addon/appModules/splstudio/splupdate.py
+++ b/addon/appModules/splstudio/splupdate.py
@@ -18,13 +18,16 @@ import addonHandler
_addonDir = os.path.join(os.path.dirname(__file__), "..", "..")
# Move this to the main app module in case version will be queried by users.
SPLAddonVersion = addonHandler.Addon(_addonDir).manifest['version']
-
# Cache the file size for the last downloaded SPL add-on installer (stored in
hexadecimal for security).
SPLAddonSize = "0x0"
# The Unix time stamp for add-on check time.
SPLAddonCheck = 0
# Update URL (the only way to change it is installing a different version from
a different branch).
SPLUpdateURL = "http://addons.nvda-project.org/files/get.php?file=spl-dev";
+# Update check timer.
+_SPLUpdateT = None
+# How long it should wait between automatic checks.
+_updateInterval = 86400

def _versionFromURL(url):
filename = url.split("/")[-1]
@@ -60,7 +63,14 @@ def updateQualify(url):
else:
return ""

-def updateCheck(auto=False):
+# The update check routine.
+# Auto is whether to respond with UI (manual check only), continuous takes in
auto update check variable for restarting the timer.
+def updateCheck(auto=False, continuous=False):
+ global _SPLUpdateT, SPLAddonCheck
+ # Regardless of whether it is an auto check, update the check time.
+ SPLAddonCheck = time.time()
+ # Should the timer be set again?
+ if continuous: _SPLUpdateT.Start(_updateInterval*1000, True)
# Auto disables UI portion of this function if no updates are pending.
if not auto: tones.beep(110, 40)
# Try builds does not (and will not) support upgrade checking unless
absolutely required.
@@ -91,9 +101,8 @@ def updateCheck(auto=False):
else: wx.CallAfter(getUpdateResponse, checkMessage, "Check for add-on
update", url.info().getheader("Content-Length"))

def getUpdateResponse(message, caption, size):
- global SPLAddonSize, SPLAddonCheck
+ global SPLAddonSize
if gui.messageBox(message, caption, wx.YES | wx.NO | wx.CANCEL |
wx.CENTER | wx.ICON_QUESTION) == wx.YES:
SPLAddonSize = hex(int(size))
- SPLAddonCheck = time.time()
os.startfile(SPLUpdateURL)

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: