Move backend.__about__ stuff into __init__

This commit is contained in:
miruka 2019-12-18 06:55:05 -04:00
parent 9e372d01d5
commit 87b262ebee
6 changed files with 12 additions and 22 deletions

View File

@ -1,12 +0,0 @@
"""<SHORTDESC>"""
__pkg_name__ = "harmonyqml"
__pretty_name__ = "Harmony QML"
__version__ = "0.2.3"
__status__ = "Development"
# __status__ = "Production"
__author__ = "miruka"
__email__ = "miruka@disroot.org"
__license__ = "LGPLv3"

View File

@ -1 +1,3 @@
from .qml_bridge import BRIDGE # noqa __app_name__ = "harmonyqml"
__display_name__ = "Harmony QML"
__version__ = "0.3.0"

View File

@ -9,7 +9,7 @@ from appdirs import AppDirs
import nio import nio
from . import __about__ from . import __app_name__
from .errors import MatrixError from .errors import MatrixError
from .matrix_client import MatrixClient from .matrix_client import MatrixClient
from .models.items import Account, Device, Event, Member, Room, Upload from .models.items import Account, Device, Event, Member, Room, Upload
@ -22,7 +22,7 @@ nio.log.logbook.StreamHandler(sys.stderr).push_application()
class Backend: class Backend:
def __init__(self) -> None: def __init__(self) -> None:
self.appdirs = AppDirs(appname=__about__.__pkg_name__, roaming=True) self.appdirs = AppDirs(appname=__app_name__, roaming=True)
from . import config_files from . import config_files
self.saved_accounts = config_files.Accounts(self) self.saved_accounts = config_files.Accounts(self)

View File

@ -24,7 +24,7 @@ import nio
from nio.crypto import AsyncDataT as UploadData from nio.crypto import AsyncDataT as UploadData
from nio.crypto import async_generator_from_data from nio.crypto import async_generator_from_data
from .__about__ import __pkg_name__, __pretty_name__ from . import __app_name__, __display_name__
from . import utils from . import utils
from .errors import ( from .errors import (
BadMimeType, InvalidUserId, InvalidUserInContext, MatrixError, BadMimeType, InvalidUserId, InvalidUserInContext, MatrixError,
@ -114,7 +114,7 @@ class MatrixClient(nio.AsyncClient):
def default_device_name(self) -> str: def default_device_name(self) -> str:
os_ = f" on {platform.system()}".rstrip() os_ = f" on {platform.system()}".rstrip()
os_ = f"{os_} {platform.release()}".rstrip() if os_ != " on" else "" os_ = f"{os_} {platform.release()}".rstrip() if os_ != " on" else ""
return f"{__pretty_name__}{os_}" return f"{__display_name__}{os_}"
async def login(self, password: str, device_name: str = "") -> None: async def login(self, password: str, device_name: str = "") -> None:
@ -221,7 +221,7 @@ class MatrixClient(nio.AsyncClient):
# to the sender so our other accounts wouldn't be able to replace # to the sender so our other accounts wouldn't be able to replace
# local echoes by real messages. # local echoes by real messages.
tx_id = uuid4() tx_id = uuid4()
content[f"{__pkg_name__}.transaction_id"] = str(tx_id) content[f"{__app_name__}.transaction_id"] = str(tx_id)
await self._local_echo(room_id, tx_id, event_type, content=echo_body) await self._local_echo(room_id, tx_id, event_type, content=echo_body)
await self._send_message(room_id, content) await self._send_message(room_id, content)
@ -291,7 +291,7 @@ class MatrixClient(nio.AsyncClient):
thumb_info: Optional[MatrixImageInfo] = None thumb_info: Optional[MatrixImageInfo] = None
content: dict = { content: dict = {
f"{__pkg_name__}.transaction_id": str(transaction_id), f"{__app_name__}.transaction_id": str(transaction_id),
"body": path.name, "body": path.name,
"info": { "info": {
@ -926,7 +926,7 @@ class MatrixClient(nio.AsyncClient):
# Add the Event to model # Add the Event to model
tx_id = ev.source.get("content", {}).get( tx_id = ev.source.get("content", {}).get(
f"{__pkg_name__}.transaction_id", f"{__app_name__}.transaction_id",
) )
local_sender = ev.sender in self.backend.clients local_sender = ev.sender in self.backend.clients

View File

@ -12,7 +12,7 @@ Python {
addImportPath("src") addImportPath("src")
addImportPath("qrc:/src") addImportPath("qrc:/src")
importNames("backend", ["BRIDGE"], () => { importNames("backend.qml_bridge", ["BRIDGE"], () => {
loadSettings(() => { loadSettings(() => {
callCoro("saved_accounts.any_saved", [], any => { callCoro("saved_accounts.any_saved", [], any => {
if (any) { py.callCoro("load_saved_accounts", []) } if (any) { py.callCoro("load_saved_accounts", []) }

View File

@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
QApplication::setOrganizationName("harmonyqml"); QApplication::setOrganizationName("harmonyqml");
QApplication::setApplicationName("harmonyqml"); QApplication::setApplicationName("harmonyqml");
QApplication::setApplicationDisplayName("HarmonyQML"); QApplication::setApplicationDisplayName("HarmonyQML");
QApplication::setApplicationVersion("0.2.3"); QApplication::setApplicationVersion("0.3.0");
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv); QApplication app(argc, argv);