[nvda-addons] Re: commit/StationPlaylist: 2 new changesets

  • From: derek riemer <driemer.riemer@xxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Thu, 21 Apr 2016 02:02:07 -0600

Out of curiosity, there's no translators comment here.
    if level in (1, 2):
        ui.message(_("No comment"))

On 4/19/2016 10:58 AM, commits-noreply@xxxxxxxxxxxxx wrote:


2 new commits in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/7cb6feb17d95/ Changeset: 7cb6feb17d95 Branch: None User: josephsl Date: 2016-04-19 16:57:36+00:00 Summary: Track comments (8.0-dev/LTS): Track Comment announcement combo box and entry dialog added.

Added a combo box in add-on settings to control how track comments should be nnounced. Also added a text entry dialog for entering track comments (Alt+NVDA+C three times).

Affected #: 2 files

diff --git a/addon/appModules/splstudio/__init__.py b/addon/appModules/splstudio/__init__.py index 7bef11d..d565aa6 100755 --- a/addon/appModules/splstudio/__init__.py +++ b/addon/appModules/splstudio/__init__.py @@ -279,15 +279,34 @@ class SPLTrackItem(IAccessible):

if level == 0:
        if splconfig.SPLConfig["General"]["TrackCommentAnnounce"] in ("message", 
"both"):
                ui.message(_("Has comment"))

 *

    if splconfig.SPLConfig["General"]["TrackCommentAnnounce"] in
    ("message", "both"):

 *

    tones.beep(512, 500)

+ if splconfig.SPLConfig["General"]["TrackCommentAnnounce"] in ("beep", "both"): + tones.beep(1024, 100)

elif level == 1:
        ui.message(splconfig.trackComments[filename])
elif level == 2:
        api.copyToClip(splconfig.trackComments[filename])

+ # Translators: Presented when track comment has been copied to clipboard. + ui.message(_("Track comment copied to clipboard")) + else: + self._trackCommentsEntry(filename, splconfig.trackComments[filename])

else:
        if level in (1, 2):
                ui.message(_("No comment"))

+ elif level == 3: + self._trackCommentsEntry(filename, "") + + # A proxy function to call the track comments entry dialog. + def _trackCommentsEntry(self, filename, comment): + dlg = wx.TextEntryDialog(gui.mainFrame, + _("Track comment"), + # Translators: The title of the track comments dialog. + _("Track comment"), defaultValue=comment) + def callback(result): + if result == wx.ID_OK: + if dlg.GetValue() is None: return + elif dlg.GetValue() == "": del splconfig.trackComments[filename] + else: splconfig.trackComments[filename] = dlg.GetValue() + gui.runScriptModalDialog(dlg, callback)

def script_announceTrackComment(self, gesture):
        self.announceTrackComment(scriptHandler.getLastScriptRepeatCount()+1)

diff --git a/addon/appModules/splstudio/splconfui.py b/addon/appModules/splstudio/splconfui.py index b73d530..6af223e 100755 --- a/addon/appModules/splstudio/splconfui.py +++ b/addon/appModules/splstudio/splconfui.py @@ -249,6 +249,27 @@ class SPLConfigDialog(gui.SettingsDialog):

                
self.categorySoundsCheckbox.SetValue(splconfig.SPLConfig["General"]["CategorySounds"])
                settingsSizer.Add(self.categorySoundsCheckbox, 
border=10,flag=wx.BOTTOM)

+ sizer = wx.BoxSizer(wx.HORIZONTAL) + # Translators: the label for a setting in SPL add-on settings to set how track comments are announced. + label = wx.StaticText(self, wx.ID_ANY, label=_("&Track comment announcement:")) + self.trackCommentValues=[("off",_("Off")), + # Translators: One of the track comment notification settings. + ("message",_("Message")), + # Translators: One of the track comment notification settings. + ("beep",_("Beep")), + # Translators: One of the track comment notification settings. + ("both",_("Both"))] + self.trackCommentList = wx.Choice(self, wx.ID_ANY, choices=[x[1] for x in self.trackCommentValues]) + trackCommentCurValue=splconfig.SPLConfig["General"]["TrackCommentAnnounce"] + selection = (x for x,y in enumerate(self.trackCommentValues) if y[0]==trackCommentCurValue).next() + try: + self.trackCommentList.SetSelection(sele ction) + except: + pass + sizer.Add(label) + sizer.Add(self.trackCommentList) + settingsSizer.Add(sizer, border=10, flag=wx.BOTTOM) +

