6,817
edits
Changes
From Gramps
m
Everything is set up, now we write out the lines with all the siblings, leaving out the active person himself, as he is in the title field!
<pre>
→Analysis: accessing the data: translation
</div>
===Analysisניתוח קטע קוד: accessing the dataגישה לנתונים===Now that your plugin runsלאחר השלמת פונקציית הקיצה של המצג המהיר, you need to open the databaseניתן לטפל בפתיחת מסד הנתונים, start the documentהפעלת המסמך, access data, and write it outגישה לנתונים וכתיבתם על המסמך. We do this using the פעולות אלו מתבצעות באמצעות [[Simple Access API|Simple Database מנשק APIפשוט למסד הנתונים]]. So, the following code:
קטע הקוד הבא מכין את כל שנדרש לפעולת הנמנשק:
<div dir="ltr">
<pre>
# setup the simple access functions
sdoc = SimpleDoc(document)
</pre>
</div>prepares everything. Then we write a title on the document, an empty line under itכעת ניתן לטפל בכותרת שתופיע על המסמך: שורת כותרת , and a headerשורה ריקה מתחת לשורת הכותרת וכותרת עליונה, with the titleבאמצעות פונקציית הכותרת, paragraph and header functionהפסקה וראש העמוד:<div dir="ltr">
<pre>
# display the title
sdoc.paragraph("")
</pre>
</div>Note that we use an underscore לתשומת לב! קו תחתון (<code>_</code>) to indicate every string that requires translationמציין מחרוזת שמצריכות תרגום, which comes from the lineמחרוזות אלו ניתנות לשליפה לתוך קובץ ‎.pot וזה מגיע מהשורה:<div dir="ltr">
<pre>
from gramps.gen.ggettext import gettext as _
</pre>
</div>
לאחר שכל ההדגרות הסתיימו, ניתן לגשת לקטע הקוד שיכתוב את השורות עם כל האחאים, את האדם הפעיל עצמו לא כוללים, שכן הוא מופיע בשדה הכותרת!
<div dir="ltr">
<pre>
# grab our current id, so we can filter the active person out
# of the data
stab.write(sdoc)
</pre>
</div>Here, the easy access classes from the כאן נעשה שימוש במחלקות הגישה הקלה מ־[[Simple Access API]] have been used to quickly achieve what we wantכדי להשיג במהירות את המטרה ללא הצורך לכתוב שורות קוד רבות נוספות.
==דוגמה שניה==