commit/placeMarkers: 5 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Tue, 01 Nov 2016 18:42:43 -0000

5 new commits in placeMarkers:

https://bitbucket.org/nvdaaddonteam/placemarkers/commits/cef34452649b/
Changeset:   cef34452649b
Branch:      None
User:        norrumar
Date:        2016-11-01 16:34:15+00:00
Summary:     Fixed regression due to change of old self.getFile method for just 
getFile.

Affected #:  2 files

diff --git a/addon/globalPlugins/placeMarkers.py 
b/addon/globalPlugins/placeMarkers.py
index 1d69ae0..1fc272f 100755
--- a/addon/globalPlugins/placeMarkers.py
+++ b/addon/globalPlugins/placeMarkers.py
@@ -479,7 +479,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                        self._states = []
 
        def getPickle(self):
-               self._pickle = self.getFile("bookmarks", ".pickle")
+               self._pickle = getFile("bookmarks", ".pickle")
 
        def script_saveBookmark(self, gesture):
                obj = api.getFocusObject()
@@ -669,7 +669,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                        if not (hasattr(treeInterceptor,'TextInfo') and not 
treeInterceptor.passThrough) and controlTypes.STATE_MULTILINE not in obj.states:
                                gesture.send()
                                return
-               fileName = self.getFile("bookmarks")
+               fileName = getFile("bookmarks")
                if not api.copyToClip(os.path.basename(fileName)):
                        ui.message(
                        # Translators: message presented when cannot copy the 
file name corresponding to place markers.

diff --git a/buildVars.py b/buildVars.py
index 21c4f8a..8b0286a 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" : "6.6",
+       "addon_version" : "7.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/a46fc9f15699/
Changeset:   a46fc9f15699
Branch:      None
User:        norrumar
Date:        2016-11-01 16:39:27+00:00
Summary:     Removed global variables.

Affected #:  1 file

diff --git a/addon/globalPlugins/placeMarkers.py 
b/addon/globalPlugins/placeMarkers.py
index 1fc272f..a43ccd5 100755
--- a/addon/globalPlugins/placeMarkers.py
+++ b/addon/globalPlugins/placeMarkers.py
@@ -67,8 +67,6 @@ _curAddon = addonHandler.Addon(_addonDir) # Addon instance
 _addonSummary = _curAddon.manifest['summary']
 _basePath = os.path.join(os.path.dirname(__file__), 
"placeMarkers").decode("mbcs")
 _searchFolder = os.path.join(_basePath, "search")
-searchFile = ""
-lastSpecificFindText = ""
 _bookmarksFolder = os.path.join(_basePath, "bookmarks")
 _configPath = globalVars.appArgs.configPath
 


https://bitbucket.org/nvdaaddonteam/placemarkers/commits/d3136c8d4744/
Changeset:   d3136c8d4744
Branch:      None
User:        norrumar
Date:        2016-11-01 17:28:09+00:00
Summary:     Create a Restore dialog with gui.guiHelper.

Affected #:  1 file

diff --git a/addon/globalPlugins/placeMarkers.py 
b/addon/globalPlugins/placeMarkers.py
index a43ccd5..65dddfb 100755
--- a/addon/globalPlugins/placeMarkers.py
+++ b/addon/globalPlugins/placeMarkers.py
@@ -296,6 +296,19 @@ def doCopy(copyDirectory):
                wx.OK|wx.ICON_ERROR)
                raise e
 
+def doRestore(restoreDirectory):
+       try:
+               shutil.rmtree(_basePath, ignore_errors=True)
+               shutil.copytree(restoreDirectory, _basePath)
+       except Exception as e:
+               wx.CallAfter(gui.messageBox,
+               # Translators: label of error dialog shown when cannot copy 
placeMarkers folder.
+               _("Folder not copied"),
+               # Translators: title of error dialog shown when cannot copy 
placeMarkers folder.
+               _("Copy Error"),
+               wx.OK|wx.ICON_ERROR)
+               raise e
+
 class CopyDialog(wx.Dialog):
 
        _instance = None
@@ -321,7 +334,7 @@ class CopyDialog(wx.Dialog):
                sHelper.addItem(wx.StaticText(self, label=dialogCaption))
 
                # Translators: The label of a grouping containing controls to 
select the destination directory in the Copy dialog.
-               directoryGroupText = _("&directory for backup:")
+               directoryGroupText = _("directory for backup:")
                groupHelper = 
sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, 
sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=directoryGroupText), 
wx.VERTICAL)))
                # Translators: The label of a button to browse for a directory.
                browseText = _("Browse...")
@@ -361,6 +374,71 @@ class CopyDialog(wx.Dialog):
        def onCancel(self, evt):
                self.Destroy()
 
+class RestoreDialog(wx.Dialog):
+
+       _instance = None
+       def __new__(cls, *args, **kwargs):
+               # Make this a singleton.
+               if RestoreDialog._instance is None:
+                       return super(RestoreDialog, cls).__new__(cls, *args, 
**kwargs)
+               return RestoreDialog._instance
+
+       def __init__(self, parent):
+               if RestoreDialog._instance is not None:
+                       return
+               RestoreDialog._instance = self
+               # Translators: The title of the Restore dialog.
+               super(RestoreDialog, self).__init__(parent, title=_("Restore 
place markers"))
+
+               mainSizer = wx.BoxSizer(wx.VERTICAL)
+               sHelper = gui.guiHelper.BoxSizerHelper(self, 
orientation=wx.VERTICAL)
+
+               # Translators: An informational message displayed in the 
Restore dialog.
+               dialogCaption=_("""Select a folder to restore a backup of your 
previous copied place markers.\n
+               They will be copied to %s.""" % _basePath)
+               sHelper.addItem(wx.StaticText(self, label=dialogCaption))
+
+               # Translators: The label of a grouping containing controls to 
select the destination directory in the Restore dialog.
+               directoryGroupText = _("directory containing backup:")
+               groupHelper = 
sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, 
sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=directoryGroupText), 
wx.VERTICAL)))
+               # Translators: The label of a button to browse for a directory.
+               browseText = _("Browse...")
+               # Translators: The title of the dialog presented when browsing 
for the destination directory when restoring place markers.
+               dirDialogTitle = _("Select directory to restore")
+               directoryEntryControl = 
groupHelper.addItem(gui.guiHelper.PathSelectionHelper(self, browseText, 
dirDialogTitle))
+               self.restoreDirectoryEdit = directoryEntryControl.pathControl
+               self.restoreDirectoryEdit.Value = os.path.join(_configPath, 
"placeMarkersBackup")
+               bHelper = 
sHelper.addDialogDismissButtons(gui.guiHelper.ButtonHelper(wx.HORIZONTAL))
+               continueButton = bHelper.addButton(self, label=_("&Continue"), 
id=wx.ID_OK)
+               continueButton.SetDefault()
+               continueButton.Bind(wx.EVT_BUTTON, self.onRestore)
+               bHelper.addButton(self, id=wx.ID_CANCEL)
+               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)
+
+       def onRestore(self, evt):
+               if not self.restoreDirectoryEdit.Value:
+                       # Translators: The message displayed when the user has 
not specified a destination directory in the Restore dialog.
+                       gui.messageBox(_("Please specify a directory."),
+                               _("Error"),
+                               wx.OK | wx.ICON_ERROR)
+                       return
+               drv=os.path.splitdrive(self.restoreDirectoryEdit.Value)[0]
+               if drv and not os.path.isdir(drv):
+                       # Translators: The message displayed when the user 
specifies an invalid destination drive, translated in NVDA core.
+                       gui.messageBox(_("Invalid drive %s")%drv,
+                               _("Error"),
+                               wx.OK | wx.ICON_ERROR)
+                       return
+               self.Hide()
+               doRestore(self.restoreDirectoryEdit.Value)
+               self.Destroy()
+
+       def onCancel(self, evt):
+               self.Destroy()
+
 class GlobalPlugin(globalPluginHandler.GlobalPlugin):
 
        scriptCategory = unicode(_addonSummary)
@@ -427,27 +505,10 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                gui.mainFrame.postPopup()
 
        def onRestore(self, evt):
-               placeMarkersPath = os.path.join(_configPath, 
"placeMarkersBackup")
-               dlg = wx.DirDialog(gui.mainFrame,
-               # Translators: label of a dialog presented for restoring place 
markers.
-               _("Select the place markers folder you wish to restore"),
-               placeMarkersPath, wx.DD_DIR_MUST_EXIST | wx.DD_DEFAULT_STYLE)
                gui.mainFrame.prePopup()
-               result = dlg.ShowModal()
+               d = RestoreDialog(gui.mainFrame)
+               d.Show()
                gui.mainFrame.postPopup()
-               if result == wx.ID_OK:
-                       placeMarkersPath = dlg.GetPath()
-                       try:
-                               shutil.rmtree(_basePath, ignore_errors=True)
-                               shutil.copytree(placeMarkersPath, _basePath)
-                       except Exception as e:
-                               wx.CallAfter(gui.messageBox,
-                               # Translators: label of error dialog shown when 
cannot copy placeMarkers folder.
-                               _("Folder not copied"),
-                               # Translators: title of error dialog shown when 
cannot copy placeMarkers folder.
-                               _("Copy Error"),
-                               wx.OK|wx.ICON_ERROR)
-                               raise e
 
        def popupSpecificSearchDialog(self):
                if gui.isInMessageBox:


https://bitbucket.org/nvdaaddonteam/placemarkers/commits/c06ef4aacbcd/
Changeset:   c06ef4aacbcd
Branch:      None
User:        norrumar
Date:        2016-11-01 18:02:10+00:00
Summary:     Add the possibility of assigning gestures to the four items of PM 
menu.

