├── manifest-translated.ini.tpl ├── changelog.md ├── .gitignore ├── manifest.ini.tpl ├── .gitattributes ├── updateVersion.py ├── style.css ├── site_scons └── site_tools │ └── gettexttool │ └── __init__.py ├── speechHistoryExplorer.pot ├── .github └── workflows │ └── upload-on-tag.yaml ├── addonReadme.md ├── addon ├── doc │ └── tr │ │ └── readme.md ├── locale │ └── tr │ │ └── LC_MESSAGES │ │ └── nvda.po └── globalPlugins │ └── speechHistoryExplorer │ ├── _configHelper.py │ └── __init__.py ├── README.md ├── sconstruct └── LICENSE /manifest-translated.ini.tpl: -------------------------------------------------------------------------------- 1 | summary = "{addon_summary}" 2 | description = """{addon_description}""" 3 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## Changes for 2023.3 ## 2 | updated the supported NVDA versions to 2023.1 3 | updated copyright in the code. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | addon/doc/*.css 2 | addon/doc/en/ 3 | *_docHandler.py 4 | *.html 5 | *.ini 6 | *.mo 7 | *.py[co] 8 | *.nvda-addon 9 | .sconsign.dblite 10 | *.code-workspace 11 | *.json -------------------------------------------------------------------------------- /manifest.ini.tpl: -------------------------------------------------------------------------------- 1 | name = {addon_name} 2 | summary = "{addon_summary}" 3 | description = """{addon_description}""" 4 | author = "{addon_author}" 5 | url = {addon_url} 6 | version = {addon_version} 7 | docFileName = {addon_docFileName} 8 | minimumNVDAVersion = {addon_minimumNVDAVersion} 9 | lastTestedNVDAVersion = {addon_lastTestedNVDAVersion} 10 | updateChannel = {addon_updateChannel} 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Try to ensure that po files in the repo does not include 5 | # source code line numbers. 6 | # Every person expected to commit po files should change their personal config file as described here: 7 | # https://mail.gnome.org/archives/kupfer-list/2010-June/msg00002.html 8 | *.po filter=cleanpo 9 | -------------------------------------------------------------------------------- /updateVersion.py: -------------------------------------------------------------------------------- 1 | import re, sys 2 | 3 | if len(sys.argv) < 2: 4 | print("the version was not detected") 5 | exit(1) 6 | version = sys.argv[1] 7 | print(f"the version recognized is: {version}") 8 | with open("buildVars.py", 'r+', encoding='utf-8') as f: 9 | text = f.read() 10 | text = re.sub('"addon_version" *:.*,', f'"addon_version" : "{version}",', text) 11 | f.seek(0) 12 | f.write(text) 13 | f.truncate() 14 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | body { 3 | font-family : Verdana, Arial, Helvetica, Sans-serif; 4 | line-height: 1.2em; 5 | } 6 | h1, h2 {text-align: center} 7 | dt { 8 | font-weight : bold; 9 | float : left; 10 | width: 10%; 11 | clear: left 12 | } 13 | dd { 14 | margin : 0 0 0.4em 0; 15 | float : left; 16 | width: 90%; 17 | display: block; 18 | } 19 | p { clear : both; 20 | } 21 | a { text-decoration : underline; 22 | } 23 | :active { 24 | text-decoration : none; 25 | } 26 | a:focus, a:hover {outline: solid} 27 | -------------------------------------------------------------------------------- /site_scons/site_tools/gettexttool/__init__.py: -------------------------------------------------------------------------------- 1 | """ This tool allows generation of gettext .mo compiled files, pot files from source code files 2 | and pot files for merging. 3 | 4 | Three new builders are added into the constructed environment: 5 | 6 | - gettextMoFile: generates .mo file from .pot file using msgfmt. 7 | - gettextPotFile: Generates .pot file from source code files. 8 | - gettextMergePotFile: Creates a .pot file appropriate for merging into existing .po files. 9 | 10 | To properly configure get text, define the following variables: 11 | 12 | - gettext_package_bugs_address 13 | - gettext_package_name 14 | - gettext_package_version 15 | 16 | 17 | """ 18 | from SCons.Action import Action 19 | 20 | def exists(env): 21 | return True 22 | 23 | XGETTEXT_COMMON_ARGS = ( 24 | "--msgid-bugs-address='$gettext_package_bugs_address' " 25 | "--package-name='$gettext_package_name' " 26 | "--package-version='$gettext_package_version' " 27 | "-c -o $TARGET $SOURCES" 28 | ) 29 | 30 | def generate(env): 31 | env.SetDefault(gettext_package_bugs_address="example@example.com") 32 | env.SetDefault(gettext_package_name="") 33 | env.SetDefault(gettext_package_version="") 34 | 35 | env['BUILDERS']['gettextMoFile']=env.Builder( 36 | action=Action("msgfmt -o $TARGET $SOURCE", "Compiling translation $SOURCE"), 37 | suffix=".mo", 38 | src_suffix=".po" 39 | ) 40 | 41 | env['BUILDERS']['gettextPotFile']=env.Builder( 42 | action=Action("xgettext " + XGETTEXT_COMMON_ARGS, "Generating pot file $TARGET"), 43 | suffix=".pot") 44 | 45 | env['BUILDERS']['gettextMergePotFile']=env.Builder( 46 | action=Action("xgettext " + "--omit-header --no-location " + XGETTEXT_COMMON_ARGS, 47 | "Generating pot file $TARGET"), 48 | suffix=".pot") 49 | 50 | -------------------------------------------------------------------------------- /speechHistoryExplorer.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the 'speechHistoryExplorer' package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: 'speechHistoryExplorer' '2022.2-dev'\n" 10 | "Report-Msgid-Bugs-To: 'nvda-translations@freelists.org'\n" 11 | "POT-Creation-Date: 2023-04-15 09:26-0600\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #. Add-on summary, usually the user visible name of the addon. 21 | #. Translators: Summary for this add-on to be shown on installation and add-on information. 22 | #: buildVars.py:17 23 | msgid "Speech history Explorer" 24 | msgstr "" 25 | 26 | #. Add-on description 27 | #. Translators: Long description to be shown for this add-on on add-on information from add-ons manager 28 | #: buildVars.py:20 29 | msgid "" 30 | "This add-on allows you to review the most recent strings spoken by NVDA, by " 31 | "default using NVDA+Shift+F11 and NVDA+Shift+F12. \n" 32 | "\tAdditionally, you can copy any spoken item to the clipboard by pressing " 33 | "NVDA+Control+F12 and shows a dialog of all stored spoken elements with NVDA" 34 | "+Alt+f12.\n" 35 | "\tUse the settings panel for the add-on to increase or decrease the maximum " 36 | "number of stored history entries, and decide whether whitespace should be " 37 | "trimmed from the start or end of text.\n" 38 | "\tUse NVDA's Input Gestures dialog to change the supplied keystrokes." 39 | msgstr "" 40 | -------------------------------------------------------------------------------- /.github/workflows/upload-on-tag.yaml: -------------------------------------------------------------------------------- 1 | permissions: 2 | contents: write 3 | name: Upload on new tags 4 | on: 5 | push: 6 | tags: 7 | ['*'] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v3 16 | - run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt 17 | - name: Set up Python 18 | uses: actions/setup-python@v4 19 | with: 20 | python-version: 3.9 21 | cache: 'pip' 22 | 23 | - name: Install dependencies 24 | run: | 25 | pip install scons markdown 26 | sudo apt update 27 | sudo apt install gettext 28 | 29 | - name: Add add-on version 30 | run: | 31 | import re 32 | with open("buildVars.py", 'r+', encoding='utf-8') as f: 33 | text = f.read() 34 | version = "${{ github.ref }}".split("/")[-1] 35 | text = re.sub('"addon_version" *:.*,', '"addon_version" : "%s",' % version, text) 36 | f.seek(0) 37 | f.write(text) 38 | f.truncate() 39 | shell: python 40 | 41 | - name: Build add-on 42 | run: scons 43 | - name: Calculate sha256 44 | run: sha256sum *.nvda-addon >> changelog.md 45 | 46 | - uses: actions/upload-artifact@v3 47 | with: 48 | name: packaged_addon 49 | path: | 50 | ./*.nvda-addon 51 | ./*.json 52 | 53 | upload_release: 54 | runs-on: ubuntu-latest 55 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 56 | needs: ["build"] 57 | steps: 58 | - uses: actions/checkout@v3 59 | - name: download releases files 60 | uses: actions/download-artifact@v3 61 | - name: Display structure of downloaded files 62 | run: ls -R 63 | 64 | - name: Release 65 | uses: softprops/action-gh-release@v1 66 | with: 67 | files: | 68 | packaged_addon/*.nvda-addon 69 | packaged_addon/*.json 70 | fail_on_unmatched_files: true 71 | prerelease: ${{ contains(github.ref, '-') }} 72 | -------------------------------------------------------------------------------- /addonReadme.md: -------------------------------------------------------------------------------- 1 | # NVDA Speech History 2 | 3 | This is an updated version of the Clip Copy add-on for NVDA, initially created by Tyler Spivey in 2012. 4 | The keystrokes were updated because the original keys could present conflicts with other applications, since very common keys were used in the original add-on, E.G, f12. 5 | 6 | ## features: 7 | 8 | * A command to copy the most recent spoken text to the clipboard. 9 | * Ability to review the 500 most recent items spoken by NVDA. 10 | * Show a dialog with the current most recent items spoken by NVDA. You can review, multi-select items and copy the current item or items selected. 11 | 12 | ## Usage. 13 | 14 | * Review the most recent items spoken by NVDA: press NVDA + shift + f11 (previous item) or NVDA + shift + f12 (next item). 15 | * Copy the last item read by NVDA, or the current reviewed item: NVDA + control + f12. 16 | * Show a dialog with the current most recent items spoken by NVDA: NVDA + alt + f12 17 | 18 | ### Speech history elements. 19 | 20 | In this dialog, you will be focused in the most recent items spoken by NVDA, the most recent item first. You can navigate the items by using up and down arrow keys. Each element will show just 100 characters, but you can see the entire contend by pressing tab key in a multiline text edit field. Those items won't update with new items spoken by NVDA. If you want to update the list of items, you must restart this dialog or press the "refresh history" button. 21 | 22 | You can search in the entire elements in the search edit field. Type some letters or words and then, press enter. The list of items will be updated according to your search. To clean the search, just clean the text in the search edit field, and press enter. Also, a search will be made if you are in the search field, and the field loses the focus. E.G, by pressing tab or focus another control in some another way. 23 | 24 | You can copy the current selected items, by using the copy button. This will copy all text shown in the field that contains all items selected. 25 | Also, you can copy all current items with "Copy all" button. This will copy just the current items shown in the list, each one will be separated by a newline. If you searched something, then this button will only copy the items found. 26 | 27 | If you want to select more than one item, use same keys as on windows. E.G, shift + up and down arrow keys to do contiguous selection, control + the same keys to do uncontiguous selection. 28 | To close this dialog, press escape or close button. 29 | -------------------------------------------------------------------------------- /addon/doc/tr/readme.md: -------------------------------------------------------------------------------- 1 | # NVDA Konuşma Geçmişi 2 | 3 | Bu, ilk olarak 2012'de Tyler Spivey tarafından oluşturulan NVDA için Clip Copy eklentisinin güncellenmiş bir versiyonudur. 4 | Orijinal eklenti E.G, f12'de çok yaygın komutlar kullanıldığından, orijinal kısayollar diğer uygulamalarla çakışma gösterebileceğinden tuş vuruşları güncellendi. 5 | 6 | ## özellikler: 7 | 8 | * En son konuşulan metni panoya kopyalama komutu. 9 | * NVDA tarafından konuşulan en son 500 öğeyi inceleme yeteneği. 10 | * NVDA tarafından konuşulan en güncel öğeleri içeren bir iletişim kutusu gösterir. Öğeleri inceleyebilir, çoklu seçim yapabilir ve geçerli öğeyi veya seçilen öğeleri kopyalayabilirsiniz. 11 | 12 | ## Kullanım: 13 | * NVDA tarafından konuşulan en son öğeleri gözden geçirin: NVDA + shift + f11 (önceki öğe) veya NVDA + shift + f12 (sonraki öğe) tuşlarına basın. 14 | * NVDA tarafından okunan son öğeyi veya geçerli gözden geçirilen öğeyi kopyalayın: NVDA + kontrol + f12. 15 | * NVDA tarafından konuşulan en güncel öğeleri içeren bir iletişim kutusu gösterir: NVDA + alt + f12 16 | 17 | ### Konuşma geçmişi öğeleri. 18 | 19 | Bu iletişim kutusunda, NVDA tarafından konuşulan en son öğelere, en son öğe en başta olmak üzere odaklanacaksınız. Yukarı ve aşağı ok tuşlarını kullanarak öğeler arasında gezinebilirsiniz. Her öğe yalnızca 100 karakter gösterecektir, ancak çok satırlı bir metin düzenleme alanında sekme tuşuna basarak tüm içeriği görebilirsiniz. Bu öğeler, NVDA tarafından konuşulan yeni öğelerle güncellenmeyecektir. Öğe listesini güncellemek istiyorsanız, bu iletişim kutusunu yeniden başlatmanız veya "geçmişi yenile" düğmesine basmanız gerekir. 20 | 21 | Arama düzenleme alanında tüm öğeleri arayabilirsiniz. Birkaç harf veya kelime yazın ve ardından enter tuşuna basın. Öğe listesi, aramanıza göre güncellenecektir. Aramayı temizlemek için, arama düzenleme alanındaki metni temizlemeniz ve enter tuşuna basmanız yeterlidir. Ayrıca, arama alanındaysanız arama yapılır ve alan odağı kaybeder. 22 | Örneğin: sekmeye basarak veya başka bir kontrole başka bir şekilde odaklanarak. 23 | Kopyala düğmesini kullanarak mevcut seçili öğeleri kopyalayabilirsiniz. Bu, seçilen tüm öğeleri içeren alanda gösterilen tüm metni kopyalayacaktır. 24 | Ayrıca, "Tümünü kopyala" düğmesi ile mevcut tüm öğeleri kopyalayabilirsiniz. Bu, yalnızca listede gösterilen mevcut öğeleri kopyalayacaktır, her biri yeni bir satırla ayrılacaktır. Herhangibir şey aradıysanız, bu düğme yalnızca bulunan öğeleri kopyalayacaktır. 25 | 26 | Birden fazla öğe seçmek istiyorsanız, Windows seçme tuşlarının aynısını kullanın. 27 | Örneğin: shift + yukarı ve aşağı ok tuşlarını bitişik seçim yapmak için, kontrol + Aşağı/yukarı ok bitişik olmayan seçimleri yapmak için. 28 | Bu iletişim kutusunu kapatmak için Escape veya kapat düğmesine basın. 29 | -------------------------------------------------------------------------------- /addon/locale/tr/LC_MESSAGES/nvda.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Konuşma Geçmişi Gezgini 2023.3\n" 4 | "POT-Creation-Date: 2023-04-27 14:41+0300\n" 5 | "PO-Revision-Date: 2023-04-27 14:56+0300\n" 6 | "Last-Translator: Umut KORKMAZ \n" 7 | "Language-Team: Umut KORKMAZ \n" 8 | "Language: tr_TR\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 13 | "X-Generator: Poedit 3.2.2\n" 14 | "X-Poedit-Basepath: ../../../globalPlugins\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | "X-Poedit-SearchPath-0: .\n" 17 | 18 | #: speechHistoryExplorer/__init__.py:47 speechHistoryExplorer/__init__.py:151 19 | msgid "Speech History Explorer" 20 | msgstr "Konuşma Geçmişi Gezgini" 21 | 22 | #: speechHistoryExplorer/__init__.py:66 23 | msgid "" 24 | "Copy the currently selected speech history Explorer item to the clipboard, " 25 | "which by default will be the most recently spoken text by NVDA." 26 | msgstr "" 27 | "Seçili olan konuşma geçmişi Gezgini öğesini panoya kopyalar, varsayılan " 28 | "olarak NVDA tarafından en son konuşulan metin olacaktır." 29 | 30 | #: speechHistoryExplorer/__init__.py:80 31 | msgid "Review the previous item in NVDA's speech history." 32 | msgstr "NVDA'nın konuşma geçmişindeki bir önceki öğeyi gözden geçirir." 33 | 34 | #: speechHistoryExplorer/__init__.py:96 35 | msgid "Review the next item in NVDA's speech history." 36 | msgstr "NVDA'nın konuşma geçmişindeki bir sonraki öğeyi gözden geçirir." 37 | 38 | #: speechHistoryExplorer/__init__.py:112 39 | msgid "Opens a dialog showing all most recent items spoken by NVDA" 40 | msgstr "" 41 | "NVDA tarafından konuşulan en son tüm öğeleri gösteren bir iletişim kutusu " 42 | "açar" 43 | 44 | #: speechHistoryExplorer/__init__.py:156 45 | msgid "" 46 | "&Maximum number of history entries (requires NVDA restart to take effect)" 47 | msgstr "" 48 | "Gösterilecek &maksimum giriş sayısı (etkinleştirilebilmesi için NVDA'nın " 49 | "yeniden başlatılması gerekir)" 50 | 51 | #: speechHistoryExplorer/__init__.py:159 52 | msgid "Trim whitespace from &start when copying text" 53 | msgstr "Metni kopyalarken baştaki boşluklarıke&s" 54 | 55 | #: speechHistoryExplorer/__init__.py:162 56 | msgid "Trim whitespace from &end when copying text" 57 | msgstr "Metni kopyalarken sondaki boşlukları k&es" 58 | 59 | #: speechHistoryExplorer/__init__.py:165 60 | msgid "Beep when performing actions" 61 | msgstr "Eylemleri gerçekleştirirken bip sesi çıkart" 62 | 63 | #: speechHistoryExplorer/__init__.py:168 64 | msgid "Beep left or right when no more older or newer elements are available" 65 | msgstr "" 66 | "Daha eski öğe yoksa soldan, daha yeni öğe yoksa sağdan bip sesi çıkart" 67 | 68 | #: speechHistoryExplorer/__init__.py:207 69 | msgid "Speech history items" 70 | msgstr "Konuşma geçmişi öğeleri" 71 | 72 | #: speechHistoryExplorer/__init__.py:231 73 | msgid "&Search" 74 | msgstr "&Ara" 75 | 76 | #: speechHistoryExplorer/__init__.py:239 77 | msgid "History list" 78 | msgstr "Geçmiş listesi" 79 | 80 | #: speechHistoryExplorer/__init__.py:265 81 | msgid "&Copy item" 82 | msgstr "&Öğeyi kopyala" 83 | 84 | #: speechHistoryExplorer/__init__.py:281 85 | msgid "Copy &all" 86 | msgstr "&Tümünü kopyala" 87 | 88 | #: speechHistoryExplorer/__init__.py:285 89 | msgid "C&lean history" 90 | msgstr "&Geçmişi temizle" 91 | 92 | #: speechHistoryExplorer/__init__.py:289 93 | msgid "&Refresh history" 94 | msgstr "Geçmişi ¥ile" 95 | 96 | #: speechHistoryExplorer/__init__.py:293 97 | msgid "C&lose" 98 | msgstr "&Kapat" 99 | -------------------------------------------------------------------------------- /addon/globalPlugins/speechHistoryExplorer/_configHelper.py: -------------------------------------------------------------------------------- 1 | # NVDA configHelper. 2 | # Copyright (C) 2022 - 2023 David CM 3 | 4 | import config 5 | 6 | def getConfigValue(path, optName): 7 | """ this function helps to accessing config values. 8 | params 9 | @path: the path to the option. 10 | @optName: the option name 11 | """ 12 | ops = config.conf[path[0]] 13 | for k in path[1:]: 14 | ops = ops[k] 15 | return ops[optName] 16 | 17 | 18 | def setConfigValue(path, optName, value): 19 | """ this function helps to accessing and set config values. 20 | params 21 | @path: the path to the option. 22 | @optName: the option name 23 | @value: the value to set. 24 | """ 25 | ops = config.conf[path[0]] 26 | for k in path[1:]: 27 | ops = ops[k] 28 | ops[optName] = value 29 | 30 | 31 | def registerConfig(clsSpec, path=None): 32 | AF = clsSpec(path) 33 | config.conf.spec[AF.__path__[0]] = AF.createSpec() 34 | AF.returnValue = True 35 | return AF 36 | 37 | 38 | class OptConfig: 39 | """ just a helper descriptor to create the main class to accesing config values. 40 | the option name will be taken from the declared variable. 41 | """ 42 | def __init__(self, desc): 43 | """ 44 | params: 45 | @desc: the spec description. 46 | """ 47 | self.desc = desc 48 | 49 | def __set_name__(self, owner, name): 50 | self.name = name 51 | owner.__confOpts__.append(name) 52 | 53 | def __get__(self, obj, type=None): 54 | if obj.returnValue: 55 | return getConfigValue(obj.__path__, self.name) 56 | return self.name, self.desc 57 | 58 | def __set__(self, obj, value): 59 | setConfigValue(obj.__path__, self.name, value) 60 | 61 | 62 | class BaseConfig: 63 | """ this class will help to get and set config values. 64 | the idea behind this is to generalize the config path and config names. 65 | sometimes, a mistake in the dict to access the values can produce an undetectable bug. 66 | if returnValue attribute is set to False, this will return the option name instead of the value. 67 | by default this value is False, to help to create the configuration spec first. 68 | Set it to true after creating this spec. 69 | """ 70 | __path__ = None 71 | def __init__(self, path=None): 72 | self.returnValue = False 73 | if not path: 74 | path = self.__class__.__path__ 75 | if not path: 76 | raise Exception("Path for the config is not defined") 77 | if isinstance(path, list): 78 | self.__path__ = path 79 | else: 80 | self.__path__ = [path] 81 | 82 | def createSpec(self): 83 | """ this method creates a config spec with the provided attributes in the class 84 | """ 85 | s = {} 86 | for k in self.__class__.__confOpts__: 87 | k = self.__getattribute__(k) 88 | s[k[0]] = k[1] 89 | return s 90 | # an array of the available options. 91 | __confOpts__ = [] 92 | 93 | 94 | def configSpec(pathOrCls): 95 | """ a decorator to help with the generation of the class config spec. 96 | adds a get and set descriptor for eatch attribute in the config class. 97 | except the attributes starting with "__". 98 | params: 99 | @pathOrCls: the config path, 100 | or if the decorator is called without params, then the decorated class. 101 | path as an argument in the decorator has a higher priority than the __path__ declared in the class. 102 | """ 103 | def configDecorator(cls): 104 | class ConfigSpec(BaseConfig): 105 | pass 106 | 107 | for k in cls.__dict__: 108 | if k.startswith("__"): continue 109 | v = getattr(cls, k) 110 | d = OptConfig(v) 111 | d.__set_name__(ConfigSpec, k) 112 | setattr(ConfigSpec, k, d) 113 | ConfigSpec.__path__ = path 114 | return ConfigSpec 115 | if isinstance(pathOrCls, str): 116 | path = pathOrCls 117 | return configDecorator 118 | else: 119 | path = pathOrCls.__path__ 120 | return configDecorator(pathOrCls) 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NVDA Speech History Explorer 2 | 3 | This is a fork of the speech history add-on for NVDA, initially created by Tyler Spivey in 2012 and maintained by James Scholes. This add-on adds some features. 4 | Also, The keystrokes were updated because the original keys could present conflicts with other applications, since very common keys were used in the original add-on, E.G, f12. 5 | 6 | ## features: 7 | 8 | * A command to copy the most recent spoken text to the clipboard. 9 | * Ability to review the 500 most recent items spoken by NVDA. 10 | * Show a dialog with the current most recent items spoken by NVDA. You can review, multi-select items and copy the current item or items selected. 11 | 12 | ## Usage. 13 | 14 | * Review the most recent items spoken by NVDA: press NVDA + shift + f11 (previous item) or NVDA + shift + f12 (next item). 15 | * Copy the last item read by NVDA, or the current reviewed item: NVDA + control + f12. 16 | * Show a dialog with the current most recent items spoken by NVDA: NVDA + alt + f12 17 | 18 | ### Speech history elements. 19 | 20 | In this dialog, you will be focused in the most recent items spoken by NVDA, the most recent item first. You can navigate the items by using up and down arrow keys. Each element will show just 100 characters, but you can see the entire contend by pressing tab key in a multiline text edit field. Those items won't update with new items spoken by NVDA. If you want to update the list of items, you must restart this dialog or press the "refresh history" button. 21 | 22 | You can search in the entire elements in the search edit field. Type some letters or words and then, press enter. The list of items will be updated according to your search. To clean the search, just clean the text in the search edit field, and press enter. Also, a search will be made if you are in the search field, and the field loses the focus. E.G, by pressing tab or focus another control in some another way. 23 | 24 | You can copy the current selected items, by using the copy button. This will copy all text shown in the field that contains all items selected. 25 | Also, you can copy all current items with "Copy all" button. This will copy just the current items shown in the list, each one will be separated by a newline. If you searched something, then this button will only copy the items found. 26 | 27 | If you want to select more than one item, use same keys as on windows. E.G, shift + up and down arrow keys to do contiguous selection, control + the same keys to do uncontiguous selection. 28 | To close this dialog, press escape or close button. 29 | 30 | 31 | ### Contributing fixing bugs and new features. 32 | If you want to fix a bug or add new feature, You will need to fork this repository. 33 | 34 | #### Forking the repository. 35 | If this is your first contribution, you will first need to "fork" the SpeechHistoryExplorer repository on github: 36 | 37 | 1. Fork this repo in your github account. 38 | 2. Clone your forked repo locally: "git clone yourRepoUrl". 39 | 3. Add this repo in your forked repo from the command line: 40 | "git remote add davidacm https://github.com/davidacm/SpeechHistoryExplorer.git". 41 | 4. fetch my branches: 42 | "git fetch davidacm". 43 | 5. Switch to the local SPE branch: "git checkout SPE". 44 | 6. Set the local SPE to use the davidacm SPE as its upstream: 45 | "git branch -u davidacm/SPE". 46 | 47 | #### Steps before coding. 48 | You must use a separate "topic" branch for each issue or feature. All code should usually be based on the latest commit in the official SPE branch at the time you start the work. 49 | So, before begin to work, do the following: 50 | 51 | 1. Remember the steps of "Forking the repository" section. 52 | 2. Checkout to SPE branch: "git checkout SPE". 53 | 3. Update the local SPE: "git pull". 54 | 4. Create a new branch based on the updated SPE branch: "git checkout -b YourNewBranch". 55 | 5. write your code. 56 | 6. Add your work to be commited (clean unwanted files first): git "add ." 57 | 7. create a commit: "git commit" and write the commit message. 58 | 8. push your branch in your repository: "git push". if the branch doesn't exist, git will tell you how to deal with this. 59 | 9. Request a pull request on my repository. 60 | 61 | Note: the main branch is called SPE. That's because this is a repo, and I prefer to use the SPE branch. The master branch will be used to integrate important changes from the original forked repository. 62 | -------------------------------------------------------------------------------- /sconstruct: -------------------------------------------------------------------------------- 1 | # NVDA add-on template SCONSTRUCT file 2 | # Copyright (C) 2012-2023 Rui Batista, Noelia Martinez, Joseph Lee 3 | # This file is covered by the GNU General Public License. 4 | # See the file COPYING.txt for more details. 5 | 6 | import codecs 7 | import gettext 8 | import os 9 | import os.path 10 | import zipfile 11 | import sys 12 | 13 | # While names imported below are available by default in every SConscript 14 | # Linters aren't aware about them. 15 | # To avoid Flake8 F821 warnings about them they are imported explicitly. 16 | # When using other Scons functions please add them to the line below. 17 | from SCons.Script import BoolVariable, Builder, Copy, Environment, Variables 18 | 19 | sys.dont_write_bytecode = True 20 | 21 | # Bytecode should not be written for build vars module to keep the repository root folder clean. 22 | import buildVars # NOQA: E402 23 | 24 | 25 | def md2html(source, dest): 26 | import markdown 27 | # Use extensions if defined. 28 | mdExtensions = buildVars.markdownExtensions 29 | lang = os.path.basename(os.path.dirname(source)).replace('_', '-') 30 | localeLang = os.path.basename(os.path.dirname(source)) 31 | try: 32 | _ = gettext.translation("nvda", localedir=os.path.join("addon", "locale"), languages=[localeLang]).gettext 33 | summary = _(buildVars.addon_info["addon_summary"]) 34 | except Exception: 35 | summary = buildVars.addon_info["addon_summary"] 36 | title = "{addonSummary} {addonVersion}".format( 37 | addonSummary=summary, addonVersion=buildVars.addon_info["addon_version"] 38 | ) 39 | headerDic = { 40 | "[[!meta title=\"": "# ", 41 | "\"]]": " #", 42 | } 43 | with codecs.open(source, "r", "utf-8") as f: 44 | mdText = f.read() 45 | for k, v in headerDic.items(): 46 | mdText = mdText.replace(k, v, 1) 47 | htmlText = markdown.markdown(mdText, extensions=mdExtensions) 48 | # Optimization: build resulting HTML text in one go instead of writing parts separately. 49 | docText = "\n".join([ 50 | "", 51 | "" % lang, 52 | "", 53 | "" 54 | "", 55 | "", 56 | "%s" % title, 57 | "\n", 58 | htmlText, 59 | "\n" 60 | ]) 61 | with codecs.open(dest, "w", "utf-8") as f: 62 | f.write(docText) 63 | 64 | 65 | def mdTool(env): 66 | mdAction = env.Action( 67 | lambda target, source, env: md2html(source[0].path, target[0].path), 68 | lambda target, source, env: 'Generating % s' % target[0], 69 | ) 70 | mdBuilder = env.Builder( 71 | action=mdAction, 72 | suffix='.html', 73 | src_suffix='.md', 74 | ) 75 | env['BUILDERS']['markdown'] = mdBuilder 76 | 77 | 78 | def validateVersionNumber(key, val, env): 79 | # Used to make sure version major.minor.patch are integers to comply with NV Access add-on store. 80 | # Ignore all this if version number is not specified, in which case json generator will validate this info. 81 | if val == "0.0.0": 82 | return 83 | versionNumber = val.split(".") 84 | if len(versionNumber) < 3: 85 | raise ValueError("versionNumber must have three parts (major.minor.patch)") 86 | if not all([part.isnumeric() for part in versionNumber]): 87 | raise ValueError("versionNumber (major.minor.patch) must be integers") 88 | 89 | 90 | vars = Variables() 91 | vars.Add("version", "The version of this build", buildVars.addon_info["addon_version"]) 92 | vars.Add("versionNumber", "Version number of the form major.minor.patch", "0.0.0", validateVersionNumber) 93 | vars.Add(BoolVariable("dev", "Whether this is a daily development version", False)) 94 | vars.Add("channel", "Update channel for this build", buildVars.addon_info["addon_updateChannel"]) 95 | 96 | env = Environment(variables=vars, ENV=os.environ, tools=['gettexttool', mdTool]) 97 | env.Append(**buildVars.addon_info) 98 | 99 | if env["dev"]: 100 | import datetime 101 | buildDate = datetime.datetime.now() 102 | year, month, day = str(buildDate.year), str(buildDate.month), str(buildDate.day) 103 | versionTimestamp = "".join([year, month.zfill(2), day.zfill(2)]) 104 | env["addon_version"] = f"{versionTimestamp}-dev" 105 | env["versionNumber"] = f"{versionTimestamp}.0.0" 106 | env["channel"] = "dev" 107 | elif env["version"] is not None: 108 | env["addon_version"] = env["version"] 109 | if "channel" in env and env["channel"] is not None: 110 | env["addon_updateChannel"] = env["channel"] 111 | 112 | buildVars.addon_info["addon_version"] = env["addon_version"] 113 | buildVars.addon_info["addon_updateChannel"] = env["addon_updateChannel"] 114 | 115 | addonFile = env.File("${addon_name}-${addon_version}.nvda-addon") 116 | 117 | 118 | def addonGenerator(target, source, env, for_signature): 119 | action = env.Action( 120 | lambda target, source, env: createAddonBundleFromPath(source[0].abspath, target[0].abspath) and None, 121 | lambda target, source, env: "Generating Addon %s" % target[0] 122 | ) 123 | return action 124 | 125 | 126 | def manifestGenerator(target, source, env, for_signature): 127 | action = env.Action( 128 | lambda target, source, env: generateManifest(source[0].abspath, target[0].abspath) and None, 129 | lambda target, source, env: "Generating manifest %s" % target[0] 130 | ) 131 | return action 132 | 133 | 134 | def translatedManifestGenerator(target, source, env, for_signature): 135 | dir = os.path.abspath(os.path.join(os.path.dirname(str(source[0])), "..")) 136 | lang = os.path.basename(dir) 137 | action = env.Action( 138 | lambda target, source, env: generateTranslatedManifest(source[1].abspath, lang, target[0].abspath) and None, 139 | lambda target, source, env: "Generating translated manifest %s" % target[0] 140 | ) 141 | return action 142 | 143 | 144 | env['BUILDERS']['NVDAAddon'] = Builder(generator=addonGenerator) 145 | env['BUILDERS']['NVDAManifest'] = Builder(generator=manifestGenerator) 146 | env['BUILDERS']['NVDATranslatedManifest'] = Builder(generator=translatedManifestGenerator) 147 | 148 | 149 | def createAddonHelp(dir): 150 | docsDir = os.path.join(dir, "doc") 151 | if os.path.isfile("style.css"): 152 | cssPath = os.path.join(docsDir, "style.css") 153 | cssTarget = env.Command(cssPath, "style.css", Copy("$TARGET", "$SOURCE")) 154 | env.Depends(addon, cssTarget) 155 | if os.path.isfile("readme.md"): 156 | readmePath = os.path.join(docsDir, buildVars.baseLanguage, "readme.md") 157 | readmeTarget = env.Command(readmePath, "readme.md", Copy("$TARGET", "$SOURCE")) 158 | env.Depends(addon, readmeTarget) 159 | 160 | 161 | def createAddonBundleFromPath(path, dest): 162 | """ Creates a bundle from a directory that contains an addon manifest file.""" 163 | basedir = os.path.abspath(path) 164 | with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) as z: 165 | # FIXME: the include/exclude feature may or may not be useful. Also python files can be pre-compiled. 166 | for dir, dirnames, filenames in os.walk(basedir): 167 | relativePath = os.path.relpath(dir, basedir) 168 | for filename in filenames: 169 | pathInBundle = os.path.join(relativePath, filename) 170 | absPath = os.path.join(dir, filename) 171 | if pathInBundle not in buildVars.excludedFiles: 172 | z.write(absPath, pathInBundle) 173 | createAddonStoreJson(dest) 174 | return dest 175 | 176 | 177 | def createAddonStoreJson(bundle): 178 | """Creates add-on store JSON file from an add-on package and manifest data.""" 179 | import json 180 | import hashlib 181 | # Set different json file names and version number properties based on version number parsing results. 182 | if env["versionNumber"] == "0.0.0": 183 | env["versionNumber"] = buildVars.addon_info["addon_version"] 184 | versionNumberParsed = env["versionNumber"].split(".") 185 | if all([part.isnumeric() for part in versionNumberParsed]): 186 | if len(versionNumberParsed) == 1: 187 | versionNumberParsed += ["0", "0"] 188 | elif len(versionNumberParsed) == 2: 189 | versionNumberParsed.append("0") 190 | else: 191 | versionNumberParsed = [] 192 | if len(versionNumberParsed): 193 | major, minor, patch = [int(part) for part in versionNumberParsed] 194 | jsonFilename = f'{major}.{minor}.{patch}.json' 195 | else: 196 | jsonFilename = f'{buildVars.addon_info["addon_version"]}.json' 197 | major, minor, patch = 0, 0, 0 198 | print('Generating % s' % jsonFilename) 199 | sha256 = hashlib.sha256() 200 | with open(bundle, "rb") as f: 201 | for byte_block in iter(lambda: f.read(65536), b""): 202 | sha256.update(byte_block) 203 | hashValue = sha256.hexdigest() 204 | try: 205 | minimumNVDAVersion = buildVars.addon_info["addon_minimumNVDAVersion"].split(".") 206 | except AttributeError: 207 | minimumNVDAVersion = [0, 0, 0] 208 | minMajor, minMinor = minimumNVDAVersion[:2] 209 | minPatch = minimumNVDAVersion[-1] if len(minimumNVDAVersion) == 3 else "0" 210 | try: 211 | lastTestedNVDAVersion = buildVars.addon_info["addon_lastTestedNVDAVersion"].split(".") 212 | except AttributeError: 213 | lastTestedNVDAVersion = [0, 0, 0] 214 | lastTestedMajor, lastTestedMinor = lastTestedNVDAVersion[:2] 215 | lastTestedPatch = lastTestedNVDAVersion[-1] if len(lastTestedNVDAVersion) == 3 else "0" 216 | channel = buildVars.addon_info["addon_updateChannel"] 217 | if channel is None: 218 | channel = "stable" 219 | addonStoreEntry = { 220 | "addonId": buildVars.addon_info["addon_name"], 221 | "displayName": buildVars.addon_info["addon_summary"], 222 | "URL": "", 223 | "description": buildVars.addon_info["addon_description"], 224 | "sha256": hashValue, 225 | "homepage": buildVars.addon_info["addon_url"], 226 | "addonVersionName": buildVars.addon_info["addon_version"], 227 | "addonVersionNumber": { 228 | "major": major, 229 | "minor": minor, 230 | "patch": patch 231 | }, 232 | "minNVDAVersion": { 233 | "major": int(minMajor), 234 | "minor": int(minMinor), 235 | "patch": int(minPatch) 236 | }, 237 | "lastTestedVersion": { 238 | "major": int(lastTestedMajor), 239 | "minor": int(lastTestedMinor), 240 | "patch": int(lastTestedPatch) 241 | }, 242 | "channel": channel, 243 | "publisher": "", 244 | "sourceURL": buildVars.addon_info["addon_sourceURL"], 245 | "license": buildVars.addon_info["addon_license"], 246 | "licenseURL": buildVars.addon_info["addon_licenseURL"], 247 | } 248 | with open(jsonFilename, "w") as addonStoreJson: 249 | json.dump(addonStoreEntry, addonStoreJson, indent="\t") 250 | 251 | 252 | def generateManifest(source, dest): 253 | addon_info = buildVars.addon_info 254 | with codecs.open(source, "r", "utf-8") as f: 255 | manifest_template = f.read() 256 | manifest = manifest_template.format(**addon_info) 257 | with codecs.open(dest, "w", "utf-8") as f: 258 | f.write(manifest) 259 | 260 | 261 | def generateTranslatedManifest(source, language, out): 262 | _ = gettext.translation("nvda", localedir=os.path.join("addon", "locale"), languages=[language]).gettext 263 | vars = {} 264 | for var in ("addon_summary", "addon_description"): 265 | vars[var] = _(buildVars.addon_info[var]) 266 | with codecs.open(source, "r", "utf-8") as f: 267 | manifest_template = f.read() 268 | result = manifest_template.format(**vars) 269 | with codecs.open(out, "w", "utf-8") as f: 270 | f.write(result) 271 | 272 | 273 | def expandGlobs(files): 274 | return [f for pattern in files for f in env.Glob(pattern)] 275 | 276 | 277 | addon = env.NVDAAddon(addonFile, env.Dir('addon')) 278 | 279 | langDirs = [f for f in env.Glob(os.path.join("addon", "locale", "*"))] 280 | 281 | # Allow all NVDA's gettext po files to be compiled in source/locale, and manifest files to be generated 282 | for dir in langDirs: 283 | poFile = dir.File(os.path.join("LC_MESSAGES", "nvda.po")) 284 | moFile = env.gettextMoFile(poFile) 285 | env.Depends(moFile, poFile) 286 | translatedManifest = env.NVDATranslatedManifest( 287 | dir.File("manifest.ini"), 288 | [moFile, os.path.join("manifest-translated.ini.tpl")] 289 | ) 290 | env.Depends(translatedManifest, ["buildVars.py"]) 291 | env.Depends(addon, [translatedManifest, moFile]) 292 | 293 | pythonFiles = expandGlobs(buildVars.pythonSources) 294 | for file in pythonFiles: 295 | env.Depends(addon, file) 296 | 297 | # Convert markdown files to html 298 | # We need at least doc in English and should enable the Help button for the add-on in Add-ons Manager 299 | createAddonHelp("addon") 300 | for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')): 301 | htmlFile = env.markdown(mdFile) 302 | env.Depends(htmlFile, mdFile) 303 | env.Depends(addon, htmlFile) 304 | 305 | # Pot target 306 | i18nFiles = expandGlobs(buildVars.i18nSources) 307 | gettextvars = { 308 | 'gettext_package_bugs_address': 'nvda-translations@groups.io', 309 | 'gettext_package_name': buildVars.addon_info['addon_name'], 310 | 'gettext_package_version': buildVars.addon_info['addon_version'] 311 | } 312 | 313 | pot = env.gettextPotFile("${addon_name}.pot", i18nFiles, **gettextvars) 314 | env.Alias('pot', pot) 315 | env.Depends(pot, i18nFiles) 316 | mergePot = env.gettextMergePotFile("${addon_name}-merge.pot", i18nFiles, **gettextvars) 317 | env.Alias('mergePot', mergePot) 318 | env.Depends(mergePot, i18nFiles) 319 | 320 | # Generate Manifest path 321 | manifest = env.NVDAManifest(os.path.join("addon", "manifest.ini"), os.path.join("manifest.ini.tpl")) 322 | # Ensure manifest is rebuilt if buildVars is updated. 323 | env.Depends(manifest, "buildVars.py") 324 | 325 | env.Depends(addon, manifest) 326 | env.Default(addon) 327 | env.Clean(addon, ['.sconsign.dblite', 'addon/doc/' + buildVars.baseLanguage + '/']) 328 | -------------------------------------------------------------------------------- /addon/globalPlugins/speechHistoryExplorer/__init__.py: -------------------------------------------------------------------------------- 1 | # NVDA Add-on: Speech History Explorer 2 | # Copyright (C) 2022 - 2023 David CM 3 | # Copyright (C) 2015-2021 James Scholes 4 | # Copyright (C) 2012 Tyler Spivey 5 | 6 | # This add-on is free software, licensed under the terms of the GNU General Public License (version 2). 7 | # See the file LICENSE for more details. 8 | 9 | import addonHandler, api, globalPluginHandler, gui, speech, speechViewer, tones, versionInfo, weakref, wx 10 | from collections import deque 11 | try: 12 | from eventHandler import FocusLossCancellableSpeechCommand 13 | except ImportError: 14 | # For older versions where this class does not exist 15 | pass 16 | from gui import guiHelper, nvdaControls 17 | from gui.dpiScalingHelper import DpiScalingHelperMixin, DpiScalingHelperMixinWithoutInit 18 | from queueHandler import eventQueue, queueFunction 19 | from scriptHandler import script 20 | 21 | addonHandler.initTranslation() 22 | 23 | BUILD_YEAR = getattr(versionInfo, 'version_year', 2021) 24 | 25 | 26 | from ._configHelper import configSpec, registerConfig 27 | @configSpec('speechHistoryExplorer') 28 | class AppConfig: 29 | maxHistoryLength = 'integer(default=500)' 30 | trimWhitespaceFromStart = 'boolean(default=false)' 31 | trimWhitespaceFromEnd = 'boolean(default=true)' 32 | beepWhenPerformingActions = 'boolean(default=true)' 33 | beepPanning = 'boolean(default=true)' 34 | AF = registerConfig(AppConfig) 35 | 36 | 37 | # a static class for ease of beeping tones. This may be used to change beeps to wave sounds. 38 | class beep: 39 | center, left, right = (100, 100), (100, 0), (0, 100) 40 | def beep(direction=(100,100), freq=220, length=100): 41 | tones.beep(freq, length, *direction) 42 | 43 | 44 | class GlobalPlugin(globalPluginHandler.GlobalPlugin): 45 | # Translators: script category for add-on gestures. 46 | scriptCategory = _("Speech History Explorer") 47 | 48 | def __init__(self, *args, **kwargs): 49 | super().__init__(*args, **kwargs) 50 | gui.settingsDialogs.NVDASettingsDialog.categoryClasses.append(speechHistoryExplorerSettingsPanel) 51 | 52 | self._history = deque(maxlen = AF.maxHistoryLength) 53 | self._patch() 54 | 55 | def _patch(self): 56 | if BUILD_YEAR >= 2021: 57 | self.oldSpeak = speech.speech.speak 58 | speech.speech.speak = self.mySpeak 59 | else: 60 | self.oldSpeak = speech.speak 61 | speech.speak = self.mySpeak 62 | 63 | @script( 64 | # Translators: Documentation string for copy currently selected speech history Explorer item script 65 | _('Copy the currently selected speech history Explorer item to the clipboard, which by default will be the most recently spoken text by NVDA.'), 66 | gesture = "kb:nvda+control+f12" 67 | ) 68 | def script_copyLast(self, gesture): 69 | text = self.getSequenceText(self._history[self.history_pos]) 70 | if AF.trimWhitespaceFromStart: 71 | text = text.lstrip() 72 | if AF.trimWhitespaceFromEnd: 73 | text = text.rstrip() 74 | if api.copyToClip(text) and AF.beepWhenPerformingActions: 75 | beep.beep(beep.center, 1500, 120) 76 | 77 | @script( 78 | # Translators: Documentation string for previous speech history Explorer item script 79 | _('Review the previous item in NVDA\'s speech history.'), 80 | gesture = "kb:nvda+shift+f11" 81 | ) 82 | def script_prevString(self, gesture): 83 | self.history_pos += 1 84 | if self.history_pos > len(self._history) - 1: 85 | if AF.beepWhenPerformingActions: 86 | if AF.beepPanning: 87 | beep.beep(beep.left) 88 | else: 89 | beep.beep() 90 | self.history_pos -= 1 91 | self.oldSpeak(self._history[self.history_pos]) 92 | 93 | @script( 94 | # Translators: Documentation string for next speech history Explorer item script 95 | _('Review the next item in NVDA\'s speech history.'), 96 | gesture = "kb:nvda+shift+f12" 97 | ) 98 | def script_nextString(self, gesture): 99 | self.history_pos -= 1 100 | if self.history_pos < 0: 101 | if AF.beepWhenPerformingActions: 102 | if AF.beepPanning: 103 | beep.beep(beep.right) 104 | else: 105 | beep.beep() 106 | self.history_pos += 1 107 | self.oldSpeak(self._history[self.history_pos]) 108 | 109 | @script( 110 | # Translators: Documentation string for show in a dialog all recent items spoken by NVDA. 111 | _('Opens a dialog showing all most recent items spoken by NVDA'), 112 | gesture = "kb:nvda+alt+f12" 113 | ) 114 | def script_showHistorial(self, gesture): 115 | gui.mainFrame.prePopup() 116 | d = HistoryDialog(gui.mainFrame, self) 117 | d.Show() 118 | d.Raise() 119 | gui.mainFrame.postPopup() 120 | 121 | def terminate(self, *args, **kwargs): 122 | super().terminate(*args, **kwargs) 123 | if BUILD_YEAR >= 2021: 124 | speech.speech.speak = self.oldSpeak 125 | else: 126 | speech.speak = self.oldSpeak 127 | gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(speechHistoryExplorerSettingsPanel) 128 | 129 | def append_to_history(self, seq): 130 | try: 131 | seq = [command for command in seq if not isinstance(command, FocusLossCancellableSpeechCommand)] 132 | except NameError: # if FocusLossCancellableSpeechCommand does not exist 133 | pass 134 | self._history.appendleft(seq) 135 | self.history_pos = 0 136 | 137 | def mySpeak(self, sequence, *args, **kwargs): 138 | self.oldSpeak(sequence, *args, **kwargs) 139 | text = self.getSequenceText(sequence) 140 | if text.strip(): 141 | queueFunction(eventQueue, self.append_to_history, sequence) 142 | 143 | def getSequenceText(self, sequence): 144 | return speechViewer.SPEECH_ITEM_SEPARATOR.join([x for x in sequence if isinstance(x, str)]) 145 | 146 | def clearHistory(self): 147 | self._history.clear() 148 | self.history_pos = 0 149 | 150 | 151 | class speechHistoryExplorerSettingsPanel(gui.settingsDialogs.SettingsPanel): 152 | # Translators: the label/title for the Speech History Explorer settings panel. 153 | title = _('Speech History Explorer') 154 | 155 | def makeSettings(self, settingsSizer): 156 | helper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) 157 | # Translators: the label for the preference to choose the maximum number of stored history entries 158 | maxHistoryLengthLabelText = _('&Maximum number of history entries (requires NVDA restart to take effect)') 159 | self.maxHistoryLengthEdit = helper.addLabeledControl(maxHistoryLengthLabelText, nvdaControls.SelectOnFocusSpinCtrl, min=1, max=5000, initial=AF.maxHistoryLength) 160 | # Translators: the label for the preference to trim whitespace from the start of text 161 | self.trimWhitespaceFromStartCB = helper.addItem(wx.CheckBox(self, label=_('Trim whitespace from &start when copying text'))) 162 | self.trimWhitespaceFromStartCB.SetValue(AF.trimWhitespaceFromStart) 163 | # Translators: the label for the preference to trim whitespace from the end of text 164 | self.trimWhitespaceFromEndCB = helper.addItem(wx.CheckBox(self, label=_('Trim whitespace from &end when copying text'))) 165 | self.trimWhitespaceFromEndCB.SetValue(AF.trimWhitespaceFromEnd) 166 | # Translators: Beep or not when actions are taken 167 | self.beepWhenPerformingActionscb = helper.addItem(wx.CheckBox(self, label=_('Beep when performing actions'))) 168 | self.beepWhenPerformingActionscb.SetValue(AF.beepWhenPerformingActions) 169 | # Translators: beep panned to the left or right if there are not more older or newer elements 170 | self.beepPanning = helper.addItem(wx.CheckBox(self, label=_('Beep left or right when no more older or newer elements are available'))) 171 | self.beepPanning.SetValue(AF.beepPanning) 172 | 173 | 174 | def onSave(self): 175 | AF.maxHistoryLength = self.maxHistoryLengthEdit.GetValue() 176 | AF.trimWhitespaceFromStart = self.trimWhitespaceFromStartCB.GetValue() 177 | AF.trimWhitespaceFromEnd = self.trimWhitespaceFromEndCB.GetValue() 178 | AF.beepWhenPerformingActions = self.beepWhenPerformingActionscb.GetValue() 179 | AF.beepPanning = self.beepPanning.GetValue() 180 | 181 | 182 | class HistoryDialog( 183 | DpiScalingHelperMixinWithoutInit, 184 | wx.Dialog # wxPython does not seem to call base class initializer, put last in MRO 185 | ): 186 | @classmethod 187 | def _instance(cls): 188 | """ type: () -> HistoryDialog 189 | return None until this is replaced with a weakref.ref object. Then the instance is retrieved 190 | with by treating that object as a callable. 191 | """ 192 | return None 193 | 194 | helpId = "speechHistoryExplorerElementsList" 195 | 196 | def __new__(cls, *args, **kwargs): 197 | instance = HistoryDialog._instance() 198 | if instance is None: 199 | return super(HistoryDialog, cls).__new__(cls, *args, **kwargs) 200 | return instance 201 | 202 | def __init__(self, parent, addon): 203 | if HistoryDialog._instance() is not None: 204 | self.updateHistory() 205 | return 206 | HistoryDialog._instance = weakref.ref(self) 207 | # Translators: The title of the history elements Dialog 208 | title = _("Speech history items") 209 | super().__init__( 210 | parent, 211 | title=title, 212 | style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX, 213 | ) 214 | # hte add-on instance 215 | self.addon = addon 216 | # the original speech history messages list. 217 | self.history = None 218 | # the results of a search, initially equals to history 219 | self.searchHistory = None 220 | # indexes of search, to save the selected item in a specific search. 221 | self.searches = {"": 0} 222 | # the current search, initially "". 223 | self.curSearch = "" 224 | # the indexes of items selected. 225 | self.selection = set() 226 | 227 | szMain = guiHelper.BoxSizerHelper(self, sizer=wx.BoxSizer(wx.VERTICAL)) 228 | szCurrent = guiHelper.BoxSizerHelper(self, sizer=wx.BoxSizer(wx.HORIZONTAL)) 229 | szBottom = guiHelper.BoxSizerHelper(self, sizer=wx.BoxSizer(wx.HORIZONTAL)) 230 | 231 | # Translators: the label for the search text field in the speech history Explorer add-on. 232 | self.searchTextFiel = szMain.addLabeledControl(_("&Search"), 233 | wx.TextCtrl, 234 | style =wx.TE_PROCESS_ENTER 235 | ) 236 | self.searchTextFiel.Bind(wx.EVT_TEXT_ENTER, self.onSearch) 237 | self.searchTextFiel.Bind(wx.EVT_KILL_FOCUS, self.onSearch) 238 | 239 | # Translators: the label for the history elements list in the speech history Explorer add-on. 240 | entriesLabel = _("History list") 241 | self.historyList = nvdaControls.AutoWidthColumnListCtrl( 242 | parent=self, 243 | autoSizeColumn=1, 244 | style=wx.LC_REPORT|wx.LC_NO_HEADER 245 | ) 246 | 247 | szMain.addItem( 248 | self.historyList, 249 | flag=wx.EXPAND, 250 | proportion=4 251 | ) 252 | # This list consists of only one column. 253 | # The provided column header is just a placeholder, as it is hidden due to the wx.LC_NO_HEADER style flag. 254 | self.historyList.InsertColumn(0, entriesLabel) 255 | self.historyList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onSelect) 256 | self.historyList.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onDeselect) 257 | 258 | # a multiline text field containing the text from the current selected element. 259 | self.currentTextElement = szCurrent.addItem( 260 | wx.TextCtrl(self, style =wx.TE_MULTILINE|wx.TE_READONLY), 261 | flag=wx.EXPAND, 262 | proportion=1 263 | ) 264 | 265 | # Translators: the label for the copy button in the speech history Explorer add-on. 266 | self.copyButton = szCurrent.addItem(wx.Button(self, label=_("&Copy item")), proportion=0) 267 | self.copyButton.Bind(wx.EVT_BUTTON, self.onCopy) 268 | szMain.addItem( 269 | szCurrent.sizer, 270 | border=guiHelper.BORDER_FOR_DIALOGS, 271 | flag = wx.EXPAND, 272 | proportion=1, 273 | ) 274 | 275 | szMain.addItem( 276 | wx.StaticLine(self), 277 | border=guiHelper.BORDER_FOR_DIALOGS, 278 | flag=wx.ALL | wx.EXPAND 279 | ) 280 | 281 | # Translators: the label for the copy all button in the speech history Explorer add-on. This is based on the current search. 282 | self.copyAllButton = szBottom.addItem(wx.Button(self, label=_("Copy &all"))) 283 | self.copyAllButton.Bind(wx.EVT_BUTTON, self.onCopyAll) 284 | 285 | # Translators: the label for the clear history button in the speech history Explorer add-on. This button clean all items in the historial, both in the dialog and in the add-on. 286 | self.clearHistoryButton = szBottom.addItem(wx.Button(self, label=_("C&lean history"))) 287 | self.clearHistoryButton.Bind(wx.EVT_BUTTON, self.onClear) 288 | 289 | # Translators: the label for the refresh history button in the speech history Explorer add-on. This button updates the list item with the new history elements. 290 | self.refreshButton = szBottom.addItem(wx.Button(self, label=_("&Refresh history"))) 291 | self.refreshButton.Bind(wx.EVT_BUTTON, self.onRefresh) 292 | 293 | # Translators: The label of a button to close the speech history dialog. 294 | closeButton = wx.Button(self, label=_("C&lose"), id=wx.ID_CLOSE) 295 | closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) 296 | szBottom.addItem(closeButton) 297 | self.Bind(wx.EVT_CLOSE, self.onClose) 298 | self.EscapeId = wx.ID_CLOSE 299 | 300 | szMain.addItem( 301 | szBottom.sizer, 302 | border=guiHelper.BORDER_FOR_DIALOGS, 303 | flag=wx.ALL | wx.EXPAND, 304 | proportion=1, 305 | ) 306 | szMain = szMain.sizer 307 | szMain.Fit(self) 308 | self.SetSizer(szMain) 309 | self.updateHistory() 310 | 311 | self.SetMinSize(szMain.GetMinSize()) 312 | # Historical initial size, result of L{self.historyList} being (550, 350) 313 | # Setting an initial size on L{self.historyList} by passing a L{size} argument when 314 | # creating the control would also set its minimum size and thus block the dialog from being shrunk. 315 | self.SetSize(self.scaleSize((763, 509))) 316 | self.CentreOnScreen() 317 | self.historyList.SetFocus() 318 | 319 | def updateHistory(self): 320 | self.selection = set() 321 | self.history = [self.addon.getSequenceText(k) for k in self.addon._history] 322 | self.doSearch(self.curSearch) 323 | 324 | def doSearch(self, text=""): 325 | self.selection = set() 326 | if not text: 327 | self.searchHistory = self.history 328 | else: 329 | self.searchHistory = [k for k in self.searchHistory if text in k.lower()] 330 | self.historyList.DeleteAllItems() 331 | self.currentTextElement.SetValue("") 332 | for k in self.searchHistory: self.historyList.Append((k[0:100],)) 333 | if len(self.searchHistory) >0: 334 | index = self.searches.get(text, 0) 335 | self.historyList.Select(index, on=1) 336 | self.historyList.SetItemState(index,wx.LIST_STATE_FOCUSED,wx.LIST_STATE_FOCUSED) 337 | 338 | def updateSelection(self): 339 | self.currentTextElement.SetValue(self.itemsToString(sorted(self.selection))) 340 | 341 | def itemsToString(self, items): 342 | s = "" 343 | for k in items: 344 | s += self.searchHistory[k] +"\n" 345 | if s: s= s[0:-1] 346 | return s 347 | 348 | def onSearch(self, evt): 349 | t = self.searchTextFiel.GetValue().lower() 350 | if t == self.curSearch: return 351 | index = self.historyList.GetFocusedItem() 352 | if index < 0: index = 0 353 | self.searches[self.curSearch] = index 354 | self.curSearch = t 355 | self.doSearch(t) 356 | 357 | def onClose(self,evt): 358 | self.DestroyChildren() 359 | self.Destroy() 360 | 361 | def onCopy(self,evt): 362 | t = self.currentTextElement.GetValue() 363 | if t: 364 | if api.copyToClip(t): 365 | tones.beep(duration=120) 366 | 367 | def onCopyAll(self, evt): 368 | t = self.itemsToString(range(0, len(self.searchHistory))) 369 | if t and api.copyToClip(t): 370 | tones.beep(1500, 120) 371 | 372 | def onClear(self, evt): 373 | self.addon.clearHistory() 374 | self.searches = {"":0} 375 | self.Close() 376 | 377 | def onRefresh(self, evt): 378 | self.updateHistory() 379 | 380 | def onSelect(self, evt): 381 | index=evt.GetIndex() 382 | self.selection.add(index) 383 | self.updateSelection() 384 | 385 | def onDeselect(self, evt): 386 | index=evt.GetIndex() 387 | self.selection.remove(index) 388 | self.updateSelection() 389 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------