Changes

From Gramps

Учебник по написанию отчетов

1,706 bytes added, 15:15, 29 November 2025
Регистрация отчета: Translated into Russian
===Регистрация отчета===
* Registration is set into a Регистрация выполняется файлом ''<name>.gpr.py'' file* Registration should define internal name of the report Регистрация состоит из единственного вызова функции [https://www.gramps-project.org/docs/gen/gen_plug.html#gramps.gen.plug._pluginreg.register register()] * Регистрация должна определить внутренний <code>id</code> (идентификатор) отчёта (preferablyпредпочтительно это должна быть строка, single string with non-special ascii charactersсодержащая не специальные символы ASCII, usable for report identification from the command line and in the options storageподходящая для идентификации отчета в командной строке и хранилище параметров, as well as for forming sane filename for storing its own stylesа так же для формирования подходящего имени файла для хранения его собственных стилей). It should also define the report's* Она так же должна определить для отчета ....** категорию <code>category </code> (textтекстовый/graphicsграфический/codeкод)** translated переводимое имя <code>name </code> (the one to display in menusкоторое будет показываться в меню)** modes that should be enabled for the report Если отчет требует для запуска наличия активного лица, то параметр <code>require_active</code> должен иметь значение <code>True</code>.** Аргумент <code>report_modes</code> должен содержать список из нуля или более следующих режимов: *** REPORT_MODE_GUI (standaloneдоступен в Gramps, book itemзапущенном в окне, command lineс графическим интерфейсом пользователя)* If the report requires an active person to run** REPORT_MODE_BKI (доступен как отчет раздел Книги)*** REPORT_MODE_CLI (доступен из интерфейса командной строки)** В заключение, then имена обеих классов <code>require_activereportclass</code> should be set to и <code>Trueoptionsclass</code>.* Finally, both report class and options class should be passed to registrationдолжны быть переданы для регистрации.
Here's the Описание остальных аргументов функции [https://www.gramps-project.org/docs/gen/gen_plug.html#gramps.gen.plug._pluginreg.register register()] находятся [Quick_Viewshttps://www.gramps-project.org/docs/gen/gen_plug.html#Analysis:_registering_the_report| registration]module-gramps.gen.plug._pluginreg здесь] statement for our report. Вот как выглядит вызов функции регистрации нашего отчёта:
<pre>
from gramps.gen.plug._pluginreg import registerfrom gramps.gen.plug._pluginreg import REPORT, STABLE, CATEGORY_TEXTfrom gramps.gen.plug._pluginreg import REPORT_MODE_GUI, REPORT_MODE_CLI*
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
)
</pre>
There are arguments for the report class and options class. The <tt>report_modes</tt> argument is set to a list of zero or more of the following modes:
* REPORT_MODE_GUI (available for Gramps running in a window, graphical user interface)* REPORT_MODE_BKI (available as a book Скопируйте код выше в файл '''report item)* REPORT_MODE_CLI (available for the command line interface).gpr.py'''.
The list should only include those options which are valid for this report.
The rest of the options should be self-explanatory.====Замечание касательно режима отчета Книга ====
Copy the above Для преобразования отчета в пригодный для использования в качестве раздела Книги вам надо добавить REPORT_MODE_BKI в список <code into '''report>report_modes</code> выше.gpr.py''' file.  ====Отчет типа Книга ...==== To turn a report into one that will work as a book reportТак же вам надо добавить дополнительный код в метод <code>write_report()</code> класса Report, you may need to add the followingпохожий на код приведенный ниже:
<pre>
</pre>
See an existing book report for more detailsПосмотрите существующие отчеты, используемые в режиме Книга, на предмет дополнительной информации. DO NOT copy the above code into НЕ КОПИРУЙТЕ код выше в файл '''report.py''' file!так как мы не собираемся использовать наш отчет в режиме Книга.
== Ручная установка вашего отчета ==
64
edits

Navigation menu