commit/StationPlaylist: 2 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Wed, 01 Jul 2015 16:43:29 -0000

2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/8ef01273ddc1/
Changeset: 8ef01273ddc1
Branch: None
User: josephsl
Date: 2015-06-30 22:39:45+00:00
Summary: Merge branch 'master' into 6.0/categoricalSearch

Affected #: 1 file

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index d64543a..7f4bd95 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -54,6 +54,9 @@ def finally_(func, final):
# Make sure the broadcaster is running a compatible version.
SPLMinVersion = "5.00"

+# Cache the handle to main Studio window.
+_SPLWin = None
+
# Threads pool.
micAlarmT = None
libScanT = None
@@ -70,9 +73,8 @@ def messageSound(wavFile, message):
# A thin wrapper around user32.SendMessage and calling a callback if defined.
# Offset is used in some time commands.
def statusAPI(arg, command, func=None, ret=False, offset=None):
- SPLWin = user32.FindWindowA("SPLStudio", None)
- if not SPLWin: return
- val = sendMessage(SPLWin, 1024, arg, command)
+ if _SPLWin is None: return
+ val = sendMessage(_SPLWin, 1024, arg, command)
if ret:
return val
if func:
@@ -266,6 +268,19 @@ class AppModule(appModuleHandler.AppModule):
self.prefsMenu = gui.mainFrame.sysTrayIcon.preferencesMenu
self.SPLSettings = self.prefsMenu.Append(wx.ID_ANY, _("SPL
Studio Settings..."), _("SPL settings"))
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU,
splconfig.onConfigDialog, self.SPLSettings)
+ # Let me know the Studio window handle.
+ threading.Thread(target=self._locateSPLHwnd).start()
+
+ # Locate the handle for main window for caching purposes.
+ def _locateSPLHwnd(self):
+ hwnd = user32.FindWindowA("SPLStudio", None)
+ while not hwnd:
+ time.sleep(1)
+ hwnd = user32.FindWindowA("SPLStudio", None)
+ # Only this thread will have privilege of notifying handle's
existence.
+ with threading.Lock() as hwndNotifier:
+ 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.
@@ -351,9 +366,7 @@ class AppModule(appModuleHandler.AppModule):
if
splconfig.SPLConfig["LibraryScanAnnounce"] != "off":
if
splconfig.SPLConfig["BeepAnnounce"]: tones.beep(370, 100)
else:
- # 5.0: Store the handle
only once.
- SPLWin =
user32.FindWindowA("SPLStudio", None)
- count =
sendMessage(SPLWin, 1024, 0, 32)
+ count =
sendMessage(_SPLWin, 1024, 0, 32)
ui.message("Scan
complete with {scanCount} items".format(scanCount = count))
if self.libraryScanning:
self.libraryScanning = False
self.scanCount = 0
@@ -480,6 +493,9 @@ class AppModule(appModuleHandler.AppModule):
# Manually clear the following dictionaries.
self.carts.clear()
self._cachedStatusObjs.clear()
+ # Just to make sure:
+ global _SPLWin
+ if _SPLWin: _SPLWin = None


# Script sections (for ease of maintenance):
@@ -959,9 +975,8 @@ class AppModule(appModuleHandler.AppModule):
global libScanT
if libScanT and libScanT.isAlive() and
api.getForegroundObject().windowClassName == "TTrackInsertForm":
return
- SPLWin = user32.FindWindowA("SPLStudio", None)
parem = 0 if self.SPLCurVersion < "5.10" else 1
- countA = sendMessage(SPLWin, 1024, parem, 32)
+ countA = sendMessage(_SPLWin, 1024, parem, 32)
if countA == 0:
self.libraryScanning = False
return
@@ -969,19 +984,19 @@ class AppModule(appModuleHandler.AppModule):
if api.getForegroundObject().windowClassName ==
"TTrackInsertForm" and self.productVersion in noLibScanMonitor:
self.libraryScanning = False
return
- countB = sendMessage(SPLWin, 1024, parem, 32)
+ countB = sendMessage(_SPLWin, 1024, parem, 32)
if countA == countB:
self.libraryScanning = False
if self.SPLCurVersion >= "5.10":
- countB = sendMessage(SPLWin, 1024, 0, 32)
+ countB = sendMessage(_SPLWin, 1024, 0, 32)
# Translators: Presented when library scanning is
finished.
ui.message(_("{itemCount} items in the
library").format(itemCount = countB))
else:
- libScanT =
threading.Thread(target=self.libraryScanReporter, args=(SPLWin, countA, countB,
parem))
+ libScanT =
threading.Thread(target=self.libraryScanReporter, args=(_SPLWin, countA,
countB, parem))
libScanT.daemon = True
libScanT.start()

- def libraryScanReporter(self, SPLWin, countA, countB, parem):
+ def libraryScanReporter(self, _SPLWin, countA, countB, parem):
scanIter = 0
while countA != countB:
countA = countB
@@ -989,7 +1004,7 @@ class AppModule(appModuleHandler.AppModule):
# Do not continue if we're back on insert tracks form.
if api.getForegroundObject().windowClassName ==
"TTrackInsertForm":
return
- countB, scanIter = sendMessage(SPLWin, 1024, parem,
32), scanIter+1
+ countB, scanIter = sendMessage(_SPLWin, 1024, parem,
32), scanIter+1
if countB < 0:
break
if scanIter%5 == 0 and
splconfig.SPLConfig["LibraryScanAnnounce"] not in ("off", "ending"):
@@ -1175,24 +1190,26 @@ class AppModule(appModuleHandler.AppModule):
def script_sayNextTrackTitle(self, gesture):
try:
obj = self.status(self.SPLNextTrackTitle).firstChild
+ # Translators: Presented when there is no information
for the next track.
+ ui.message(_("No next track scheduled or no track is
playing")) if obj.name is None else ui.message(obj.name)
except RuntimeError:
# Translators: Presented when next track information is
unavailable.
ui.message(_("Cannot find next track information"))
- return
- # Translators: Presented when there is no information for the
next track.
- ui.message(_("No next track scheduled or no track is playing"))
if obj.name is None else ui.message(obj.name)
+ finally:
+ self.finish()
# Translators: Input help mode message for a command in Station
Playlist Studio.
script_sayNextTrackTitle.__doc__=_("Announces title of the next track
if any")

def script_sayTemperature(self, gesture):
try:
obj = self.status(self.SPLTemperature).firstChild
+ # Translators: Presented when there is no weather or
temperature information.
+ ui.message(_("Weather and temperature not configured"))
if obj.name is None else ui.message(obj.name)
except RuntimeError:
# Translators: Presented when temperature information
cannot be found.
ui.message(_("Weather information not found"))
- return
- # Translators: Presented when there is no weather or
temperature information.
- ui.message(_("Weather and temperature not configured")) if
obj.name is None else ui.message(obj.name)
+ finally:
+ self.finish()
# Translators: Input help mode message for a command in Station
Playlist Studio.
script_sayTemperature.__doc__=_("Announces temperature and weather
information")

@@ -1222,10 +1239,9 @@ class AppModule(appModuleHandler.AppModule):
def script_libraryScanMonitor(self, gesture):
if not self.libraryScanning:
if self.productVersion >= "5.10":
- SPLWin = user32.FindWindowA("SPLStudio", None)
- scanning = sendMessage(SPLWin, 1024, 1, 32)
+ scanning = sendMessage(_SPLWin, 1024, 1, 32)
if scanning < 0:
- items = sendMessage(SPLWin, 1024, 0, 32)
+ items = sendMessage(_SPLWin, 1024, 0,
32)
ui.message(_("{itemCount} items in the
library").format(itemCount = items))
return
self.libraryScanning = True


https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/55d398d21aa9/
Changeset: 55d398d21aa9
Branch: 6.0/categoricalSearch
User: josephsl
Date: 2015-07-01 16:42:27+00:00
Summary: Column search (6.0-dev): Different title will be used depending on
whether column search is enabled.

Affected #: 1 file

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index 7f4bd95..85a5f4e 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -263,7 +263,6 @@ class AppModule(appModuleHandler.AppModule):
self.backgroundStatusMonitor = True
else:
self.backgroundStatusMonitor = False"""
- # Emergency hack: disable this until recursion issue is fixed.
self.backgroundStatusMonitor = False
self.prefsMenu = gui.mainFrame.sysTrayIcon.preferencesMenu
self.SPLSettings = self.prefsMenu.Append(wx.ID_ANY, _("SPL
Studio Settings..."), _("SPL settings"))
@@ -759,7 +758,9 @@ class AppModule(appModuleHandler.AppModule):

def trackFinderGUI(self, columnSearch=False):
try:
- d = splconfig.SPLFindDialog(gui.mainFrame,
api.getFocusObject(), self.findText, "Find track", columnSearch = columnSearch)
+ if not columnSearch: title = "Find track"
+ else: title = "Column search"
+ d = splconfig.SPLFindDialog(gui.mainFrame,
api.getFocusObject(), self.findText, title, columnSearch = columnSearch)
gui.mainFrame.prePopup()
d.Raise()
d.Show()

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: