Open main menu

Gramps β

Changes

Report API/he

1,269 bytes added, 12:32, 8 October 2024
m
מסמך API מילולי: format
מתוך הסוגים שלעיל, רק דוחות מילוליים, דוחות חזותיים ותרשימים משתמשים ב־API דוחות (מסמך), מכיוון שדוחות מרשתת כותבים את הפלט ישירות לקבצים, בעוד שספר דוחות הוא פשוט שילוב של דוחות מילוליים ודוחות חזותיים שמקובצים יחדיו כ{{man label|ספר דוחות}}.
==מקובל APIמשותף ==At the moment the combination of textual and graphical elements within one document is not supported לעת עתה שילוב רכיבים מילוליים וחזותיים בתוך מסמך אחד לא נתמך (for future plans refer to Report לתוכניות עתידיות נא עיין בעיצוב מחדש של API redesignדוחות), thus Text and Graphical reports are implemented via separate APIsלכן דוחות מילוליים וחזותיים מיושמים באמצעות מנשקי API נפרדים, 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 note|הערה!|The את שיטות <tt>BaseDoc.open</tt> and the ו-<tt>BaseDoc.close</tt> methods have to be implemented by the subclassed document generatorsיש ליישם על ידי מחוללי מסמכים מחלקה משנית.}}===עימוד===[[Image:Doc_paper.png|left|thumb|400px]] התיאור ומאפייני הדף אליו יועבר תצוג כל דוח באשר הוא, מאוחסן על ידי אדגם [http://www.gramps-project.org/docs/gen/gen_plug.html#gen.plug.docgen.paperstyle.paperstyle Classyle]. אדגם זה זמין דרך תכונת מחלקה <tt>basedoc.paper_style</tt>. סוג ה־PaperStyle שנבחר מועבר למחולל המסמכים בעת האתחול, ומטופל על ידי מסגרת פתוח הדוחות.
===עמוד===רכיב <tt>PaperStyle</tt> מכיל מידע על גודל הדף ([[Imagehttp:Doc_paper//www.gramps-project.org/docs/gen/gen_plug.png|right|thumb|400px]html#gen.plug.docgen.paperstyle.PaperStyle מחלקה PaperSize ] 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 classרוחב שמיש]ו־[http://www. This instance is available via the <tt>BaseDocgramps-project.paper_style<org/docs/gen/tt> class attributegen_plug.html#gen.plug.docgen.paperstyle. The chosen PaperStyle is given to the document generator at initialization.get_usable_height גובה שמיש]. רוחב וגובה מתקבלים תמיד לפי כיוון הנייר (לאורך או לרוחב), 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.
מקור מערכת הצירים הוא תמיד הפינה השמאלית העליונה של האזור בו ניתן להשתמש.
{{-}}
==מסמך API מילולי 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 (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מכיוון ש־style_name צריך לשמש כסגנון עבור הכתובית (כלומר מחרוזת '''alt'''), 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מלל לא עטוף
|-
|}
6,817
edits