Develop and Download Open Source Software

Browse Subversion Repository

Contents of /sandbox/website/devDocs/devDocs.ja.po

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations) (download)
Mon Feb 10 11:37:27 2014 UTC (10 years, 1 month ago) by nishimoto
File size: 62805 byte(s)
updated devDocs
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: devDocs\n"
9 "POT-Creation-Date: 2014-01-12 22:25+0000\n"
10 "PO-Revision-Date: 2014-01-28 22:21+0900\n"
11 "Last-Translator: Takuya Nishimoto <nishimotz@gmail.com>, Kojiro Kuyo <kuyo@bitstoyama.com>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "X-Generator: Poedit 1.5.7\n"
17
18 #. type: Plain text
19 #, no-wrap
20 msgid "[[!meta title=\"NVDA Add-on Development Guide\"]]\n"
21 msgstr "[[!meta title=\"NVDA Add-on 開発者ガイド\"]]\n"
22
23 #. type: Plain text
24 msgid ""
25 "Welcome to NVDA add-on Development Guide. This is the one-stop guide on how "
26 "NvDA add-ons are developed, as well as explaining some useful code segments "
27 "from NvDA core source code useful when writing add-ons."
28 msgstr ""
29 "NVDAアドオン開発者ガイドへようこそ。このガイドは、アドオンを製作する時に役に"
30 "立つNVDAコアのソースコード・セグメントについて解説 すると同時に、NVDAアドオン"
31 "の開発方法について記述したワンステップガイドです。"
32
33 #. type: Plain text
34 msgid ""
35 "For more information on NVDA development, please visit [NvDA Community "
36 "Development page][1]. Be sure to go over [NVDA Developer Guide][2] to "
37 "familiarize yourself with key terms and basics on getting started with add-"
38 "on development."
39 msgstr ""
40 "NVDA開発について詳細は、[NvDA開発コミュニティーのページ][1]をご覧ください。ア"
41 "ドオンの開発を始めるために重要事項と基本に慣れるために[NVDA開発者ガイド][2]を"
42 "必ずよくお読みください。"
43
44 #. type: Title ##
45 #, no-wrap
46 msgid "Audience"
47 msgstr "対象者"
48
49 #. type: Plain text
50 msgid ""
51 "This guide is designed for both beginners who are new to Python and/or NVDA "
52 "development in general, as well as experts and power users and programmers "
53 "who are familiar with Python or other programming languages and/or familiar "
54 "with NvDA source code structure."
55 msgstr ""
56 "このガイドは、Python及びその他のプログラム言語に精通している方や、NvDAソース"
57 "コードの構造に精通しているエキスパート、パワーユーザー、及びプログラマはもち"
58 "ろんのこと、一般のPythonユーザー、またはNVDA開発をするのは初めてというビギ"
59 "ナーの両者のために書かれています。"
60
61 #. type: Plain text
62 msgid ""
63 "If you are new to NVDA add-on or core development, we recommend that you get "
64 "to know Python first, as it gives necessary programming background for "
65 "understanding the rest of the guide. If you are a Python programmer but are "
66 "new to NvDA development, please checkout NVDA development Guide and Design "
67 "Overview document, both of which can be found on the NVDA Community website."
68 msgstr ""
69 "もしNVDAアドオンまたはコアの開発をするのが初めてならば、このガイドを理解する"
70 "ため、まず最初に、そのプログラミングバックグラウンドであるPythonを理解される"
71 "ことをお勧めします。あなたがPythonプログラマであるけれどもNvDAの開発をするの"
72 "が初めてならば、チェックアウトNVDA開発者ガイドと設計概要を文書化した(両方が"
73 "NVDAコミュニティのウェブサイト上に掲載されています)。"
74
75 #. type: Title ###
76 #, no-wrap
77 msgid "Authors, contributions and copyright"
78 msgstr "作者、貢献者と著作権"
79
80 #. type: Plain text
81 msgid ""
82 "This guide was originally written by Joseph Lee and is shaped by NVDA user "
83 "and developer community. We welcome your feedback and contributionn."
84 msgstr ""
85 "このガイドはジョセフ・リーによって書かれ、NVDAユーザと開発コミュニティによっ"
86 "てまとめられます。私達はあなたのフィードバックと貢献を歓迎します。"
87
88 #. type: Plain text
89 msgid ""
90 "Copyright: NVDA is copyright 2006-2013 NV Access. Microsoft Windows, "
91 "Microsoft Office, Win32 API and other MS products are copyright Microsoft "
92 "Corporation. IAccessible package is copyright IBM and Linux Foundation. "
93 "Python is copyright Python Foundation. Other products mentioned are "
94 "copyrighted by authors of these products."
95 msgstr ""
96 "著作権: NVDA is copyright 2006-2013 NV Access. Microsoft Windows、Microsoft "
97 "Office、Win32 API、および他のMS製品の著作権はMicrosoft Corporationに帰属しま"
98 "す。IAccessibleパッケージの著作権はIBM及びLinux財団に帰属します。Pythonの著作"
99 "権はPython Foundationに帰属します。その他製品の著作権は各製品の作者に帰属しま"
100 "す。"
101
102 #. type: Title ##
103 #, no-wrap
104 msgid "System requirements"
105 msgstr "システム用件"
106
107 #. type: Plain text
108 msgid ""
109 "To create an add-on for NVDA, please make sure the following system "
110 "requirements are met:"
111 msgstr ""
112 "NVDAアドオンを作成するためには、以下のシステム用件を満たしていることをご確認"
113 "ください:"
114
115 #. type: Bullet: '* '
116 msgid ""
117 "A version of NVDA is available on your computer (either a portable or "
118 "installed version will work, but we strongly recommend that you install a "
119 "copy of NVDA on your development computer)."
120 msgstr ""
121 "NVDAのバージョンは、ポータブル版、インストール版のどちらでもかまいませんが、"
122 "開発を行うコンピュータにNVDAをインストールしておくことを推奨します。"
123
124 #. type: Bullet: '* '
125 msgid "Python 2.7 series, version 2.7.5 32-bit for Windows."
126 msgstr "Python2.7シリーズ、version 2.7.5 32-bit for Windows."
127
128 #. type: Bullet: '* '
129 msgid "SCons 2, version 2.3.0 for generating add-on packages."
130 msgstr "SCons 2, version 2.3.0 アドオンパッケージを生成する際に使用します。"
131
132 #. type: Bullet: '* '
133 msgid "Markdown 2.0.1 or later for generating add-on documentation."
134 msgstr "Markdown 2.0.1以降 アドオン文書類を生成する際に使用します。"
135
136 #. type: Bullet: '* '
137 msgid "GNU Gettext package for Windows for message localization support."
138 msgstr ""
139 "GNU Gettext package for Windows メッセージの多言語化をサポートする際に使用し"
140 "ます。"
141
142 #. type: Bullet: '* '
143 msgid ""
144 "Git 1.7.9 or later if you wish to upload the add-on to a repository such as "
145 "Bitbucket (optional, see below). You can use various Git clients, such as "
146 "Git Bash, Cygwin's Git, Tortoise Git and so forth."
147 msgstr ""
148 "Git 1.7.9 もしくはそれ以降のバーション アドオンをアップロードするさいにに使用"
149 "します。Git Bash、Cygwin's Git、Tortoise Gitなどなどの様々なGitクライアントが"
150 "利用可能です。"
151
152 #. type: Bullet: '* '
153 msgid ""
154 "The NVDA Community Add-on template for ease of add-on file and folder "
155 "packaging and management (optional; [click here][3] to download the add-on "
156 "template)."
157 msgstr ""
158 "NVDAコミュニティにはアドオンテンプレートや簡単なアドオンファイル、及びアドオ"
159 "ンパッケージを用意しています。(アドオンテンプレートをダウンロードするには[こ"
160 "こをクリック][3]してください。)"
161
162 #. type: Bullet: '* '
163 msgid "Additional Python modules or dependencies for your add-on."
164 msgstr "あなたが作成するアドオンに必要なPython追加モジュール。"
165
166 #. type: Title ##
167 #, no-wrap
168 msgid "What are add-ons?"
169 msgstr "アドオンって何?"
170
171 #. type: Plain text
172 msgid ""
173 "An add-on is an additional package that extends NvDA's functionality or "
174 "support for programs. This may include adding global features, enhancing "
175 "support for an application or adding support for newer braille displays or "
176 "speech synthesizers."
177 msgstr ""
178 "アドオンとは、NVDAの機能を拡張したり、NVDAがアプリケーションをサポートするた"
179 "めの追加パッケージです。アドオンはグローバルな機能を追加し、アプリケーション"
180 "への支持を強化したり、新たな点字ディスプレイまたは音声エンジンに対応できる可"
181 "能性があります。"
182
183 #. type: Plain text
184 msgid "An add-on may include one or more of the following components:"
185 msgstr ""
186 "ひとつのアドオンは以下のひとつまたは複数のコンポーネントを含むことができま"
187 "す。"
188
189 #. type: Bullet: '* '
190 msgid ""
191 "Global plugin: A global plugin adds features for NVDA which can be used "
192 "anywhere, such as OCR capability."
193 msgstr ""
194 "グローバルプラグイン:グローバルプラグインはどの場面でも使うことができるプラ"
195 "グインで、例えばOCR等、NVDAの可能性を広げる機能を追加することができます。"
196
197 #. type: Bullet: '* '
198 msgid ""
199 "App module: An app module allows enhanced support for a program, such as "
200 "specific windows or controls of a program such as audio editors."
201 msgstr ""
202 "Appモジュール:Appモジュールは特定のウィンドウに指示を与えたり、オーディオエ"
203 "ディタのようなプログラムのコントロールなど、アプリケーション対応機能の強化を"
204 "図ります。"
205
206 #. type: Bullet: '* '
207 msgid ""
208 "Driver: A driver allows a program to talk to hardware. Currently one can "
209 "write drivers for new braille displays or speech synthesizers."
210 msgstr ""
211 "ドライバ:ドライバは、プログラムがハードウェアに働きかけることを可能にしま"
212 "す。現在、新しい点字ディスプレイや音声エンジンをサポートするために、ドライバ"
213 "を作成することができます。"
214
215 #. type: Plain text
216 msgid ""
217 "Each NVDA add-on package (composed of one or more components) is a zip file "
218 "with the file extension of .nvda-addon. These can be installed via Add-ons "
219 "Manager, found in NvDA 2012.2 or later. Alternatively, one can install them "
220 "from file manager if one uses NVDA 2012.3 or later installed on the computer."
221 msgstr ""
222 "各NVDAアドオンパッケージ(一個または複数のアドオンモジュールから構成されていま"
223 "す)は、 .nvda-addon という名前のファイル拡張子を持つzipファイルです。これらは"
224 "アドオンマネージャー経由でインストールされます。これはNVDA 2012.2以降のバー"
225 "ジョンに備わっています。NVDA 2012.3以降を使うならば、別の方法として、ファイル"
226 "マネージャからそれらをインストールすることができます。"
227
228 #. type: Plain text
229 msgid ""
230 "Throughout this guide, we refer to standard NVDA python modules which comes "
231 "with NVDA as \"NvDA Core\" to distinguish it from add-on modules."
232 msgstr ""
233 "このガイドでは、スタンダードなNVDAモジュールを、アドオンモジュールと区別する"
234 "ために、「NvDAコア」と呼びます。"
235
236 #. type: Title ##
237 #, no-wrap
238 msgid "Setting up the add-on development environment"
239 msgstr "アドオン開発環境の構築"
240
241 #. type: Plain text
242 msgid "Follow these steps to prepare your computer for writing NVDA add-ons."
243 msgstr "以下の手順に従って、アドオン開発環境を整えてください。"
244
245 #. type: Title ###
246 #, no-wrap
247 msgid "Installing dependencies"
248 msgstr "依存パッケージのインストール"
249
250 #. type: Bullet: '1. '
251 msgid ""
252 "If you don't have NVDA, download and install NVDA from NV access website."
253 msgstr ""
254 "まだNVDAをおもちでなければ、 NV accessのサイトからダウンロードし、インストー"
255 "ルしてください。"
256
257 #. type: Bullet: '2. '
258 msgid ""
259 "Install Python 2.7.x 32-bit on your computer (if using Windows, install "
260 "using the 32-bit Windows installer package)."
261 msgstr ""
262 "Python 2.7.x 32ビット版をインストールしてください (もしWindowsをお使いであれ"
263 "ば 、Windows 32ビット版インストールパッケージを使ってください)."
264
265 #. type: Bullet: '3. '
266 msgid "Install Markdown and SCons using their Windows installer packages."
267 msgstr ""
268 "Markdown 及びSCons のWindows版インストールパッケージをインストールしてくださ"
269 "い。"
270
271 #. type: Bullet: '4. '
272 msgid "If you plan to share your add-on code with others, install Git clients."
273 msgstr ""
274 "もしアドオンのソースコードを他の人とシェアする計画があるならば、Git クライア"
275 "ントをインストールします。"
276
277 #. type: Bullet: '5. '
278 msgid ""
279 "Paste the Gettext executable files to your add-on development folder (see "
280 "the next section on add-on development folder)."
281 msgstr ""
282 "Gettext 実行ファイルを、アドオン開発フォルダにペーストしてください(アドオン"
283 "開発フォルダについては次の段落をご覧ください)。"
284
285 #. type: Bullet: '6. '
286 msgid ""
287 "If you are developing support for a program, speech synthesizer or a braille "
288 "display, install the needed software and/or have the hardware handy."
289 msgstr ""
290 "もし、音声エンジンまたは点字ディスプレイをサポートするプログラムを作成なら"
291 "ば、それらに必要なソフトウェア及びハードウェアをご用意ください。"
292
293 #. type: Title ###
294 #, no-wrap
295 msgid "The add-on development folder"
296 msgstr "アドオン開発フォルダ"
297
298 #. type: Plain text
299 msgid ""
300 "When writing add-ons, it is recommended that you store your add-on code in "
301 "separate folders, one per add-on. If you chose to download the add-on "
302 "template, the folder structure will be automatically created."
303 msgstr ""
304 "アドオンを作成する時には、それ専用のフォルダ、1つのアドオンに対して1個のフォ"
305 "ルダに、アドオンコードを収めることをお勧めします。アドオンテンプレートをダウ"
306 "ンロードして使用されるなら、フォルダ構造は自動的に作成されます。"
307
308 #. type: Plain text
309 msgid ""
310 "Once you install the needed dependencies (see above), paste the Gettext "
311 "package executables into this add-on folder."
312 msgstr ""
313 "必要な依存パッケージ(上記を見てください)をインストールしたら、このアドオン"
314 "フォルダの中にGettextパッケージの実行形式ファイルを貼り付けてください。"
315
316 #. type: Title ###
317 #, no-wrap
318 msgid "Add-on folder structure"
319 msgstr "アドオンフォルダの構造"
320
321 #. type: Plain text
322 msgid ""
323 "Each add-on folder, at a minimum, must contain the following files and "
324 "folders:"
325 msgstr ""
326 "各アドオンフォルダは、最低限、以下のファイルとフォルダを含まなければなりませ"
327 "ん:"
328
329 #. type: Plain text
330 #, no-wrap
331 msgid ""
332 " * manifest.ini to store manifesst information such as add-on name and author.\n"
333 "* An \"addon\" subfolder with the add-on module directory underneath this subfolder (appModules, globalPlugins, synthDrivers, brailleDisplays). One or more module folders can be specified.\n"
334 msgstr ""
335 " * manifest.ini アドオンの名前や制作者等の情報を記述します。\n"
336 "*\"addon\" サブフォルダ この下に、(appModules, globalPlugins, synthDrivers, brailleDisplays)等のアドオンモジュールディレクトリを持つフォルダです。1つ以上または複数のモジュールフォルダを指定することができます。\n"
337
338 #. type: Plain text
339 msgid ""
340 "If you are using the add-on template, the folder structure will "
341 "automatically be created, so you need to create only the addon subfolder and "
342 "the add-on module folder(s) and code inside this folder. See the readme file "
343 "in the template folder for more information on customizing your add-on "
344 "manifest using the template files."
345 msgstr ""
346 "アドオンテンプレートを使っているなら、フォルダ構造は自動的に作成されますか"
347 "ら、このフォルダの中のaddonサブフォルダとアドオンモジュールフォルダ(複数可)と"
348 "コードだけを作成する必要があります。テンプレートファイルを使ってアドオンを作"
349 "成したりカスタマイズする方法についての詳細な説明は、テンプレートフォルダの中"
350 "のreadmeファイルをご覧ください。"
351
352 #. type: Title ###
353 #, no-wrap
354 msgid "Packaging add-ons"
355 msgstr "アドオンのパッケージング"
356
357 #. type: Plain text
358 msgid "There are two ways of packaging add-ons:"
359 msgstr "アドオンをパッケージングするには2つの方法があります:"
360
361 #. type: Bullet: '1. '
362 msgid ""
363 "To package your add-on manually, zip up (compress) your add-on folder as a ."
364 "zip file, then rename the file extension to .nvda-addon."
365 msgstr ""
366 "手動でアドオンをパッケージングするには、アドオンフォルダをzipファイルとして圧"
367 "縮したあと、そのファイルの拡張子を.zipから.nvda-addonにリネームしてください。"
368
369 #. type: Bullet: '2. '
370 msgid ""
371 "To use the add-on template with SCons, open Command Prompt with "
372 "administrator mode (Windows Vista or later), change to your add-on folder "
373 "and type `scons~."
374 msgstr ""
375 "アドオンテンプレートとSConsを使って作成するには、まず管理者モード(Windows "
376 "Vistaまたはそれ以降の場合)でコマンドプロンプトを開き、アドオンフォルダに移動"
377 "して、 scons とタイプしてください。"
378
379 #. type: Plain text
380 msgid ""
381 "For more information on add-on management, see the management chapter in "
382 "this guide."
383 msgstr ""
384 "アドオン管理における詳細については、このガイドの管理の章をご覧ください。"
385
386 #. type: Title ##
387 #, no-wrap
388 msgid "Getting started: Hands-on examples"
389 msgstr "さあ始めましょう:実際例"
390
391 #. type: Plain text
392 msgid ""
393 "So are you ready to start your adventure with add-ons, but not sure as to "
394 "how to bring it to life? If that is you, please go through this chapter, as "
395 "it gives you basic information to get you started with add-ons and give you "
396 "tips on writing code."
397 msgstr ""
398 "それでは、あなたはアドオンの冒険の旅に出発する準備ができていると思いますが、"
399 "どのようにしてそれが蘇生させるかについてまだ確信していませんね?もしそうなら"
400 "どうぞ、アドオンの開発を始めるために、コードを書くことについての秘訣を与える"
401 "ために、それがあなたに基礎情報を与える時に、この章に目を通してください。"
402
403 #. type: Plain text
404 msgid ""
405 "Note: for this chapter, we will not use the actual add-on packages. Instead, "
406 "we'll use plugin folders - a number of subdirectories in your NVDA user "
407 "configuration folder (available from Start Menu/Screen if NVDA is installed) "
408 "to store our example Python files."
409 msgstr ""
410 "メモ:この章では、実際のアドオンパッケージは使用しません。代わりに、プラグイ"
411 "ンフォルダを使います - 例Pythonファイルを格納するフォルダで、NVDAのユーザー設"
412 "定フォルダ中の多くのサブディレクトリ(NVDAがインストールされるならスタートメ"
413 "ニュー/スクリーンから入手可能です)。"
414
415 #. type: Plain text
416 msgid ""
417 "To edit .py files, you need a word processor which can handle .py files. The "
418 "best one we recommend is Notepad++."
419 msgstr ""
420 ".pyファイルを編集するために、.pyファイルを処理することができるテキストエディ"
421 "タが必要です。我々が推奨する最もよいものはNotepad++です。"
422
423 #. type: Title ###
424 #, no-wrap
425 msgid "How add-on code is organized"
426 msgstr "アドオンコードの作成方法"
427
428 #. type: Plain text
429 #, no-wrap
430 msgid " Your add-on code is stored in one or more Python files (.py file). Despite different kinds of add-ons out there, they all have similar layout.\n"
431 msgstr "アドオンコードは1つまたは複数のPythonファイル(.pyファイル)に記述します。世の中にはさまざまな種類のアドオンが存在しますが、それらはみな同じようなレイアウトで記述されています。\n"
432
433 #. type: Plain text
434 #, no-wrap
435 msgid " First, you start by writing an optional header for your add-on, such as your name, a brief sentence or two on what the add-on is for and so on. Although this is optional, it is recommend that you write the header as a reminder to keep track of what you are doing with your add-on.\n"
436 msgstr "まず最初に、アドオンがあるものの上のあなたの名前、1、2の短いセンテンスなどなどのあなたのアドオンのためにオプショナル・ヘッダを書くことから始めます。これはオプションですが、あなたのアドオンにさせたいことに絶えず注意するために、リマインダーとしてヘッダを書くことを勧めます。\n"
437
438 #. type: Plain text
439 #, no-wrap
440 msgid " Next, you tell NVDA the modules you need for your add-on file. This is done by writing `import module` where module is the name of the module you wish to use in your code. For example, if you want to hear tones while writing your add-on, write `import tones`. Typically you may need to import two or more modules for your specific add-on (see below on list of modules you need for the type of add-on module you are writing).\n"
441 msgstr "次に、アドオンファイルに必要なNVDAモジュールを伝えます。あなたがコードの中で使うことを希望するモジュールの名前で、`import module` と記述することによって指定します。例えば、アドオンを書く間に、tonesを聞きたいならば、`import tones`と書いてください。一般に、具体的な、アドオン(あなたがアドオンモジュールのタイプのために必要なモジュールのリストの上で、あなたが書いていると下でわかってください).のために1つあるいは2つ以上のモジュールをインポートする必要があるかもしれません。\n"
442
443 #. type: Plain text
444 #, no-wrap
445 msgid " after declaring the modules you need or import, you write your add-on code (defining classes, variables, methods and so on). The most important section is the add-on class code, which will determine the type of add-on module your code will be assigned to.\n"
446 msgstr "必要なモジュールをインポート宣言したあと、アドオンコード(定義するクラス、変数、手順など)を書きます。最も重要な節はアドオンクラスコードで、それは、あなたが作るアドオンモジュールの種類を決定づけます。\n"
447
448 #. type: Plain text
449 #, no-wrap
450 msgid " For instance, if you wish to add support for a program, after importing appModuleHandler and other needed modules, you would write:\n"
451 msgstr ""
452
453 #. type: Plain text
454 #, no-wrap
455 msgid " `class appModule(appModuleHandler.AppModule):`\n"
456 msgstr ""
457
458 #. type: Plain text
459 msgid ""
460 "After that, all you are writing is Python code (see the Python documentation "
461 "on how to write Python programs)."
462 msgstr ""
463
464 #. type: Title ###
465 #, no-wrap
466 msgid "Running your add-on in this example chapter"
467 msgstr ""
468
469 #. type: Plain text
470 msgid ""
471 "To run your example add-ons from this chapter, open your NVDA user "
472 "configuration directory (from Start Menu/Screen, look for Explore NVDA user "
473 "configuration folder\" item). Then paste your .py file to the appropriate "
474 "folder: appModules folder for app module examples, and globalPlugins folder "
475 "for global plugins."
476 msgstr ""
477
478 #. type: Title ###
479 #, no-wrap
480 msgid "Example 1: Hear a tone when pressing NVDA+A"
481 msgstr ""
482
483 #. type: Plain text
484 msgid ""
485 "Let us start with a simple example: if you press NvDA+A, you would hear a "
486 "tone for 1 second from any program. Since we want to use this everywhere, it "
487 "must be a global plugin."
488 msgstr ""
489
490 #. type: Plain text
491 msgid ""
492 "First, open your user configuration folder, then open globalPlugins folder. "
493 "Create a new .py file and give it a descriptive name such as example1.py (it "
494 "is strongly recommended that when you name your global plugin file, give it "
495 "a short descriptive name). Then open the newly created .py file in the word "
496 "processor."
497 msgstr ""
498
499 #. type: Plain text
500 msgid ""
501 "The below code implements our example. Put this in your .py file as exactly "
502 "as shown:"
503 msgstr ""
504
505 #. type: Plain text
506 #, no-wrap
507 msgid "\t# Add-on development first example\n"
508 msgstr ""
509
510 #. type: Plain text
511 #, no-wrap
512 msgid ""
513 "\timport globalPluginHandler\n"
514 "\timport tones # We want to hear beeps.\n"
515 msgstr ""
516
517 #. type: Plain text
518 #, no-wrap
519 msgid "\tclass GlobalPlugin(globalPluginHandler.GlobalPlugin):\n"
520 msgstr ""
521
522 #. type: Plain text
523 #, no-wrap
524 msgid ""
525 "\t\tdef script_doBeep(self, gesture):\n"
526 "\t\t\ttones.beep(440, 1000) # Beep a standard middle A for 1 second.\n"
527 msgstr ""
528
529 #. type: Plain text
530 #, no-wrap
531 msgid ""
532 "\t\t__gestures={\n"
533 "\t\t\t\"kb:NVDA+A\":\"doBeep\"\n"
534 "\t\t}\n"
535 msgstr ""
536
537 #. type: Plain text
538 msgid ""
539 "In Python, you put comments by putting hash sign (#) at the start of the "
540 "comment line."
541 msgstr ""
542
543 #. type: Title ###
544 #, no-wrap
545 msgid "Example 1 code explanation"
546 msgstr ""
547
548 #. type: Plain text
549 msgid ""
550 "Our first example let's us sound a beep for one second when we press NVDA+A. "
551 "But you might be wondering what that above code means, so let's step through "
552 "the code, one piece at a time."
553 msgstr ""
554
555 #. type: Bullet: '1. '
556 msgid ""
557 "At the top of the file, we wrote a header which tells us that this is an "
558 "example add-on."
559 msgstr ""
560
561 #. type: Bullet: '2. '
562 msgid ""
563 "Since this is a global plugin, we need to import a crucial module: global "
564 "plugin handler, so we wrote `import globalPluginHandler`."
565 msgstr ""
566
567 #. type: Bullet: '3. '
568 msgid ""
569 "Then we wrote `import tones` to import (load, or include) the tones module, "
570 "a built-in module from NVDA. Whenever you wish to use a method from a given "
571 "module, import the needed module(s)."
572 msgstr ""
573
574 #. type: Bullet: '4. '
575 msgid ""
576 "Next, we defined a class called GlobalPlugin. The text inside the brackets "
577 "tells us where this class is coming from (more on this concept in a second). "
578 "A class, in programming, describes an object, such as a person, a desk, a "
579 "program and others."
580 msgstr ""
581
582 #. type: Bullet: '5. '
583 msgid ""
584 "Inside the class, we wrote a method (function) called `script_doBeep`. This "
585 "is an example of a script, a method that'll be run or executed when you "
586 "press a command. Inside this script, we wrote `tones.beep(440, 1000)` to "
587 "tell NVDA to sound a middle A tone for 1 second. In programming, a function "
588 "can take arguments, or a set or parameters which tells the function what to "
589 "do based on the given values (we'll meet them later). In fact, many methods "
590 "you'll be writing, including our doBeep script takes one or more arguments. "
591 "More on scripts later as we journey through the guide."
592 msgstr ""
593
594 #. type: Bullet: '6. '
595 msgid ""
596 "Lastly, we wrote a simple dictionary (a collection) to store our command "
597 "(script) bindings for our doBeep script. Here, we told NVDA to assign NVDA+A "
598 "command for doBeep script."
599 msgstr ""
600
601 #. type: Plain text
602 msgid ""
603 "Save this file, then restart NVDA. Now whenever you press NvDA+A, you'll "
604 "hear a middle A tone for 1 second. Once you are comfortable with the add-on "
605 "code and how it is laid out, you can delete the newly created .py file."
606 msgstr ""
607
608 #. type: Title ###
609 #, no-wrap
610 msgid "I don't understand those above terms"
611 msgstr ""
612
613 #. type: Plain text
614 msgid ""
615 "For some, the terms \"class\", \"method\" and so on might be new. Let's go "
616 "over what these terms are, as they are fundamental for add-on development:"
617 msgstr ""
618
619 #. type: Bullet: '* '
620 msgid ""
621 "Class: a class describes an object. It could describe anything, such as a "
622 "person, a desk, an NVDA add-on and others. Classes are fundamental to NVDA "
623 "and other programs - in fact, a number of programmers are skilled at coming "
624 "up with classes."
625 msgstr ""
626
627 #. type: Bullet: '* '
628 msgid ""
629 "Method: A method is a short program or a routine that a program runs for "
630 "doing something, such as generating tones, calculating huge numbers, loading "
631 "NVDA add-ons and so on. Some people call them \"functions.\""
632 msgstr ""
633
634 #. type: Bullet: '* '
635 msgid ""
636 "Script: A script is a method which runs when the user performs commands such "
637 "as pressing certain keys on a keyboard. For example, when you press NVDA"
638 "+F12, NVDA runs dateTime script, located in one of the NVDA core modules "
639 "named Global Commands. A script takes two arguments: where the script would "
640 "be executed (usually \"self\"; more on that later) and the gesture for the "
641 "script (see below)."
642 msgstr ""
643
644 #. type: Bullet: '* '
645 msgid ""
646 "Variable: A variable is something that can change, such as name of a person, "
647 "name of the NVDA add-on we're running, version of NVDA you are using and so "
648 "on. An add-on file may define one or more variables (for example, to store "
649 "common constants such as strings)."
650 msgstr ""
651
652 #. type: Bullet: '* '
653 msgid ""
654 "Module: A module is a collection of methods and variables in a file. When we "
655 "write add-ons, we are in fact writing additional modules that NVDA can use "
656 "while it is running."
657 msgstr ""
658
659 #. type: Plain text
660 msgid "There are other terms that we'll get to know shortly."
661 msgstr ""
662
663 #. type: Title ###
664 #, no-wrap
665 msgid "Example 2: Generate a tone when switching to Notepad"
666 msgstr ""
667
668 #. type: Plain text
669 msgid "Most of the below code comes from NvDA Developer Guide."
670 msgstr ""
671
672 #. type: Plain text
673 msgid ""
674 "Not only NVDA let's you add global commands, but it also allows writing code "
675 "to enhance usage of programs through app modules. An app module is also a "
676 "Python file except that, this time, the name of the .py file is the name of "
677 "the executable for a program. For example, an app module for Notepad would "
678 "be named notepad.py."
679 msgstr ""
680
681 #. type: Plain text
682 msgid ""
683 "The below code, from NVDA developer Guide, gives a short example of a "
684 "typical app module: play a short beep when switching to Notepad. Put the "
685 "below code in notepad.py, which in turn should be placed in appModules "
686 "folder in your user configuration folder in order for it to run."
687 msgstr ""
688
689 #. type: Plain text
690 #, no-wrap
691 msgid "\t# An example app module.\n"
692 msgstr ""
693
694 #. type: Plain text
695 #, no-wrap
696 msgid ""
697 "\timport appModuleHandler\n"
698 "\timport tones\n"
699 msgstr ""
700
701 #. type: Plain text
702 #, no-wrap
703 msgid "\tclass AppModule(appModuleHandler.AppModule):\n"
704 msgstr ""
705
706 #. type: Plain text
707 #, no-wrap
708 msgid ""
709 "\t\tdef event_gainFocus(self, obj, nextHandler):\n"
710 "\t\t\ttones.beep(256, 200)\n"
711 "\t\t\tnextHandler()\n"
712 msgstr ""
713
714 #. type: Title ###
715 #, no-wrap
716 msgid "Example 2 code explanation"
717 msgstr ""
718
719 #. type: Plain text
720 msgid ""
721 "We're seeing more new code here. Let's go over this, again piece by piece:"
722 msgstr ""
723
724 #. type: Bullet: '1. '
725 msgid ""
726 "Unlike the first example, the crucial module we need is appModuleHandler."
727 msgstr ""
728
729 #. type: Bullet: '2. '
730 msgid "The class that we are using is AppModule."
731 msgstr ""
732
733 #. type: Bullet: '3. '
734 msgid ""
735 "Unlike last time, we're using events, a method run when certain events occur "
736 "such as when names of controls change. Events take an object as one of its "
737 "arguments, the object for which the event needs to be dealt with, or, as "
738 "many people say, \"fired.\""
739 msgstr ""
740
741 #. type: Bullet: '4. '
742 msgid ""
743 "Inside the event method, we're also seeing a call to `nextHandler`. This "
744 "method is used in event methods to tell NvDA to pass the event so it can be "
745 "taken care of, such as saying the name of a control after beeping."
746 msgstr ""
747
748 #. type: Title ###
749 #, no-wrap
750 msgid "More new terms please"
751 msgstr ""
752
753 #. type: Plain text
754 msgid "Other terms you may see include:"
755 msgstr ""
756
757 #. type: Bullet: '* '
758 msgid ""
759 "Event: An event is a method that'll be run when some events happen, such as "
760 "when a program is on focused, when names of controls change and so on."
761 msgstr ""
762
763 #. type: Bullet: '* '
764 msgid ""
765 "Call: We say a function calls some another method when we run the second "
766 "method from another method. For example, in our first example, we're calling "
767 "tones.beep method from our script method."
768 msgstr ""
769
770 #. type: Bullet: '* '
771 msgid ""
772 "Object: An object is an instance of a class - that is, a class coming to "
773 "life when a program runs. Throughout your add-ons, as you write classes and "
774 "when you run your add-ons, your classes come to life as objects, commonly "
775 "abbreviated to obj. In NVDA, an object may refer to controls or parts of a "
776 "program."
777 msgstr ""
778
779 #. type: Bullet: '* '
780 msgid ""
781 "Self: In Python, the word \"self\" means current class (if we're defining "
782 "one, such as when writing add-ons), or means the class for which a method is "
783 "defined. For example, in a class called numbers, the add method would have "
784 "self as the first argument, reminding us that add method is part of the "
785 "class of numbers. In NVDA development world, self usually means the current "
786 "NVDA object (see below), or in the add-on development, the instance of an "
787 "add-on. Many of your methods will have self as the first argument."
788 msgstr ""
789
790 #. type: Plain text
791 msgid ""
792 "Just like example 1, once you're comfortable with app module code, you may "
793 "wish to delete the Notepad app module code unless you want to keep hearing "
794 "beeps when you switch to Notepad. The actual differences between global "
795 "plugins and app modules will become more clear when we talk about them in "
796 "more detail throughout this guide."
797 msgstr ""
798
799 #. type: Title ###
800 #, no-wrap
801 msgid "A few tips for beginners"
802 msgstr ""
803
804 #. type: Plain text
805 msgid "Here are a few useful tips passed on by add-on writers:"
806 msgstr ""
807
808 #. type: Bullet: '* '
809 msgid "Start with easy add-ons, such as saying a message, tones and so on."
810 msgstr ""
811
812 #. type: Bullet: '* '
813 msgid "Write and test one method at a time."
814 msgstr ""
815
816 #. type: Bullet: '* '
817 msgid ""
818 "If you are writing app modules or drivers, become familiar with programs, "
819 "synthesizers or braille displays you wish to support (e.g. read "
820 "documentation, try using them, etc.)."
821 msgstr ""
822
823 #. type: Bullet: '* '
824 msgid ""
825 "When defining commands (especially in global plugins), consult commands used "
826 "in NvDA and other add-ons first before assigning a new command in your add-"
827 "on to avoid command conflicts."
828 msgstr ""
829
830 #. type: Title ##
831 #, no-wrap
832 msgid "Useful modules from NVDA core"
833 msgstr ""
834
835 #. type: Plain text
836 msgid ""
837 "Throughout the life of add-on development, you'll come across some useful "
838 "modules from NvDA core that would be helpful in your add-on code. This "
839 "section explains them and some functions in those modules that would be "
840 "useful."
841 msgstr ""
842
843 #. type: Title ###
844 #, no-wrap
845 msgid "List of useful NVDA core modules and methods"
846 msgstr ""
847
848 #. type: Plain text
849 msgid ""
850 "The following lists available NVDA core modules and some useful methods "
851 "found in those modules:"
852 msgstr ""
853
854 #. type: Bullet: '* '
855 msgid ""
856 "Addon Handler (addonHandler.py): The module which implements the add-on "
857 "subsystem. The addonHandler.initTranslation() method is used to initialize "
858 "internationalization support for your add-on."
859 msgstr ""
860
861 #. type: Bullet: '* '
862 msgid ""
863 "NVDA basic API (api.py): A collection of core methods used throughout NVDA, "
864 "such as obtaining focus and navigator object, setting focus and so on. See "
865 "the next list on useful methods from this module."
866 msgstr ""
867
868 #. type: Bullet: '* '
869 msgid ""
870 "App Module subsystem (appModuleHandler.py, appModules): The subsystem in "
871 "charge of handling app modules (see chapter on app modules for more "
872 "information)."
873 msgstr ""
874
875 #. type: Bullet: '* '
876 msgid ""
877 "ARIA support (aria.py): Implements support for Accessible Rich Internet "
878 "Applications (ARIA)."
879 msgstr ""
880
881 #. type: Bullet: '* '
882 msgid ""
883 "Base object collection (baseObject.py): Contains useful base objects such as "
884 "scriptable objects (see the chapter on NvDA objects and overlay objects for "
885 "more information)."
886 msgstr ""
887
888 #. type: Bullet: '* '
889 msgid ""
890 "Braille input and output subsystem (braille.py, brailleInput.py): Controls "
891 "braille output to and input from braille displays, needed by braille display "
892 "driver add-ons."
893 msgstr ""
894
895 #. type: Bullet: '* '
896 msgid ""
897 "Build-in modules (builtin.py): Allows access to builtin modules when working "
898 "with add-ons."
899 msgstr ""
900
901 #. type: Bullet: '* '
902 msgid ""
903 "Configuration (config): Manages configuration and profiles (profiles are "
904 "available in 2013.3 or later)."
905 msgstr ""
906
907 #. type: Bullet: '* '
908 msgid ""
909 "Controls and states collection (controltypes.py): Includes dictionaries on "
910 "control types (roles) and possible states that a control can be in."
911 msgstr ""
912
913 #. type: Bullet: '* '
914 msgid "Events (eventHandler.py): Handles various events such as gaining focus."
915 msgstr ""
916
917 #. type: Bullet: '* '
918 msgid ""
919 "Global Commands collection (globalCommands.py): A list of global commands "
920 "available while using NVDA (see section on script scope for more "
921 "information)."
922 msgstr ""
923
924 #. type: Bullet: '* '
925 msgid ""
926 "Global Plugin subsystem (globalPluginHandler.py): The module needed for "
927 "controlling global plugins."
928 msgstr ""
929
930 #. type: Bullet: '* '
931 msgid ""
932 "NVDA GUI (gui): A collection of classes used by NVDA to display its messages "
933 "graphically. Includes GUI's for NVDA menu, add-on manager and others."
934 msgstr ""
935
936 #. type: Bullet: '* '
937 msgid ""
938 "Hardware port utilities (hwPortUtils.py): A set of utilities for "
939 "communicating over serial and other hardware ports, useful during driver add-"
940 "on development."
941 msgstr ""
942
943 #. type: Bullet: '* '
944 msgid ""
945 "IAccessible support (IAccessibleHandler.py, IAccessible objects): Used for "
946 "supporting IAccessible controls."
947 msgstr ""
948
949 #. type: Bullet: '* '
950 msgid "Input management (inputCore.py): Manages input from the user."
951 msgstr ""
952
953 #. type: Bullet: '* '
954 msgid ""
955 "Java Access Bridge support (JABHandler.py): A collection of methods used for "
956 "supporting JAB subsystem used for Java applications."
957 msgstr ""
958
959 #. type: Bullet: '* '
960 msgid ""
961 "Keyboard input (keyboardHandler.py): Supports entering commands from the "
962 "keyboard."
963 msgstr ""
964
965 #. type: Bullet: '* '
966 msgid ""
967 "Logging facility (logHandler.py): Allows a module to write logs to be viewed "
968 "by a developer or a user via Log Viewer."
969 msgstr ""
970
971 #. type: Bullet: '* '
972 msgid "Mouse support (mouseHandler.py): Supports mouse commands."
973 msgstr ""
974
975 #. type: Bullet: '* '
976 msgid ""
977 "NvDA objects collection (NVDAObjects): A collection of NvDA objects or "
978 "controls used in many applications and standards such as UIA (User Interface "
979 "Automation)."
980 msgstr ""
981
982 #. type: Bullet: '* '
983 msgid ""
984 "Scripts support (scriptHandler.py): Handles scripts, methods executed due to "
985 "the user pressing keyboard commands and other input."
986 msgstr ""
987
988 #. type: Bullet: '* '
989 msgid "Speech output (speech.py): Controls speech output."
990 msgstr ""
991
992 #. type: Bullet: '* '
993 msgid ""
994 "Synthesizer driver support (synthDriverHandler.py): This is the core module "
995 "needed for speech synthesizer add-ons."
996 msgstr ""
997
998 #. type: Bullet: '* '
999 msgid ""
1000 "Widget text access (textInfos): Allows access to text for widget and "
1001 "documents."
1002 msgstr ""
1003
1004 #. type: Bullet: '* '
1005 msgid ""
1006 "Touchscreen support (touchHandler.py): Provides support for touchscreen "
1007 "input (installed versions only)."
1008 msgstr ""
1009
1010 #. type: Bullet: '* '
1011 msgid "Tone output (tones.py): Allows the user to hear tones."
1012 msgstr ""
1013
1014 #. type: Bullet: '* '
1015 msgid ""
1016 "User interface messages (ui.py): Includes ui.message method used to speak or "
1017 "braille certain text."
1018 msgstr ""
1019
1020 #. type: Bullet: '* '
1021 msgid ""
1022 "Virtual buffers (virtualBuffers): Handles virtual buffer documents such as "
1023 "websites."
1024 msgstr ""
1025
1026 #. type: Plain text
1027 msgid ""
1028 "The modules without .py extension are directories, containing specialist "
1029 "modules."
1030 msgstr ""
1031
1032 #. type: Title ###
1033 #, no-wrap
1034 msgid "Useful methods"
1035 msgstr ""
1036
1037 #. type: Plain text
1038 msgid ""
1039 "Here is a list of some useful methods used in add-ons. For more information "
1040 "on how they're implemented, see the NvDA source code documentation. For "
1041 "worked out examples, see the section of this guide on add-on components."
1042 msgstr ""
1043
1044 #. type: Plain text
1045 msgid "From addonHandler:"
1046 msgstr ""
1047
1048 #. type: Bullet: '* '
1049 msgid ""
1050 "`addonHandler.initTranslation()`: Sets up the translation subsystem for add-"
1051 "ons via Gettext."
1052 msgstr ""
1053
1054 #. type: Plain text
1055 msgid "From api.py:"
1056 msgstr ""
1057
1058 #. type: Bullet: '* '
1059 msgid ""
1060 "`api.getFocusObject()`: Retrieves the focused control (returns the object "
1061 "with focus)."
1062 msgstr ""
1063
1064 #. type: Bullet: '* '
1065 msgid ""
1066 "`api.getNavigatorObject()`: Fetches the current navigator object. If NvDA is "
1067 "set to follow system focus, the focus and navigator object will be the same, "
1068 "otherwise a different object is returned."
1069 msgstr ""
1070
1071 #. type: Bullet: '* '
1072 msgid ""
1073 "`api.getForegroundObject()`: Returns the foreground window of the current "
1074 "application (the parent of this object is the application itself)."
1075 msgstr ""
1076
1077 #. type: Bullet: '* '
1078 msgid ""
1079 "These have a corresponding method to set certain object as the focus or "
1080 "navigator object."
1081 msgstr ""
1082
1083 #. type: Plain text
1084 msgid "From logHandler:"
1085 msgstr ""
1086
1087 #. type: Bullet: '* '
1088 msgid "`logHandler.Log`: The class which implements logging facility."
1089 msgstr ""
1090
1091 #. type: Plain text
1092 msgid "From tones:"
1093 msgstr ""
1094
1095 #. type: Bullet: '* '
1096 msgid ""
1097 "`tones.beep(pitch in hertz, duration in milliseconds, left channel volume, "
1098 "right channel volume)`: Plays a tone of specified pitch for specified "
1099 "duration. The first two arguments are mandatory, while the other two are "
1100 "optional."
1101 msgstr ""
1102
1103 #. type: Plain text
1104 msgid "From ui:"
1105 msgstr ""
1106
1107 #. type: Bullet: '* '
1108 msgid ""
1109 "`ui.message(message to be spoken/brailled)`: Speaks or brailles the message. "
1110 "This should be a string surrounded by quotes."
1111 msgstr ""
1112
1113 #. type: Plain text
1114 msgid ""
1115 "There are other useful methods out there, but the above are the most useful "
1116 "ones. See the NVDA source code documentation for other methods, or see the "
1117 "examples below on how these methods and others are used throughout the life "
1118 "of an add-on."
1119 msgstr ""
1120
1121 #. type: Title ##
1122 #, no-wrap
1123 msgid "Add-on module components and development tips"
1124 msgstr ""
1125
1126 #. type: Plain text
1127 msgid ""
1128 "An add-on module consists of a number of components. This includes handling "
1129 "input and output, working with different NvDA objects, reacting to events, "
1130 "storing configuration and more."
1131 msgstr ""
1132
1133 #. type: Plain text
1134 msgid ""
1135 "This chapter introduces key components and concepts that are used in add-on "
1136 "development, such as NVDA objects, scripts, event handling and additional "
1137 "topics with examples."
1138 msgstr ""
1139
1140 #. type: Plain text
1141 msgid ""
1142 "Note that the NVDA core development guide introduces the below concepts. "
1143 "This chapter is intended as an extension of that document. Consult the NVDA "
1144 "development guide for a brief introductions."
1145 msgstr ""
1146
1147 #. type: Title ###
1148 #, no-wrap
1149 msgid "Working with objects on screen"
1150 msgstr ""
1151
1152 #. type: Plain text
1153 msgid ""
1154 "An object is an instance of a class - that is, a class coming to life while "
1155 "a program is running. For example, if a class called button has been "
1156 "defined, the button on a screen is the object of this button class."
1157 msgstr ""
1158
1159 #. type: Plain text
1160 msgid ""
1161 "In NVDA, an object is representation of a control or parts of a program. "
1162 "This includes buttons, check boxes, edit fields, toolbars, sliders and even "
1163 "the application window. These are organized into hierarchies, or parent-"
1164 "child relationship where an object may contain child objects - for example, "
1165 "a list object in Windows Explorer may contain one or more list items, and "
1166 "the parent of this list might be the Windows Explorer window. The object "
1167 "that you're examining right now is termed \"navigator object.\""
1168 msgstr ""
1169
1170 #. type: Plain text
1171 msgid ""
1172 "The NVDA objects (or simply called objects) contains a number of useful "
1173 "properties or atributes. These include the object's name, its value "
1174 "(checked, text of the edit window, etc.), role (check box, window, embedded "
1175 "object, etc., location (screen coordinates) and more. NVDA objects also "
1176 "contain useful methods for manipulating them, such as changing the value of "
1177 "the object, reacting to events for the object (gains focus, value changed, "
1178 "etc.) and so on."
1179 msgstr ""
1180
1181 #. type: Plain text
1182 msgid ""
1183 "In many situations, an NvDA object may belong to a class of related objects. "
1184 "For each object classes, NvDA provides ways of handling them. These classes "
1185 "include IAccessible, JAB, UIA and so forth. These classes and behaviors for "
1186 "each class of objects is defined in NVDAObjects directory in the NvDA source "
1187 "code, and to use them in your add-on, import the appropriate object class "
1188 "handler for the object you're using (e.g. if you're working with an "
1189 "IAccessible object, impore NVDAObjects.IAccessible.)."
1190 msgstr ""
1191
1192 #. type: Plain text
1193 msgid ""
1194 "Two of these object classes merit special mention: virtual buffers and tree "
1195 "interceptors. A tree interceptor allows NvDA to work with a \"tree\" of "
1196 "objects as though they are just one object. A special case of tree "
1197 "interceptor is virtual buffer, which allows NVDA to work with complex "
1198 "documents such as PDF documents."
1199 msgstr ""
1200
1201 #. type: Title ###
1202 #, no-wrap
1203 msgid "Examining object hierarchy"
1204 msgstr ""
1205
1206 #. type: Plain text
1207 msgid ""
1208 "There are a number of ways which you can use to see the hierarchy of an "
1209 "object for a given program:"
1210 msgstr ""
1211
1212 #. type: Bullet: '1. '
1213 msgid ""
1214 "Using object navigation commands (NvDA+Numpad 2/4/5/6/8) with simple review "
1215 "mode turned off."
1216 msgstr ""
1217
1218 #. type: Bullet: '2. '
1219 msgid ""
1220 "Using Python Console, use obj.next/previous/parent/firstChild/lastChild "
1221 "attributes. If you want to see all available properties, from mPython "
1222 "Console, type dir(obj)."
1223 msgstr ""
1224
1225 #. type: Plain text
1226 msgid ""
1227 "If you wish to see a more detailed description about the navigator object, "
1228 "while the navigator object is located at the object you're interested in, "
1229 "press NvDA+F1 to launch log viewer. The root of all objects in Windows is "
1230 "the desktop, or shell object."
1231 msgstr ""
1232
1233 #. type: Title ###
1234 #, no-wrap
1235 msgid "Focus vs. navigator object"
1236 msgstr ""
1237
1238 #. type: Plain text
1239 msgid ""
1240 "In your add-on, you might wish to work with various objects and manipulate "
1241 "them. These may include changing the focused object, synchronizing navigator "
1242 "and focus objects, changing the role of an object and so on."
1243 msgstr ""
1244
1245 #. type: Plain text
1246 msgid ""
1247 "A focus object is the currently focused control. These are linked to "
1248 "keyboard focus - that is, it follows the highlighted control. In contrast, a "
1249 "navigator object is the object you're interested in. Since navigator objects "
1250 "can move anywhere, you can examine two objects at once: the focused object "
1251 "and the navigator object. For instance, you might be focused on an edit "
1252 "field while examining the title bar as the navigator object."
1253 msgstr ""
1254
1255 #. type: Plain text
1256 msgid ""
1257 "In your add-on, to fetch the object with focus, write `someObj = api."
1258 "getFocusObject()`. The someObj can be named differently - the convention is "
1259 "to use the name \"obj\". To fetch the navigator object (which might be "
1260 "different from the focused object), use `obj = api.getNavigatorObject()`."
1261 msgstr ""
1262
1263 #. type: Title ###
1264 #, no-wrap
1265 msgid "Other useful object-related goodies"
1266 msgstr ""
1267
1268 #. type: Plain text
1269 msgid ""
1270 "Here are some other methods which works with NVDA objects, all located in "
1271 "api.py module:"
1272 msgstr ""
1273
1274 #. type: Bullet: '* '
1275 msgid ""
1276 "If you wish to obtain the foreground object (useful if you wish to look at "
1277 "some child object of the foreground window), use `obj = api."
1278 "getForegroundObject()`."
1279 msgstr ""
1280
1281 #. type: Bullet: '* '
1282 msgid ""
1283 "From Python Console, to see the number of child objects that an object "
1284 "contains (for instance, the children, or widgets of a foreground window), "
1285 "type `obj.childCount`. The value 0 means that there are no more child "
1286 "objects."
1287 msgstr ""
1288
1289 #. type: Bullet: '* '
1290 msgid ""
1291 "To set some object as the new focus or navigator object, use `api."
1292 "setFocusObject(obj)` or `api.setNavigatorObject(obj)`."
1293 msgstr ""
1294
1295 #. type: Bullet: '* '
1296 msgid ""
1297 "You can fetch various properties of an object by specifying obj.property "
1298 "where property is the attribute you wish to see (e.g. obj.value)."
1299 msgstr ""
1300
1301 #. type: Title ###
1302 #, no-wrap
1303 msgid "Example 1: Finding the value of a slider in a program"
1304 msgstr ""
1305
1306 #. type: Plain text
1307 msgid ""
1308 "Suppose you are asked by a user to give him the value of a slider in a "
1309 "program using an app module. After looking at the object hierarchy and other "
1310 "properties, you know that the toolbar is the last child of the foreground "
1311 "object."
1312 msgstr ""
1313
1314 #. type: Plain text
1315 msgid "Here is the code to implement this feature:"
1316 msgstr ""
1317
1318 #. type: Plain text
1319 #, no-wrap
1320 msgid "\t# Object example 1\n"
1321 msgstr ""
1322
1323 #. type: Plain text
1324 #, no-wrap
1325 msgid ""
1326 "\timport api\n"
1327 "\timport appModuleHandler\n"
1328 msgstr ""
1329
1330 #. type: Plain text
1331 #, no-wrap
1332 msgid "\t\tsliderChildIndex = -1 # The variable to store the child index.\n"
1333 msgstr ""
1334
1335 #. type: Plain text
1336 #, no-wrap
1337 msgid ""
1338 "\t\tdef getSliderValue(self):\n"
1339 "\t\t\tfg = api.getForegroundObject()\n"
1340 "\t\t\tsliderVal = fg.children[self.sliderChildIndex].value\n"
1341 "\t\t\treturn sliderVal\n"
1342 msgstr ""
1343
1344 #. type: Plain text
1345 msgid ""
1346 "In this code, the method `fg.children[index]` is used to retrieve the child "
1347 "with the given index (here, since we said the toolbar is the last child, the "
1348 "index would be minus 1, or the very last child; we could have used fg."
1349 "lastChild)."
1350 msgstr ""
1351
1352 #. type: Plain text
1353 msgid ""
1354 "However, this code has an issue: what if the slider value is actually within "
1355 "the first child of the actual slider control? One way to fix this is to "
1356 "check the object's role. The modified code looks like this:"
1357 msgstr ""
1358
1359 #. type: Plain text
1360 #, no-wrap
1361 msgid ""
1362 "\tdef getSliderValue(self):\n"
1363 "\t\tfrom controltypes import ROLE_SLIDER # It is possible to import from within a method.\n"
1364 "\t\tfg = api.getForegroundObject()\n"
1365 "\t\tslider = fg.lastChild\n"
1366 "\t\tif slider.role == ROLE_SLIDER: return slider.firstChild.value\n"
1367 msgstr ""
1368
1369 #. type: Plain text
1370 msgid ""
1371 "Thus, when we know for sure that we're dealing with the slider, the method "
1372 "returns the value of the slider's first child (if that is the case). Note "
1373 "the two equals signs for equality, as opposed to just one equals sign for "
1374 "assignment."
1375 msgstr ""
1376
1377 #. type: Plain text
1378 msgid ""
1379 "There are other examples you can try to familiarize yourself with object "
1380 "navigation and manipulation:"
1381 msgstr ""
1382
1383 #. type: Bullet: '* '
1384 msgid ""
1385 "Obtaining the name of an object that is located somewhere else in the "
1386 "program."
1387 msgstr ""
1388
1389 #. type: Bullet: '* '
1390 msgid "Moving the navigator to the foreground object."
1391 msgstr ""
1392
1393 #. type: Bullet: '* '
1394 msgid "Setting focus to another program."
1395 msgstr ""
1396
1397 #. type: Plain text
1398 msgid ""
1399 "For real-life examples on objects in NvDA, consult the NvDA source code or "
1400 "source codes of various community add-ons."
1401 msgstr ""
1402
1403 #. type: Title ###
1404 #, no-wrap
1405 msgid "Specialist objects and overriding object properties at runtime"
1406 msgstr ""
1407
1408 #. type: Plain text
1409 msgid ""
1410 "Sometimes, it is not enough to work with default behavior for a control. For "
1411 "example, some parts of a program may need custom gestures, or one may need "
1412 "to change the role of a window to that of a button."
1413 msgstr ""
1414
1415 #. type: Plain text
1416 msgid ""
1417 "NVDA provides two methods for creating specialist, or overlay objects (or "
1418 "classes), each suited for different needs:"
1419 msgstr ""
1420
1421 #. type: Bullet: '* '
1422 msgid ""
1423 "`event_NvDAObject_init(self, object we're dealing with)`: If you wish to "
1424 "override certain attributes of a control such as its role or label (name), "
1425 "you can use this method to ask NvDA to take your \"input\" to account when "
1426 "meeting objects for the first time (or initialized). For instance, if the "
1427 "control has the window class name of TForm (seen on many Delphi "
1428 "applications), you can ask NVDA to treat this control as a standard window "
1429 "by assigning obj.role = ROLE_WINDOW (see control types dictionary for list "
1430 "of available roles)."
1431 msgstr ""
1432
1433 #. type: Bullet: '* '
1434 msgid ""
1435 "`chooseNVDAObjectOverlayClasses(self, object, list of classes)`: This allows "
1436 "NVDA to use your own logic when dealing with certain objects. For example, "
1437 "this is useful if you wish to assign custom gestures for certain parts of a "
1438 "program in your app module (in fact, many app modules creates objects to "
1439 "deal with certain parts of a program, then uses "
1440 "chooseNvDAObjectOverlayClasses to select the correct object when certain "
1441 "conditions are met). These custom objects must be based on a solid object "
1442 "that we wish to eeal with (mostly IAccessible is enough, thus most overlay "
1443 "objects inherit from, or is the child or specialist class of IAccessible "
1444 "objects)."
1445 msgstr ""
1446
1447 #. type: Plain text
1448 msgid ""
1449 "Note that in case of the second method, the class(s) with the given name "
1450 "must be present in the file, which is/are inherited from a known base object "
1451 "(in Python, the syntax for the inheritence is `childClass(baseClass)`, and "
1452 "is usually read as, \"this child class inherits from this base class\". "
1453 "We'll see code like this later)."
1454 msgstr ""
1455
1456 #. type: Title ###
1457 #, no-wrap
1458 msgid "Examples of overlay classes and modified roles"
1459 msgstr ""
1460
1461 #. type: Plain text
1462 msgid ""
1463 "Below examples illustrate the uses of the two overlay and attribute "
1464 "modification methods we've discussed above:"
1465 msgstr ""
1466
1467 #. type: Plain text
1468 msgid "An example of the first case: modifying an atribute."
1469 msgstr ""
1470
1471 #. type: Plain text
1472 #, no-wrap
1473 msgid ""
1474 "\t# Reassign some Delphi forms as window.\n"
1475 "\t\tdef event_NvDAObject_init(self, obj):\n"
1476 "\t\t\tif obj.windowClassName == \"TForm\": obj.role = ROLE_WINDOW\n"
1477 msgstr ""
1478
1479 #. type: Plain text
1480 msgid ""
1481 "This means that whenever we encounter a window with the class name of \"TForm"
1482 "\", NvDA will treat this as a normal window."
1483 msgstr ""
1484
1485 #. type: Plain text
1486 msgid ""
1487 "Example 2 deals with an app module which has two objects for dealing with "
1488 "specific parts of a program, then uses chooseNVDAObjectOverlayClasses to "
1489 "assign the logic for each control."
1490 msgstr ""
1491
1492 #. type: Plain text
1493 #, no-wrap
1494 msgid "\t#An example of overlay classes\n"
1495 msgstr ""
1496
1497 #. type: Plain text
1498 #, no-wrap
1499 msgid ""
1500 "\tclass enhancedEdit(IAccessible):\n"
1501 "\t\t# Some code to be run when window class name is MyEdit.\n"
1502 msgstr ""
1503
1504 #. type: Plain text
1505 #, no-wrap
1506 msgid ""
1507 "\tclass MainWindow(IAccessible):\n"
1508 "\t\t# Another code, this time adding custom gestures for main window of the program.\n"
1509 msgstr ""
1510
1511 #. type: Plain text
1512 #, no-wrap
1513 msgid "\t# In the app module:\n"
1514 msgstr ""
1515
1516 #. type: Plain text
1517 #, no-wrap
1518 msgid ""
1519 "\tdef chooseNVDAObjectOverlayClasses(self, obj, clsList):\n"
1520 "\t\tif obj.windowClassName == \"myEdit\": clsList.insert(0, enhancedEdit)\n"
1521 "\t\telif obj.windowClassName == \"TWindow\": clsList.insert(0, mainWindow)\n"
1522 msgstr ""
1523
1524 #. type: Plain text
1525 msgid ""
1526 "In both cases, the object that we wish to check must be inserted as the "
1527 "first element of the clsList. The effect is that these custom objects will "
1528 "take precedence when looking up gestures or code (behavior) for the object, "
1529 "and in the developer info, these custom objects will come first when MRO "
1530 "(Method Resolution Order) for the navigator object is displayed."
1531 msgstr ""
1532
1533 #. type: Title ###
1534 #, no-wrap
1535 msgid "Input and output: scripts and UI messages"
1536 msgstr ""
1537
1538 #. type: Plain text
1539 msgid ""
1540 "Another crucial component of add-ons is handling commands from users and "
1541 "displaying what the add-on is doing. These are done via scripts (input) and "
1542 "UI messages (output)."
1543 msgstr ""
1544
1545 #. type: Plain text
1546 msgid ""
1547 "A script is a method run when the user performs certain commands. For "
1548 "example, when you press NvDA+T, NVDA runs a script in global commands module "
1549 "called SayTitle. In Poedit, for instance, when a translator presses Control"
1550 "+Shift+A, NvDA will read translator comments added by the programmer to help "
1551 "clarify a given translatable string. this command is not a native NvDA "
1552 "command, but it is defined in the Poedit app module to perform this function."
1553 msgstr ""
1554
1555 #. type: Plain text
1556 msgid ""
1557 "Typically, an add-on which accepts scripts will have a list of command:"
1558 "function map somewhere in the module. The simplest is a gestures (commands) "
1559 "dictionary, a python dictionary (typically named __gestures) which holds "
1560 "commands as keys and scripts as values for these keys (more than one key, or "
1561 "command can be bound to scripts). These dictionaries are loaded when add-on "
1562 "loads and is cleared when either NvDA exits or the app for the app module "
1563 "loses focus (that is, the user has switched to another program)."
1564 msgstr ""
1565
1566 #. type: Plain text
1567 msgid ""
1568 "Another way to bind scripts is via runtime insertion. This is done by "
1569 "creating another gestures dictionary apart from __gestures dictionary which "
1570 "holds context-sensitive gestures such as manipulating a single control. Then "
1571 "the developer would use inputCore.bindGesture (or inputCore.bindGestures if "
1572 "more than one gestures/scripts are defined) to define certain gestures for a "
1573 "time, then using inputCore.clearGestures then inputCore.bindGestures"
1574 "(__gestures) to remove the added gestures. A more elegant way, which "
1575 "involves scripts for specific objects, will be covered when we talk about "
1576 "overlay classes."
1577 msgstr ""
1578
1579 #. type: Plain text
1580 msgid ""
1581 "As of time of writing, NvDA supports input from the keyboard, braille "
1582 "dislays with or without braille keyboard and touchscreens."
1583 msgstr ""
1584
1585 #. type: Title ###
1586 #, no-wrap
1587 msgid "Example 2: A basic script dictionary"
1588 msgstr ""
1589
1590 #. type: Plain text
1591 msgid ""
1592 "In this example, we'll define two scripts called \"sayHello\" and say"
1593 "\"GoodBye\", then bind them into two separte gestures."
1594 msgstr ""
1595
1596 #. type: Plain text
1597 #, no-wrap
1598 msgid ""
1599 "\t# An example fragment for script assignment.\n"
1600 "\timport ui\n"
1601 msgstr ""
1602
1603 #. type: Plain text
1604 #, no-wrap
1605 msgid ""
1606 "\tdef script_sayHello(self, gesture):\n"
1607 "\t\tui.message\"Hello!\")\n"
1608 msgstr ""
1609
1610 #. type: Plain text
1611 #, no-wrap
1612 msgid ""
1613 "\tdef script_sayGoodBye(self, gesture):\n"
1614 "\t\tui.message(\"Good Bye!\")\n"
1615 msgstr ""
1616
1617 #. type: Plain text
1618 #, no-wrap
1619 msgid ""
1620 "\t__gestures={\n"
1621 "\t\t\"kb:control+NVDA+1\":\"sayHello\",\n"
1622 "\t\t\"kb:Control+NVDA+2\":\"sayGoodBye\"\n"
1623 "\t}\n"
1624 msgstr ""
1625
1626 #. type: Plain text
1627 msgid ""
1628 "Now when you press Control+NvDA+1, NvDA will say, \"Hello\", and when you "
1629 "press Control+NvDA+2, NVDA will say, \"Good bye.\""
1630 msgstr ""
1631
1632 #. type: Title ###
1633 #, no-wrap
1634 msgid "Example 3: runtime script insertion/removal"
1635 msgstr ""
1636
1637 #. type: Plain text
1638 #, no-wrap
1639 msgid "\t# Future sections #\n"
1640 msgstr ""
1641
1642 #. type: Plain text
1643 msgid "Please delete this notice when appropriate sections are done."
1644 msgstr ""
1645
1646 #. type: Title ##
1647 #, no-wrap
1648 msgid "Add-on components and development tips"
1649 msgstr ""
1650
1651 #. type: Plain text
1652 msgid ""
1653 "Includes introductions to input and scripts, output systems, objects, "
1654 "events, configuration, add-on settings and reloading plug-ins. Also includes "
1655 "some tips on add-on development such as debugging. It concludes with some "
1656 "useful examples and do's and don'ts."
1657 msgstr ""
1658
1659 #. type: Plain text
1660 msgid ""
1661 "Planned sections (please feel free to contribute your knowledge in this "
1662 "section):"
1663 msgstr ""
1664
1665 #. type: Bullet: '* '
1666 msgid "Introduction to NVDA objects."
1667 msgstr ""
1668
1669 #. type: Bullet: '* '
1670 msgid "Examining object attributes with Python Console."
1671 msgstr ""
1672
1673 #. type: Bullet: '* '
1674 msgid "Fetching and setting objects."
1675 msgstr ""
1676
1677 #. type: Bullet: '* '
1678 msgid ""
1679 "Object hierarchy and differences between regular and simple review modes."
1680 msgstr ""
1681
1682 #. type: Bullet: '* '
1683 msgid "The event_NVDAObject_init and chooseNVDAObjectOverlayClasses methods."
1684 msgstr ""
1685
1686 #. type: Bullet: '* '
1687 msgid "Events and list of available events."
1688 msgstr ""
1689
1690 #. type: Bullet: '* '
1691 msgid "Next handlers."
1692 msgstr ""
1693
1694 #. type: Bullet: '* '
1695 msgid ""
1696 "Input from keyboard, braille displays, mouse and touchscreen via scripts."
1697 msgstr ""
1698
1699 #. type: Bullet: '* '
1700 msgid "Script lookup process and conflicts."
1701 msgstr ""
1702
1703 #. type: Bullet: '* '
1704 msgid ""
1705 "Static and dynamic script bindings, gesture dictionaries and script "
1706 "categories."
1707 msgstr ""
1708
1709 #. type: Bullet: '* '
1710 msgid "Braille, speech and tone output."
1711 msgstr ""
1712
1713 #. type: Bullet: '* '
1714 msgid "Debugging add-ons."
1715 msgstr ""
1716
1717 #. type: Bullet: '* '
1718 msgid "If something goes wrong (common errors and exceptions)."
1719 msgstr ""
1720
1721 #. type: Bullet: '* '
1722 msgid "Few working and non-working examples for each topic."
1723 msgstr ""
1724
1725 #. type: Bullet: '* '
1726 msgid "These plan sections may change."
1727 msgstr ""
1728
1729 #. type: Title ##
1730 #, no-wrap
1731 msgid "Global Plugins"
1732 msgstr ""
1733
1734 #. type: Plain text
1735 msgid "A chapter devoted to global plugins."
1736 msgstr ""
1737
1738 #. type: Plain text
1739 msgid "Planned sections:"
1740 msgstr ""
1741
1742 #. type: Bullet: '* '
1743 msgid "What exactly is global plugin."
1744 msgstr ""
1745
1746 #. type: Bullet: '* '
1747 msgid ""
1748 "Importance of consulting NvDA and add-on commands to minimize command "
1749 "conflicts."
1750 msgstr ""
1751
1752 #. type: Bullet: '* '
1753 msgid "When not to use global plugins."
1754 msgstr ""
1755
1756 #. type: Bullet: '* '
1757 msgid "A few worked out examples."
1758 msgstr ""
1759
1760 #. type: Bullet: '* '
1761 msgid "These sections may change."
1762 msgstr ""
1763
1764 #. type: Title ##
1765 #, no-wrap
1766 msgid "App Modules"
1767 msgstr ""
1768
1769 #. type: Plain text
1770 msgid "A chapter devoted to app modules."
1771 msgstr ""
1772
1773 #. type: Bullet: '* '
1774 msgid "What is an app module."
1775 msgstr ""
1776
1777 #. type: Bullet: '* '
1778 msgid "App module scripts."
1779 msgstr ""
1780
1781 #. type: Bullet: '* '
1782 msgid "Defining objects representing different parts of a program."
1783 msgstr ""
1784
1785 #. type: Bullet: '* '
1786 msgid "Silencing NVDA for a program."
1787 msgstr ""
1788
1789 #. type: Bullet: '* '
1790 msgid "How app developers can help NVDA users through accessible app designs."
1791 msgstr ""
1792
1793 #. type: Bullet: '* '
1794 msgid ""
1795 "A few worked out examples and examples from existing app modules from NVDA "
1796 "core and from community."
1797 msgstr ""
1798
1799 #. type: Bullet: '* '
1800 msgid "These topics may change."
1801 msgstr ""
1802
1803 #. type: Title ##
1804 #, no-wrap
1805 msgid "Drivers"
1806 msgstr ""
1807
1808 #. type: Plain text
1809 msgid "A chapter devoted to driver development."
1810 msgstr ""
1811
1812 #. type: Title ##
1813 #, no-wrap
1814 msgid "Misc items"
1815 msgstr ""
1816
1817 #. type: Plain text
1818 msgid ""
1819 "Includes Bitbucket repo, add-ons lisst, other topics and contact information."
1820 msgstr ""
1821
1822 #. type: Plain text
1823 msgid ""
1824 "[1]: http://community.nvda-project.org/wiki/Development [2]: http://"
1825 "community.nvda-project.org/documentation/developerGuide.html"
1826 msgstr ""

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26