Open main menu

Gramps β

Changes

Report API/he

1,688 bytes added, 12:32, 8 October 2024
m
מסמך API מילולי: format
<div dir="rtl" lang="he" class="mw-content-rtl">
{{languages/he|Report API}}
{{man note|The {{man label|מנשק Simple Document API interface}}|It is a report הוא מנשק APIשנועד לדוחות ([https://enhe.wikipedia.org/wiki/Application_programming_interface Application programming interfaceממשק_תכנות_יישומים מנשק תכנות יישומים ]) made for Gramps plugin/addon writersכדי לשרת כותבי תוספים עבור גרמפס}}
The [[Report_API/he|Simple Document מנשק API interfaceשל מסמך פשוט]] is for easy presentation of the data and can be used with מיועד להצגה קלה של הנתונים וניתן להשתמש בו עם [[Simple Access Simple_Access_API/he|מנשק APIלגישה קלה]].{{stub/he}}
{{stub}} In Gramps there are five different types of reports.קיימים בגרמפס חמישה סוגים שונים של דוחות:* Text reportדוח מילולי* Graphical reportדוח חזותי* Graphתרשים* Bookספר דוחות* Web pagesעמודי מרשתתOnly Text reports, Graphical reports and Graphs use the Report (Document) APIמתוך הסוגים שלעיל, since Web reports write their output directly into filesרק דוחות מילוליים, while Book reports are simply combination of Text reports and Graphical reports. ==Common API==At the moment the combination of textual and graphical elements within one document is not supported דוחות חזותיים ותרשימים משתמשים ב־API דוחות (for future plans refer to Report API redesignמסמך), thus Text and Graphical reports are implemented via separate APIsמכיוון שדוחות מרשתת כותבים את הפלט ישירות לקבצים, though they have a common part.This common part is implemented in the [http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.basedoc.BaseDoc BaseDoc class], which contains among others basic document opening, closing, and stylesheet handling methods. It also stores the physical description of a page (sheet of paper in print)בעוד שספר דוחות הוא פשוט שילוב של דוחות מילוליים ודוחות חזותיים שמקובצים יחדיו כ{{man label|ספר דוחות}}.
{{man note|Note!|The <tt>BaseDoc== API משותף ==לעת עתה שילוב רכיבים מילוליים וחזותיים בתוך מסמך אחד לא נתמך (לתוכניות עתידיות נא עיין בעיצוב מחדש של API דוחות), לכן דוחות מילוליים וחזותיים מיושמים באמצעות מנשקי API נפרדים, אם כי יש להם מרכיב משותף.מרכיב משותף זה מיושם באמצעות [http://www.gramps-project.open<org/docs/gen/tt> and the <tt>gen_plug.html#gen.plug.docgen.basedoc.BaseDocמחלקת BaseDoc], שמכיל בין היתר ראש וסיומת עמוד של מסמכים בסיסיים , ושיטות טיפול בגיליון סגנונות.close</tt> methods have to be implemented by the subclassed document generatorsהמנשק מאחסן גם את התיאור הממשי של העמוד (גיליון נייר בדפוס).}}
{{man note|הערה!|את שיטות <tt>BaseDoc.open</tt> ו-<tt>BaseDoc.close</tt> יש ליישם על ידי מחוללי מסמכים מחלקה משנית.}}===Pageעימוד===[[Image:Doc_paper.png|rightleft|thumb|400px]] Description of the paper, which every report will be rendered on התיאור ומאפייני הדף אליו יועבר תצוג כל דוח באשר הוא, is stored by an instance of the מאוחסן על ידי אדגם [http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.paperstyle.PaperStyle PaperStyle classpaperstyle Classyle]. This instance is available via the אדגם זה זמין דרך תכונת מחלקה <tt>BaseDocbasedoc.paper_style</tt> class attribute. The chosen PaperStyle is given to the document generator at initializationסוג ה־PaperStyle שנבחר מועבר למחולל המסמכים בעת האתחול, and is handled by the reporting frameworkומטופל על ידי מסגרת פתוח הדוחות.
The רכיב <tt>PaperStyle</tt> holds information on the size of the paper מכיל מידע על גודל הדף ([http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.paperstyle.PaperStyle מחלקה PaperSize class] instanceלדוגמה), the size of the margins, and the orientation of the paperגודל השוליים וכיוון הדף. Use the proper accessor methods to get the valuesכדי לקבל את הערכים יש להשתמש בשיטות העזר המתאימות. To get the metrics of the usable area of a paper כדי לקבל את תשקיל האזור בו ניתן להשתמש בדף (page without the marginsדף ללא שוליים) one can also use the אפשר גם להשתמש ב[http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.paperstyleשיטות נוחות.PaperStyle.get_usable_width PaperStyle.get_usable_widthרוחב שמיש] and ו־[http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.paperstyle.PaperStyle.get_usable_height PaperStyle.get_usable_heightגובה שמיש] convenience methods. Width and height are always given according to the orientation of the paper, thus width is always the horizontalרוחב וגובה מתקבלים תמיד לפי כיוון הנייר (לאורך או לרוחב), and height is always the vertical dimensionולכן הרוחב הוא תמיד הממד האופקי והגובה הוא תמיד הממד האנכי.
Text reports do not need to care about paper propertiesלדוחות מלל אין צורך לדאוג למאפייני דף, as the document generator שכן מחולל המסמכים (or the external viewerאו המשקף החיצוני) paginates the report according to those propertiesמספרר את הדוח בהתאם לאותם מאפיינים. Whileמאידך, on the other handדוחות חזותיים כן נדרשים להתחשב במאפייני הדף בעת יצירת רכיבים חזותיים, graphical reports do need to take paper properties into account when creating graphical elements, i.e. they should not draw on the marginsכלומר הם לא אמורים לגלוש לשוליים.<!--[[Image:gramps-devel.png|left|22px]] ''document generator should hide paper properies for graphical reports too'מחולל מסמכים צריך להסתיר גם מאפייני דף עבור דוחות חזותיים'--> The origin of the coordinate system is the top left corner of the usable area.
מקור מערכת הצירים הוא תמיד הפינה השמאלית העליונה של האזור בו ניתן להשתמש.
{{-}}
==Text document מסמך APIמילולי ==
The specification of the את מפרט ה־API לרכיב Textdoc API is ניתן למצוא בקישור הבא: [https://gramps-project.org/docs/gen/gen_plug.html#gramps.gen.plug.docgen.textdoc.TextDoc hereTextDoc]
The interface for adding media objects is as followsהמנשק להוספת עצמי מדיה הוא כדלקמן:
<div dir="ltr">
<pre>
add_media_object(name, align, w_cm, h_cm, alt='', style_name=None, crop=None)[sourceמקור]</pre> Add a photo of the specified width </div>הוספת תמונה ברוחב שצוין (in centimetersבסנטימטרים). Parametersמשתנים: <div dir="ltr"> <pre> name – filename of the image to addשם קובץ התמונה אותה מעוניינים להוסיף&rlm; align – alignment of the imageיישור התמונה. Valid values are ‘left’, ‘right’ערכים תקינים הם 'שמאל', ‘center’'ימין', and ‘single’'מרכז' ו'יחיד'&rlm; w_cm – width in centimeters&rlm; רוחב בסנטימטרים h_cm – height in centimetersגובה בסנטימטרים alt – an alternative text to useמלל חלופי בו ניתן להשתמש. Useful for eg html reportsשימושי לדוגמה בדוחות HTML style_name – style to use for captionsשם הסגנון בו יעשה שימוש בכתוביות crop – image cropping parametersמשתנים לחיתוך תמונה
</pre>
</div>
לתשומת לב! עקב מבנה מסמכים אלה, תמונות מותרות רק כמסמכי או תאי צאצא (כלומר עקיבה).
Note that because of the structure of these documents, Images are only allowed as children (i.e. following) Document or Cell. This interface is used in the following reportsמנשק זה משמש בדוחות הבאים: {| {{Prettytable}}
|-
! Reportדוח! Built-inסוג! alignיישור! style_nameשם סגנון! how calledאופן קריאה
|-
| Detailed Ancestral Reportדו"ח אבות־קדמונים מפורט| Built-inמובנה| rightימין
| DDR-Caption
| via על־ידי gen/plug/report/utils.py
|-
| Detailed Descendant Reportדוח צאצאים מפורט| Built-inמובנה| rightימין
| DDR-Caption
| via על־ידי gen/plug/report/utils.py
|-
| Individual Complete Reportדוח אישי מלא| Built-inמובנה| rightימין| Noneללא| directיָשִׁיר
|-
| Book ספר דוחות (Title Pageעמוד השער)| Built-inמובנה| centerמֶרְכָּז| Noneללא| directיָשִׁיר
|-
| Person Everythingדוח אדם כולל| Addonתוסף| singleיחיד
| PE-Level%d
| directיָשִׁיר
|-
|}
None of the reports use הדוחות הללו לא משתמש במלל חלופי 'alt'. It is understood (from looking at the code in odfdocמבחינת שורות הקוד ב־odfdoc.py) that ברור כי יישור ל'''leftשמאל''' and ול'''rightימין''' alignment should cause the text to wrap around the media objectאמור לגרום למלל להתעטף סביב לעצם המדיה, while for בעוד שליישור '''singleיחיד''' alignment, there should be no text on either side of the media objectלא אמור להיות מלל משני הצדי עצם המדיה.
Since style_name should be used as the style for the caption מכיוון ש־style_name צריך לשמש כסגנון עבור הכתובית (i.e. the כלומר מחרוזת '''alt''' string) it should also be used for the image itself, יש להשתמש בו גם עבור התמונה עצמה. Otherwise the caption would not be below the pictureאחרת הכתובית לא תופיעה מתחת ובצמוד לתמונהAs at December 2014, output appears as follows:<br>
נכון לדצמבר 2014, הפלט מופיע כדלקמן:
{| {{Prettytable}}
|-
! Formatתסדיר! rightימין! centerמרכז! singleיחיד
|-
| HTML
| '''OKבסדר''' Picture on rightתמונה מימין, text wrapped round itמלל עטוף סביבה
| ?
| Picture on left marginתמונה בצמוד לשוליים השמאליים, text not wrappedמלל לא עטוף
|-
| RTF
| Picture on left marginתמונה בצמוד לשוליים השמאליים, text not wrappedמלל לא עטוף
| ?
| '''OKבסדר''' Picture aligned with previous paragraphתמונה מיושרת לפסקה הקודמת, text not wrappedמלל לא עטוף
|-
| ODF
| '''OKבסדר''' Picture on rightתמונה מימין, text wrapped round itמלל עטוף סביבה
| ?
| Picture centredהתמונה ממורכזת, text not wrappedמלל לא עטוף
|-
| PDF
| Picture on rightתמונה מימין, text not wrappedמלל לא עטוף
| ?
| Picture on left marginתמונה בצמוד לשוליים השמאליים, text not wrappedמלל לא עטוף
|-
|}
==Draw document מסמך תרשים API==
{{stub}}
==Graph document מסמך חזותי API=={{stub/he}}
[[Category:Developers/Reference]]
6,817
edits