Open main menu

Gramps β

Changes

Quick Views/he

1,061 bytes added, 02:23, 21 October 2025
no edit summary
<div dir="rtl" lang="he" class="mw-content-rtl">
{{languages/he|Quick Views}}
[[File:QuickViewReport-EditPerson-context-menu-popup-50default-60.png|thumb|left|450px|תפריט הקשר מצג מהיר בעורך אדם]]
מצגים מהירים (בעבר נקראו ''דוחות מהירים'' אך עדין מופיעים ב"עדכוני תוספים זמינים" כ''דוח מהיר'') הם דוחות אליהם ניתן להגיע מתפריטי ההקשר של: אנשים, משפחות וכדומה'. קיימתקבוצה קיימת קבוצה של [[Gramps_{{man version}}_Wiki_Manual_-_Reports_-_part_8/he#מצגים_מהירים|מצגים מהירים מובנים]] אותה ניתן להרחיב באמצעות תוספים מסוג QuickView.
ההנחה היא שגם משתמשים בעלי ידע מוגבל בקידוד יהיו מסוגלים ליצור אותם.
נלווה לכלי זה, נבנתה גם [[Simple Access API/he|גישה פשוטה למסד נתונים (API)]] וממשק מסמכים פשוט, כדי להסיר מורכבויות עד כמה שניתן.
==היכן לאחסן אחסון מצגים מהירים שיצרתישנוצרו באופן אישי==
מצגים מהירים מורכבים בדרך כלל משני קבצים בתת מחיצה יעודית עבורם, שממוקמים במחיצת התוספים של ה''[[Gramps_{{man version}}_Wiki_Manual_-_User_Directory/he|משתמש]]''. הנתיב למחיצה זו במערכות הפעלה דמויי לינוקס הוא '''/home/[user_name]/.gramps'''. במחיצה זו תמצא מחיצת משנה בשם '''plugins'''. על מנת שתוסף המצג המהיר המותאם אישית יופיע בגרמפס, יש לשמור את הקבצים במחיצה זו.
אל המחיצה ניתן להגיע ממסוף באופן הבא
פלט דוח מהיר יראה כך:
[[File:QuickViewReport-Siblings-quick-report-resultexample-3460.png|thumb|left|450px|פלט תוצאת מצג מהיר לדוגמה]]
{{-}}
<span id="siblings.gpr.py"></span>
===ניתוח הקוד: רישום הדוח===
כעת ננתח את קטעי הקוד השונים שנכללו בשני הקבצים שנשמרו קודם לכן.<br># 1. קובץ הרישום [[Quick_Views/he#siblings2.gpr.py|siblings2.gpr.py]] . גרמפס יחפש בקובץ הרישום את הפונקציה '''register''' שמופיעה בתחתית הקובץ.
להלן פירוט והסבר על שאר שורות קוד קובץ הרישום:
* {{man label|name}} = שם ייחודי: שם שבו יזהה גרמפס את המתקע (במקרה זה זהו דוח המצג המהיר), אין להשתמש ברווחים או בסמלים מוזרים. בדוגמה שלעיל נוספה לשם הסיפרה '2' כדי למנוע התנגשויות עם [[Gramps_{{man version}}_Wiki_Manual_-_Reports_-_part_8/he#צאצאים|מצג צאצאים מהיר]].
* [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L159-L171 {{man label|סוג־אב}}] = ־קבוע קבוע מיוחד שמציין היכן יוצג הדוח. ניתן להשתמש בב־'''CATEGORY_QR_PERSON''' כדי לצפות בדוח בעורך מצג אדם, או '''CATEGORY_QR_FAMILY''' כדי לצפות בדוח בעורך מצג משפחה. (CATEGORY_QR_DATE מיועד לדוחות שניתן להטמיע בתוך דוחות אחרים מכיוון שלא קיים סוג־אב "תאריך").
* {{man label|run_func}} = היא הפונקציה אותה מייצרים בתוסף זה ואותה יבצע גרמפס כאשר משתמש יבחר את הדוח המהיר הזה מתפריט ההקשר.
* [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L58-L69 {{man label|מצב}}] =מצב הדוח שנוצר ''', '''לא יציב''', ''יציב''', '''ניסוי''' או '''בטא'''
* {{man label|translated_name}} = the name of the report as it will appear in the menu* [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L58-L69 {{man label|status}}] = is your report '''Stable''', '''Unstable''', '''Experimental''' and '''Beta'''שם הדוח כפי שיופיע בתפריט* {{man label|description}} = a description of what your plugin doesתיאור קצר על התוסף ומטרתו. This appears in a tooltip over the menuיופיע כרמז צץ מעל התפריט* {{man label|author_name}} = your nameשם יוצר המתקע* {{man label|author_email}}= your emailדוא"ל יוצר המתקע, so people can congratulate you with your workכדי שמשתמשים יוכלו לשלוח את ברכתם, or ask for bug fixesאו לבקש תיקוני תקלים והצעות לשינויים...
And beginning with Gramps החל בגירסת גרמפס 5.2 version, there are נוספו מספר מאפייני [https://github.com/gramps-project/gramps/pull/1451 additional registration propertiesרישום]חדשים: * {{man label|help_url}} = a webpage that will be opened when using the Helpעמוד המרשתת שייפתח בעת השימוש בעזרה* [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L71-L76 {{man label|audience}}] = filtering options'קהל יעד, אפשרויות סינון: ‘All’'כולם', ‘Developer’ and ‘Expert’'מפתחים' ו'מומחים.* {{man label|maintainers}} = name of person currently maintaining the addonשם האדם שמתחזק כעת את התוסף, if different from the author_nameבמידה ששונה מ־author_name* {{man label|maintainers_email}} = email of person currently maintaining the addonדוא"ל של האדם שמתחזק כעת את התוסף, if different from the במידה ששונה מכתובת author_email* [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L297-L299 {{man label|requires_mod}}], [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L300-L303 {{man label|requires_gi}}], [https://github.com/gramps-project/gramps/blob/892fc270592095192947097d22a72834d5c70447/gramps/gen/plug/_pluginreg.py#L304-L306 {{man label|requires_exe}}] = if the addon has prerequisitesהאם קיימות דרישות קדם לתוסף.
===Analysisניתוח הקוד: the run functionפונקציית הריצה===
Now lets analyse the 2. קובץ הריצה [[Quick_Views/he#siblings.py|siblings.py]] fileIf the user clicks in the quick view report menu on your report, the run function is executed with the following three parameters:
כאשר משתמש מקיש על דוח מצג מהיר בתפריט ההקשר, פונקציית הריצה תתבצע עם שלושת המשתנים הבאים:
<div dir="ltr">
<code>run(database, document, person)</code>
</div>
כלומר, הדוח מקבל מגרמפס את המשתנים: שם מסד הנתונים שפתוח כעת ונמצע בעבודה, את המסמך עליו יש לכתוב, ואת ה'אדם' של שמקושר לעצם שבמוקד המשתמש (עליו מונח מצביע העכבר). לדוח מצג מהיר 'אדם', זהו אדם, ובהתאמה לדוח מצג מהיר 'משפחה', זוהי משפחה.
Soבדוגמה זו, your report receives from Gramps the currently opened database name on which to work, the document on which to write, and the person of the object the user is on. For a person quick view report, this is a person, for family, a family. In this example, the function called is הפונקציה שתקרא היא:<div dir="ltr">
<code>def run(database, document, person):</code>
</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/he|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מחרוזות אלו ניתנות לשליפה לתוך קובץ &lrm;.pot וזה מגיע מהשורה:<div dir="ltr">
<pre>
from gramps.gen.ggettext import gettext as _
</pre>
</div>
לאחר שכל ההדגרות הסתיימו, ניתן לגשת לקטע הקוד שיכתוב את השורות עם כל האחאים, את האדם הפעיל עצמו לא כוללים, שכן הוא מופיע בשדה הכותרת!
<div dir="ltr">
<pre>
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>
# 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/he|מנשק API גישה פשוטה למסד הנתונים]] have been used to quickly achieve what we wantכדי להשיג במהירות את המטרה ללא הצורך לכתוב שורות קוד רבות נוספות.
==דוגמה שניה==
אפשרויות העברת ושיתוף מידע ממסד הנתונים לפטים שונים הן רבות ומגוונות. מתכנת מנוסה, לא חייב להגביל את עצמו ל־API מסד הנתונים פשוט זה. כמו כן, כאשר יוצרים (בכתיבת קוד) דוח 'אמיתי', ניתן במקביל גם לרשום אותו כדוח מהיר עם הגדרות ברירת מחדל.
לקריאה נוספת: [https://github.com/gramps-project/gramps/tree/master/gramps/plugins/quickview מצגים מהיריםמצג מהיר]
=לקריאה נוספת=
15,091
edits