Hi,
Thanks, will perform code review.
Cheers,
Joseph
-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of Noelia
Sent: Sunday, June 7, 2015 7:02 AM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: commit/clipContentsDesigner: 4 new changesets
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/ac74be1d5f1
Changeset: ac74be1d5f1dDialog settings shortcut can be assigned in input gestures dialog,
Branch: None
User: norrumar
Date: 2015-06-07 12:34:26+00:00
Summary: Added a checkbox to copy settings, suggested by Joseph.
separator is set, suggested by Bhavya
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
# Date: 05/06/2015indent_type = "\t", encodin
# 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,
val = Validator()conf["separator"]["bookmarkSeparator"]
conf.validate(val)
+def getBookmark():
+ if conf["separator"]["bookmarkSeparator"] == "":
+ bookmark = "\r\n"
+ else:
+ bookmark = "\r\n%s\r\n" %
+ 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)conf["separator"]["bookmarkSeparator"]
self._copyStartMarker = None
- self.bookmark = self.getBookmark()
-
- def getBookmark(self):
- if conf["separator"]["bookmarkSeparator"] == "":
- bookmark = "\r\n"
- else:
- bookmark = "\r\n%s\r\n" %
- return bookmarkbetween contents appended to the clipboard.")
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
- # Translators: title of a dialog.defaultValue=conf["separator"]["bookmarkSeparator"])
- title = _("Clip Contents Designer settings")
- d = wx.TextEntryDialog(gui.mainFrame, message, title,
- gui.mainFrame.prePopup()d.GetValue()
- try:
- result = d.ShowModal()
- except AttributeError:
- pass
- gui.mainFrame.postPopup()
- if result == wx.ID_OK:
- conf["separator"]["bookmarkSeparator"] =
- self.bookmark = self.getBookmark()configuration saved")
- try:
- conf.validate(val, copy=True)
- conf.write()
- log.info("clipContentsDesigner add-on
- except Exception as e:clipContentsDesigner add-on configuration")
- log.warning("Could not save
- log.debugWarning("", exc_info=True)string to be used as a &separator between contents appended to the
- 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
+ settingsSizer.Add(setSeparatorLabel)self.setSeparatorEdit.SetValue(conf["separator"]["bookmarkSeparator"])
+ self.setSeparatorEdit=wx.TextCtrl(self, wx.NewId())
+
+ settingsSizer.Add(self.setSeparatorEdit, border=10,flag=wx.BOTTOM)
+ # Translators: label of a dialog.label=_("&Copy settings"))
+ self.copySettingsCheckBox=wx.CheckBox(self, wx.NewId(),
+ self.copySettingsCheckBox.SetValue(False)self.setSeparatorEdit.GetValue()
+ 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"] =
+ global bookmarksaved")
+ bookmark = getBookmark()
+ try:
+ conf.validate(val, copy=True)
+ conf.write()
+ log.info("clipContentsDesigner add-on configuration
+ except Exception as e:add-on configuration")
+ log.warning("Could not save clipContentsDesigner
+ log.debugWarning("", exc_info=True)globalVars.appArgs.configPath)
+ raise e
+ if self.copySettingsCheckBox.GetValue():
+ try:
+ shutil.copy(iniFileName,
+ except:https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/72293930173
+ pass
Changeset: 72293930173aby Joseph.
Branch: None
User: norrumar
Date: 2015-06-07 13:29:31+00:00
Summary: Added option to import settings when reinstalling, suggested
"clipContentsDesigner.ini")):
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,
+ if gui.messageBox(add-on. Do you want to import them?"),
+ # Translators: the label of a message box dialog.
+ _("You seem to have previous settings saved for this
+ # Translators: the title of a message box dialog.shutil.copy(os.path.join(globalVars.appArgs.configPath,
+ _("Import ClipContentsDesigner add-on settings"),
+ wx.YES|wx.NO|wx.ICON_WARNING)==wx.YES:
+ try:
+
+ except:https://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/6a717e017ce
+ pass
Changeset: 6a717e017cefhttps://bitbucket.org/nvdaaddonteam/clipcontentsdesigner/commits/36be0f3bc73
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")
Changeset: 36be0f3bc732submenu, Input gestures dialog, Text review category.
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
be used to find the text segments once the entire appended text is pasted.
## Preferences Menu ##
-* Clip Contents Designer settings: Allows to set a separator which can
+* Clip Contents Designer settings: Allows to set a separator which canbe used to find the text segments once the entire appended text is pasted.
+submenu, Input gestures dialog, Configuration category.
+Note: The above command can be changed from NVDA menu, Preferences
clipboard if MathPlayer is installed.
## Changes for 3.0 ##
* Braille representation of MathML objects can be appended to the
* If no separator is set, just a single line will be placed betweenthe appended text segments.
+* A shortcut can be assigned tho open the Clip Contents Designersettings dialog.
+* Added a check box in the settings dialog, for choosing if theseparator should be copied to be imported when reinstalling the add-on.
contents.
## Changes for 2.0 ##
* Hindi characters can be used as the separator between appended
----------------------------------------------------------------
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.