# Translators: the label for a setting in SPL add-on settings to toggle top and 
bottom notification.
self.topBottomCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Notify when located at 
&top or bottom of playlist viewer"))
self.topBottomCheckbox.SetValue(splconfig.SPLConfig["General"]["TopBottomAnnounce"])

@@ -342,6 +363,7 @@ class SPLConfigDialog(gui.SettingsDialog):

splconfig.SPLConfig["General"]["TimeHourAnnounce"] = 
self.hourAnnounceCheckbox.Value
splconfig.SPLConfig["General"]["TrackDial"] = self.trackDialCheckbox.Value
splconfig.SPLConfig["General"]["CategorySounds"] = 
self.categorySoundsCheckbox.Value

+ splconfig.SPLConfig["General"]["TrackCommentAnnounce"] = self.trackCommentValues[self.trackCommentList.GetSelection()][0]

splconfig.SPLConfig["General"]["TopBottomAnnounce"] = 
self.topBottomCheckbox.Value
splconfig.SPLConfig["General"]["MetadataReminder"] = 
self.metadataValues[self.metadataList.GetSelection()][0]
splconfig.SPLConfig["MetadataStreaming"]["MetadataEnabled"] = 
self.metadataStreams

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/5afba6a3be47/ Changeset: 5afba6a3be47 Branch: staging User: josephsl Date: 2016-04-19 16:58:48+00:00 Summary: Merge branch ‘8.0/trackComments’ into staging

Affected #: 3 files

diff --git a/addon/appModules/splstudio/__init__.py b/addon/appModules/splstudio/__init__.py index 77e411c..fe965b4 100755 --- a/addon/appModules/splstudio/__init__.py +++ b/addon/appModules/splstudio/__init__.py @@ -138,7 +138,6 @@ class SPLTrackItem(IAccessible):

def reportFocus(self):
        # 7.0: Cache column header data structures if meeting track items for 
the first time.
        # It is better to do it while reporting focus, otherwise Python throws 
recursion limit exceeded error when initOverlayClass does this.

 *

    # Cache header column.

if self.appModule._columnHeaders is None:
        self.appModule._columnHeaders = self.parent.children[-1]
# 7.0: Also cache column header names to improve performance (may need to check 
for header repositioning later).

@@ -148,6 +147,9 @@ class SPLTrackItem(IAccessible):

category = self._getColumnContent(self._indexOf("Category"))
if category in _SPLCategoryTones:
        tones.beep(_SPLCategoryTones[category], 50)

+ # LTS: Comments please. + if splconfig.SPLConfig["General"]["TrackCommentAnnounce"] != “off”: + self.announceTrackComment(0)

# 6.3: Catch an unusual case where screen order is off yet column order is same 
as screen order and NvDA is told to announce all columns.
if splconfig._shouldBuildDescriptionPieces():
        descriptionPieces = []

@@ -266,12 +268,56 @@ class SPLTrackItem(IAccessible):

                if self.IAccessibleChildID == 1 and 
splconfig.SPLConfig["General"]["TopBottomAnnounce"]:
                        tones.beep(2000, 100)

+ # Track comments. + + # Track comment announcer. + # Levels indicate what should be done. + # 0 indicates reportFocus, subsequent levels indicate script repeat count+1. + def announceTrackComment(self, level): + filename = self._getColumnContent(self._indexOf("Filename")) + if filename in splconfig.trackComments: + if level == 0: + if splconfig.SPLConfig["General"]["TrackCommentAnnounce"] in ("message", “both"): + ui.message(_("Has comment")) + if splconfig.SPLConfig["General"]["TrackCommentAnnounce”] in ("beep", "both"): + tones.beep(1024, 100) + elif level == 1: + ui.message(splconfig.trackComments[filename]) + elif level == 2: + api.copyToClip(splconfig.trackComments[filename]) + # Translators: Presented when track comment has been copied to clipboard. + ui.message(_("Track comment copied to clipboard")) + else: + self._trackCo mmentsEntry(filename, splconfig.trackComments[filename]) + else: + if level in (1, 2): + ui.message(_("No comment")) + elif level == 3: + self._trackCommentsEntry(filename, "") + + # A proxy function to call the track comments entry dialog. + def _trackCommentsEntry(self, filename, comment): + dlg = wx.TextEntryDialog(gui.mainFrame, + _("Track comment"), + # Translators: The title of the track comments dialog. + _("Track comment"), defaultValue=comment) + def callback(result): + if result == wx.ID_OK: + if dlg.GetValue() is None: return + elif dlg.GetValue() == "": del splconfig.trackComments[filename] + else: splconfig.trackComments[filename] = dlg.GetValue() + gui.runScriptModalDialog(dlg, callback) + + def script_announceTrackComment(self, gesture): + self.announceTrackComment(scriptHandler.getLastScriptRepeatCount()+1) +

__gestures={
        "kb:control+alt+rightArrow":"nextColumn",
        "kb:control+alt+leftArrow":"prevColumn",
        #"kb:control+`":"toggleTrackDial",
        "kb:downArrow":"nextTrack",
        "kb:upArrow":"prevTrack",

+ “kb:Alt+NVDA+C":"announceTrackComment”

        }

class SPL510TrackItem(SPLTrackItem):

diff --git a/addon/appModules/splstudio/splconfig.py b/addon/appModules/splstudio/splconfig.py index 1572e0a..356c4dd 100755 --- a/addon/appModules/splstudio/splconfig.py +++ b/addon/appModules/splstudio/splconfig.py @@ -30,6 +30,7 @@ BeepAnnounce = boolean(default=false)

MessageVerbosity = option("beginner", "advanced", default="beginner")
BrailleTimer = option("off", "intro", "outro", "both", default="off")
AlarmAnnounce = option("beep", "message", "both", default="beep")

+TrackCommentAnnounce = option("off", “beep”, “message”, “both”, default="off")

LibraryScanAnnounce = option("off", "ending", "progress", "numbers", 
default="off")
TrackDial = boolean(default=false)
CategorySounds = boolean(default=false)

@@ -126,6 +127,8 @@ _configErrors ={

# The below init function is really a vehicle that traverses through config 
profiles in a loop.
# Prompt the config error dialog only once.
_configLoadStatus = {} # Key = filename, value is pass or no pass.

+# Track comments map. +trackComments = {}

def initConfig():
        # 7.0: When add-on 7.0 starts for the first time, check if a conversion 
file exists.

@@ -139,7 +142,7 @@ def initConfig():

        os.remove(SPLIni)
        os.rename(os.path.join(globalVars.appArgs.configPath, 
"splstudio7.ini"), SPLIni)
# Load the default config from a list of profiles.

 *

    global SPLConfig, SPLConfigPool, _configLoadStatus,
    SPLActiveProfile, SPLSwitchProfile

+ global SPLConfig, SPLConfigPool, _configLoadStatus, SPLActiveProfile, SPLSwitchProfile, trackComments

if SPLConfigPool is None: SPLConfigPool = []
# Translators: The name of the default (normal) profile.
if SPLActiveProfile is None: SPLActiveProfile = _("Normal profile")

@@ -163,6 +166,12 @@ def initConfig():

        _configLoadStatus[SPLConfigPool[0].name] = "noInstantProfile"
# 7.1: The config module knows the fate of the instant profile.
del SPLConfig["InstantProfile"]

+ # LTS: Load track comments if they exist. + # This must be a separate file (another pickle file). + try: + trackComments = cPickle.load(file(os.path.join(globalVars.appArgs.configPath, "spltrackcomments.pickle"), "r")) + except IOError: + pass

if len(_configLoadStatus):
        # Translators: Standard error title for configuration error.
        title = _("Studio add-on Configuration error")

@@ -599,6 +608,8 @@ def saveConfig():

splupdate._SPLUpdateT = None
# Close profile triggers dictionary.
saveProfileTriggers()

+ # Dump track comments. + cPickle.dump(trackComments, file(os.path.join(globalVars.appArgs.configPath, "spltrackcomments.pickle"), "wb"))

# Save update check state.
splupdate.terminate()
# Save profile-specific settings to appropriate dictionary if this is the case.

diff --git a/addon/appModules/splstudio/splconfui.py b/addon/appModules/splstudio/splconfui.py index 9c9b5f7..a4a7d9d 100755 --- a/addon/appModules/splstudio/splconfui.py +++ b/addon/appModules/splstudio/splconfui.py @@ -249,6 +249,27 @@ class SPLConfigDialog(gui.SettingsDialog):

                
self.categorySoundsCheckbox.SetValue(splconfig.SPLConfig["General"]["CategorySounds"])
                settingsSizer.Add(self.categorySoundsCheckbox, 
border=10,flag=wx.BOTTOM)

+ sizer = wx.BoxSizer(wx.HORIZONTAL) + # Translators: the label for a setting in SPL add-on settings to set how track comments are announced. + label = wx.StaticText(self, wx.ID_ANY, label=_("&Track comment announcement:")) + self.trackCommentValues=[("off",_("Off")), + # Translators: One of the track comment notification settings. + ("message",_("Message")), + # Translators: One of the track comment notification settings. + ("beep",_("Beep")), + # Translators: One of the track comment notification settings. + ("both",_("Both"))] + self.trackCommentList = wx.Choice(self, wx.ID_ANY, choices=[x[1] for x in self.trackCommentValues]) + trackCommentCurValue=splconfig.SPLConfig["General"]["TrackCommentAnnounce"] + selection = (x for x,y in enumerate(self.trackCommentValues) if y[0]==trackCommentCurValue).next() + try: + self.trackCommentList.SetSelection(sele ction) + except: + pass + sizer.Add(label) + sizer.Add(self.trackCommentList) + settingsSizer.Add(sizer, border=10, flag=wx.BOTTOM) +

# Translators: the label for a setting in SPL add-on settings to toggle top and 
bottom notification.
self.topBottomCheckbox=wx.CheckBox(self,wx.NewId(),label=_("Notify when located at 
&top or bottom of playlist viewer"))
self.topBottomCheckbox.SetValue(splconfig.SPLConfig["General"]["TopBottomAnnounce"])

@@ -342,6 +363,7 @@ class SPLConfigDialog(gui.SettingsDialog):

splconfig.SPLConfig["General"]["TimeHourAnnounce"] = 
self.hourAnnounceCheckbox.Value
splconfig.SPLConfig["General"]["TrackDial"] = self.trackDialCheckbox.Value
splconfig.SPLConfig["General"]["CategorySounds"] = 
self.categorySoundsCheckbox.Value

+ splconfig.SPLConfig["General"]["TrackCommentAnnounce"] = self.trackCommentValues[self.trackCommentList.GetSelection()][0]

splconfig.SPLConfig["General"]["TopBottomAnnounce"] = 
self.topBottomCheckbox.Value
splconfig.SPLConfig["General"]["MetadataReminder"] = 
self.metadataValues[self.metadataList.GetSelection()][0]
splconfig.SPLConfig["MetadataStreaming"]["MetadataEnabled"] = 
self.metadataStreams

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.


--
------------------------------------------------------------------------


   Derek Riemer

 * Department of computer science, third year undergraduate student.
 * Proud user of the NVDA screen reader.
 * Open source enthusiast.
 * Member of Bridge Cu
 * Avid skiier.

Websites:
Honors portfolio <http://derekriemer.com>
Awesome little hand built weather app! <http://django.derekriemer.com/weather/>

email me at derek.riemer@xxxxxxxxxxxx <mailto:derek.riemer@xxxxxxxxxxxx>
Phone: (303) 906-2194

Other related posts: