Skip to content

Commit

Permalink
Addendum for #1056: add dummyEditor flag so a client can pretend to e…
Browse files Browse the repository at this point in the history
…dit but changes will not be saved in read-only mode. Handy for testing + demos
  • Loading branch information
justvanrossum committed Jan 15, 2024
1 parent 2934f51 commit b6ab72d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fontra/core/fonthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def remoteMethod(method):
class FontHandler:
backend: ReadableFontBackend
readOnly: bool = False
dummyEditor: bool = False # allow editing in read-only mode, don't write to backend
allConnectionsClosedCallback: Optional[Callable[[], Awaitable[Any]]] = None

def __post_init__(self):
Expand Down Expand Up @@ -149,7 +150,7 @@ async def useConnection(self, connection) -> AsyncGenerator[None, None]:

@remoteMethod
async def isReadOnly(self, *, connection=None) -> bool:
return self.readOnly
return self.readOnly and not self.dummyEditor

@remoteMethod
async def getBackEndInfo(self, *, connection=None) -> dict:
Expand Down

0 comments on commit b6ab72d

Please sign in to comment.