Affected #:  1 file

diff --git a/addon/globalPlugins/placeMarkers.py 
b/addon/globalPlugins/placeMarkers.py
index 65dddfb..c48279e 100755
--- a/addon/globalPlugins/placeMarkers.py
+++ b/addon/globalPlugins/placeMarkers.py
@@ -492,24 +492,40 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                except WindowsError:
                        pass
 
+       def script_openSpecificSearchFolder(self, gesture):
+               wx.CallAfter(self.onSpecificSearch, None)
+       script_openSpecificSearchFolder.__doc__ = _("Opens the specific search 
folder.")
+
        def onBookmarks(self, evt):
                try:
                        os.startfile(_bookmarksFolder)
                except WindowsError:
                        pass
 
+       def script_openBookmarksFolder(self, gesture):
+               wx.CallAfter(self.onBookmarks, None)
+       script_openBookmarksFolder.__doc__ = _("Opens the bookmarks folder.")
+
        def onCopy(self, evt):
                gui.mainFrame.prePopup()
                d = CopyDialog(gui.mainFrame)
                d.Show()
                gui.mainFrame.postPopup()
 
+       def script_activateCopyDialog(self, gesture):
+               wx.CallAfter(self.onCopy, None)
+       script_activateCopyDialog.__doc__ = _("Activates the Copy dialog.")
+
        def onRestore(self, evt):
                gui.mainFrame.prePopup()
                d = RestoreDialog(gui.mainFrame)
                d.Show()
                gui.mainFrame.postPopup()
 
+       def script_activateRestoreDialog(self, gesture):
+               wx.CallAfter(self.onRestore, None)
+       script_activateRestoreDialog.__doc__ = _("Activates the Restore 
dialog.")
+
        def popupSpecificSearchDialog(self):
                if gui.isInMessageBox:
                        return


https://bitbucket.org/nvdaaddonteam/placemarkers/commits/bccc6a08df78/
Changeset:   bccc6a08df78
Branch:      7.0
User:        norrumar
Date:        2016-11-01 18:42:25+00:00
Summary:     Restore and Copy dialogs are not a singleton to preven py dead 
errors. Check if backup directory exists in Restore dialog.

Affected #:  1 file

diff --git a/addon/globalPlugins/placeMarkers.py 
b/addon/globalPlugins/placeMarkers.py
index c48279e..e5bf105 100755
--- a/addon/globalPlugins/placeMarkers.py
+++ b/addon/globalPlugins/placeMarkers.py
@@ -311,17 +311,7 @@ def doRestore(restoreDirectory):
 
 class CopyDialog(wx.Dialog):
 
-       _instance = None
-       def __new__(cls, *args, **kwargs):
-               # Make this a singleton.
-               if CopyDialog._instance is None:
-                       return super(CopyDialog, cls).__new__(cls, *args, 
**kwargs)
-               return CopyDialog._instance
-
        def __init__(self, parent):
-               if CopyDialog._instance is not None:
-                       return
-               CopyDialog._instance = self
                # Translators: The title of the Copy dialog.
                super(CopyDialog, self).__init__(parent, title=_("Copy place 
markers"))
 
@@ -376,17 +366,7 @@ class CopyDialog(wx.Dialog):
 
 class RestoreDialog(wx.Dialog):
 
-       _instance = None
-       def __new__(cls, *args, **kwargs):
-               # Make this a singleton.
-               if RestoreDialog._instance is None:
-                       return super(RestoreDialog, cls).__new__(cls, *args, 
**kwargs)
-               return RestoreDialog._instance
-
        def __init__(self, parent):
-               if RestoreDialog._instance is not None:
-                       return
-               RestoreDialog._instance = self
                # Translators: The title of the Restore dialog.
                super(RestoreDialog, self).__init__(parent, title=_("Restore 
place markers"))
 
@@ -407,7 +387,9 @@ class RestoreDialog(wx.Dialog):
                dirDialogTitle = _("Select directory to restore")
                directoryEntryControl = 
groupHelper.addItem(gui.guiHelper.PathSelectionHelper(self, browseText, 
dirDialogTitle))
                self.restoreDirectoryEdit = directoryEntryControl.pathControl
-               self.restoreDirectoryEdit.Value = os.path.join(_configPath, 
"placeMarkersBackup")
+               backupDirectory = os.path.join(_configPath, 
"placeMarkersBackup")
+               if os.path.isdir(backupDirectory):
+                       self.restoreDirectoryEdit.Value = backupDirectory
                bHelper = 
sHelper.addDialogDismissButtons(gui.guiHelper.ButtonHelper(wx.HORIZONTAL))
                continueButton = bHelper.addButton(self, label=_("&Continue"), 
id=wx.ID_OK)
                continueButton.SetDefault()

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.

Other related posts: