2 new commits in placeMarkers:
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/0bb982b46191/
Changeset: 0bb982b46191
Branch: None
User: norrumar
Date: 2017-06-17 05:05:36+00:00
Summary: Merge branch 'master' into stable
Affected #: 4 files
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 9fc6f1d..5d2995e 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -107,6 +107,18 @@ def doFindText(text, reverse=False, caseSensitive=False):
def doFindTextUp(text, caseSensitive=False):
doFindText(text, reverse=True, caseSensitive=caseSensitive)
+def moveToBookmark(position):
+ obj = api.getFocusObject()
+ treeInterceptor=obj.treeInterceptor
+ if hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough:
+ obj=treeInterceptor
+ info = obj.makeTextInfo(textInfos.POSITION_FIRST)
+ info.move(textInfos.UNIT_CHARACTER, position)
+ info.updateCaret()
+ speech.cancelSpeech()
+ info.move(textInfos.UNIT_LINE,1,endPoint="end")
+ speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+
def standardFileName(fileName):
fileName.encode("mbcs")
notAllowed = re.compile("\?|:|\*|\t|<|>|\"|\/|\\||") # Invalid
characters
@@ -122,7 +134,7 @@ def getFile(folder, ext=""):
childID = obj.IAccessibleChildID
iAObj = obj.IAccessibleObject
accValue = iAObj.accValue(childID)
- nameToAdd = " - %s" %
accValue.split("/")[-1].split("\\")[-1].split("#")[0]
+ nameToAdd = " - %s" %
accValue.split("#")[0].split("/")[-1].split("\\")[-1]
except:
nameToAdd = ""
file = file.rsplit(" - ", 1)[0]
@@ -163,8 +175,13 @@ def getSavedBookmarks():
fileName = getFileBookmarks()
try:
savedBookmarks = cPickle.load(file(fileName, "r"))
+ if isinstance(savedBookmarks, list):
+ bookmarksDic = {}
+ for bookmark in savedBookmarks:
+ bookmarksDic[bookmark] = Note()
+ savedBookmarks = bookmarksDic
except IOError:
- savedBookmarks = []
+ savedBookmarks = {}
return savedBookmarks
### Dialogs
@@ -296,6 +313,65 @@ def doRestore(restoreDirectory):
wx.OK|wx.ICON_ERROR)
raise e
+class NotesDialog(wx.Dialog):
+
+ def __init__(self, parent, fileName):
+ # Translators: The title of the Notes dialog.
+ super(NotesDialog, self).__init__(parent, title=_("Notes"))
+ self.fileName = fileName
+ mainSizer = wx.BoxSizer(wx.VERTICAL)
+ sHelper = gui.guiHelper.BoxSizerHelper(self,
orientation=wx.VERTICAL)
+ # Translators: The label of a list box in the Notes dialog.
+ notesLabel = _("&Bookmarks")
+ self.bookmarks = getSavedBookmarks()
+ positions = self.bookmarks.keys()
+ positions.sort()
+ self.pos = positions[0]
+ firstNoteBody = self.bookmarks[self.pos].body
+ notesChoices = []
+ for pos in positions:
+ notesChoices.append("{position} -
{title}".format(position=pos, title=self.bookmarks[pos].title))
+ self.notesListBox = sHelper.addLabeledControl(notesLabel,
wx.ListBox , choices=notesChoices)
+ self.notesListBox.Selection = 0
+ self.notesListBox.Bind(wx.EVT_LISTBOX, self.onNotesChange)
+ # Translators: The label of an edit box in the Notes dialog.
+ noteLabel = _("Not&e:")
+ noteLabeledCtrl = gui.guiHelper.LabeledControlHelper(self,
noteLabel, wx.TextCtrl, style=wx.TE_MULTILINE )
+ self.noteEdit = noteLabeledCtrl.control
+ self.noteEdit.SetMaxLength(1024)
+ self.noteEdit.Value = firstNoteBody
+ bHelper =
sHelper.addItem(guiHelper.ButtonHelper(orientation=wx.HORIZONTAL))
+ # Translators: The label for a button in the Notes dialog.
+ self.saveButton = bHelper.addButton(self, label=_("&Save note"))
+ self.Bind(wx.EVT_BUTTON, self.onSave, self.saveButton)
+
sHelper.addDialogDismissButtons(self.CreateButtonSizer(wx.OK|wx.CANCEL))
+ self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
+ mainSizer.Add(sHelper.sizer,
border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
+ self.Sizer = mainSizer
+ mainSizer.Fit(self)
+ self.notesListBox.SetFocus()
+ self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+
+ def onNotesChange(self, evt):
+ self.pos = int(self.notesListBox.GetStringSelection().split(" -
")[0])
+ self.noteEdit.Value = self.bookmarks[self.pos].body
+
+ def onSave(self, evt):
+ noteTitle = self.notesListBox.GetStringSelection().split(" -
")[1].encode("mbcs")
+ noteBody = self.noteEdit.Value
+ note = Note(noteTitle, noteBody)
+ self.bookmarks[self.pos] = note
+ try:
+ cPickle.dump(self.bookmarks, file(self.fileName, "wb"))
+ self.notesListBox.SetFocus()
+ except Exception as e:
+ log.debugWarning("Error saving bookmark", exc_info=True)
+ raise e
+
+ def onOk(self, evt):
+ self.Destroy()
+ wx.CallLater(1000, moveToBookmark, self.pos)
+
class CopyDialog(wx.Dialog):
def __init__(self, parent):
@@ -425,6 +501,15 @@ class RestoreDialog(wx.Dialog):
def onCancel(self, evt):
self.Destroy()
+ ### Note
+
+class Note(object):
+
+ def __init__(self, title="", body=""):
+ super(Note, self).__init__()
+ self.title = title
+ self.body = body
+
### Global plugin
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
@@ -526,6 +611,27 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
# Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
script_specificFind.__doc__ = _("finds a text string from the current
cursor position for a specific document.")
+ def popupNotesDialog(self):
+ if getSavedBookmarks() == {}:
+ ui.message(
+ # Translators: message presented when the
current document doesn't contain bookmarks.
+ _("No bookmarks"))
+ return
+ gui.mainFrame.prePopup()
+ d = NotesDialog(gui.mainFrame, getFileBookmarks())
+ d.Show()
+ gui.mainFrame.postPopup()
+
+ def script_activateNotesDialog(self, gesture):
+ obj=api.getFocusObject()
+ treeInterceptor=obj.treeInterceptor
+ if not (hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough):
+ gesture.send()
+ return
+ wx.CallAfter(self.popupNotesDialog)
+ # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
+ script_activateNotesDialog.__doc__ = _("Show the Notes dialog for a
specific document.")
+
def script_saveBookmark(self, gesture):
obj = api.getFocusObject()
treeInterceptor=obj.treeInterceptor
@@ -545,13 +651,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
start.setEndPoint(end, "endToStart")
count = len(start.text)
bookmarks = getSavedBookmarks()
- if count in bookmarks:
- ui.message(
- # Translators: message presented when the
current position was previously saved as a bookmark.
- _("This position was already saved"))
- return
- bookmarks.append(count)
- bookmarks.sort()
+ noteTitle =
obj.makeTextInfo(textInfos.POSITION_SELECTION).text[:100].encode("mbcs")
+ positions = bookmarks.keys()
+ if count in positions:
+ noteBody = bookmarks[count].body
+ else:
+ noteBody = ""
+ bookmarks[count] = Note(noteTitle, noteBody)
fileName = getFileBookmarks()
try:
cPickle.dump(bookmarks, file(fileName, "wb"))
@@ -576,7 +682,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- if len(bookmarks) == 0:
+ positions = bookmarks.keys()
+ if len(positions) == 0:
ui.message(
# Translators: message presented when the
current document doesn't contain bookmarks.
_("No bookmarks"))
@@ -585,19 +692,20 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
try:
end = obj.makeTextInfo(textInfos.POSITION_CARET)
except (NotImplementedError, RuntimeError):
- ui.message(_("Bookmark cannot be deleted"))
+ ui.message(
+ # Translators: Message presented when a
bookmark can't be deleted.
+ _("Bookmark cannot be deleted"))
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
- if count not in bookmarks:
+ if count not in positions:
ui.message(
# Translators: message presented when the
current document has bookmarks, but none is selected.
_("No bookmark selected"))
return
- bookmarks.remove(count)
+ del(bookmarks[count])
fileName = getFileBookmarks()
- if len(bookmarks) > 0:
- bookmarks.sort()
+ if len(positions) > 0:
try:
cPickle.dump(bookmarks, file(fileName, "wb"))
ui.message(
@@ -631,7 +739,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- if len(bookmarks) == 0:
+ positions = bookmarks.keys()
+ if len(positions) == 0:
ui.message(
# Translators: message presented when trying to
select a bookmark, but none is found.
_("No bookmarks found"))
@@ -646,16 +755,17 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
- for bookmark in bookmarks:
- if bookmark > count:
- end.move(textInfos.UNIT_CHARACTER,
bookmark-count)
+ positions.sort()
+ for pos in positions:
+ if pos > count:
+ end.move(textInfos.UNIT_CHARACTER, pos - count)
obj.selection = end
if not willSayAllResume(gesture):
end.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(end,reason=controlTypes.REASON_CARET)
ui.message(
# Translators: message
presented when a bookmark is selected.
- _("Position: character %d") %
bookmark)
+ _("Position: character %d") %
pos)
return
ui.message(
# Translators: message presented when the next bookmark
is not found.
@@ -673,7 +783,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- if len(bookmarks) == 0:
+ positions = bookmarks.keys()
+ if len(positions) == 0:
ui.message(
# Translators: message presented when trying to
select a bookmark, but none is found.
_("No bookmarks found"))
@@ -687,17 +798,17 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
- bookmarks.reverse()
- for bookmark in bookmarks:
- if bookmark < count:
- end.move(textInfos.UNIT_CHARACTER,
bookmark-count)
+ positions.reverse()
+ for pos in positions:
+ if pos < count:
+ end.move(textInfos.UNIT_CHARACTER, pos - count)
obj.selection = end
if not willSayAllResume(gesture):
end.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(end,reason=controlTypes.REASON_CARET)
ui.message(
# Translators: message
presented when a bookmark is selected.
- _("Position: character %d") %
bookmark)
+ _("Position: character %d") %
pos)
return
ui.message(
# Translators: message presented when the previous
bookmark is not found.
@@ -732,5 +843,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
"kb:NVDA+k": "selectNextBookmark",
"kb:shift+NVDA+k": "selectPreviousBookmark",
"kb:control+shift+k": "copyCurrentBookmarksFile",
+ "kb:alt+NVDA+k": "activateNotesDialog",
}
diff --git a/addon/readme.md b/addon/readme.md
new file mode 100644
index 0000000..6742eec
--- /dev/null
+++ b/addon/readme.md
@@ -0,0 +1,78 @@
+# placeMarkers #
+
+* Authors: Noelia, Chris.
+* download [stable version][1]
+* download [development version][2]
+
+This addon is used for saving and searching specific text strings or
bookmarks. It can be used on web pages or documents in NVDA's browse mode. It
can also be used for saving or searching strings of text in multi-line
controls; in this case, if it's not possible to update the caret, the
corresponding string will be copied to the clipboard, so that it can be
searched using other tools.
+The plugin saves the specified strings and bookmarks to files whose name is
based on the title and URL of the current document.
+This addon is based on SpecificSearch and Bookmark&Search, developed by the
same author. You should uninstall them to use this one, since they have common
keystrokes and features.
+
+## Key Commands: ##
+
+* control+shift+NVDA+f: Opens a dialog with an edit box that shows the
last saved search; in this dialog you can also select the previously saved
searches from a combo box or remove the selected string from the history using
a checkbox. You can choose if the text contained in the edit box will be added
to the history of your saved texts. Finally, choose an action from the next
group of radio buttons (between Search next, Search previous or Don't search),
and specify if NVDA will make a case sensitive search. When you press okay,
NVDA will search for this string.
+* control+shift+NVDA+k: Saves the current position as a bookmark. If you
want to provide a name for this bookmark, select some text from this position
before saving it.
+* control+shift+NVDA+delete: Deletes the bookmark corresponding to this
position.
+* NVDA+k: Moves to the next bookmark.
+* shift+NVDA+k: Moves to the previous bookmark.
+* control+shift+k: Copies the file name where the place markers data will
be saved to the clipboard, without an extension.
+* alt+NVDA+k: Opens a dialog with the bookmarks saved for this document.
You can write a note for each bookmark; press Save note to save changes.
Pressing OK you can move to the selected position.
+
+Note: Sometimes this doesn't work on browsers like Firefox. If it happens,
please refresh the buffer pressing NVDA+f5 and try to use the dialog again, or
move to the bookmark from the document using NVDA+k.
+
+
+## Place markers Submenu (NVDA+N) ##
+
+Using the Place markers submenu under NVDA's Preferences menu, you can access:
+
+* Specific search folder: opens a folder of specific searches previously
saved.
+* Bookmarks folder: Opens a folder of the saved bookmarks.
+* Copy placeMarkers folder: You can save a copy of the bookmarks folder.
+* Restore placeMarkers: You can restore your bookmarks from a previously
saved placeMarkers folder.
+
+Note: The bookmark position is based on the number of characters; and
therefore in dynamic pages it is better to use the specific search, not
bookmarks.
+
+
+## Changes for 8.0 ##
+* Removed fragment identifiers from bookmark filenames, which can avoid
issues in the VitalSource Bookshelf ePUB reader.
+* Added a Notes dialog, to associate comments for saved bookmarks and
move to the selected position.
+
+## Changes for 7.0 ##
+* The dialog to save a string of text for specific search has been
removed. This functionality is now included in the Specific search dialog,
which has been redesigned to allow different actions when pressing the OK
button.
+* The visual presentation of the dialogs has been enhanced, adhering to
the appearance of the dialogs shown in NVDA.
+* Performing a Find Next or Find Previous command in Browse Mode will now
correctly do a case sensitive search if the original Find was case sensitive.
+* Requires NVDA 2016.4 or later.
+* Now you can assign gestures to open the Copy and Restore place markers
dialogs.
+* NVDA will present a message to notify when place markers have been
copied or restored with the corresponding dialogs.
+
+## Changes for 6.0 ##
+* When the add-on features are not usable, gestures are sent to the
corresponding application.
+
+## Changes for 5.0 ##
+* Added case sensitive search.
+* Removed option to open documentation from Place markers menu.
+* More intuitive key commands.
+
+## Changes for 4.0 ##
+* Removed fragment identifiers from bookmark filenames, which can avoid issues
in ePUBREADER Firefox add-on.
+* Add-on help is available from the Add-ons Manager.
+
+## Changes for 3.1 ##
+* Translation updates and new language.
+* Bookmark position is not announced in skim reading.
+
+## Changes for 3.0 ##
+* Added support for skim reading.
+
+## Changes for 2.0 ##
+* Added options to save and delete different searches for each file.
+* Fixed bug which broke when paths contained non latin characters.
+* Shortcuts can now be reassigned using the NVDA gesture input dialog.
+
+## Changes for 1.0 ##
+* Initial version.
+* Translated into: Brazilian Portuguese, Farsi, Finnish, French, Galician,
German, Italian, Japanese, Korean, Nepali, Portuguese, Spanish, Slovak,
Slovenian, Tamil.
+
+[1]: http://addons.nvda-project.org/files/get.php?file=pm
+
+[2]: http://addons.nvda-project.org/files/get.php?file=pm-dev
diff --git a/buildVars.py b/buildVars.py
index 7ff28c5..93e0019 100755
--- a/buildVars.py
+++ b/buildVars.py
@@ -19,7 +19,7 @@ addon_info = {
# Translators: Long description to be shown for this add-on on add-on
information from add-ons manager
"addon_description" : _("Add-on for setting place markers on specific
virtual documents"),
# version
- "addon_version" : "7.2",
+ "addon_version" : "8.2-dev",
# Author(s)
"addon_author" : u"Noelia <nrm1977@xxxxxxxxx>, Chris
<llajta2012@xxxxxxxxx>",
# URL for the add-on documentation support
diff --git a/readme.md b/readme.md
index cdacd40..f55a004 100644
--- a/readme.md
+++ b/readme.md
@@ -11,11 +11,12 @@ This addon is based on SpecificSearch and Bookmark&Search,
developed by the same
## Key Commands: ##
* control+shift+NVDA+f: Opens a dialog with an edit box that shows the
last saved search; in this dialog you can also select the previously saved
searches from a combo box or remove the selected string from the history using
a checkbox. You can choose if the text contained in the edit box will be added
to the history of your saved texts. Finally, choose an action from the next
group of radio buttons (between Search next, Search previous or Don't search),
and specify if NVDA will make a case sensitive search. When you press okay,
NVDA will search for this string.
-* control+shift+NVDA+k: Saves the current position as a bookmark.
+* control+shift+NVDA+k: Saves the current position as a bookmark. If you
want to provide a name for this bookmark, select some text from this position
before saving it.
* control+shift+NVDA+delete: Deletes the bookmark corresponding to this
position.
* NVDA+k: Moves to the next bookmark.
* shift+NVDA+k: Moves to the previous bookmark.
* control+shift+k: Copies the file name where the place markers data will
be saved to the clipboard, without an extension.
+* alt+NVDA+k: Opens a dialog with the bookmarks saved for this document.
You can write a note for each bookmark; press Save note to save changes.
Pressing OK you can move to the selected position.
## Place markers Submenu (NVDA+N) ##
@@ -29,6 +30,11 @@ Using the Place markers submenu under NVDA's Preferences
menu, you can access:
Note: The bookmark position is based on the number of characters; and
therefore in dynamic pages it is better to use the specific search, not
bookmarks.
+
+## Changes for 8.0 ##
+* Removed fragment identifiers from bookmark filenames, which can avoid
issues in the VitalSource Bookshelf ePUB reader.
+* Added a Notes dialog, to associate comments for saved bookmarks and
move to the selected position.
+
## Changes for 7.0 ##
* The dialog to save a string of text for specific search has been
removed. This functionality is now included in the Specific search dialog,
which has been redesigned to allow different actions when pressing the OK
button.
* The visual presentation of the dialogs has been enhanced, adhering to
the appearance of the dialogs shown in NVDA.
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/1ab64f003508/
Changeset: 1ab64f003508
Branch: master
User: norrumar
Date: 2017-06-17 05:11:38+00:00
Summary: Bump version: 8.0 (stable)
* Added support for the VitalSource Bookshelf ePUB reader.
* Added a dialog for bookmarks, which possibility of editing associated notes
and came back to the selected position of the current document. Based on
requirements of EPUBTEST 0300 - Fundamental Accessible Reading System Tests >
Annotation Tests.
Affected #: 1 file
diff --git a/buildVars.py b/buildVars.py
index 93e0019..964d185 100755
--- a/buildVars.py
+++ b/buildVars.py
@@ -19,7 +19,7 @@ addon_info = {
# Translators: Long description to be shown for this add-on on add-on
information from add-ons manager
"addon_description" : _("Add-on for setting place markers on specific
virtual documents"),
# version
- "addon_version" : "8.2-dev",
+ "addon_version" : "8.0",
# Author(s)
"addon_author" : u"Noelia <nrm1977@xxxxxxxxx>, Chris
<llajta2012@xxxxxxxxx>",
# URL for the add-on documentation support
Repository URL: https://bitbucket.org/nvdaaddonteam/placemarkers/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.