<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">inkycal.main.</span></span><spanclass="sig-name descname"><spanclass="pre">Inkycal</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">settings_path</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">render</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.main.Inkycal"title="Link to this definition"></a></dt>
<dd><p>Inkycal main class</p>
<p>Main class of Inkycal, test and run the main Inkycal program.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>settings_path = str -> the full path to your settings.json file
if no path is given, tries looking for settings file in /boot folder.</p></li>
<li><p>render = bool (True/False) -> show the image on the epaper display?</p></li>
</ul>
</dd>
<dt>Attributes:</dt><dd><ulclass="simple">
<li><p>optimize = True/False. Reduce number of colours on the generated image
to improve rendering on E-Papers. Set this to False for 9.7” E-Paper.</p></li>
<spanclass="sig-name descname"><spanclass="pre">calibrate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">cycles</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">3</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.main.Inkycal.calibrate"title="Link to this definition"></a></dt>
<spanclass="sig-name descname"><spanclass="pre">countdown</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">interval_mins</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.main.Inkycal.countdown"title="Link to this definition"></a></dt>
<dd><p>Returns the remaining time in seconds until next display update</p>
<emclass="property"><spanclass="pre">async</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">run</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.main.Inkycal.run"title="Link to this definition"></a></dt>
<dd><p>Runs main program in nonstop mode.</p>
<p>Uses an infinity loop to run Inkycal nonstop. Inkycal generates the image
from all modules, assembles them in one image, refreshed the E-Paper and
<spanclass="sig-name descname"><spanclass="pre">test</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.main.Inkycal.test"title="Link to this definition"></a></dt>
<dd><p>Tests if Inkycal can run without issues.</p>
<p>Attempts to import module names from settings file. Loads the config
for each module and initializes the module. Tries to run the module and
checks if the images could be generated correctly.</p>
<p>Generated images can be found in the /images folder of Inkycal.</p>
<spanid="custom-functions"></span><h1>Custom functions<aclass="headerlink"href="#module-inkycal.custom.functions"title="Link to this heading"></a></h1>
<spanclass="sig-prename descclassname"><spanclass="pre">inkycal.custom.functions.</span></span><spanclass="sig-name descname"><spanclass="pre">auto_fontsize</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">font</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">max_height</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.custom.functions.auto_fontsize"title="Link to this definition"></a></dt>
<dd><p>Scales a given font to 80% of max_height.</p>
<p>Gets the height of a font and scales it until 80% of the max_height
is filled.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>font: A PIL Font object.</p></li>
<li><p>max_height: An integer representing the height to adjust the font to
which the given font should be scaled to.</p></li>
</ul>
</dd>
<dt>Returns:</dt><dd><p>A PIL font object with modified height.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">inkycal.custom.functions.</span></span><spanclass="sig-name descname"><spanclass="pre">get_fonts</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.custom.functions.get_fonts"title="Link to this definition"></a></dt>
<dd><p>Print all available fonts by name.</p>
<p>Searches the /font folder in Inkycal and displays all fonts found in
there.</p>
<dl>
<dt>Returns:</dt><dd><p>printed output of all available fonts. To access a fontfile, use the
<spanclass="sig-prename descclassname"><spanclass="pre">inkycal.custom.functions.</span></span><spanclass="sig-name descname"><spanclass="pre">get_system_tz</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.custom.functions.get_system_tz"title="Link to this definition"></a></dt>
<dd><p>Gets the system-timezone</p>
<p>Gets the timezone set by the system.</p>
<dlclass="simple">
<dt>Returns:</dt><dd><ulclass="simple">
<li><p>A timezone if a system timezone was found.</p></li>
<li><p>None if no timezone was found.</p></li>
</ul>
</dd>
</dl>
<p>The extracted timezone can be used to show the local time instead of UTC. e.g.</p>
<spanclass="gp">>>></span><spanclass="nb">print</span><spanclass="p">(</span><spanclass="n">arrow</span><spanclass="o">.</span><spanclass="n">now</span><spanclass="p">(</span><spanclass="n">tz</span><spanclass="o">=</span><spanclass="n">get_system_tz</span><spanclass="p">())</span><spanclass="c1"># prints timezone aware time.</span>
<spanclass="sig-prename descclassname"><spanclass="pre">inkycal.custom.functions.</span></span><spanclass="sig-name descname"><spanclass="pre">internet_available</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.custom.functions.internet_available"title="Link to this definition"></a></dt>
<dd><p>checks if the internet is available.</p>
<p>Attempts to connect to google.com with a timeout of 5 seconds to check
if the network can be reached.</p>
<dlclass="simple">
<dt>Returns:</dt><dd><ulclass="simple">
<li><p>True if connection could be established.</p></li>
<li><p>False if the internet could not be reached.</p></li>
</ul>
</dd>
</dl>
<p>Returned output can be used to add a check for internet availability:</p>
<spanclass="sig-prename descclassname"><spanclass="pre">inkycal.custom.functions.</span></span><spanclass="sig-name descname"><spanclass="pre">text_wrap</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">text</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">font</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">max_width</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.custom.functions.text_wrap"title="Link to this definition"></a></dt>
<dd><p>Splits a very long text into smaller parts</p>
<p>Splits a long text to smaller lines which can fit in a line with max_width.
Uses a Font object for more accurate calculations.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>text -> Text as a string</p></li>
<li><p>font: A PIL font object which is used to calculate the size.</p></li>
<li><p>max_width: int-> a width in pixels defining the maximum width before
splitting the text into the next chunk.</p></li>
</ul>
</dd>
<dt>Returns:</dt><dd><p>A list containing chunked strings of the full text.</p>
<spanid="helper-classes"></span><h1>Helper classes<aclass="headerlink"href="#module-inkycal.modules.ical_parser"title="Link to this heading"></a></h1>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">inkycal.modules.ical_parser.</span></span><spanclass="sig-name descname"><spanclass="pre">iCalendar</span></span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar"title="Link to this definition"></a></dt>
<dd><p>iCalendar parsing moudule for inkycal.
Parses events from given iCalendar URLs / paths</p>
<emclass="property"><spanclass="pre">static</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">all_day</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">event</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.all_day"title="Link to this definition"></a></dt>
<spanclass="sig-name descname"><spanclass="pre">clear_events</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.clear_events"title="Link to this definition"></a></dt>
<spanclass="sig-name descname"><spanclass="pre">get_events</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">timeline_start</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">timeline_end</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">timezone</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.get_events"title="Link to this definition"></a></dt>
<dd><p>Input an arrow (time) object for:
* the beginning of timeline (events have to end after this time)
* the end of the timeline (events have to begin before this time)
* timezone if events should be formatted to local time
<emclass="property"><spanclass="pre">static</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">get_system_tz</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.get_system_tz"title="Link to this definition"></a></dt>
<spanclass="sig-name descname"><spanclass="pre">load_from_file</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">filepath</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.load_from_file"title="Link to this definition"></a></dt>
<dd><p>Input a string or list of strings containing valid iCalendar filepaths
example: ‘path1’ (single file) OR [‘path1’, ‘path2’] (multiple files)
<spanclass="sig-name descname"><spanclass="pre">load_url</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">url</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">username</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">password</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.load_url"title="Link to this definition"></a></dt>
<dd><p>Input a string or list of strings containing valid iCalendar URLs
example: ‘URL1’ (single url) OR [‘URL1’, ‘URL2’] (multiple URLs)
add username and password to access protected files</p>
<spanclass="sig-name descname"><spanclass="pre">show_events</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">fmt</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">'DD</span><spanclass="pre">MMM</span><spanclass="pre">YY</span><spanclass="pre">HH:mm'</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.show_events"title="Link to this definition"></a></dt>
<dd><p>print all parsed events in a more readable way
use the format (fmt) parameter to specify the date format
see <aclass="reference external"href="https://arrow.readthedocs.io/en/latest/#supported-tokens">https://arrow.readthedocs.io/en/latest/#supported-tokens</a>
<spanclass="sig-name descname"><spanclass="pre">sort</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.ical_parser.iCalendar.sort"title="Link to this definition"></a></dt>
<dd><p>Sort all parsed events in order of beginning time</p>
</dd></dl>
</dd></dl>
<pid="module-inkycal.modules.inky_image">Custom image class for Inkycal Project
Takes care of handling images. Made to be used by other modules to handle
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">inkycal.modules.inky_image.</span></span><spanclass="sig-name descname"><spanclass="pre">Inkyimage</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">image</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage"title="Link to this definition"></a></dt>
<dd><p>Custom Imgae class written for commonly used image operations.</p>
<spanclass="sig-name descname"><spanclass="pre">autoflip</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">layout</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">None</span></span></span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.autoflip"title="Link to this definition"></a></dt>
<dd><p>flips the image automatically to the given layout.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>layout:-> str. Choose <cite>horizontal</cite> or <cite>vertical</cite>.</p></li>
</ul>
</dd>
</dl>
<p>Checks the image’s width and height.</p>
<p>In horizontal mode, the image is flipped if the image height is greater
than the image width.</p>
<p>In vertical mode, the image is flipped if the image width is greater
<spanclass="sig-name descname"><spanclass="pre">clear</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.clear"title="Link to this definition"></a></dt>
<dd><p>Removes currently saved image if present.</p>
<spanclass="sig-name descname"><spanclass="pre">flip</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">angle</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.flip"title="Link to this definition"></a></dt>
<dd><p>Flips the image by the given angle.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>angle:->int. A multiple of 90, e.g. 90, 180, 270, 360.</p></li>
<spanclass="sig-name descname"><spanclass="pre">load</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">None</span></span></span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.load"title="Link to this definition"></a></dt>
<emclass="property"><spanclass="pre">static</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">merge</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">image1</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">image2</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.merge"title="Link to this definition"></a></dt>
<dd><p>Merges two images into one.</p>
<p>Replaces white pixels of the first image with transparent ones. Then pastes
the first image on the second one.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>image1: A PIL Image object in ‘RGBA’ mode.</p></li>
<li><p>image2: A PIL Image object in ‘RGBA’ mode.</p></li>
<emclass="property"><spanclass="pre">static</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">preview</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">image</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.preview"title="Link to this definition"></a></dt>
<dd><p>Previews an image on gpicview (only works on Rapsbian with Desktop).</p>
<spanclass="sig-name descname"><spanclass="pre">remove_alpha</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.remove_alpha"title="Link to this definition"></a></dt>
<dd><p>Removes transparency if image has transparency.</p>
<p>Checks if an image has an alpha band and replaces the transparency with
<spanclass="sig-name descname"><spanclass="pre">resize</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">width</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">height</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.resize"title="Link to this definition"></a></dt>
<dd><p>Resize an image to desired width or height</p>
<spanclass="sig-name descname"><spanclass="pre">to_palette</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">palette</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">dither=True)</span><spanclass="pre">-></span><spanclass="pre">(<module</span><spanclass="pre">'PIL.Image'</span><spanclass="pre">from</span><spanclass="pre">'/home/runner/work/Inkycal/Inkycal/venv/lib/python3.11/site-packages/PIL/Image.py'></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre"><module</span><spanclass="pre">'PIL.Image'</span><spanclass="pre">from</span><spanclass="pre">'/home/runner/work/Inkycal/Inkycal/venv/lib/python3.11/site-packages/PIL/Image.py'></span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#inkycal.modules.inky_image.Inkyimage.to_palette"title="Link to this definition"></a></dt>
<dd><p>Maps an image to a given colour palette.</p>
<p>Maps each pixel from the image to a colour from the palette.</p>
<dlclass="simple">
<dt>Args:</dt><dd><ulclass="simple">
<li><p>palette: A supported token. (see below)</p></li>
<li><p>dither:->bool. Use dithering? Set to <cite>False</cite> for solid colour fills.</p></li>
</ul>
</dd>
<dt>Returns:</dt><dd><ulclass="simple">
<li><p>two images: one for the coloured band and one for the black band.</p></li>
</ul>
</dd>
<dt>Raises:</dt><dd><ulclass="simple">
<li><p>ValueError if palette token is not supported</p></li>