tiqi-group / pydase

A flexible and robust Python library for creating, managing, and interacting with data services, with built-in support for web and RPC servers, and customizable features for diverse use cases.
MIT License
0 stars 1 forks source link

Cursor jumping in input field #112

Open FinnHoller opened 3 months ago

FinnHoller commented 3 months ago

Describe the bug

When a task is running, it is not possible to tune an input value by moving the text cursor, because it keeps jumping to the end of the input value, every time an iteration of the task is executed.

To Reproduce

Run the minimal code snippet start the task and edit the input value once. After that it will be harder to edit the value because the cursor keeps jumping.

import asyncio
import logging

import pydase

logging.getLogger("pydase").setLevel(logging.INFO)
logger = logging.getLogger(__name__)

class Issue(pydase.DataService):
    def __init__(self) -> None:
        super().__init__()
        self._counter = 0
        self.point_count = 100

    @property
    def counter(self) -> int:
        return self._counter

    def _update(self) -> None:
        self._counter += 1
        self._counter = self._counter % self.point_count

    async def run_loop(self) -> None:
        while True:
            self._update()
            await asyncio.sleep(1)

if __name__ == "__main__":
    service = Issue()
    pydase.Server(
        service,
        host="127.0.0.1",
        enable_rpc=True,
    ).run()

Expected behaviour

It should be possible to tune input values while running a task, by navigating the cursor through larger input values.

Screenshot/Video

Issue_request.webm

Additional context

The problem only occurs after changing the input value for the first time, while the task is running.