Improve some python documentation and add an intro

This commit is contained in:
miruka 2020-05-22 17:27:57 -04:00
parent c8f3a4937c
commit 855672481f
5 changed files with 28 additions and 8 deletions

View File

@ -15,6 +15,8 @@
## Issues
- SSL error on python 3.7
- Jumping between accounts (clicking in account bar or alt+(Shift+)N) is
laggy with hundreds of rooms in between
- On startup, if a room's last event is a membership change,

View File

@ -1,6 +1,15 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""This package provides a Python backend accessible from the QML UI side."""
"""This package provides Mirage's backend side that can interact with the UI.
To learn more about how this package works, you might want to check the
documentation in the following modules first:
- `qml_bridge`
- `backend`
- `matrix_client`
- `nio_callbacks`
"""
__app_name__ = "mirage"
__display_name__ = "Mirage"

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Matrix client and related classes."""
"""Matrix client to interact with a homeserver and other related classes."""
import asyncio
import html

View File

@ -22,7 +22,7 @@ if TYPE_CHECKING:
class NioCallbacks:
"""Register callbacks for nio's request responses and room events.
For every nio `Response` and `Event` subclasses, this class can have a
For every `nio.Response` and `nio.Event` subclasses, this class can have a
method named `on<ClassName>` (e.g. `onRoomMessageText`) that will
automatically be registered in nio.

View File

@ -4,6 +4,15 @@
# directly or indirectly via another module import (e.g. backend).
# See https://stackoverflow.com/a/55918049
"""Provide `BRIDGE`, main object accessed by QML to interact with Python.
PyOtherSide, the library that handles interaction between our Python backend
and QML UI, will access the `BRIDGE` object and call its methods directly.
The `BRIDGE` object should be the only existing instance of the `QMLBridge`
class.
"""
import asyncio
import logging as log
import os
@ -18,16 +27,16 @@ from .pyotherside_events import CoroutineDone, LoopException
class QMLBridge:
"""Setup asyncio and provide synchronous methods to call coroutines.
"""Setup asyncio and provide methods to call coroutines from QML.
A thread is created to run the asyncio loop in, to ensure all calls from
QML return instantly.
Methods are provided for QML to call coroutines using PyOtherSide, which
doesn't have this ability out of the box.
Synchronous methods are provided for QML to call coroutines using
PyOtherSide, which doesn't have this ability out of the box.
Attributes:
backend: The `Backend` containing the coroutines of interest and
`MatrixClient` objects.
backend: The `backend.Backend` object containing general coroutines
for QML and that manages `MatrixClient` objects.
"""
def __init__(self) -> None: