2 new commits in placeMarkers:
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/7dcf5d620c56/
Changeset: 7dcf5d620c56
Branch: None
User: norrumar
Date: 2018-08-10 11:02:05+00:00
Summary: Version 11.0-dev
Affected #: 2 files
diff --git a/addon/globalPlugins/placeMarkers/__init__.py
b/addon/globalPlugins/placeMarkers/__init__.py
index 5900cde..6c8446a 100644
--- a/addon/globalPlugins/placeMarkers/__init__.py
+++ b/addon/globalPlugins/placeMarkers/__init__.py
@@ -29,7 +29,7 @@ import wx
import ui
import speech
import sayAllHandler
-from scriptHandler import willSayAllResume
+from scriptHandler import willSayAllResume, script
from cursorManager import CursorManager
from logHandler import log
from .skipTranslation import translate
@@ -74,42 +74,41 @@ def doFindText(text, reverse=False, caseSensitive=False):
obj.doFindText(text=text, reverse=reverse,
caseSensitive=caseSensitive)
elif obj.role != controlTypes.ROLE_EDITABLETEXT:
return
- else:
- CursorManager._lastFindText = text
- CursorManager._lastCaseSensitivity = caseSensitive
- try:
- info=obj.makeTextInfo(textInfos.POSITION_CARET)
- except (NotImplementedError, RuntimeError):
- info=obj.makeTextInfo(textInfos.POSITION_FIRST)
- try:
- res=info.find(text,reverse=reverse,
caseSensitive=caseSensitive)
- except WindowsError:
- wx.CallAfter(gui.messageBox,
- # Message translated in NVDA core.
- translate('text "%s" not found') % text,
- # Message translated in NVDA core.
- translate("Find Error"),
- wx.OK|wx.ICON_ERROR)
- except:
- if api.copyToClip(text):
- # Translators: message presented when a string
of text has been copied to the clipboard.
- ui.message(_("%s copied to clipboard") % text)
- return
- if res:
- if hasattr(obj,'selection'):
- obj.selection=info
- else:
- info.updateCaret()
- speech.cancelSpeech()
- info.move(textInfos.UNIT_LINE,1,endPoint="end")
-
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ CursorManager._lastFindText = text
+ CursorManager._lastCaseSensitivity = caseSensitive
+ try:
+ info=obj.makeTextInfo(textInfos.POSITION_CARET)
+ except (NotImplementedError, RuntimeError):
+ info=obj.makeTextInfo(textInfos.POSITION_FIRST)
+ try:
+ res=info.find(text,reverse=reverse, caseSensitive=caseSensitive)
+ except WindowsError:
+ wx.CallAfter(gui.messageBox,
+ # Message translated in NVDA core.
+ translate('text "%s" not found') % text,
+ # Message translated in NVDA core.
+ translate("Find Error"),
+ wx.OK|wx.ICON_ERROR)
+ except:
+ if api.copyToClip(text):
+ # Translators: message presented when a string of text
has been copied to the clipboard.
+ ui.message(_("%s copied to clipboard") % text)
+ return
+ if res:
+ if hasattr(obj,'selection'):
+ obj.selection=info
else:
- wx.CallAfter(gui.messageBox,
- # Message translated in NVDA core.
- translate('text "%s" not found') % text,
- # Message translated in NVDA core.
- translate("Find Error"),
- wx.OK|wx.ICON_ERROR)
+ info.updateCaret()
+ speech.cancelSpeech()
+ info.move(textInfos.UNIT_LINE,1,endPoint="end")
+ speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
+ else:
+ wx.CallAfter(gui.messageBox,
+ # Message translated in NVDA core.
+ translate('text "%s" not found') % text,
+ # Message translated in NVDA core.
+ translate("Find Error"),
+ wx.OK|wx.ICON_ERROR)
def doFindTextUp(text, caseSensitive=False):
doFindText(text, reverse=True, caseSensitive=caseSensitive)
@@ -226,7 +225,7 @@ class SpecificSearchDialog(wx.Dialog):
self.searchTextEdit.Bind(wx.EVT_TEXT,
self.onSearchEditTextChange)
# Translators: A label for a chekbox in the Specific search
dialog.
self.addCheckBox = sHelper.addItem(wx.CheckBox(self,
label=_("&Add to history")))
- # Translators: Label for a set of radio buttons
in the Specific search dialog.
+ # Translators: Label for a set of radio buttons in the Specific
search dialog.
searchActionsLabel = _("Action on s&earch")
searchChoices = (
# Translators: An action in the Search group of the
Specific search dialog.
@@ -250,7 +249,7 @@ class SpecificSearchDialog(wx.Dialog):
self.addCheckBox.Disable()
self.searchRadioBox.Disable()
self.caseSensitiveCheckBox.Disable()
- self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+ self.CentreOnScreen()
def onSearchEditTextChange(self, evt):
if self.searchTextEdit.Value:
@@ -369,7 +368,7 @@ class NotesDialog(wx.Dialog):
self.Sizer = mainSizer
mainSizer.Fit(self)
self.notesListBox.SetFocus()
- self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+ self.CenterOnScreen()
def onNotesChange(self, evt):
self.pos = int(self.notesListBox.GetStringSelection().split(" -
")[0])
@@ -456,7 +455,7 @@ class CopyDialog(wx.Dialog):
mainSizer.Add(sHelper.sizer,
border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
self.Sizer = mainSizer
mainSizer.Fit(self)
- self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+ self.CenterOnScreen()
def onCopy(self, evt):
if not self.copyDirectoryEdit.Value:
@@ -526,7 +525,7 @@ class RestoreDialog(wx.Dialog):
mainSizer.Add(sHelper.sizer,
border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
self.Sizer = mainSizer
mainSizer.Fit(self)
- self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
+ self.CenterOnScreen()
def onRestore(self, evt):
if not self.restoreDirectoryEdit.Value:
@@ -570,7 +569,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
scriptCategory = str(ADDON_SUMMARY)
def __init__(self):
- super(globalPluginHandler.GlobalPlugin, self).__init__()
+ super(GlobalPlugin, self).__init__()
self.menu = gui.mainFrame.sysTrayIcon.preferencesMenu
self.BSMenu = wx.Menu()
self.mainItem = self.menu.AppendSubMenu(self.BSMenu,
@@ -605,25 +604,29 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def terminate(self):
try:
- self.menu.RemoveItem(self.mainItem)
- except wx.PyDeadObjectError:
+ self.menu.Remove(self.mainItem)
+ except:
pass
def onSpecificSearch(self, evt):
os.startfile(SEARCH_FOLDER)
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Opens the specific search folder.")
+ )
def script_openSpecificSearchFolder(self, gesture):
wx.CallAfter(self.onSpecificSearch, None)
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_openSpecificSearchFolder.__doc__ = _("Opens the specific search
folder.")
def onBookmarks(self, evt):
os.startfile(BOOKMARKS_FOLDER)
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Opens the bookmarks folder.")
+ )
def script_openBookmarksFolder(self, gesture):
wx.CallAfter(self.onBookmarks, None)
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_openBookmarksFolder.__doc__ = _("Opens the bookmarks folder.")
def onCopy(self, evt):
gui.mainFrame.prePopup()
@@ -631,10 +634,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
d.Show()
gui.mainFrame.postPopup()
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Activates the Copy dialog of %s." %
ADDON_SUMMARY)
+ )
def script_activateCopyDialog(self, gesture):
wx.CallAfter(self.onCopy, None)
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_activateCopyDialog.__doc__ = _("Activates the Copy dialog of
%s." % ADDON_SUMMARY)
def onRestore(self, evt):
gui.mainFrame.prePopup()
@@ -642,10 +647,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
d.Show()
gui.mainFrame.postPopup()
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Activates the Restore dialog of %s." %
ADDON_SUMMARY)
+ )
def script_activateRestoreDialog(self, gesture):
wx.CallAfter(self.onRestore, None)
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_activateRestoreDialog.__doc__ = _("Activates the Restore dialog
of %s." % ADDON_SUMMARY)
def popupSpecificSearchDialog(self):
gui.mainFrame.prePopup()
@@ -653,6 +660,11 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
d.Show()
gui.mainFrame.postPopup()
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("finds a text string from the current cursor
position for a specific document."),
+ gesture="kb:NVDA+control+shift+f"
+ )
def script_specificFind(self,gesture):
obj=api.getFocusObject()
if not controlTypes.STATE_MULTILINE in obj.states:
@@ -661,8 +673,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
self.popupSpecificSearchDialog()
- # 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() == {}:
@@ -675,6 +685,11 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
d.Show()
gui.mainFrame.postPopup()
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Show the Notes dialog for a specific document."),
+ gesture="kb:NVDA+alt+k"
+ )
def script_activateNotesDialog(self, gesture):
obj=api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -686,9 +701,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
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.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Saves the current position as a bookmark."),
+ gesture="kb:NVDA+control+shift+k"
+ )
def script_saveBookmark(self, gesture):
obj = api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -713,8 +731,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
count = len(start.text)
bookmarks = getSavedBookmarks()
noteTitle =
obj.makeTextInfo(textInfos.POSITION_SELECTION).text[:100].encode("mbcs")
- positions = list(bookmarks.keys())
- if count in positions:
+ if count in bookmarks:
noteBody = bookmarks[count].body
else:
noteBody = ""
@@ -731,9 +748,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
# Translators: message presented when a
bookmark cannot be saved.
_("Cannot save bookmark"))
raise e
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_saveBookmark.__doc__ = _("Saves the current position as a
bookmark.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Deletes the current bookmark."),
+ gesture="kb:NVDA+control+shift+delete"
+ )
def script_deleteBookmark(self, gesture):
obj = api.getFocusObject()
treeInterceptor=obj.treeInterceptor
@@ -743,8 +763,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- positions = list(bookmarks.keys())
- if len(positions) == 0:
+ if bookmarks == {}:
ui.message(
# Translators: message presented when the
current document doesn't contain bookmarks.
_("No bookmarks"))
@@ -759,14 +778,14 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
- if count not in positions:
+ if count not in bookmarks:
ui.message(
# Translators: message presented when the
current document has bookmarks, but none is selected.
_("No bookmark selected"))
return
del(bookmarks[count])
fileName = getFileBookmarks()
- if len(positions) > 0:
+ if bookmarks != {}:
try:
pickle.dump(bookmarks, file(fileName, "wb"))
ui.message(
@@ -778,9 +797,9 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
else:
try:
os.remove(fileName)
- ui.message(_
+ ui.message(
# Translators: message presented when
the current document doesn't contain bookmarks.
- ("No bookmarks"))
+ _("No bookmarks"))
return
except WindowsError:
pass
@@ -788,9 +807,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
ui.message(
# Translators: message presented when cannot delete a
bookmark.
_("Cannot delete bookmark"))
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_deleteBookmark.__doc__ = _("Deletes the current bookmark.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Moves to the next bookmark."),
+ resumeSayAllMode=sayAllHandler.CURSOR_CARET,
+ gesture="kb:NVDA+k"
+ )
def script_selectNextBookmark(self, gesture):
obj = api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -804,8 +827,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- positions = list(bookmarks.keys())
- if len(positions) == 0:
+ if bookmarks == {}:
ui.message(
# Translators: message presented when trying to
select a bookmark, but none is found.
_("No bookmarks found"))
@@ -820,6 +842,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
+ positions = list(bookmarks.keys())
positions.sort()
for pos in positions:
if pos > count:
@@ -835,10 +858,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
ui.message(
# Translators: message presented when the next bookmark
is not found.
_("Next bookmark not found"))
- script_selectNextBookmark.resumeSayAllMode=sayAllHandler.CURSOR_CARET
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_selectNextBookmark.__doc__ = _("Moves to the next bookmark.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Moves to the previous bookmark."),
+ resumeSayAllMode=sayAllHandler.CURSOR_CARET,
+ gesture="kb:NVDA+shift+k"
+ )
def script_selectPreviousBookmark(self, gesture):
obj = api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -852,8 +878,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gesture.send()
return
bookmarks = getSavedBookmarks()
- positions = list(bookmarks.keys())
- if len(positions) == 0:
+ if bookmarks == {}:
ui.message(
# Translators: message presented when trying to
select a bookmark, but none is found.
_("No bookmarks found"))
@@ -867,6 +892,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
return
start.setEndPoint(end, "endToStart")
count = len(start.text)
+ positions = list(bookmarks.keys())
positions.sort()
positions.reverse()
for pos in positions:
@@ -883,10 +909,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
ui.message(
# Translators: message presented when the previous
bookmark is not found.
_("Previous bookmark not found"))
-
script_selectPreviousBookmark.resumeSayAllMode=sayAllHandler.CURSOR_CARET
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_selectPreviousBookmark.__doc__ = _("Moves to the previous
bookmark.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Copies the name of the current file for place
markers to the clipboard."),
+ gesture="kb:control+shift+k"
+ )
def script_copyCurrentBookmarksFile(self, gesture):
obj=api.getFocusObject()
if not controlTypes.STATE_MULTILINE in obj.states:
@@ -903,9 +931,11 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
ui.message(
# Translators: message presented when file name for
place markers is copied to clipboard.
_("Place markers file name copied to clipboard"))
- # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
- script_copyCurrentBookmarksFile.__doc__ = _("Copies the name of the
current file for place markers to the clipboard.")
+ @script(
+ # Translators: message presented in input mode, when a
keystroke of an addon script is pressed.
+ description=_("Saves the current position as a temporary
bookmark.")
+ )
def script_saveTempBookmark(self, gesture):
obj = api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -937,9 +967,11 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
except Exception as e:
log.debugWarning("Error saving temporary bookmark",
exc_info=True)
raise e
- # Translators: message presented in input mode, when a keystroke of an
addon script is pressed.
- script_saveTempBookmark.__doc__ = _("Saves the current position as a
temporary bookmark.")
+ @script(
+ # Translators: Message presented in input help mode.
+ description=_("Moves to the temporary bookmark for the current
document.")
+ )
def script_moveToTempBookmark(self, gesture):
obj = api.getFocusObject()
appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
@@ -958,16 +990,3 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
except:
# Translators: Message presented when a temporary
bookmark can't be found.
ui.message("Temporary bookmark not found")
- # Translators: Message presented in input help mode.
- script_moveToTempBookmark.__doc__ = _("Moves to the temporary bookmark
for the current document.")
-
- __gestures = {
- "kb:control+shift+NVDA+f": "specificFind",
- "kb:control+shift+NVDA+k": "saveBookmark",
- "kb:control+shift+NVDA+delete": "deleteBookmark",
- "kb:NVDA+k": "selectNextBookmark",
- "kb:shift+NVDA+k": "selectPreviousBookmark",
- "kb:control+shift+k": "copyCurrentBookmarksFile",
- "kb:alt+NVDA+k": "activateNotesDialog",
- }
-
diff --git a/buildVars.py b/buildVars.py
index 39f6ba5..d4fc28c 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" : "10.2",
+ "addon_version" : "11.0-dev",
# Author(s)
"addon_author" : u"Noelia <nrm1977@xxxxxxxxx>, Chris
<llajta2012@xxxxxxxxx>",
# URL for the add-on documentation support
https://bitbucket.org/nvdaaddonteam/placemarkers/commits/41b830293a45/
Changeset: 41b830293a45
Branch: 11.0-dev
User: norrumar
Date: 2018-08-10 11:25:56+00:00
Summary: Update readme
Affected #: 1 file
diff --git a/readme.md b/readme.md
index 531eff9..b9045f0 100644
--- a/readme.md
+++ b/readme.md
@@ -33,6 +33,10 @@ 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 11.0 ##
+* Requires NVDA 2018.3.
+* If needed, you can download the [last version compatible with NVDA
2017.3][3].
+
## Changes for 10.0 ##
* In Edge, gestures associated with bookmarks selection, such as NVDA+k,
NVDA+shift+k or NVDA+alt+k, will be sent to the application instead of trying
to move the cursor to bookmarks, to avoid errors, especially in long documents.
* Now specific search is supported in Edge.
@@ -86,3 +90,4 @@ Note: The bookmark position is based on the number of
characters; and therefore
[1]: http://addons.nvda-project.org/files/get.php?file=pm
[2]: http://addons.nvda-project.org/files/get.php?file=pm-dev
+[3]:
https://github.com/nvdaes/placeMarkers/releases/download/10.2/placeMarkers-10.2.nvda-addon
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.