-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update project docs with 1.4.1 changes
- Loading branch information
Showing
10 changed files
with
138 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:html_theme.sidebar_secondary.remove: True | ||
|
||
.. _base_api_client: | ||
|
||
=============== | ||
Base API Client | ||
=============== | ||
|
||
.. autoclass:: patcher.client.__init__.BaseAPIClient | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
:html_theme.sidebar_secondary.remove: True | ||
|
||
========== | ||
Decorators | ||
========== | ||
|
||
.. automodule:: patcher.utils.decorators | ||
:members: | ||
:undoc-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,150 @@ | ||
.. _customize_reports: | ||
|
||
===================== | ||
==================== | ||
Customizing Reports | ||
===================== | ||
==================== | ||
|
||
Tailor the user interface elements of your exported PDF reports. You have the flexibility to modify the font, and customize the header and footer text according to your preferences. See the sample PDF image below for an illustration of these customizable features. | ||
|
||
.. _example-pdf-image: | ||
|
||
.. image:: https://raw.githubusercontent.com/liquidz00/Patcher/develop/images/example_pdf.jpeg | ||
.. image:: ../_static/example_pdf.jpeg | ||
:alt: Example PDF | ||
:width: 750px | ||
:align: center | ||
|
||
.. seealso:: | ||
Configuring the date format is done at runtime by using the ``--date-format`` option. See :ref:`date format <date-format>` for more information. | ||
|
||
.. _config_ini: | ||
.. _property_list_file: | ||
|
||
Setup | ||
----- | ||
===== | ||
|
||
When you first launch Patcher, a :ref:`setup assistant <setup>` will automatically create the necessary ``config.ini`` file and copy the required fonts to the appropriate directory. | ||
When you first launch Patcher, a :ref:`setup assistant <setup>` will automatically create the necessary ``com.liquidzoo.patcher.plist`` file in the user's Library Application Support directory, located at ``$HOME/Library/Application Support/Patcher``. Once setup is completed successfully, the ``first_run_done`` key in the property list file will automatically be set to ``True``: | ||
|
||
Modifying the file | ||
^^^^^^^^^^^^^^^^^^ | ||
.. code-block:: xml | ||
Any resource Patcher interacts with can be found in the Application Support directory in the user library. Using ``jappleseed`` as an example, the path to the configuration file would be ``'/Users/jappleseed/Library/Application Support/Patcher/config.ini'``. | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Setup</key> | ||
<dict> | ||
<key>first_run_done</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</plist> | ||
Open this file in your text editor of choice, or execute the command below in Terminal to open the file in the TextEdit app. | ||
.. admonition:: Warning | ||
:class: warning | ||
|
||
.. code-block:: console | ||
**Do not modify** the ``first_run_done`` key in the ``Setup`` dictionary directly. Altering this key may cause Patcher to re-run the setup process. If you need to reset the initial setup state, use the ``--reset`` option instead. For more information, see :ref:`resetting Patcher <resetting_patcher>`. | ||
|
||
$ open -a "TextEdit.app" ~/Library/Application\ Support/Patcher/config.ini | ||
Modifying the Property List File | ||
================================ | ||
|
||
Sample configuration | ||
^^^^^^^^^^^^^^^^^^^^ | ||
The property list file contains the settings that control the appearance of the PDF reports. You can edit these values using ``/usr/libexec/PlistBuddy`` or a code editor of your choice (VSCode, BBEdit, CodeRunner, etc.). | ||
|
||
Still assuming the logged in user is jappleseed, a ``config.ini`` file could look like the following: | ||
.. admonition:: Opening Property Lists in Xcode | ||
:class: tip | ||
|
||
.. code-block:: ini | ||
If the plist file appears as a binary file when opened in VSCode or other editors, you can open it in **Xcode** instead. Xcode is available as a free download from the Mac App Store and fully supports editing plist files. This will prevent issues with binary formatting that some editors may encounter. | ||
|
||
[Settings] | ||
patcher_path = /Users/jappleseed/Library/Application Support/Patcher | ||
Using ``jappleseed`` as an example, the path to the property list file would be: | ||
|
||
[UI] | ||
header_text = AnyOrg Mac Patch Report | ||
footer_text = AnyOrg Mac Patch Report | ||
font_name = Assistant | ||
font_regular_path = /Users/jappleseed/Library/Application Support/Patcher/fonts/Assistant-Regular.ttf | ||
font_bold_path = /Users/jappleseed/Library/Application Support/Patcher/fonts/Assistant-Bold.ttf | ||
``/Users/jappleseed/Library/Application Support/Patcher/com.liquidzoo.patcher.plist`` | ||
|
||
The above example would result in a PDF report that looks identical to the :ref:`example PDF image <example-pdf-image>` at the top of this page. | ||
Editing the Header & Footer Text | ||
-------------------------------- | ||
|
||
.. warning:: | ||
Altering the ``[Settings]`` section of the configuration file is not recommended. Patcher references this path throughout the codebase and modifying it incorrectly may lead to unintended results or errors. | ||
.. tip:: | ||
Why not use ``defaults`` to edit the property list file? Unfortunately, the ``defaults`` binary in macOS lacks the ability to update keys nested within dictionaries. ``PlistBuddy`` is much better equipped to handle property lists with nested elements. | ||
|
||
Edit Header and Footer Text | ||
--------------------------- | ||
To modify the header and footer text using PlistBuddy, use the following commands: | ||
|
||
To customize the header and footer texts, simply modify the ``header_text`` and ``footer_text`` values under the UI section of the config file. | ||
.. code-block:: console | ||
.. code-block:: ini | ||
$ /usr/libexec/PlistBuddy -c "Set :UI:HEADER_TEXT 'Your Custom Header Text'" ~/Library/Application\ Support/Patcher/com.liquidzoo.patcher.plist | ||
$ /usr/libexec/PlistBuddy -c "Set :UI:FOOTER_TEXT 'Your Custom Footer Text'" ~/Library/Application\ Support/Patcher/com.liquidzoo.patcher.plist | ||
[UI] | ||
header_text = Your Custom Header Text | ||
footer_text = Your Custom Footer Text | ||
These commands will correctly update the ``HEADER_TEXT`` and ``FOOTER_TEXT`` keys within the ``UI`` dictionary. | ||
|
||
.. note:: | ||
The footer text will automatically append a ``|`` character followed by the page number to the end of the specified footer text. | ||
|
||
Sample Property List Structure | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Below is an example of what the nested UI dictionary might look like in the property list file: | ||
|
||
.. code-block:: xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>UI</key> | ||
<dict> | ||
<key>HEADER_TEXT</key> | ||
<string>AnyOrg Patch Report</string> | ||
<key>FOOTER_TEXT</key> | ||
<string>AnyOrg Patch Report</string> | ||
<key>FONT_NAME</key> | ||
<string>Assistant</string> | ||
<key>FONT_REGULAR_PATH</key> | ||
<string>/Users/jappleseed/Library/Application Support/Patcher/fonts/Assistant-Regular.ttf</string> | ||
<key>FONT_BOLD_PATH</key> | ||
<string>/Users/jappleseed/Library/Application Support/Patcher/fonts/Assistant-Bold.ttf</string> | ||
</dict> | ||
</dict> | ||
</plist> | ||
The above example would result in a PDF report that looks identical to the :ref:`example PDF image <example-pdf-image>` at the top of this page. | ||
|
||
Customizing the Font | ||
-------------------- | ||
|
||
If you wish to change the font, modify the ``font_name``, ``font_regular_path`` and ``font_bold_path`` values in the UI section: | ||
To change the font, update the ``FONT_NAME``, ``FONT_REGULAR_PATH`` and ``FONT_BOLD_PATH`` values in the UI dictionary. | ||
|
||
.. code-block:: ini | ||
.. code-block:: console | ||
[UI] | ||
font_name = YourPreferredFont | ||
font_regular_path = /path/to/your/font/Regular.ttf | ||
font_bold_path = /path/to/your/font/Bold.ttf | ||
$ /usr/libexec/PlistBuddy -c "Set :UI:FONT_NAME 'Helvetica'" ~/Library/Application\ Support/Patcher/com.liquidzoo.patcher.plist | ||
$ /usr/libexec/PlistBuddy -c "Set :UI:FONT_REGULAR_PATH '/path/to/Helvetica-Regular.ttf'" ~/Library/Application\ Support/Patcher/com.liquidzoo.patcher.plist | ||
$ /usr/libexec/PlistBuddy -c "Set :UI:FONT_BOLD_PATH '/path/to/Helvetica-Bold.ttf'" ~/Library/Application\ Support/Patcher/com.liquidzoo.patcher.plist | ||
.. important:: | ||
The default font used in testing is `Google's Assistant Font <https://fonts.google.com/specimen/Assistant>`_. While you can specify a different font to match your organization's branding, be aware that doing so may cause formatting or alignment issues in the exported PDF reports. It is recommended to test the PDF export functionality thoroughly after changing the font to ensure the new font does not adversely affect the document's appearance. | ||
|
||
Full Example Configuration | ||
-------------------------- | ||
|
||
A full example configuration with custom header, footer text and a specified font: | ||
|
||
.. code-block:: ini | ||
[Settings] | ||
patcher_path = /Users/$user/Library/Application Support/Patcher | ||
[UI] | ||
header_text = Confidential Report | ||
footer_text = © 2024 Your Company | ||
font_name = Helvetica | ||
font_regular_path = /path/to/Helvetica-Regular.ttf | ||
font_bold_path = /path/to/Helvetica-Bold.ttf | ||
Here is an example configuration with custom header, footer text, and a specified font: | ||
|
||
.. code-block:: xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Setup</key> | ||
<dict> | ||
<key>first_run_done</key> | ||
<true/> | ||
</dict> | ||
<key>UI</key> | ||
<dict> | ||
<key>HEADER_TEXT</key> | ||
<string>Confidential Report</string> | ||
<key>FOOTER_TEXT</key> | ||
<string>© 2024 Your Company</string> | ||
<key>FONT_NAME</key> | ||
<string>Helvetica</string> | ||
<key>FONT_REGULAR_PATH</key> | ||
<string>/path/to/Helvetica-Regular.ttf</string> | ||
<key>FONT_BOLD_PATH</key> | ||
<string>/path/to/Helvetica-Bold.ttf</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.