Add warning popup when old settings.json detected
This commit is contained in:
@@ -29,7 +29,9 @@ from .models.model import Model
|
||||
from .models.model_store import ModelStore
|
||||
from .presence import Presence
|
||||
from .sso_server import SSOServer
|
||||
from .user_files import Accounts, History, NewTheme, Settings, Theme, UIState
|
||||
from .user_files import (
|
||||
Accounts, History, NewTheme, Pre070Settings, Settings, Theme, UIState,
|
||||
)
|
||||
|
||||
# Logging configuration
|
||||
log.getLogger().setLevel(log.INFO)
|
||||
@@ -112,6 +114,7 @@ class Backend:
|
||||
self.theme = Theme(self, self.settings.General.theme)
|
||||
# self.new_theme = NewTheme(self, self.settings.General.new_theme)
|
||||
self.new_theme = NewTheme(self, ".new.py") # TODO
|
||||
Pre070Settings(self)
|
||||
|
||||
self.clients: Dict[str, MatrixClient] = {}
|
||||
|
||||
|
@@ -63,6 +63,12 @@ class LoopException(PyOtherSideEvent):
|
||||
traceback: Optional[str] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class Pre070SettingsDetected(PyOtherSideEvent):
|
||||
"""Warn that a pre-0.7.0 settings.json file exists."""
|
||||
path: Path = field()
|
||||
|
||||
|
||||
@dataclass
|
||||
class UserFileChanged(PyOtherSideEvent):
|
||||
"""Indicate that a config or data file changed on disk."""
|
||||
|
@@ -145,7 +145,7 @@ class QMLBridge:
|
||||
rc = lambda c: asyncio.run_coroutine_threadsafe(c, self._loop) # noqa
|
||||
|
||||
try:
|
||||
from devtools import debug # noqa
|
||||
from devtools import debug # noqa
|
||||
d = debug # noqa
|
||||
except ModuleNotFoundError:
|
||||
log.warning("Module python-devtools not found, can't use debug()")
|
||||
|
@@ -18,7 +18,9 @@ import pyotherside
|
||||
from watchgod import Change, awatch
|
||||
|
||||
from .pcn.section import Section
|
||||
from .pyotherside_events import LoopException, UserFileChanged
|
||||
from .pyotherside_events import (
|
||||
LoopException, Pre070SettingsDetected, UserFileChanged,
|
||||
)
|
||||
from .theme_parser import convert_to_qml
|
||||
from .utils import (
|
||||
aiopen, atomic_write, deep_serialize_for_qml, dict_update_recursive,
|
||||
@@ -396,6 +398,17 @@ class Accounts(ConfigFile, JSONFile):
|
||||
self.save()
|
||||
|
||||
|
||||
@dataclass
|
||||
class Pre070Settings(ConfigFile):
|
||||
"""Detect and warn about the presence of a pre-0.7.0 settings.json file."""
|
||||
|
||||
filename: str = "settings.json"
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.path.exists():
|
||||
Pre070SettingsDetected(self.path)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Settings(ConfigFile, PCNFile):
|
||||
"""General config file for UI and backend settings"""
|
||||
|
Reference in New Issue
Block a user