5 new commits in placeMarkers:
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/4a58ca95d9f3/
Changeset: 4a58ca95d9f3
Branch: None
User: norrumar
Date: 2018-12-20 12:09:50+00:00
Summary: Various fixes
Affected #: 1 file
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 26b9365..0df4cc2 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -120,14 +120,13 @@ def moveToBookmark(position):
obj = api.getFocusObject()
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor, BrowseModeDocumentTreeInterceptor) and
not treeInterceptor.passThrough:
- obj=treeInterceptor
- bookmark = getSavedBookmarks()[position].bookmark
- if bookmark is None
- bookmark = obj.makeTextInfo(Offsets(position, position))
- bookmark.updateSelection()
+ obj = treeInterceptor
+ bookmark = Offsets(position, position)
+ info = obj.makeTextInfo(bookmark)
+ info.updateSelection()
speech.cancelSpeech()
- bookmark.move(textInfos.UNIT_LINE,1,endPoint="end")
- speech.speakTextInfo(bookmark,reason=controlTypes.REASON_CARET)
+ info.move(textInfos.UNIT_LINE,1,endPoint="end")
+ speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
def standardFileName(fileName):
fileName.encode("mbcs")
@@ -555,11 +554,10 @@ class RestoreDialog(wx.Dialog):
class Note(object):
- def __init__(self, title="", body="", bookmark=None):
+ def __init__(self, title="", body=""):
super(Note, self).__init__()
self.title = title
self.body = body
- self.bookmark = bookmark
### Global plugin
@@ -729,13 +727,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
noteBody = bookmarks[startOffset].body
else:
noteBody = ""
- bookmarks[startOffset] = Note(noteTitle, noteBody, bookmark)
+ bookmarks[startOffset] = Note(noteTitle, noteBody)
fileName = getFileBookmarks()
try:
- pickle.dump(bookmarks, file(fileName, "wb"))
+ pickle.dump(sorted(bookmarks), file(fileName, "wb"))
ui.message(
# Translators: message presented when a
position is saved as a bookmark.
- _("Saved position at character %d") % bookmark)
+ _("Saved position at character %d") %
bookmark.startOffset)
except Exception as e:
log.debugWarning("Error saving bookmark", exc_info=True)
ui.message(
@@ -751,7 +749,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def script_deleteBookmark(self, gesture):
obj = api.getFocusObject()
treeInterceptor=obj.treeInterceptor
- if hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough:
+ if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
else:
gesture.send()
@@ -762,22 +760,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
# Translators: message presented when the
current document doesn't contain bookmarks.
_("No bookmarks"))
return
- start = obj.makeTextInfo(textInfos.POSITION_ALL)
- try:
- end = obj.makeTextInfo(textInfos.POSITION_CARET)
- except (NotImplementedError, RuntimeError):
- 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:
+ curPos =
obj.makeTextInfo(textInfos.POSITION_CARET).bookmark.startOffset
+ if curPos not in bookmarks:
ui.message(
# Translators: message presented when the
current document has bookmarks, but none is selected.
- _("No bookmark selected"))
+ (_("No bookmark selected")))
return
- del(bookmarks[count])
+ del(bookmarks[curPos])
fileName = getFileBookmarks()
if bookmarks != {}:
try:
@@ -827,14 +816,20 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
_("No bookmarks found"))
return
curPos =
obj.makeTextInfo(textInfos.POSITION_CARET).bookmark.startOffset
- nextBookmark = min(bookmarks, key=lambda x:abs(x-bookmark))
- nextBookmark.updateSelection()
- if not willSayAllResume(gesture):
- bookmark.move(textInfos.UNIT_LINE,1,endPoint="end")
-
speech.speakTextInfo(bookmark,reason=controlTypes.REASON_CARET)
- ui.message(
- # Translators: message presented when a
bookmark is selected.
- _("Position: character %d") % pos)
+ nextPos = None
+ for pos in bookmarks:
+ if pos > curPos:
+ nextPos = pos
+ break
+ if nextPos is not None:
+ info = obj.makeTextInfo(Offsets(nextPos, nextPos))
+ info.updateSelection()
+ if not willSayAllResume(gesture):
+ info.move(textInfos.UNIT_LINE,1,endPoint="end")
+
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ ui.message(
+ # Translators: message presented when a
bookmark is selected.
+ _("Position: character %d") % nextPos)
return
ui.message(
# Translators: message presented when the next bookmark
is not found.
@@ -848,12 +843,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_selectPreviousBookmark(self, gesture):
obj = api.getFocusObject()
-
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- if appName == "MicrosoftEdgeCP.exe":
- gesture.send()
- return
+
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ #if appName == "MicrosoftEdgeCP.exe":
+ #gesture.send()
+ #return
treeInterceptor=obj.treeInterceptor
- if hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough:
+ if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
else:
gesture.send()
@@ -864,28 +859,21 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
# Translators: message presented when trying to
select a bookmark, but none is found.
_("No bookmarks found"))
return
- start = obj.makeTextInfo(textInfos.POSITION_ALL)
- try:
- end = obj.makeTextInfo(textInfos.POSITION_CARET)
- except (NotImplementedError, RuntimeError):
- # Translators: message presented when cannot find any
bookmarks.
- ui.message(_("Cannot find any bookmarks"))
- return
- start.setEndPoint(end, "endToStart")
- count = len(start.text)
- positions = list(bookmarks.keys())
- positions.sort()
- 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") %
pos)
+ curPos =
obj.makeTextInfo(textInfos.POSITION_CARET).bookmark.startOffset
+ prevPos = None
+ for pos in sorted(bookmarks, reverse=True):
+ if pos < curPos:
+ prevPos = pos
+ break
+ if prevPos is not None:
+ info = obj.makeTextInfo(Offsets(prevPos, prevPos))
+ info.updateSelection()
+ if not willSayAllResume(gesture):
+ info.move(textInfos.UNIT_LINE,1,endPoint="end")
+
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ ui.message(
+ # Translators: message presented when a
bookmark is selected.
+ _("Position: character %d") % prevPos)
return
ui.message(
# Translators: message presented when the previous
bookmark is not found.
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/6342b922fb18/
Changeset: 6342b922fb18
Branch: None
User: norrumar
Date: 2018-12-20 15:59:02+00:00
Summary: Fix notes dialog and temporary bookmarks
Affected #: 1 file
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 0df4cc2..f1b1f39 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -730,7 +730,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
bookmarks[startOffset] = Note(noteTitle, noteBody)
fileName = getFileBookmarks()
try:
- pickle.dump(sorted(bookmarks), file(fileName, "wb"))
+ pickle.dump(bookmarks, file(fileName, "wb"))
ui.message(
# Translators: message presented when a
position is saved as a bookmark.
_("Saved position at character %d") %
bookmark.startOffset)
@@ -817,7 +817,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
curPos =
obj.makeTextInfo(textInfos.POSITION_CARET).bookmark.startOffset
nextPos = None
- for pos in bookmarks:
+ for pos in sorted(bookmarks):
if pos > curPos:
nextPos = pos
break
@@ -907,32 +907,24 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_saveTempBookmark(self, gesture):
obj = api.getFocusObject()
-
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- if appName == "MicrosoftEdgeCP.exe":
- gesture.send()
- return
+
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ #if appName == "MicrosoftEdgeCP.exe":
+ #gesture.send()
+ #return
treeInterceptor=obj.treeInterceptor
- if hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough:
+ if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
else:
gesture.send()
return
- start = obj.makeTextInfo(textInfos.POSITION_ALL)
- try:
- end = obj.makeTextInfo(textInfos.POSITION_CARET)
- except (NotImplementedError, RuntimeError):
- ui.message(
- # Translators: message presented when a
bookmark cannot be saved.
- _("Bookmark cannot be saved"))
- return
- start.setEndPoint(end, "endToStart")
- count = len(start.text)
+ bookmark = obj.makeTextInfo(textInfos.POSITION_CARET).bookmark
+ startOffset = bookmark.startOffset
fileName = getFileTempBookmark()
try:
with codecs.open(fileName, "w", "utf-8") as f:
- f.write(str(count))
+ f.write(str(startOffset))
# Translators: Message presented when a
temporary bookmark is saved.
- ui.message(_("Saved temporary bookmark at
position %d" % count))
+ ui.message(_("Saved temporary bookmark at
position %d" % startOffset))
except Exception as e:
log.debugWarning("Error saving temporary bookmark",
exc_info=True)
raise e
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/2e8bcb2f4591/
Changeset: 2e8bcb2f4591
Branch: None
User: norrumar
Date: 2018-12-29 17:19:23+00:00
Summary: Bump version: 12.2.1
Affected #: 2 files
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index f1b1f39..546c708 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -709,10 +709,10 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_saveBookmark(self, gesture):
obj = api.getFocusObject()
-
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- #if appName == "MicrosoftEdgeCP.exe":
- #gesture.send()
- #return
+
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ if appName == "MicrosoftEdgeCP.exe":
+ gesture.send()
+ return
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
@@ -720,14 +720,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmark = obj.makeTextInfo(textInfos.POSITION_CARET).bookmark
- startOffset = bookmark.startOffset
bookmarks = getSavedBookmarks()
noteTitle =
obj.makeTextInfo(textInfos.POSITION_SELECTION).text[:100].encode("utf-8")
- if startOffset in bookmarks:
- noteBody = bookmarks[startOffset].body
+ if bookmark.startOffset in bookmarks:
+ noteBody = bookmarks[bookmark.startOffset].body
else:
noteBody = ""
- bookmarks[startOffset] = Note(noteTitle, noteBody)
+ bookmarks[bookmark.startOffset] = Note(noteTitle, noteBody)
fileName = getFileBookmarks()
try:
pickle.dump(bookmarks, file(fileName, "wb"))
@@ -799,10 +798,10 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_selectNextBookmark(self, gesture):
obj = api.getFocusObject()
-
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- #if appName == "MicrosoftEdgeCP.exe":
- #gesture.send()
- #return
+
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ if appName == "MicrosoftEdgeCP.exe":
+ gesture.send()
+ return
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
@@ -824,13 +823,14 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
if nextPos is not None:
info = obj.makeTextInfo(Offsets(nextPos, nextPos))
info.updateSelection()
- if not willSayAllResume(gesture):
+ if willSayAllResume(gesture):
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ else:
ui.message(
# Translators: message presented when a
bookmark is selected.
_("Position: character %d") % nextPos)
- return
+ return
ui.message(
# Translators: message presented when the next bookmark
is not found.
_("Next bookmark not found"))
@@ -843,10 +843,10 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_selectPreviousBookmark(self, gesture):
obj = api.getFocusObject()
-
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- #if appName == "MicrosoftEdgeCP.exe":
- #gesture.send()
- #return
+
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ if appName == "MicrosoftEdgeCP.exe":
+ gesture.send()
+ return
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
@@ -868,13 +868,14 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
if prevPos is not None:
info = obj.makeTextInfo(Offsets(prevPos, prevPos))
info.updateSelection()
- if not willSayAllResume(gesture):
+ if willSayAllResume(gesture):
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ else:
ui.message(
# Translators: message presented when a
bookmark is selected.
_("Position: character %d") % prevPos)
- return
+ return
ui.message(
# Translators: message presented when the previous
bookmark is not found.
_("Previous bookmark not found"))
diff --git a/buildVars.py b/buildVars.py
index 738d26f..2ec3fc0 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" : "12.2",
+ "addon_version" : "12.2.1",
# Author(s)
"addon_author" : u"Noelia <nrm1977@xxxxxxxxx>, Chris
<llajta2012@xxxxxxxxx>",
# URL for the add-on documentation support
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/fc5f8b0f9ef2/
Changeset: fc5f8b0f9ef2
Branch: None
User: norrumar
Date: 2018-12-29 17:45:37+00:00
Summary: Cosmetics
Affected #: 1 file
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 546c708..1cede97 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -763,7 +763,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
if curPos not in bookmarks:
ui.message(
# Translators: message presented when the
current document has bookmarks, but none is selected.
- (_("No bookmark selected")))
+ _("No bookmark selected"))
return
del(bookmarks[curPos])
fileName = getFileBookmarks()
@@ -908,10 +908,10 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
)
def script_saveTempBookmark(self, gesture):
obj = api.getFocusObject()
-
#appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
- #if appName == "MicrosoftEdgeCP.exe":
- #gesture.send()
- #return
+
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
+ if appName == "MicrosoftEdgeCP.exe":
+ gesture.send()
+ return
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
@@ -919,13 +919,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmark = obj.makeTextInfo(textInfos.POSITION_CARET).bookmark
- startOffset = bookmark.startOffset
fileName = getFileTempBookmark()
try:
with codecs.open(fileName, "w", "utf-8") as f:
- f.write(str(startOffset))
+ f.write(str(bookmark.startOffset))
# Translators: Message presented when a
temporary bookmark is saved.
- ui.message(_("Saved temporary bookmark at
position %d" % startOffset))
+ ui.message(_("Saved temporary bookmark at
position %d" % bookmark.startOffset))
except Exception as e:
log.debugWarning("Error saving temporary bookmark",
exc_info=True)
raise e
@@ -941,7 +940,9 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
treeInterceptor=obj.treeInterceptor
- if not(hasattr(treeInterceptor,'TextInfo') and not
treeInterceptor.passThrough):
+ if isinstance(treeInterceptor,
BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
+ obj=treeInterceptor
+ else:
gesture.send()
return
fileName = getFileTempBookmark()
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/17ddae3f04f9/
Changeset: 17ddae3f04f9
Branch: bookmark
User: norrumar
Date: 2018-12-29 17:56:56+00:00
Summary: Avoid repeating sentence in skim reading
Affected #: 1 file
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 1cede97..96b8c37 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -825,7 +825,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
info.updateSelection()
if willSayAllResume(gesture):
info.move(textInfos.UNIT_LINE,1,endPoint="end")
-
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+
#speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
else:
ui.message(
# Translators: message presented when a
bookmark is selected.
@@ -870,7 +870,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
info.updateSelection()
if willSayAllResume(gesture):
info.move(textInfos.UNIT_LINE,1,endPoint="end")
-
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+
#speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
else:
ui.message(
# Translators: message presented when a
bookmark is selected.
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.