Open carlosperate opened 2 years ago
so the goal is to turn
def panic() -> None:
"""
Put micro:bit in panic() mode and display an unhappy face.
Press the reset button to exit panic() mode.
"""
pass
into the following?
_("panic() \nPut micro:bit in panic() mode and display an unhappy face. Press the reset button to exit panic() mode.")
What about instance methods?
class _Accelerometer(object):
def get_x(self) -> int:
"""
Return micro:bit's tilt (X acceleration) in milli-g's.
"""
pass
so the goal is to turn
def panic() -> None: """ Put micro:bit in panic() mode and display an unhappy face. Press the reset button to exit panic() mode. """ pass
into the following?
_("panic() \nPut micro:bit in panic() mode and display an unhappy face. Press the reset button to exit panic() mode.")
Yes 👍
What about instance methods?
class _Accelerometer(object): def get_x(self) -> int: """ Return micro:bit's tilt (X acceleration) in milli-g's. """ pass
For the micro:bit API, classes for built in board features have a single instance by default. So the user cannot initialise a new instance of the micro:bit accelerometer class. In this case it looks like the API just follows a similar pattern a module functions: https://github.com/mu-editor/mu/blob/9fe47acf97096649d94cd26b379247f73e74d6ee/mu/modes/api/microbit.py#L76
For thinsg like MicroPython PyBoard I2C calsses (which you can initilisate) it looks very similar: https://github.com/mu-editor/mu/blob/9fe47acf97096649d94cd26b379247f73e74d6ee/mu/modes/api/pyboard.py#L175
i try to submit a PR then
We can create Python script in the utils folder to convert Python stub files (.py or .pyi files) into the files that Qscintilla takes to generate the autocompletion.
Example input stub files to use: https://github.com/oivron/microbit-stubs/tree/master/microbit/lib Example output file for Qscintilla: https://github.com/mu-editor/mu/blob/master/mu/modes/api/microbit.py
We should also a bit of documentation (could be the file header) to indicate how it works and where to find some of the stub files generated.