[nvda-addons] Re: commit/clipContentsDesigner: 4 new changesets

  • From: Noelia <nrm1977@xxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Sun, 07 Jun 2015 16:02:09 +0200

Hi Joseph and all, your suggestion has been implemented. For simplicity, I have added a check box, since I think it's too complicated to add options for copying and restoring settings, added in add-ons as placeMarkers because it contains entire folders. But with a simple ini file, I think it can be enough like that. So the dialog has an edit an a check box.
In this way if people want, can copy the configuration file to the personal NVDA's configuration, but it's optative. If done, when reinstalling, NVDA will ask if the separator should be imported.
I have added the possibility of assigning a shortcut to open the settings dialog of the add-on, from preferences menu, input gestures, configuration category.
Please test and review. I will upload it to the website, in add-ons under development.
Thanks.


El 07/06/2015 a las 15:55, commits-noreply@xxxxxxxxxxxxx escribió:

4 new commits in clipContentsDesigner:

https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/ac74be1d5f1d/
Changeset: ac74be1d5f1d
Branch: None
User: norrumar
Date: 2015-06-07 12:34:26+00:00
Summary: Added a checkbox to copy settings, suggested by Joseph. Dialog
settings shortcut can be assigned in input gestures dialog, configuration.

Affected #: 1 file

diff --git a/addon/globalPlugins/clipContentsDesigner/__init__.py
b/addon/globalPlugins/clipContentsDesigner/__init__.py
index 5044b31..89ff5d1 100644
--- a/addon/globalPlugins/clipContentsDesigner/__init__.py
+++ b/addon/globalPlugins/clipContentsDesigner/__init__.py
@@ -2,6 +2,8 @@

# clipContentsDesigner: a global plugin for managing clipboard text
# Version: 3.0
+# Added option of copying the separator to import when reinstalling the
add-on, suggested by Joseph Lee
+# Date: 07/06/2015
# Just use a single new line to separate appended strings when no separator
is set, suggested by Bhavya
# Date: 05/06/2015
# Braille representation for math can be appended to the clipboard
@@ -40,9 +42,12 @@ import textInfos
import ui
import msg # Developed by Alberto Bufolino
import win32clipboard
+import os
+import shutil
+import globalVars
import wx
import gui
-import os
+from gui import SettingsDialog
from logHandler import log
from cStringIO import StringIO
from configobj import ConfigObj
@@ -51,9 +56,9 @@ from validate import Validator
addonHandler.initTranslation()

try:
- from globalCommands import SCRCAT_TEXTREVIEW
+ from globalCommands import SCRCAT_TEXTREVIEW, SCRCAT_CONFIG
except:
- SCRCAT_TEXTREVIEW = None
+ SCRCAT_TEXTREVIEW = SCRCAT_CONFIG = None

iniFileName = os.path.join(os.path.dirname(__file__),
"clipContentsDesigner.ini")

@@ -67,6 +72,15 @@ conf = ConfigObj(iniFileName, configspec = confspec, indent_type =
"\t", encodin
val = Validator()
conf.validate(val)

+def getBookmark():
+ if conf["separator"]["bookmarkSeparator"] == "":
+ bookmark = "\r\n"
+ else:
+ bookmark = "\r\n%s\r\n" % conf["separator"]["bookmarkSeparator"]
+ return bookmark
+
+bookmark = getBookmark()
+
class GlobalPlugin(globalPluginHandler.GlobalPlugin):

scriptCategory = SCRCAT_TEXTREVIEW
@@ -81,14 +95,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onSettings,
self.settingsItem)

self._copyStartMarker = None
- self.bookmark = self.getBookmark()
-
- def getBookmark(self):
- if conf["separator"]["bookmarkSeparator"] == "":
- bookmark = "\r\n"
- else:
- bookmark = "\r\n%s\r\n" %
conf["separator"]["bookmarkSeparator"]
- return bookmark

def terminate(self):
try:
@@ -97,28 +103,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
pass

def onSettings(self, evt):
- # Translators: label of a dialog.
- message = _("Type the string to be used as a separator between
contents appended to the clipboard.")
- # Translators: title of a dialog.
- title = _("Clip Contents Designer settings")
- d = wx.TextEntryDialog(gui.mainFrame, message, title,
defaultValue=conf["separator"]["bookmarkSeparator"])
- gui.mainFrame.prePopup()
- try:
- result = d.ShowModal()
- except AttributeError:
- pass
- gui.mainFrame.postPopup()
- if result == wx.ID_OK:
- conf["separator"]["bookmarkSeparator"] = d.GetValue()
- self.bookmark = self.getBookmark()
- try:
- conf.validate(val, copy=True)
- conf.write()
- log.info("clipContentsDesigner add-on configuration
saved")
- except Exception as e:
- log.warning("Could not save clipContentsDesigner
add-on configuration")
- log.debugWarning("", exc_info=True)
- raise e
+ gui.mainFrame._popupSettingsDialog(AddonSettingsDialog)
+
+ def script_settings(self, gesture):
+ wx.CallAfter(gui.mainFrame.onSettings, None)
+ script_settings.category = SCRCAT_CONFIG
+ script_settings.__doc__ = _("Shows the Clip Contents Designer settings
dialog")

def clearClipboard(self):
try:
@@ -189,7 +179,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
self._copyStartMarker = None
try:
clipData = api.getClipData()
- text = clipData+self.bookmark+newText
+ text = clipData+bookmark+newText
except TypeError:
text = newText
if api.copyToClip(text):
@@ -211,3 +201,42 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
"kb:NVDA+windows+x": "clear",
"kb:NVDA+windows+f9": "setSelectionStartMarker",
}
+
+class AddonSettingsDialog(SettingsDialog):
+
+ # Translators: title of a dialog.
+ title = _("Clip Contents Designer settings")
+
+ def makeSettings(self, settingsSizer):
+ # Translators: label of a dialog.
+ setSeparatorLabel=wx.StaticText(self, -1, label=_("Type the string to be
used as a &separator between contents appended to the clipboard."))
+ settingsSizer.Add(setSeparatorLabel)
+ self.setSeparatorEdit=wx.TextCtrl(self, wx.NewId())
+
self.setSeparatorEdit.SetValue(conf["separator"]["bookmarkSeparator"])
+ settingsSizer.Add(self.setSeparatorEdit, border=10,
flag=wx.BOTTOM)
+ # Translators: label of a dialog.
+ self.copySettingsCheckBox=wx.CheckBox(self, wx.NewId(),
label=_("&Copy settings"))
+ self.copySettingsCheckBox.SetValue(False)
+ settingsSizer.Add(self.copySettingsCheckBox,border=10,
flag=wx.BOTTOM)
+
+ def postInit(self):
+ self.setSeparatorEdit.SetFocus()
+
+ def onOk(self,evt):
+ super(AddonSettingsDialog, self).onOk(evt)
+ conf["separator"]["bookmarkSeparator"] =
self.setSeparatorEdit.GetValue()
+ global bookmark
+ bookmark = getBookmark()
+ try:
+ conf.validate(val, copy=True)
+ conf.write()
+ log.info("clipContentsDesigner add-on configuration
saved")
+ except Exception as e:
+ log.warning("Could not save clipContentsDesigner add-on
configuration")
+ log.debugWarning("", exc_info=True)
+ raise e
+ if self.copySettingsCheckBox.GetValue():
+ try:
+ shutil.copy(iniFileName,
globalVars.appArgs.configPath)
+ except:
+ pass


https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/72293930173a/
Changeset: 72293930173a
Branch: None
User: norrumar
Date: 2015-06-07 13:29:31+00:00
Summary: Added option to import settings when reinstalling, suggested by
Joseph.

Affected #: 1 file

diff --git a/addon/installTasks.py b/addon/installTasks.py
index ece074a..b9d5028 100644
--- a/addon/installTasks.py
+++ b/addon/installTasks.py
@@ -1,6 +1,9 @@
# -*- coding: UTF-8 -*-

import addonHandler
+import os
+import shutil
+import globalVars
import gui
import wx

@@ -17,3 +20,14 @@ def onInstall():
wx.YES|wx.NO|wx.ICON_WARNING)==wx.YES:
addon.requestRemove()
break
+ if os.path.isfile(os.path.join(globalVars.appArgs.configPath,
"clipContentsDesigner.ini")):
+ if gui.messageBox(
+ # Translators: the label of a message box dialog.
+ _("You seem to have previous settings saved for this add-on.
Do you want to import them?"),
+ # Translators: the title of a message box dialog.
+ _("Import ClipContentsDesigner add-on settings"),
+ wx.YES|wx.NO|wx.ICON_WARNING)==wx.YES:
+ try:
+ shutil.copy(os.path.join(globalVars.appArgs.configPath,
"clipContentsDesigner.ini"), os.path.join(os.path.dirname(__file__), "globalPlugins",
"clipContentsDesigner"))
+ except:
+ pass


https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/6a717e017cef/
Changeset: 6a717e017cef
Branch: None
User: norrumar
Date: 2015-06-07 13:34:15+00:00
Summary: Fixed script_settings.

Affected #: 1 file

diff --git a/addon/globalPlugins/clipContentsDesigner/__init__.py
b/addon/globalPlugins/clipContentsDesigner/__init__.py
index 89ff5d1..aa5307c 100644
--- a/addon/globalPlugins/clipContentsDesigner/__init__.py
+++ b/addon/globalPlugins/clipContentsDesigner/__init__.py
@@ -106,7 +106,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
gui.mainFrame._popupSettingsDialog(AddonSettingsDialog)

def script_settings(self, gesture):
- wx.CallAfter(gui.mainFrame.onSettings, None)
+ wx.CallAfter(self.onSettings, None)
script_settings.category = SCRCAT_CONFIG
script_settings.__doc__ = _("Shows the Clip Contents Designer settings
dialog")



https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/36be0f3bc732/
Changeset: 36be0f3bc732
Branch: master
User: norrumar
Date: 2015-06-07 13:53:49+00:00
Summary: Updated readme.

Affected #: 1 file

diff --git a/readme.md b/readme.md
index b585822..21bdff0 100644
--- a/readme.md
+++ b/readme.md
@@ -15,11 +15,15 @@ The clipboard content can also be cleared.
Note: The above commands can be changed from NVDA menu, Preferences submenu,
Input gestures dialog, Text review category.

## Preferences Menu ##
-* Clip Contents Designer settings: Allows to set a separator which can be
used to find the text segments once the entire appended text is pasted.
+* Clip Contents Designer settings: Allows to set a separator which can be
used to find the text segments once the entire appended text is pasted. You can
also choose if the separator should be copied to your personal NVDA's
configuration folder, so that it can be imported when reinstalling the add-on.
+
+Note: The above command can be changed from NVDA menu, Preferences submenu,
Input gestures dialog, Configuration category.

## Changes for 3.0 ##
* Braille representation of MathML objects can be appended to the clipboard
if MathPlayer is installed.
* If no separator is set, just a single line will be placed between the
appended text segments.
+* A shortcut can be assigned tho open the Clip Contents Designer settings
dialog.
+* Added a check box in the settings dialog, for choosing if the separator
should be copied to be imported when reinstalling the add-on.

## Changes for 2.0 ##
* Hindi characters can be used as the separator between appended contents.

Repository URL: https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting bugs.
Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe:
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: