Stop supporting starting without pyotherside
This commit is contained in:
parent
6da3e0ab87
commit
b3135601ed
|
@ -10,8 +10,9 @@ from typing import Coroutine, Sequence
|
|||
from appdirs import AppDirs
|
||||
|
||||
import nio
|
||||
import pyotherside
|
||||
|
||||
from . import __about__, pyotherside
|
||||
from . import __about__
|
||||
from .pyotherside_events import CoroutineDone
|
||||
|
||||
log.getLogger().setLevel(log.INFO)
|
||||
|
@ -42,27 +43,10 @@ class App:
|
|||
|
||||
self.loop = asyncio.get_event_loop()
|
||||
|
||||
if not pyotherside.AVAILABLE:
|
||||
self.set_debug(True, verbose=True)
|
||||
|
||||
self.loop_thread = Thread(target=self._loop_starter)
|
||||
self.loop_thread.start()
|
||||
|
||||
|
||||
def set_debug(self, enable: bool, verbose: bool = False) -> None:
|
||||
if verbose:
|
||||
log.getLogger().setLevel(log.DEBUG)
|
||||
nio.logger_group.level = nio.log.logbook.DEBUGG
|
||||
|
||||
if enable:
|
||||
log.info("Debug mode enabled.")
|
||||
self.loop.set_debug(True)
|
||||
self.debug = True
|
||||
else:
|
||||
self.loop.set_debug(False)
|
||||
self.debug = False
|
||||
|
||||
|
||||
def _loop_starter(self) -> None:
|
||||
asyncio.set_event_loop(self.loop)
|
||||
|
||||
|
@ -115,11 +99,6 @@ class App:
|
|||
remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
|
||||
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.call_backend_coro("load_settings", "")
|
||||
self.call_backend_coro("load_saved_accounts", "")
|
||||
|
||||
|
||||
# Make CTRL-C work again
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import asyncio
|
||||
import json
|
||||
import logging as log
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
import aiofiles
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from . import pyotherside
|
||||
import pyotherside
|
||||
|
||||
from .backend import Backend
|
||||
from .theme_parser import convert_to_qml
|
||||
from .utils import dict_update_recursive
|
||||
|
@ -172,9 +173,6 @@ class Theme(ConfigFile):
|
|||
|
||||
|
||||
async def read(self) -> str:
|
||||
if not pyotherside.AVAILABLE:
|
||||
return ""
|
||||
|
||||
if not self.path.exists():
|
||||
await self.write(await self.default_data())
|
||||
|
||||
|
|
|
@ -12,12 +12,14 @@ import aiofiles
|
|||
from PIL import Image as PILImage
|
||||
|
||||
import nio
|
||||
import pyotherside
|
||||
from nio.api import ResizingMethod
|
||||
|
||||
from . import pyotherside, utils
|
||||
from .pyotherside import ImageData, Size
|
||||
from . import utils
|
||||
|
||||
POSFormat = int
|
||||
Size = Tuple[int, int]
|
||||
ImageData = Tuple[bytearray, Size, int] # last int: pyotherside format enum
|
||||
|
||||
CONCURRENT_DOWNLOADS_LIMIT = asyncio.BoundedSemaphore(8)
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
import logging as log
|
||||
from typing import Tuple, Callable
|
||||
|
||||
AVAILABLE = True
|
||||
try:
|
||||
import pyotherside
|
||||
except ModuleNotFoundError:
|
||||
log.warning("pyotherside module is unavailable.")
|
||||
AVAILABLE = False
|
||||
|
||||
Size = Tuple[int, int]
|
||||
ImageData = Tuple[bytearray, Size, int] # last int: pyotherside format enum
|
||||
|
||||
format_data: int = pyotherside.format_data if AVAILABLE else 0
|
||||
format_svg_data: int = pyotherside.format_svg_data if AVAILABLE else 1
|
||||
format_rgb888: int = pyotherside.format_rgb888 if AVAILABLE else 2
|
||||
format_argb32: int = pyotherside.format_argb32 if AVAILABLE else 3
|
||||
|
||||
|
||||
def send(event: str, *args) -> None:
|
||||
if AVAILABLE:
|
||||
pyotherside.send(event, *args)
|
||||
|
||||
|
||||
def set_image_provider(provider: Callable[[str, Size], ImageData]) -> None:
|
||||
if AVAILABLE:
|
||||
pyotherside.set_image_provider(provider)
|
|
@ -2,7 +2,8 @@ from dataclasses import dataclass, field
|
|||
from enum import Enum
|
||||
from typing import Any, Dict, List, Union
|
||||
|
||||
from . import pyotherside
|
||||
import pyotherside
|
||||
|
||||
from .models import SyncId
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user