diff --git a/addon/globalPlugins/clipContentsDesigner/__init__.py b/addon/globalPlugins/clipContentsDesigner/__init__.py index aa1da051..c956cf82 100644 --- a/addon/globalPlugins/clipContentsDesigner/__init__.py +++ b/addon/globalPlugins/clipContentsDesigner/__init__.py @@ -34,10 +34,22 @@ "confirmToCopy": "boolean(default=False)", "confirmToCut": "boolean(default=False)", "confirmationRequirement": "integer(default=0)", + "browseableTextFormat": "integer(default=0)", "maxLengthForBrowseableText": "integer(default=100000)", } config.conf.spec["clipContentsDesigner"] = confspec +### Constants + +BROWSEABLETEXT_FORMATS = [ + # Translators: label of a dialog. + _("Preformatted text in HTML"), + # Translators: label of a dialog. + _("HTML as shown in a web browser"), + # Translators: label of a dialog. + _("Raw text"), + ] + def getBookmark(): try: separator = config.conf["clipContentsDesigner"]["separator"] @@ -289,9 +301,17 @@ def script_showClipboardText(self, gesture): ui.message(_("Clipboard is empty")) else: maxLength = config.conf["clipContentsDesigner"]["maxLengthForBrowseableText"] if config.conf["clipContentsDesigner"]["maxLengthForBrowseableText"] <= len(text) else len(text) - browseableText = "
%s
" % text[:maxLength] + format = config.conf["clipContentsDesigner"]["browseableTextFormat"] + html = True + if format == 0: + browseableText = "
%s
" % text.strip()[:maxLength] + elif format == 1: + browseableText = text.strip()[:maxLength] + else: + browseableText = text[:maxLength] + html = False # Translators: title of a browseable message. - ui.browseableMessage(browseableText, _("Clipboard text (%d/%d)" % (maxLength, len(text))), True) + ui.browseableMessage(browseableText, _("Clipboard text ({max}/{current} - {formatForTitle})".format(max=maxLength, current=len(text), formatForTitle=BROWSEABLETEXT_FORMATS[format])), html) script_showClipboardText.__doc__ = _("Shows the clipboard text in browse mode") __gestures = { @@ -354,6 +374,10 @@ def makeSettings(self, settingsSizer): self.confirmRequirementChoices = sHelper.addLabeledControl(confirmRequirementsLabel, wx.Choice, choices=requirementChoices) self.confirmRequirementChoices.SetSelection(config.conf["clipContentsDesigner"]["confirmationRequirement"]) # Translators: label of a dialog. + formatLabel = _("&Format to show the clipboard text in browse mode:") + self.formatChoices = sHelper.addLabeledControl(formatLabel, wx.Choice, choices=BROWSEABLETEXT_FORMATS) + self.formatChoices.SetSelection(config.conf["clipContentsDesigner"]["browseableTextFormat"]) + # Translators: label of a dialog. maxLengthLabel=wx.StaticText(self,-1,label=_("&Maximum number of characters when showing clipboard text in browse mode")) self.maxLengthEdit=gui.nvdaControls.SelectOnFocusSpinCtrl(self, min=1, max=1000000, initial=config.conf["clipContentsDesigner"]["maxLengthForBrowseableText"]) @@ -368,4 +392,5 @@ def onSave(self): config.conf["clipContentsDesigner"]["confirmToCopy"] = self.confirmList.IsChecked(2) config.conf["clipContentsDesigner"]["confirmToCut"] = self.confirmList.IsChecked(3) config.conf["clipContentsDesigner"]["confirmationRequirement"] = self.confirmRequirementChoices.GetSelection() + config.conf["clipContentsDesigner"]["browseableTextFormat"] = self.formatChoices.GetSelection() config.conf["clipContentsDesigner"]["maxLengthForBrowseableText"] = self.maxLengthEdit.GetValue() diff --git a/buildVars.py b/buildVars.py index 52d708a4..359726b5 100644 --- a/buildVars.py +++ b/buildVars.py @@ -19,7 +19,7 @@ # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description" : _("""Add-on for managing clipboard text."""), # version - "addon_version" : "9.0-dev", + "addon_version" : "9.1-dev", # Author(s) "addon_author" : u"Noelia Ruiz Martínez ", # URL for the add-on documentation support diff --git a/readme.md b/readme.md index 77046db7..4b0e1d3d 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ Note: The above commands can be changed from NVDA menu, Preferences submenu, Inp ## Preferences Menu ## * Clip Contents Designer settings: Allows to set a separator which can be used to find the text segments once the entire added text is pasted. It's also possible to choose if the added text will be appended or prepended, if available actions (add, clear clipboard, emulate copy and emulate cut) should be performed inmediately or after confirmation, and if confirmations will be requested always, just if text is contained in the clipboard, or if clipboard is not empty. -Furthermore, it's possible to change the maximum number of characters of the clipboard text which will be shown in browse mode. Please, be aware that increasing this limit may produce issues if the clipboard contains large strings of text. The default limit is 100000 characters. +Furthermore, it's possible to change the format and maximum number of characters of the clipboard text which will be shown in browse mode. Please, be aware that increasing this limit may produce issues if the clipboard contains large strings of text. The default limit is 100000 characters. Notes: