commit/StationPlaylist: josephsl: Selective column announcements (6.0-dev): Provide move up/down buttons to rearrange column order.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Sun, 05 Jul 2015 21:13:24 -0000

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/c0e17946a637/
Changeset: c0e17946a637
Branch: 6.0/selectiveColumnAnnouncements
User: josephsl
Date: 2015-07-05 21:13:02+00:00
Summary: Selective column announcements (6.0-dev): Provide move up/down
buttons to rearrange column order.

WXPython/Phoenix contains wx.RearrangeList/RearrangeDDialog, a handy control to
move item order. However, WXPython Classic does not include this, thus move
up/down handler has been provided. Once NVDA moves to WXPython Phoenix, this
will be replaced by RearrangeDialog.
Also, because this control should be available for all profiles, this cannot be
set by profiles. Thus, let the column order list be stored into SPLConfig from
the add-on settings dialog itslef, not from the new column order dialog.

Affected #: 2 files

diff --git a/addon/appModules/splstudio/__init__.py
b/addon/appModules/splstudio/__init__.py
index 8feec95..6a6af57 100755
--- a/addon/appModules/splstudio/__init__.py
+++ b/addon/appModules/splstudio/__init__.py
@@ -99,14 +99,14 @@ class SPLTrackItem(IAccessible):

def reportFocus(self):
tones.beep(800, 400)
- #if not splconfig.SPLConfig["UseScreenColumnOrder"]:
- descriptionPieces = []
- for header in splconfig.SPLConfig["ColumnOrder"]:
- index = self._indexOf(header)
- content = self._getColumnContent(index)
- if content:
- descriptionPieces.append("%s: %s"%(header,
content))
- self.description = ", ".join(descriptionPieces)
+ if not splconfig.SPLConfig["UseScreenColumnOrder"]:
+ descriptionPieces = []
+ for header in splconfig.SPLConfig["ColumnOrder"]:
+ index = self._indexOf(header)
+ content = self._getColumnContent(index)
+ if content:
+ descriptionPieces.append("%s:
%s"%(header, content))
+ self.description = ", ".join(descriptionPieces)
super(IAccessible, self).reportFocus()

# Track Dial: using arrow keys to move through columns.

diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index 5a72d29..dbab169 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -14,6 +14,7 @@ import api
import gui
import wx
from winUser import user32
+import tones

# Configuration management
SPLIni = os.path.join(globalVars.appArgs.configPath, "splstudio.ini")
@@ -279,6 +280,7 @@ class SPLConfigDialog(gui.SettingsDialog):
# Translators: the label for a setting in SPL add-on settings
to toggle custom column announcement.

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"]
sizer.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..."))
@@ -329,6 +331,7 @@ class SPLConfigDialog(gui.SettingsDialog):
SPLConfig["LibraryScanAnnounce"] =
self.libScanValues[self.libScanList.GetSelection()][0]
SPLConfig["TrackDial"] = self.trackDialCheckbox.Value
SPLConfig["UseScreenColumnOrder"] =
self.columnOrderCheckbox.Value
+ SPLConfig["ColumnOrder"] = self.columnOrder
SPLConfig["SayScheduledFor"] = self.scheduledForCheckbox.Value
SPLConfig["SayListenerCount"] = self.listenerCountCheckbox.Value
SPLConfig["SayPlayingCartName"] = self.cartNameCheckbox.Value
@@ -553,7 +556,9 @@ class ColumnAnnouncementsDialog(wx.Dialog):
sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label for a setting in SPL add-on dialog to
select a base profile for copying.
label = wx.StaticText(self, wx.ID_ANY, label=_("C&olumns:"))
- self.trackColumns= wx.Choice(self, wx.ID_ANY,
choices=SPLConfig["ColumnOrder"])
+ # WXPython Phoenix contains RearrangeList to allow item orders
to be changed automatically.
+ # Because WXPython Classic doesn't include this, work around by
using a variant of check list box and move up/down buttons.
+ self.trackColumns= wx.CheckListBox(self, wx.ID_ANY,
choices=parent.columnOrder)
try:
self.trackColumns.SetSelection(0)
except:
@@ -562,6 +567,17 @@ class ColumnAnnouncementsDialog(wx.Dialog):
sizer.Add(self.trackColumns)
mainSizer.Add(sizer, border=10, flag=wx.BOTTOM)

+ sizer = wx.BoxSizer(wx.HORIZONTAL)
+ # Translators: The label for a button in SPL add-on
configuration dialog to reset settings to defaults.
+ self.upButton = wx.Button(self, wx.ID_ANY, label=_("Move &up"))
+ self.upButton.Bind(wx.EVT_BUTTON,self.onMoveUp)
+ sizer.Add(self.upButton)
+ # Translators: The label for a button in SPL
add-on configuration dialog to reset settings to defaults.
+ self.dnButton = wx.Button(self, wx.ID_ANY, label=_("Move
&down"))
+ self.dnButton.Bind(wx.EVT_BUTTON,self.onMoveDown)
+ sizer.Add(self.dnButton)
+ mainSizer.Add(sizer, border=10, flag=wx.BOTTOM)
+
mainSizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL))
self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
@@ -572,6 +588,7 @@ class ColumnAnnouncementsDialog(wx.Dialog):

def onOk(self, evt):
parent = self.Parent
+ parent.columnOrder = self.trackColumns.GetItems()
parent.profiles.SetFocus()
parent.Enable()
self.Destroy()
@@ -581,6 +598,24 @@ class ColumnAnnouncementsDialog(wx.Dialog):
self.Parent.Enable()
self.Destroy()

+ def onMoveUp(self, evt):
+ tones.beep(1000, 200)
+ selIndex= self.trackColumns.GetSelection()
+ if selIndex > 0:
+ selItem = self.trackColumns.GetString(selIndex)
+ self.trackColumns.Delete(selIndex)
+ self.trackColumns.Insert(selItem, selIndex-1)
+ self.trackColumns.Select(selIndex-1)
+
+ def onMoveDown(self, evt):
+ tones.beep(500, 200)
+ selIndex= self.trackColumns.GetSelection()
+ if selIndex < self.trackColumns.GetCount()-1:
+ selItem = self.trackColumns.GetString(selIndex)
+ self.trackColumns.Delete(selIndex)
+ self.trackColumns.Insert(selItem, selIndex+1)
+ self.trackColumns.Select(selIndex+1)
+
# Additional configuration dialogs

# A common alarm dialog

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:

  • » commit/StationPlaylist: josephsl: Selective column announcements (6.0-dev): Provide move up/down buttons to rearrange column order. - commits-noreply